Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
← Back to list

Abstract Invariant Generator

Infers loop invariants, preconditions and postconditions via abstract interpretation and emits them in Dafny, Isabelle, Coq or ACSL syntax.

Dev & CodingAdvanced★ 252⑂ 24AI score 7/10Last updated: Aug 21, 2026

What it does

  • Locates specification points in your code: loops, function boundaries, assertion sites.
  • Applies interval, relational and shape analysis to infer numeric ranges, variable relationships and data-structure properties.
  • Generates loop invariants that satisfy initialization, maintenance and exit conditions, using templates for counter, accumulator and search loops.
  • Proposes preconditions (index in bounds, non-zero divisor, non-null node) and postconditions (sortedness, multiset preservation, search result contracts).
  • Formats output for Dafny, Isabelle/HOL, Coq and ACSL (C) so you can paste it straight into a proof.
  • Includes recipes for strengthening weak invariants, nested loops and multi-exit loops.

Who it's for

  • Engineers and researchers doing formal verification with Dafny, Coq, Isabelle or Frama-C.
  • Developers of safety-critical code who must attach contracts to functions.
  • Graduate students and instructors teaching algorithm correctness proofs.

Examples

  1. Paste a Python insertion sort and ask for Dafny: you get a method with outer/inner loop invariants plus a multiset-preservation clause.
  2. Ask for ACSL annotations (requires \valid(...), loop invariant, loop variant) for a C find_max function, then run Frama-C on it.
  3. When the verifier complains that an invariant is too weak, use the strengthening section to add "what has been processed so far" properties and close the proof.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/ArabelaTso/Skills-4-SE/HEAD/skills/abstract-invariant-generator/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
↓ Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the skills/abstract-invariant-generator folder from the GitHub repo ArabelaTso/Skills-4-SE into my ~/.claude/skills/abstract-invariant-generator/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/ArabelaTso/Skills-4-SE.git && mkdir -p ~/.claude/skills && cp -r Skills-4-SE/skills/abstract-invariant-generator ~/.claude/skills/

⚠ This is a third-party skill. Check the source repository before installing.

  1. Open a terminal and clone the repo: git clone https://github.com/ArabelaTso/Skills-4-SE.git
  2. Create the skills directory if needed: mkdir -p ~/.claude/skills
  3. Copy just this skill: cp -r Skills-4-SE/skills/abstract-invariant-generator ~/.claude/skills/
  4. Verify with ls ~/.claude/skills/abstract-invariant-generator that SKILL.md (and any references folder) is present.
  5. Restart Claude Code and try a prompt like "generate Dafny loop invariants for this function" to trigger the skill.
  6. For actual proof checking, install your target verifier (Dafny, Coq, Isabelle, Frama-C) separately and run the generated specifications through it.
View source on GitHub ↗License: Apache-2.0