Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill acsl-annotation-assistant
Generate comprehensive ACSL (ANSI/ISO C Specification Language) annotations for C/C++ programs to support formal verification with tools like Frama-C.
Add complete function specifications with preconditions and postconditions:
/*@
requires \valid(array + (0..n-1));
requires n > 0;
ensures \result >= 0 && \result < n;
ensures \forall integer i; 0 <= i < n ==> array[\result] >= array[i];
assigns \nothing;
*/
int find_max_index(int *array, int n);
Generate loop invariants, variants, and assigns clauses:
/*@
loop invariant 0 <= i <= n;
loop invariant \forall integer k; 0 <= k < i ==> sum == \sum(0, k, array);
loop assigns i, sum;
loop variant n - i;
*/
for (i = 0; i < n; i++) {
sum += array[i];
}
Add pointer validity and separation annotations:
/*@
requires \valid(dest + (0..n-1));
requires \valid_read(src + (0..n-1));
requires \separated(dest + (0..n-1), src + (0..n-1));
ensures \forall integer i; 0 <= i < n ==> dest[i] == \old(src[i]);
assigns dest[0..n-1];
*/
void memcpy_safe(char *dest, const char *src, size_t n);
Insert runtime and verification assertions:
//@ assert 0 <= index && index < array_length;
//@ assume divisor != 0;
Define reusable logical predicates and axioms:
/*@
predicate sorted{L}(int *a, integer n) =
\forall integer i, j; 0 <= i <= j < n ==> a[i] <= a[j];
*/
/*@
axiomatic Sum {
logic integer sum{L}(int *a, integer low, integer high);
axiom sum_empty{L}:
\forall int *a, integer i; sum(a, i, i) == 0;
axiom sum_next{L}:
\forall int *a, integer low, high;
low < high ==> sum(a, low, high) == sum(a, low, high-1) + a[high-1];
}
*/
Before annotating:
Start with the function-level specification:
requires): What must be true when function is calledensures): What will be true when function returnsFor each loop, specify:
Insert intermediate assertions to:
Create reusable logical definitions for:
\valid(ptr) // Single valid pointer
\valid(ptr + (low..high)) // Valid range
\valid_read(ptr) // Read-only validity
\separated(ptr1, ptr2) // No aliasing
\forall type var; condition ==> property
\exists type var; condition && property
\old(expr) // Value at function entry
\at(expr, Label) // Value at specific point
\result // Function return value
\nothing // Empty set (for assigns)
\forall integer i; low <= i < high ==> array[i] >= 0
/*@
behavior valid_input:
assumes n > 0;
requires \valid(array + (0..n-1));
ensures \result >= 0;
behavior invalid_input:
assumes n <= 0;
ensures \result == -1;
complete behaviors;
disjoint behaviors;
*/
When generating annotations for WP verification:
assigns clauses to specify frame conditions\valid over raw pointer checks\separated for pointer disjointnessloop assigns for all loopsloop variant for termination proofsArray bounds safety:
/*@ requires 0 <= index < length;
requires \valid(array + index);
*/
Null pointer checks:
/*@ requires ptr != \null;
requires \valid(ptr);
*/
Overflow prevention:
/*@ requires INT_MIN <= a + b <= INT_MAX; */
Generate annotations in standard ACSL comment syntax:
/*@ ... *///@ assertion/*@
predicate valid_array(int *a, integer n) =
\valid(a + (0..n-1)) && n > 0;
*/
/*@
requires valid_array(array, n);
ensures \result >= 0 && \result < n;
ensures \forall integer i; 0 <= i < n ==> array[\result] >= array[i];
assigns \nothing;
*/
int find_max_index(int *array, int n) {
int max_idx = 0;
/*@
loop invariant 0 <= i <= n;
loop invariant 0 <= max_idx < n;
loop invariant \forall integer k; 0 <= k < i ==>
array[max_idx] >= array[k];
loop assigns i, max_idx;
loop variant n - i;
*/
for (int i = 1; i < n; i++) {
if (array[i] > array[max_idx]) {
max_idx = i;
}
}
return max_idx;
}
This skill includes reference materials for ACSL:
acsl_reference.md - Comprehensive ACSL syntax referencecommon_patterns.md - Frequently used annotation patternsframa_c_integration.md - Tips for using with Frama-CLoad these references as needed for detailed syntax information or advanced patterns.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Modern JavaScript/TypeScript development with Bun runtime. Covers package management, bundling, testing, and migration from Node.js. Use when working with Bun, optimizing JS/TS development speed, or migrating from Node.js to Bun.
You are a dependency management expert specializing in safe, incremental upgrades of project dependencies. Plan and execute dependency updates with minimal risk, proper testing, and clear migration pa
Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
Opinionated backend development standards for Node.js + Express + TypeScript microservices. Covers layered architecture, BaseController pattern, dependency injection, Prisma repositories, Zod validation, unifiedConfig, Sentry error tracking, async safety, and testing discipline.
Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
Take arabelatso/acsl-annotation-assistant from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.