abstract-invariant-generator

abstract-invariant-generator is a skill for Claude Code, Codex from ArabelaTso/Skills-4-SE. It costs 77 tokens per session (2,836 once invoked), scanned A, original, Apache-2.0.

A formal-verification aid that infers loop invariants, function preconditions, and postconditions from program code. These are statements describing what must be true before, during, and after execution.

In plain words
What is it for?
Use it when adding formal specifications for systems such as Dafny, Isabelle, or Coq, including loop and function contracts.
Why use it?
It reduces the manual effort needed to write specifications for proving that code behaves correctly.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding formal specifications for systems such as Dafny, Isabelle, or Coq, including loop and function contracts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arabelatso/skills-4-se/abstract-invariant-generator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ArabelaTso/Skills-4-SE --skill abstract-invariant-generator
Clone the repo
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for abstract-invariant-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/arabelatso/skills-4-se/abstract-invariant-generator/github.svg)](https://agentmods.dev/skills/arabelatso/skills-4-se/abstract-invariant-generator)
Your own site
<a href="https://agentmods.dev/skills/arabelatso/skills-4-se/abstract-invariant-generator"><img src="https://agentmods.dev/badge/skills/arabelatso/skills-4-se/abstract-invariant-generator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for abstract-invariant-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/arabelatso/skills-4-se/abstract-invariant-generator"><img src="https://agentmods.dev/badge/skills/arabelatso/skills-4-se/abstract-invariant-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,836 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00077 $0.02836
Opus 5 $0.00039 $0.01418
Sonnet 5 $0.00015 $0.00567
Haiku 4.5 $0.00008 $0.00284

Measured 12d ago against content hash 412405583d20, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

abstract-invariant-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/abstract-invariant-generator/SKILL.md · 452 lines

How it starts

The opening of the file, as written. The whole thing — 452 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Abstract Invariant Generator

Overview

This skill uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions. It generates formal specifications that support verification and reasoning about program correctness.

Invariant Generation Workflow

Step 1: Identify Specification Points

Analyze the code to identify where invariants are needed:

Loop Invariants: For each loop

while condition:
    # Need: invariant that holds before/after each iteration
    body

Function Contracts: For each function

def function(params):
    # Need: precondition (what must be true on entry)
    body
    # Need: postcondition (what is guaranteed on exit)

Assertions: For verification points

# Need: invariant that holds at this point
assert property

Step 2: Perform Abstract Interpretation

Use abstract domains to infer properties:

Interval Analysis: Infer numeric ranges

i = 0
while i < n:
    # Inferred: 0 ≤ i < n
    i += 1
# Inferred: i = n

Relational Analysis: Infer relationships between variables

i = 0
j = 0
while i < n:
    # Inferred: i = j
    i += 1
    j += 1

Shape Analysis: Infer data structure properties

while node is not None:
    # Inferred: node is in the linked list
    node = node.next

Step 3: Generate Loop Invariants

For each loop, generate an invariant that:

  1. Holds before the loop (initialization)
  2. Is preserved by the loop body (maintenance)
  3. Combined with loop exit, implies desired property (termination)

Template-Based Generation:

Counter Loop:

i = 0
while i < n:
    arr[i] = 0
    i += 1

Generated Invariant:

invariant 0 ≤ i ≤ n
invariant ∀k. 0 ≤ k < i ⟹ arr[k] = 0

Accumulator Loop:

sum = 0
i = 0
while i < len(arr):
    sum += arr[i]
    i += 1

Generated Invariant:

invariant 0 ≤ i ≤ len(arr)
invariant sum = Σ(arr[0..i-1])

Read the full file on GitHub · 452 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 452 lines · 77 tokens per session scan A 412405583d20

Subscribe to this mod's changes

abstract-invariant-generator is a skill published in the GitHub repository ArabelaTso/Skills-4-SE (252 stars, last pushed 21d ago), licensed Apache-2.0. It adds 77 tokens to every session and 2,836 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

perf-profiler

A performance investigation guide that uses repeatable measurements and profiling evidence to find where software spends time or resources. Profiling records runtime activity such as CPU use, memory use, database work, or network delays.

laolaoshiren/claude-code-skills-zh · 78 tokens

log-analyzer

A log-analysis helper that reads application and system logs to find unusual patterns and likely causes. Logs are records of events such as errors, requests, warnings, and service activity.

laolaoshiren/claude-code-skills-zh · 24 tokens

trace

Trace Elixir call trees from entry points via mix xref. Use when debugging data flow, planning signature changes, or understanding how a bug reaches code.

oliver-kriska/claude-elixir-phoenix · 33 tokens

code-review-web

Review web application code for bugs, security issues, performance problems, and stack-specific anti-patterns. Use this skill whenever the user wants to review code, debug a production issue, investigate a build failure, audit security, or check a PR before merging. Triggers on code review, review my code, debug…

rampstackco/claude-skills · 121 tokens

bim-consistency-checker

Check BIM model consistency: naming conventions, parameter completeness, spatial relationships, and data integrity across model elements.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 28 tokens

022-root-cause-analysis

Use when a framed problem needs root-cause investigation rather than a symptom-level fix, applying Five Whys, Fishbone (Ishikawa), Current Reality Tree, and constraint identification. This should trigger when an issue's Root Cause Analysis point of view needs evaluation, or when a maintainer directly asks to find the…

jabrena/plinth · 85 tokens