/adacore:gnatprovefrom adacore
Provides up-to-date guidance on SPARK (Ada) and GNATprove features, including recent syntax, proof results that appear successful but prove nothing, design restrictions, and how to locate the correct SPARK User's Guide for the installed release.
Ships in adacore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill holds only what a capable agent is likely to miss: features newer than its training data, results that look green but are not, and restrictions that force a redesign if found late. For everything else, the SPARK User's Guide (UG) and Reference Manual (RM) for the installed release are authoritative; read them.
"SPARK" may mean the language or the tool. "Run SPARK" means run
gnatprove; "update the SPARK" means edit the source.
Run gnatprove --version once, then read
references/versions.md to map it to a release and to
the matching manuals. Every link in this skill goes to the SPARK Pro 27.0
manuals; on another release, change gnat-27.0 in the URL as that file says.
Material that needs a newer release than Pro 25 / FSF 15 is marked Requires: with the first release that has it. On an older release, do not use it; use the fallback given.
alire.toml at the root), run
alr gnatprove -P <project.gpr> .... Otherwise use gnatprove if it is on
PATH. Otherwise ask the user how to set up the environment: SPARK Pro
installs usually need more than a PATH entry.gnatprove instances on the same
project concurrently; they share output directories.2>&1 | tee gnatprove-run.txt) so you never re-run only to re-read
it. A run that timed out but printed output is still usable.--level. Without it, gnatprove does not use level 0: it
runs cvc5 with --steps=100 and no timeout. Start at --level=0 or 1;
raise it only for checks the provers gave up on. Do not use 3 or 4 without
the user's agreement.-f while iterating. Incremental results are correct, and
-f reruns everything in scope. Use it only for a final measurement that
must be repeatable from a clean state, and say so when you report it.-u file.adb (a unit) or --limit-subp=file.adb:NN (one
subprogram, NN = its declaration line). File names have no source
directory prefix. Inside a generic, add -U and prefix the location with
the instantiation's (--limit-line=main.adb:12:gen.adb:5).
Requires: SPARK Pro 26 / FSF 16 or later for the prefixed location.gnatprove --help is authoritative for the installed release.gnatprove.out, and check that every unit you meant to prove appears in
it. The console line Success: all checks proved (N checks). /
Summary: X/Y checks proved Requires: SPARK Pro 26 / FSF 16 or later.warning: no checks generated by GNATprove means nothing was analyzed,
not that it is correct. So does a suspiciously low check count.SPARK_Mode => On is analyzed when there is no
configuration SPARK_Mode. Unmarked code is not checked for SPARK at all.SPARK_Mode cannot be an aspect of an instantiation;
put pragma SPARK_Mode; before the with clauses of the instantiating
unit. Then confirm checks appear in instantiation at .... A check may hold
for one instance and fail for another.--limit-line on a line with no checks prints nothing and no summary.
Line numbers shift after every edit; confirm them.--level stays proved at a lower one. Before reporting the level a
proof needs, run with --report=provers, which marks results taken from a
cache. Requires: SPARK Pro 27 / FSF 17 or later. Before SPARK Pro 27: use a
-f run at that level.Global => null, Pre => True and
terminating. The [assumed-global-null] and [assumed-always-terminates]
warnings name a missing model: write the Global and contracts.SPARK_Mode => Off bodies get a generated, unchecked, coarse Global
(every write becomes In_Out; pointers become one __HEAP; writes through
in access parameters and effects of indirect or dispatching calls can be
missed).Post. GNATprove checks
that a procedure terminates only if it has Always_Terminates; add it
when termination matters. Functions without Side_Effects are always
checked to terminate.Builder'Switches and Builder'Default_Switches are ignored by
gnatprove: -gnat2022 or -gnatX0 there must move to package Compiler.
Requires: SPARK Pro 27 / FSF 17 or later. Before SPARK Pro 27: they are
honored.--warnings=error stops the analysis after warnings; it does not turn
them into errors.Do not do these without the user's explicit agreement. Each makes a check go away without proving it.
pragma Assume, or pragma Annotate (GNATprove, False_Positive | Intentional, ...).Import (an axiom: its Post is never
proved).SPARK_Mode => Off on a body to get past proof.Pre, Post or type the user specified, or clamping values
(X := T'Min (X, Max)) to dodge a range check.Agents rarely think to use these. Check the list before writing contracts or proof scaffolding.
| Feature | Reach for it when |
|---|---|
Expr'At (Label) | a contract or assertion needs an expression's value at an earlier <<Label>> (needs -gnatX0). Requires: SPARK Pro 27 / FSF 17 or later. |
E'Loop_Index | an invariant of a for E of A loop needs the current index. Requires: SPARK Pro 27 / FSF 17 or later. Before SPARK Pro 27: loop with for I in A'Range. |
Modifies => (X when B, Y) | a subprogram changes only part of its state; everything not listed is preserved. Requires: SPARK Pro 27 / FSF 17 or later. Before SPARK Pro 27: write frame conditions in Post. |
Program_Exit | a subprogram may end the program. Requires: SPARK Pro 26 / FSF 16 or later. |
Exceptional_Cases | a subprogram raises exceptions on purpose; it names the exceptions and the postcondition that holds when each is raised. |
Exit_Cases | a subprogram does not always return normally; it partitions the inputs by how the call ends (normal return, an exception, program exit). Requires: SPARK Pro 26 / FSF 16 or later. |
Assertion levels (pragma Assertion_Level) | ghost code and assertions should be enabled or disabled in groups. Requires: SPARK Pro 26 / FSF 16 or later. |
Potentially_Invalid | data from hardware, files or another language may hold invalid values; check X'Valid on read. Requires: SPARK Pro 26 / FSF 16 or later. |
Side_Effects | a function must modify state, raise, or may not terminate. |
Ghost_Predicate | a type predicate needs ghost entities or 'Initialized. |
| Contracts on access-to-subprogram types | a callback must satisfy a Pre/Post. |
Higher_Order_Specialization | a higher-order function (map, fold, or any other function or lemma procedure taking an access-to-function as a parameter, unless it does not fit the special requirements) should accept 'Access of a function that reads global data or has a precondition; each such call is specialized for that function. |
Mutable_In_Parameters | foreign code changes what an in handle designates. |
No_Wrap_Around, No_Bitwise_Operations | a modular type should not wrap, or is used only arithmetically. |
By (A, B), So (A, B) | an assertion needs a hint that should not stay in the proof context. |
Hide_Info, Unhide_Info | the proof context must be controlled. On a package's private part or body, they override the default visibility (a withed unit's SPARK private part is visible by default). On an expression function, Hide_Info hides its body by default and Unhide_Info discloses it only where a proof needs it. |
Automatic_Instantiation | a lemma about a function is needed wherever the function appears. |
| SPARKlib | big integers and reals; functional containers (for models) and formal containers (executable); Multisets for permutations; the lemma library; SPARK.Higher_Order maps and folds; cut operations; input-output, strings and C strings libraries; address-to-access conversions. It ships as a project template to copy, not a ready project. |
--proof-warnings=on | a contract or assumption might be always false, or code dead. Off by default: expensive (it runs extra proofs; bound them with --proof-warnings-timeout) and incomplete. |
| Proof manifests | proofs must replay in CI with per-subprogram switches. Requires: SPARK Pro 27 / FSF 17 or later. Before SPARK Pro 27: session files (--replay). |
-W/-A/-D =tag | a warning kind must be enabled, silenced, or made an error. Requires: SPARK Pro 26 / FSF 16 or later. Before SPARK Pro 26: --warnings and pragma Warnings. |
--explain CODE | a message carries an explain code. |
Curated extensions need -gnatX or pragma Extensions_Allowed (On);
experimental ones need -gnatX0 or
pragma Extensions_Allowed (All_Extensions). Check that the project's build
can use them first. See
GNAT language extensions.
(S with delta A.X => 0, B (I).Y => 1)); fixed lower bounds
(array (Natural range 0 .. <>) of T); prefixed calls on untagged types;
'Constrained on generic formal objects; Static intrinsic shifts;
Unsigned_Base_Range. Requires: SPARK Pro 26 / FSF 16 or later:
expression defaults for generic formal functions.X'Super; No_Dynamic_Accessibility_Checks; inferred generic
actuals. Requires: SPARK Pro 26 / FSF 16 or later: finally, continue, a
standalone use implying with. Requires: SPARK Pro 27 / FSF 17 or later:
No_Raise, External_Initialization, attribute subprograms
(function T'Integer_Literal (S : String) return T;).when, case pattern
matching, constructors, destructors, Size'Class, 'To_String, structural
instantiation, First_Controlling_Parameter, Default_Dispatching_Calls.Check these before choosing a design; GNATprove finds them only after the code is written.
SPARK_Mode => Off; SPARK code still gets
no finalization, so release resources explicitly.Constant_Indexing,
Variable_Indexing, Implicit_Dereference) and no
Ada.Iterator_Interfaces; iterate with the Iterable aspect.SPARK.Pointers from SPARKlib. A derived
tagged type cannot have a component of a named access-to-variable type.
An in out parameter of a named access-to-variable type is moved, not
borrowed: the callee may repoint it.'Access cannot be taken on a subprogram with global inputs
or outputs, except as the actual of a Higher_Order_Specialization
function, or for an access type annotated
Handler
(synchronized globals only; SPARK code cannot call it). A call through a
subprogram pointer is assumed possibly nonterminating.when E : others).Partition_Elaboration_Policy (Sequential); tasks never terminate; no task entries; a task's or
protected operation's Global names only synchronized state. See
Concurrency.'Address only in representation clauses;
effectively volatile objects only at library level. A volatile read may
appear only in a non-interfering context (whole assignment, object
initializer, an actual whose formal is of a non-scalar volatile type), not
inside a larger expression.SPARK_Mode placement: only on library-level units or as a
configuration pragma; never on an instantiation. A generic marked with
SPARK_Mode cannot be instantiated inside a subprogram body.Pre'Class must be weaker and
its Post'Class stronger than the overridden one's, and GNATprove checks
it. Dispatching calls are verified against the class-wide contracts. Write
the root type's class-wide contracts first. See
Object Oriented Programming and LSP.--mode is not one chain. check < check_all < flow. prove is
check_all plus flow's uninitialized-read check, without the data- and
flow-dependency checks. all (the default) is both.pragma Assert_And_Cut forgets only what was modified or tested in its
enclosing statement sequence, not all prior context; a block scopes it.Default_Initial_Condition with no argument promises full default
initialization; => null means not fully initialized.-gnata or by
pragma Assertion_Policy (for kind Ghost or for its assertion level).
Ghost code is not always stripped.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/alireThis skill should be used when the user wants to "use Alire", "install Alire","create an Alire project", "add a crate", "set up tests for an Alire crate", "add AUnit / GNATtest to an Alire project", or otherwise refine the crate structure of an Ada project/gnatdocThis skill should be used when the user wants to "generate API documentation", "generate Ada documentation", "run gnatdoc", "document an Ada package", "annotate Ada code with GNATdoc tags", "use @param/@return/@field/@enum/@exception/@exclude tags", "produce HTML/ODF/RST/XML docs for Ada code", or is otherwise working with GNATdoc to extract documentation from Ada sources./gnatfuzzThis skill should be used when the user wants to "fuzz Ada code", "run gnatfuzz", "generate a fuzzing harness", "investigate a fuzz crash", "write a fuzzing wrapper for an unsupported parameter type", "generate or minimize a corpus", or is otherwise running a fuzzing campaign on an Ada/SPARK project. Covers running gnatfuzz, designing fuzzable subprograms, managing corpora, and reading fuzzing outputs and crash files.npx claudepluginhub adacore/skills --plugin adacoreOther plugins' skills for the same job