Help us improve
Share bugs, ideas, or general feedback.
From ada-spark
Use when writing, porting, reviewing, or proving Ada or SPARK - .ada/.adb/.ads/.gpr files, contracts (Pre/Post/Contract_Cases), Alire (alr) projects, SPARK proof (GNATprove, AoRTE, assurance levels, ownership/borrow), embedded (Ravenscar/Jorvik, light runtimes), and GNAT/GNAT SAS tooling. Targets the latest toolchain (Ada 2022, Alire + GNAT FSF) and blocks stale pre-2022 advice (GNAT Community, pragma contracts, CodePeer). Not for unrelated languages.
npx claudepluginhub agent-sh/ada-sparkHow this skill is triggered — by the user, by Claude, or both
Slash command
/ada-spark:ada-sparkThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Write idiomatic, correct, current Ada and SPARK. The toolchain and ecosystem moved hard between 2022 and 2026, so the dominant failure mode is stale advice: pointing users at the dead GNAT Community edition, writing pragma contracts, claiming "SPARK can't do pointers", or calling the analyzer "CodePeer". The correction map below is the single most important asset - apply it on every Ada/SPARK t...
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Create and present web-based slidedecks using Slidev with Markdown, Vue components, code highlighting, animations, interactive demos, LaTeX, and Mermaid for technical presentations, conference talks, code walkthroughs, and teaching materials.
Share bugs, ideas, or general feedback.
Write idiomatic, correct, current Ada and SPARK. The toolchain and ecosystem moved hard between 2022 and 2026, so the dominant failure mode is stale advice: pointing users at the dead GNAT Community edition, writing pragma contracts, claiming "SPARK can't do pointers", or calling the analyzer "CodePeer". The correction map below is the single most important asset - apply it on every Ada/SPARK task. The second failure mode: code that compiles as Ada but is rejected by GNATprove, or OOP/contract idioms ported from other languages that violate Ada's tagged-type and LSP rules - see "What strong models get wrong".
Canonical docs: learn.adacore.com, docs.adacore.com, Ada 2022 RM at ada-auth.org.
When you see the LEFT column in code, docs, or your own memory, it is STALE - use the RIGHT column.
| Stale (avoid) | Current (use) | Notes |
|---|---|---|
| "Download GNAT Community Edition" | Alire (alr) + GNAT FSF | GNAT Community ended; 2021 was the last release. Single most common stale instruction. |
pragma Precondition / pragma Postcondition | aspect with Pre => / with Post => | Aspects (Ada 2012+) are idiomatic and portable. Pragmas still compile but are not the modern form. |
Pre / Post on a dispatching tagged primitive | Pre'Class / Post'Class | Specific Pre is illegal on a tagged primitive (RM 6.1.1) and is never inherited / never checked for dispatching calls. |
| "SPARK can't do pointers" | move / observe / borrow ownership model | Rust-like affine ownership on access types since SPARK 20-22. |
codepeer (CLI / product) | gnatsas (GNAT SAS) | CodePeer was renamed to GNAT Static Analysis Suite (~24 line, 2024). CLI is gnatsas analyze/report. |
CodePeer --level 0..4, SQL results DB | --mode=fast / --mode=deep, .sam/.sar files | Level switch discontinued; results are now version-controllable files, not a database. |
| "Latest Ada is Ada 2012" | Ada 2022 (finalized, shipping) | Use -gnat2022 / pragma Ada_2022. Default language version in recent GCC. |
pragma SPARK_Mode; (no value) / "On is the project default" | SPARK_Mode => On/Off/Auto; opt-in | Three-valued; without configuration, scope is Auto, not On. |
Ada.IO, Ada.Strings.Format, Ada.Collections | Ada.Text_IO, Ada.Strings.Fixed/Unbounded, Ada.Containers.Vectors | Do not hallucinate unit names; the real ones are precise. |
plain and / or in contracts | and then / or else | Short-circuit guards evaluation order (e.g. guard a dereference); plain and can break proof or raise. |
| GPS (GNAT Programming Studio) | GNAT Studio; strategic focus ALS + VS Code | Renamed; the Ada & SPARK VS Code extension + Ada Language Server are the current direction. |
When asserting anything that may be version-sensitive, qualify it (e.g. "as of GNAT FSF 15.2 / Ada 2022"). This project rides the latest toolchain (latest stable + snapshots) - re-verify exact versions against alire-project/GNAT-FSF-builds releases, not memory.
Trigger on: writing/porting/reviewing/optimizing .ada/.adb/.ads code; Ada packages, strong typing, generics, tagged types, tasking; contracts (Pre/Post/Contract_Cases/Global/Depends); SPARK proof, SPARK_Mode, GNATprove, assurance levels, loop invariants, ghost code, ownership/borrow; .gpr project files; Alire (alr) setup; embedded/bare-metal Ada (Ravenscar/Jorvik, light runtimes, bb-runtimes); GNAT SAS / GNATcheck static analysis.
Skip unless: the task names Ada, SPARK, GNAT, Alire, or GNATprove, or touches a .ada/.adb/.ads/.gpr file. Do NOT activate for unrelated languages, or for SPARK the Apache web UI / SPARK the cluster framework (different products that share the name).
Toolchain & ecosystem
alr init --bin myproj, alr with <crate> (add dep), alr build, alr run, alr toolchain --select, alr search <crate>, alr publish. There is no alr install <pkg> - do not invent cargo semantics.gprbuild is the project-aware builder (gprbuild -P proj.gpr -XMODE=release); gnatmake is single-file. "GPRbuild vs gprbuild" is one tool, just casing.aws (web), gtkada, gnatcoll, vss (Unicode strings), libadalang (Ada 2022 parsing/semantics).Contracts (aspects, not pragmas)
function F (X : T) return U with Pre => ..., Post => F'Result = .... 'Result names the return value; X'Old captures the entry value - do not invent in/out keywords in contracts.Contract_Cases guards must be disjoint and complete (GNATprove checks this); do not write overlapping guards.Global => null means "touches no global state". Global/Depends are SPARK flow contracts allowed alongside Pre/Post.SPARK proof model
SPARK_Mode is three-valued (On/Off/Auto). Common pattern: spec SPARK_Mode => On over a body SPARK_Mode => Off to expose a proven interface above an unprovable implementation.Relaxed_Initialization + the 'Initialized attribute (checked by proof).pragma Loop_Invariant) are MANUAL - SPARK does not infer them. A Post that needs an invariant fails until you write it. pragma Loop_Variant proves termination. Ghost code (with Ghost) and Big_Numbers (Ada.Numerics.Big_Numbers) are for specification/proof only.These compile-fail, fail proof, or post-date model knowledge cutoffs.
Class-wide contracts & LSP
tagged and has dispatching (overriding) primitives.Pre/Post (specific) are NOT inherited and do NOT govern dispatching calls; Pre'Class/Post'Class (class-wide) are inherited by overrides and govern dispatching. A dispatching call is checked against the class-wide contract of the static (declared) type of the controlling operand.Pre'Class must be WEAKER (contravariant, conceptually disjoined down the hierarchy); Post'Class must be STRONGER (covariant, conjoined). Strengthening Pre'Class or weakening Post'Class fails the LSP verification condition.high: extension of "X" is not initialized - all components (including invisible ones) must be initialized.SPARK pointers / ownership
SPARK_Mode => On.pragma Assume to document a true-but-unprovable gap (a deliberate hole).Generics in SPARK
generic unit is involved in proof.SPARK_Mode on the instantiation context (it cannot attach to an instantiation directly). The same generic can prove on one instance and fail on another; messages always name the instantiation.Static analysis: GNAT SAS vs GNATprove - never conflate
gnatsas analyze -P p.gpr then gnatsas report; --mode=fast (CI) / --mode=deep; baseline+diff to gate only new findings; SARIF output; MISRA via GNATcheck; custom checks in LKQL.Embedded gotchas
No_Exception_Propagation, No_Finalization, No_Tasking: exceptions can be raised/handled locally but not propagated (unhandled -> Last_Chance_Handler, no resume); controlled types (RAII) are unavailable - they will not compile.Max_Entry_Queue_Length, Max_Protected_Entries, allows relative delay, richer Pure_Barriers). Select with pragma Profile (Jorvik); or (Ravenscar). Both keep hard-real-time guarantees.Portability traps
'Image text (spacing, record field order, access values) is implementation-defined - define T'Put_Image for portable/stable output; do not rely on default 'Image formatting.delta): pure-integer only when small is a ratio of suitably-sized ints; range may stop at 'Last - Delta; ordinary fixed-point arithmetic is not fully specified.Pure/Preelaborate/Elaborate_Body; add pragma Elaborate_All (X) when elaboration code calls into a withed non-pure unit, or the binder may pick a legal-but-failing order.pragma Precondition, codepeer, or claim Ada 2012 is current or SPARK lacks pointers (any LEFT-column item).Pre/Post on a dispatching tagged primitive and assume inheritance; use Pre'Class/Post'Class.Pre'Class or weaken Post'Class in an override (LSP violation).Loop_Invariant and expect a value-dependent Post to prove.alr --version, gnat --version, the .gpr, alire.toml). Build language as -gnat2022 unless told otherwise.and then/or else; explicit SPARK_Mode; pick a target assurance level. For ports: translate stale constructs via the correction map first, then idiomatize, then add contracts/proof.gprbuild -P proj.gpr (or alr build); for SPARK run gnatprove -P proj.gpr --level=N and read which level/VC fails; for plain Ada, gnatsas analyze + gnatsas report.Verify any unstable or non-obvious API against current upstream docs - the toolchain changes fast and pre-2022 assumptions are common failure modes:
Pre'Class/Post'Class): https://docs.adacore.com/spark2014-docs/html/ug/en/source/object_oriented_programming.htmlalr): https://alire.ada.dev/docs/agent-knowledge/ada-spark-best-practices.md (50 sources)