Agent skill

Formal Spec Generator

by ArabelaTso in ArabelaTso/Skills-4-SE

Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions.

Apache-2.0Auto-check passed

Install Formal Spec Generator

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill formal-spec-generator -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE formal-spec-generator --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/formal-spec-generator .claude/skills/formal-spec-generator && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
formal-spec-generator
GitHub stars
253
Token cost
~1.5k tokens
SKILL.md length
561 words
Files
4 (incl. references)
Skills in repo
170
Repo updated
First seen
Licence
Apache-2.0

At a glance

Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions.

  • Works in 5 steps: Understand the Input → Choose Target System → Identify Specification Components → …
  • Formalize algorithms
  • SKILL.md covers Workflow, Key Principles, Common Patterns and Examples, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Formal Spec Generator is an agent skill from ArabelaTso/Skills-4-SE. Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions. Use when users need to: (1) Formalize algorithms or data structures, (2) Create function specifications with contracts, (3) Generate predicates and properties for verification, (4) Translate informal requirements into formal logic, (5) Specify invariants for loops or data structures, or (6) Create formal definitions for…

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/coq_patterns.md`, `references/examples.md` and `references/isabelle_patterns.md`).

The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.

When your agent uses it

  • Formalize algorithms
  • Data structures
  • Create function specifications with contracts
  • Generate predicates and properties for verification

Example prompts

  • “/formal-spec-generator”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Understand the Input
  2. Choose Target System
  3. Identify Specification Components
  4. Generate Formal Specifications
  5. Structure the Output

What it can do on your machine

Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are isabelle and coq).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Formal Spec Generator loads about 1.5k tokens when it runs, and up to ~4.7k if it reads all its reference files. Until then it costs about 152 tokens; SKILL.md has 561 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~152
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 561 words, ~1,508 tokens.

Download SKILL.mdSave it as .claude/skills/formal-spec-generator/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
formal-spec-generator
description
Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions. Use when users need to: (1) Formalize algorithms or data structures, (2) Create function specifications with contracts, (3) Generate predicates and properties for verification, (4) Translate informal requirements into formal logic, (5) Specify invariants for loops or data structures, or (6) Create formal definitions for mathematical concepts. Supports both Isabelle/HOL and Coq equally.

Formal Specification Generator

Generate formal specifications in Isabelle/HOL or Coq from informal descriptions, source code, or mathematical statements.

Workflow

1. Understand the Input

Identify what type of input is provided:

  • Informal requirements: Natural language descriptions (e.g., "a function that sorts a list")
  • Source code: Existing implementations in Python, C, Java, or other languages
  • Pseudocode: Algorithmic descriptions with semi-formal structure
  • Mathematical definitions: Properties or theorems to formalize
2. Choose Target System

Ask the user which formal proof assistant to target:

  • Isabelle/HOL: Preferred for higher-order logic, functional programming style
  • Coq: Preferred for constructive logic, dependent types, proof automation
  • Both: Generate specifications in both systems when requested

If not specified, default to generating both versions.

3. Identify Specification Components

Determine what needs to be formalized:

  • Function definitions: Type signatures and implementations
  • Data types: Algebraic data types, records, or inductive types
  • Predicates: Properties and logical relationships
  • Pre/post-conditions: Function contracts and correctness specifications
  • Invariants: Loop invariants or data structure invariants
4. Generate Formal Specifications

Use the reference files for syntax and patterns:

Generate specifications that include:

  1. Type definitions for data structures
  2. Function definitions with proper types
  3. Predicates describing properties
  4. Correctness specifications relating inputs to outputs
  5. Theorem statements (proofs can be left as sorry in Isabelle or Admitted in Coq)
5. Structure the Output

Organize the generated specifications clearly:

For Isabelle/HOL:

isabelle
theory TheoryName
  imports Main
begin

(* Data type definitions *)
datatype ...

(* Function definitions *)
fun function_name :: "types" where
  ...

(* Predicates and properties *)
definition property_name :: "type" where
  ...

(* Correctness specifications *)
theorem theorem_name:
  "specification"
  sorry

end

For Coq:

coq
Require Import List Arith.
Import ListNotations.

(* Data type definitions *)
Inductive ...

(* Function definitions *)
Fixpoint function_name ... :=
  ...

(* Predicates and properties *)
Definition property_name ... : Prop :=
  ...

(* Correctness theorems *)
Theorem theorem_name :
  specification.
Proof.
  Admitted.

Key Principles

Completeness
  • Include all necessary type definitions
  • Specify both preconditions and postconditions
  • Define helper predicates when needed
  • State correctness theorems even if proofs are omitted
Clarity
  • Use descriptive names for functions and predicates
  • Add comments explaining non-obvious specifications
  • Structure code logically (types, then functions, then properties)
  • Keep specifications close to the informal description
Correctness
  • Ensure type signatures are accurate
  • Match the semantics of the informal specification
  • Use appropriate logical operators (∀, ∃, ⟶, ∧, ∨)
  • Verify that pre/post-conditions capture the intended behavior
Idiomatic Style
  • Follow standard conventions for each system
  • Use built-in libraries (List, Arith, etc.) when available
  • Prefer simple definitions over complex ones
  • Use pattern matching for recursive structures
Show full SKILL.md (221 more words)Show less

Common Patterns

From Informal Requirements

When given natural language descriptions:

  1. Extract the function signature (inputs, outputs, types)
  2. Identify preconditions (assumptions about inputs)
  3. Identify postconditions (guarantees about outputs)
  4. Define helper predicates for complex properties
  5. State the correctness theorem

Example: "A function that finds the maximum element in a non-empty list"

  • Input: list nat (precondition: non-empty)
  • Output: nat
  • Postcondition: result is in the list AND result ≥ all elements
From Source Code

When given existing implementations:

  1. Translate the data structures to formal types
  2. Translate the function logic to formal definitions
  3. Infer the implicit preconditions and postconditions
  4. Formalize the expected behavior as predicates
  5. State correctness theorems
From Mathematical Definitions

When given mathematical statements:

  1. Choose appropriate formal types (nat, int, real, etc.)
  2. Translate mathematical notation to formal syntax
  3. Define predicates for mathematical properties
  4. State theorems for mathematical facts

Examples

For complete worked examples including insertion sort, binary search, and stack data structures, see examples.md.

Tips

  • Start simple: Begin with basic definitions, then add complexity
  • Use libraries: Import standard libraries (List, Arith, etc.) for common operations
  • Leave proofs: Focus on specifications; proofs can be sorry/Admitted
  • Test syntax: Ensure generated code is syntactically valid
  • Explain choices: Comment on design decisions in the specifications
  • Both systems: When generating both Isabelle and Coq, ensure semantic equivalence

© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/formal-spec-generator of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/coq_patterns.md
  • references/examples.md
  • references/isabelle_patterns.md

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Formal Spec Generator next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Formal Spec Generator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Formal Spec Generator this skillArabelaTso/Skills-4-SE253—~1.5kAutomated safety check: PassApache-2.0
Generatealirezarezvani/claude-skills28k1 repos~1.1kAutomated safety check: PassMIT
Definition Of Done Generatorjeremylongshore/tons-of-skills-marketplace2.8k—~605Automated safety check: PassMIT
Fal Generatenexu-io/open-design100k—~306Automated safety check: PassApache-2.0
Video Generationbytedance/deer-flow84k3 repos~1.4kAutomated safety check: PassMIT
Image Generationonyx-dot-app/onyx32k1 repos~1.7kAutomated safety check: PassCustom licence

Similar skills

  • Generate

    alirezarezvani/claude-skills

    Generate Playwright tests. An agent skill from alirezarezvani/claude-skills.

    28k GitHub starsUsed in 1 repo~1.1k tokens
    Testing & QAAuto-check passed
  • Definition Of Done Generator

    jeremylongshore/tons-of-skills-marketplace

    Generate definition of done generator operations. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~605 tokensUpdated today
    Auto-check passed
  • Fal Generate

    nexu-io/open-design

    Generate images and videos using fal.ai AI models. An agent skill from nexu-io/open-design.

    100k GitHub stars~306 tokensUpdated today
    Media & CreativeAuto-check passed
  • Video Generation

    bytedance/deer-flow

    Generates short videos from a structured JSON prompt, optionally guided by a reference image used as the first or last frame.

    84k GitHub starsUsed in 3 repos~1.4k tokens
    Media & CreativeAuto-check passed
  • Image Generation

    onyx-dot-app/onyx

    Generate or edit raster images (photos, illustrations, textures, sprites, mockups, logos, infographics) using the workspace's configured image-generation provider via onyx-cli image.

    32k GitHub starsUsed in 1 repo~1.7k tokens
    Media & CreativeAuto-check passed
  • Structured Image Generation

    bytedance/deer-flow

    Turns an image request into a structured JSON prompt and runs a bundled Python script to generate the picture, optionally guided by reference images.

    84k GitHub starsUsed in 4 repos~2.9k tokens
    Media & CreativeAuto-check passed

More from ArabelaTso/Skills-4-SE

All 170 skills in this repo
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Metamorphic Test Generator

    ArabelaTso/Skills-4-SE

    Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.

    253 GitHub stars~798 tokensUpdated 1 mo ago
    Auto-check passed
  • Reproduction Trace Instrumenter

    ArabelaTso/Skills-4-SE

    Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.

    253 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Spring Mvc To Boot Migrator

    ArabelaTso/Skills-4-SE

    Automatically migrate Spring MVC applications to Spring Boot.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • State Snapshot Instrumenter

    ArabelaTso/Skills-4-SE

    Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Formal Spec Generator

What does Formal Spec Generator do?

Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions. Formal Spec Generator is an agent skill from ArabelaTso/Skills-4-SE. Generate formal specifications (definitions, predicates, invariants, pre/post-conditions) in Isabelle/HOL or Coq from informal requirements, source code, pseudocode, or mathematical descriptions.

When should I use Formal Spec Generator?

Formal Spec Generator fits situations like: formalize algorithms; data structures; create function specifications with contracts; generate predicates and properties for verification.

How do I install Formal Spec Generator in Claude Code?

Run `npx skills add ArabelaTso/Skills-4-SE --skill formal-spec-generator -a claude-code`. Or copy the skill folder (skills/formal-spec-generator in ArabelaTso/Skills-4-SE) into .claude/skills/formal-spec-generator in your project. Claude Code loads it when a task matches its description.

How do I install Formal Spec Generator in Codex?

Run `npx skills add ArabelaTso/Skills-4-SE --skill formal-spec-generator -a codex`. Or copy the skill folder (skills/formal-spec-generator in ArabelaTso/Skills-4-SE) into .agents/skills/formal-spec-generator in your project. Codex loads it when a task matches its description.

Can I use Formal Spec Generator in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill formal-spec-generator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/formal-spec-generator, .gemini/skills/formal-spec-generator, .github/skills/formal-spec-generator and .opencode/skills/formal-spec-generator in your project.

What does Formal Spec Generator need to run?

SKILL.md names no scripts, command-line tools or credentials: Formal Spec Generator is instructions for the agent only.

Does Formal Spec Generator access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Formal Spec Generator safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Formal Spec Generator use?

Formal Spec Generator is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Formal Spec Generator use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.2k tokens, read only when the agent opens those files.

What are the alternatives to Formal Spec Generator?

Skills that share tags, products or a category with Formal Spec Generator: Generate (alirezarezvani/claude-skills, 28k stars), Definition Of Done Generator (jeremylongshore/tons-of-skills-marketplace, 2.8k stars), Fal Generate (nexu-io/open-design, 100k stars) and Video Generation (bytedance/deer-flow, 84k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Formal Spec Generator?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 170 skills in this directory. The repository was last updated on August 21, 2026.

Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.