Agent skill

Proof Carrying Code Generator

by ArabelaTso in ArabelaTso/Skills-4-SE

Generate executable code together with formal proofs certifying safety and correctness properties in Isabelle/HOL or Coq.

Apache-2.0Auto-check passed

Install Proof Carrying Code Generator

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

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

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE proof-carrying-code-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/proof-carrying-code-generator .claude/skills/proof-carrying-code-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
proof-carrying-code-generator
GitHub stars
253
Token cost
~2.9k tokens
SKILL.md length
510 words
Files
4 (incl. references)
Skills in repo
151
Repo updated
First seen
Licence
Apache-2.0

At a glance

Generate executable code together with formal proofs certifying safety and correctness properties in Isabelle/HOL or Coq.

  • Works in 5 steps: Verified implementations with… → Safety certificates for memory safety,… → Functional specifications with… → …
  • Building verified software
  • SKILL.md covers Overview, PCC Generation Workflow, Core Approaches and Safety Properties, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Proof Carrying Code Generator is an agent skill from ArabelaTso/Skills-4-SE. Generate executable code together with formal proofs certifying safety and correctness properties in Isabelle/HOL or Coq. Use when building verified software, safety-critical systems, or when formal guarantees are required. Produces code with accompanying proofs for memory safety, bounds checking, functional correctness, invariant preservation, and termination. Supports extraction to OCaml/Haskell/SML and integration with existing codebases.

Its SKILL.md is about 2.9k 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_pcc.md`, `references/isabelle_pcc.md` and `references/safety_properties.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

  • Building verified software
  • Safety-critical systems
  • Formal guarantees are required

Example prompts

  • “/proof-carrying-code-generator”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Verified implementations with correctness proofs
  2. Safety certificates for memory safety, bounds checking, null safety
  3. Functional specifications with pre/postconditions
  4. Invariant proofs for data structure integrity
  5. Extracted code from verified specifications

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

Proof Carrying Code Generator loads about 2.9k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 119 tokens; SKILL.md has 510 words of instructions outside code blocks.

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

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). 510 words, ~2,903 tokens.

Download SKILL.mdSave it as .claude/skills/proof-carrying-code-generator/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
proof-carrying-code-generator
description
Generate executable code together with formal proofs certifying safety and correctness properties in Isabelle/HOL or Coq. Use when building verified software, safety-critical systems, or when formal guarantees are required. Produces code with accompanying proofs for memory safety, bounds checking, functional correctness, invariant preservation, and termination. Supports extraction to OCaml/Haskell/SML and integration with existing codebases.

Proof-Carrying Code Generator

Generate executable code bundled with formal proofs that certify key safety and correctness properties.

Overview

Proof-carrying code (PCC) is executable code accompanied by formal proofs that certify specific properties. This skill helps generate:

  1. Verified implementations with correctness proofs
  2. Safety certificates for memory safety, bounds checking, null safety
  3. Functional specifications with pre/postconditions
  4. Invariant proofs for data structure integrity
  5. Extracted code from verified specifications

The generated code can be extracted to mainstream languages (OCaml, Haskell, SML) while maintaining proof certificates.

PCC Generation Workflow

Requirements
    ↓
Formal Specification
    ↓
Verified Implementation
    ↓
Proof Obligations
    ↓
Certified Code + Proofs
    ↓
Code Extraction

Core Approaches

Approach 1: Specification-First

Start with formal specification, implement, then prove.

Steps:

  1. Write formal specification
  2. Implement function/algorithm
  3. State correctness theorem
  4. Prove theorem
  5. Extract code

Example (Isabelle):

isabelle
(* Specification *)
definition sorted_spec :: "nat list ⇒ nat list ⇒ bool" where
  "sorted_spec input output ≡ sorted output ∧ mset output = mset input"

(* Implementation *)
fun insertion_sort :: "nat list ⇒ nat list" where
  "insertion_sort [] = []" |
  "insertion_sort (x # xs) = insert x (insertion_sort xs)"

(* Correctness theorem *)
theorem insertion_sort_correct:
  "sorted_spec input (insertion_sort input)"
proof (induction input)
  case Nil
  then show ?case by (simp add: sorted_spec_def)
next
  case (Cons x xs)
  then show ?case
    using insert_sorted mset_insert
    by (auto simp: sorted_spec_def)
qed

(* Extract code *)
export_code insertion_sort in SML file "sort.sml"
Approach 2: Refinement-Based

Start abstract, refine to concrete with proofs at each step.

Steps:

  1. Abstract specification
  2. Refine to intermediate level
  3. Prove refinement correct
  4. Refine to executable code
  5. Prove final refinement
  6. Extract code

Example (Coq):

coq
(* Abstract specification *)
Definition find_spec {A} (P : A → bool) (l : list A) : option A :=
  (* Nondeterministic: any element satisfying P *)
  ...

(* Concrete implementation *)
Fixpoint find {A} (P : A → bool) (l : list A) : option A :=
  match l with
  | [] => None
  | x :: xs => if P x then Some x else find P xs
  end.

(* Refinement proof *)
Theorem find_refines : forall A P l,
  find P l = find_spec P l.
Proof.
  (* Proof that concrete refines abstract *)
Qed.

(* Extract *)
Extraction "find.ml" find.
Approach 3: Program-First

Write code with annotations, generate proof obligations, prove them.

Steps:

  1. Write function with contracts
  2. Generate verification conditions
  3. Prove verification conditions
  4. Certify code

Example (Coq with Program):

coq
Require Import Program.

Program Definition safe_div (a b : nat) (H : b ≠ 0) : nat :=
  a / b.

(* Proof obligation automatically generated *)
Next Obligation.
  (* Prove division is safe *)
Qed.

Safety Properties

Memory Safety

Property: No buffer overflows, out-of-bounds access.

Pattern:

isabelle
lemma array_access_safe:
  "⟦ i < length arr ⟧ ⟹ ∃v. arr ! i = v"
  by auto

fun safe_get :: "'a list ⇒ nat ⇒ 'a option" where
  "safe_get [] _ = None" |
  "safe_get (x # xs) 0 = Some x" |
  "safe_get (x # xs) (Suc n) = safe_get xs n"

lemma safe_get_bounds:
  "safe_get xs i = Some v ⟹ i < length xs"
  by (induction xs i rule: safe_get.induct) auto
Null Safety

Property: No null pointer dereferences.

Pattern:

coq
Definition safe_head {A} (l : list A) (H : l ≠ []) : A :=
  match l with
  | [] => match H eq_refl with end
  | x :: _ => x
  end.

Lemma safe_head_correct : forall A (l : list A) H,
  l ≠ [] → safe_head l H = hd_error l.
Proof.
  intros. destruct l; auto. contradiction.
Qed.
Bounds Checking

Property: All array accesses within bounds.

Pattern:

isabelle
definition bounded_access :: "'a array ⇒ nat ⇒ 'a option" where
  "bounded_access arr i = (if i < array_length arr
                           then Some (array_get arr i)
                           else None)"

lemma bounded_access_safe:
  "bounded_access arr i = Some v ⟹ i < array_length arr"
  by (simp add: bounded_access_def split: if_splits)

Correctness Properties

Functional Correctness

Property: Function computes correct result.

Pattern:

isabelle
fun factorial :: "nat ⇒ nat" where
  "factorial 0 = 1" |
  "factorial (Suc n) = Suc n * factorial n"

function fact_spec :: "nat ⇒ nat" where
  "fact_spec 0 = 1" |
  "fact_spec n = n * fact_spec (n - 1)"
  by auto

theorem factorial_correct:
  "factorial n = fact_spec n"
  by (induction n) auto
Invariant Preservation

Property: Data structure invariants maintained.

Pattern:

coq
Inductive BST : tree → Prop :=
  | BST_leaf : BST Leaf
  | BST_node : forall l x r,
      BST l → BST r →
      (forall y, In y l → y < x) →
      (forall y, In y r → x < y) →
      BST (Node l x r).

Fixpoint insert (x : nat) (t : tree) : tree :=
  match t with
  | Leaf => Node Leaf x Leaf
  | Node l y r =>
      if x <? y then Node (insert x l) y r
      else if y <? x then Node l y (insert x r)
      else t
  end.

Theorem insert_preserves_BST : forall x t,
  BST t → BST (insert x t).
Proof.
  induction t; intros; simpl.
  - constructor; constructor.
  - inversion H; subst.
    destruct (x <? n) eqn:E1.
    + (* Insert left *)
    + destruct (n <? x) eqn:E2.
      * (* Insert right *)
      * (* Equal, no change *)
Qed.
Termination

Property: Function always terminates.

Pattern:

isabelle
function gcd :: "nat ⇒ nat ⇒ nat" where
  "gcd a 0 = a" |
  "gcd a b = gcd b (a mod b)"
  by auto
termination
  by (relation "measure (λ(a, b). b)") auto

lemma gcd_terminates:
  "∃result. gcd a b = result"
  by auto

Framework-Specific Guidance

Isabelle/HOL PCC

For Isabelle-specific code generation, extraction, and certification patterns, see references/isabelle_pcc.md.

Key features:

  • Code generation to SML, OCaml, Haskell, Scala
  • Refinement framework for verified implementations
  • Sepref for imperative code with proofs
  • Export with proof certificates
Coq PCC

For Coq-specific extraction, Program framework, and certification, see references/coq_pcc.md.

Key features:

  • Extraction to OCaml, Haskell, Scheme
  • Program for proof obligations
  • Equations for well-founded recursion
  • Certified compilation
Show full SKILL.md (198 more words)Show less

Common Safety Properties

For detailed safety and correctness property patterns, see references/safety_properties.md.

Categories include:

  • Memory safety (bounds, null, use-after-free)
  • Type safety (no type confusion)
  • Arithmetic safety (no overflow, division by zero)
  • Concurrency safety (no data races, deadlocks)
  • Information flow security (no leaks)

Specification:

isabelle
definition binary_search_spec :: "nat list ⇒ nat ⇒ nat option" where
  "binary_search_spec xs target = (
    if sorted xs ∧ target ∈ set xs
    then Some (THE i. i < length xs ∧ xs ! i = target)
    else None)"

Implementation:

isabelle
fun binary_search :: "nat list ⇒ nat ⇒ nat option" where
  "binary_search xs target = bs_aux xs target 0 (length xs)"

fun bs_aux :: "nat list ⇒ nat ⇒ nat ⇒ nat ⇒ nat option" where
  "bs_aux xs target low high = (
    if low ≥ high then None
    else let mid = (low + high) div 2 in
         if xs ! mid = target then Some mid
         else if xs ! mid < target then bs_aux xs target (mid + 1) high
         else bs_aux xs target low mid)"

Safety proofs:

isabelle
lemma bs_aux_bounds:
  "⟦ bs_aux xs target low high = Some i; low ≤ high; high ≤ length xs ⟧
   ⟹ low ≤ i ∧ i < high"
proof (induction xs target low high rule: bs_aux.induct)
  case (1 xs target low high)
  then show ?case
    by (auto simp: Let_def split: if_splits)
qed

lemma bs_aux_no_overflow:
  "⟦ low ≤ high; high ≤ length xs ⟧
   ⟹ (low + high) div 2 < length xs"
  by auto

Correctness proof:

isabelle
theorem binary_search_correct:
  "sorted xs ⟹ binary_search xs target = binary_search_spec xs target"
proof -
  assume "sorted xs"
  show ?thesis
  proof (cases "target ∈ set xs")
    case True
    then show ?thesis
      using binary_search_finds_target[OF `sorted xs` True]
      by (simp add: binary_search_spec_def)
  next
    case False
    then show ?thesis
      using binary_search_not_found[OF `sorted xs` False]
      by (simp add: binary_search_spec_def)
  qed
qed

Code extraction:

isabelle
export_code binary_search in SML file "binary_search.sml"
export_code binary_search in OCaml file "binary_search.ml"

Best Practices

  1. Start with Specifications: Clear specs before implementation
  2. Incremental Verification: Verify small pieces, compose
  3. Reuse Lemmas: Build library of certified components
  4. Automate Proofs: Use tactics and automation where possible
  5. Test Extracted Code: Verify extraction produces correct code
  6. Document Properties: Clearly state what's certified
  7. Modular Design: Separate concerns, verify independently

Verification Checklist

Before finalizing proof-carrying code:

  • All safety properties proven
  • Functional correctness established
  • Termination proven (if applicable)
  • Invariants maintained
  • Bounds checking verified
  • Code extracts successfully
  • Extracted code tested
  • Proof certificates included
  • Documentation complete

Integration Patterns

Integrating with Existing Code

Pattern: Verify critical components, interface with unverified code.

Example:

isabelle
(* Verified core *)
definition verified_sort :: "nat list ⇒ nat list" where
  "verified_sort = insertion_sort"

theorem verified_sort_correct:
  "sorted (verified_sort xs) ∧ mset (verified_sort xs) = mset xs"
  by (simp add: verified_sort_def insertion_sort_correct)

(* Export for use in larger system *)
export_code verified_sort in OCaml file "verified_sort.ml"
Certified Libraries

Pattern: Build library of verified functions.

Example:

coq
Module VerifiedList.
  (* Verified operations *)
  Definition safe_nth := ...
  Definition safe_update := ...
  Definition verified_map := ...

  (* Correctness theorems *)
  Theorem safe_nth_correct : ...
  Theorem safe_update_correct : ...
  Theorem verified_map_correct : ...
End VerifiedList.

(* Extract entire module *)
Extraction "verified_list.ml" VerifiedList.

Additional Resources

For detailed guidance on specific aspects:

© 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/proof-carrying-code-generator of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/coq_pcc.md
  • references/isabelle_pcc.md
  • references/safety_properties.md

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Proof Carrying Code 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.

Proof Carrying Code Generator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Proof Carrying Code Generator this skillArabelaTso/Skills-4-SE253—~2.9kAutomated safety check: PassApache-2.0
Executealirezarezvani/claude-skills28k—~831Automated safety check: PassMIT
Generatealirezarezvani/claude-skills28k1 repos~1.1kAutomated safety check: PassMIT
Fal Generatenexu-io/open-design100k—~306Automated safety check: PassApache-2.0
Generate Then Executemohitagw15856/pm-claude-skills1.4k—~938Automated safety check: PassMIT
Video Generationbytedance/deer-flow83k3 repos~1.4kAutomated safety check: PassMIT

Similar skills

  • Execute

    alirezarezvani/claude-skills

    /cs:execute <decision — Generate a 90-day execution plan with weekly milestones, DRIs, and check-in cadence from an approved decision.

    28k GitHub stars~831 tokensUpdated 1 mo ago
    Product & Project ManagementAuto-check passed
  • 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
  • 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 yesterday
    Media & CreativeAuto-check passed
  • Generate Then Execute

    mohitagw15856/pm-claude-skills

    Separate raw idea-generation from judgment so creativity isn't strangled by your inner critic — diverge with zero evaluation, then switch to hard critique.

    1.4k GitHub stars~938 tokensUpdated yesterday
    Agent WorkflowsAuto-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.

    83k 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

More from ArabelaTso/Skills-4-SE

All 151 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 Proof Carrying Code Generator

What does Proof Carrying Code Generator do?

Generate executable code together with formal proofs certifying safety and correctness properties in Isabelle/HOL or Coq. Proof Carrying Code Generator is an agent skill from ArabelaTso/Skills-4-SE. Generate executable code together with formal proofs certifying safety and correctness properties in Isabelle/HOL or Coq.

When should I use Proof Carrying Code Generator?

Proof Carrying Code Generator fits situations like: building verified software; safety-critical systems; formal guarantees are required.

How do I install Proof Carrying Code Generator in Claude Code?

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

How do I install Proof Carrying Code Generator in Codex?

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

Can I use Proof Carrying Code 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 proof-carrying-code-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/proof-carrying-code-generator, .gemini/skills/proof-carrying-code-generator, .github/skills/proof-carrying-code-generator and .opencode/skills/proof-carrying-code-generator in your project.

What does Proof Carrying Code Generator need to run?

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

Does Proof Carrying Code 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 Proof Carrying Code 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 Proof Carrying Code Generator use?

Proof Carrying Code 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 Proof Carrying Code Generator use?

About 2.9k tokens (SKILL.md is roughly 12k 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 9.5k tokens, read only when the agent opens those files.

What are the alternatives to Proof Carrying Code Generator?

Skills that share tags, products or a category with Proof Carrying Code Generator: Execute (alirezarezvani/claude-skills, 28k stars), Generate (alirezarezvani/claude-skills, 28k stars), Fal Generate (nexu-io/open-design, 100k stars) and Generate Then Execute (mohitagw15856/pm-claude-skills, 1.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Proof Carrying Code Generator?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 151 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.