Agent skill

Program To Model Extractor

by ArabelaTso in ArabelaTso/Skills-4-SE

Extract abstract mathematical models from functional code (Haskell, OCaml, F) for formal reasoning in Isabelle/HOL.

Apache-2.0Auto-check passed

Install Program To Model Extractor

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill program-to-model-extractor -a claude-code

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

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE program-to-model-extractor --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/program-to-model-extractor .claude/skills/program-to-model-extractor && 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
program-to-model-extractor
GitHub stars
253
Token cost
~1.5k tokens
SKILL.md length
376 words
Files
3 (incl. references)
Skills in repo
150
Repo updated
First seen
Licence
Apache-2.0

At a glance

Extract abstract mathematical models from functional code (Haskell, OCaml, F) for formal reasoning in Isabelle/HOL.

  • Works in 5 steps: Analyze the Source Code → Extract Data Types → Model Functions → …
  • Convert functional programs to Isabelle definitions
  • SKILL.md covers Overview, Extraction Workflow, Common Extraction Patterns and Abstraction Guidelines, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Program To Model Extractor is an agent skill from ArabelaTso/Skills-4-SE. Extract abstract mathematical models from functional code (Haskell, OCaml, F) for formal reasoning in Isabelle/HOL. Use when users need to: (1) Convert functional programs to Isabelle definitions, (2) Extract high-level algorithm essence from implementation code, (3) Generate formal specifications and properties from code, (4) Create verification-ready models that capture mathematical properties while abstracting away implementation details. Focuses on structural recursion, algebraic data types, higher-order…

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/extraction_patterns.md` and `references/isabelle_syntax.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

  • Convert functional programs to Isabelle definitions
  • Extract high-level algorithm essence from implementation code
  • Generate formal specifications and properties from code
  • Create verification-ready models that capture mathematical properties while abstracting away implementation details

Example prompts

  • “/program-to-model-extractor”

Workflow steps

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

  1. Analyze the Source Code
  2. Extract Data Types
  3. Model Functions
  4. State Properties
  5. Identify Invariants

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 haskell).

    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

Program To Model Extractor loads about 1.5k tokens when it runs, and up to ~4.2k if it reads all its reference files. Until then it costs about 145 tokens; SKILL.md has 376 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~145
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.2k

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). 376 words, ~1,549 tokens.

Download SKILL.mdSave it as .claude/skills/program-to-model-extractor/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
program-to-model-extractor
description
Extract abstract mathematical models from functional code (Haskell, OCaml, F#) for formal reasoning in Isabelle/HOL. Use when users need to: (1) Convert functional programs to Isabelle definitions, (2) Extract high-level algorithm essence from implementation code, (3) Generate formal specifications and properties from code, (4) Create verification-ready models that capture mathematical properties while abstracting away implementation details. Focuses on structural recursion, algebraic data types, higher-order functions, and invariant extraction.

Program-to-Model Extractor

Extract high-level mathematical models from functional code for formal reasoning in Isabelle/HOL.

Overview

This skill transforms functional programs (Haskell, OCaml, F#) into abstract mathematical models suitable for formal verification in Isabelle/HOL. The extraction focuses on the algorithm's mathematical essence—capturing core properties, invariants, and structural patterns while abstracting away language-specific implementation details.

Extraction Workflow

1. Analyze the Source Code

Identify key elements:

  • Data structures: Algebraic types, lists, trees, custom types
  • Core functions: Main computational logic
  • Recursion patterns: Structural, tail, mutual recursion
  • Properties: What should be true about inputs/outputs?
2. Extract Data Types

Convert source language types to Isabelle datatypes:

haskell
-- Haskell
data Tree a = Leaf | Node a (Tree a) (Tree a)
isabelle
(* Isabelle *)
datatype 'a tree = Leaf | Node "'a" "'a tree" "'a tree"
3. Model Functions

Choose the appropriate Isabelle construct:

For primitive recursion (terminates obviously):

isabelle
fun length :: "'a list ⇒ nat" where
  "length [] = 0" |
  "length (x # xs) = 1 + length xs"

For general recursion (needs termination proof):

isabelle
function gcd :: "nat ⇒ nat ⇒ nat" where
  "gcd m n = (if n = 0 then m else gcd n (m mod n))"
by pat_completeness auto
termination by (relation "measure snd") auto

For non-recursive definitions:

isabelle
definition compose :: "('b ⇒ 'c) ⇒ ('a ⇒ 'b) ⇒ ('a ⇒ 'c)" where
  "compose f g = (λx. f (g x))"
4. State Properties

Extract and formalize key properties as lemmas:

isabelle
lemma length_append: "length (xs @ ys) = length xs + length ys"
lemma quicksort_permutes: "mset (quicksort xs) = mset xs"
lemma quicksort_sorted: "sorted (quicksort xs)"
5. Identify Invariants

For stateful or accumulator-based functions, state what holds during computation:

isabelle
fun sum_acc :: "int ⇒ int list ⇒ int" where
  "sum_acc acc [] = acc" |
  "sum_acc acc (x # xs) = sum_acc (acc + x) xs"

lemma sum_acc_correct: "sum_acc acc xs = acc + sum_list xs"

Common Extraction Patterns

List Processing

Source: Recursive list operations Model: Isabelle list functions with length/permutation properties See: extraction_patterns.md

Sorting Algorithms

Source: Comparison-based sorting Model: Functions with sorted and mset (permutation) properties See: extraction_patterns.md

Tree Operations

Source: Recursive tree traversals and folds Model: Isabelle datatypes with structural recursion See: extraction_patterns.md

Higher-Order Functions

Source: map, filter, fold, composition Model: Isabelle higher-order definitions with fusion lemmas See: extraction_patterns.md

Partial Functions

Source: Functions that may fail (division, lookup) Model: Option types with case analysis See: extraction_patterns.md

Show full SKILL.md (149 more words)Show less
Tail Recursion

Source: Accumulator-based functions Model: Functions with accumulator correctness lemmas See: extraction_patterns.md

Abstraction Guidelines

Focus on high-level mathematical essence:

✓ Do extract:

  • Core algorithm structure
  • Mathematical properties (sorted, permutation, etc.)
  • Invariants and pre/post-conditions
  • Structural recursion patterns
  • Type relationships

✗ Don't extract:

  • Performance optimizations
  • Language-specific syntax details
  • Implementation tricks
  • Memory layout concerns
  • Specific evaluation strategies

Example: Complete Extraction

Source (Haskell):

haskell
quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (p:xs) = quicksort lesser ++ [p] ++ quicksort greater
  where lesser  = filter (< p) xs
        greater = filter (>= p) xs

Extracted Model (Isabelle):

isabelle
fun quicksort :: "'a::linorder list ⇒ 'a list" where
  "quicksort [] = []" |
  "quicksort (p # xs) =
     quicksort (filter (λx. x < p) xs) @ [p] @
     quicksort (filter (λx. x ≥ p) xs)"

(* Key properties *)
lemma quicksort_permutes: "mset (quicksort xs) = mset xs"
lemma quicksort_sorted: "sorted (quicksort xs)"
lemma quicksort_correct:
  "sorted (quicksort xs) ∧ mset (quicksort xs) = mset xs"

Explanation:

  • Converted type constraint Ord a to 'a::linorder
  • Preserved structural recursion pattern
  • Extracted two key properties: permutation and sortedness
  • Combined into correctness specification

References

Tips

  • Start with the simplest functions first to build up the model incrementally
  • Use mset (multisets) to express permutation properties elegantly
  • For complex recursion, explicitly state the termination measure
  • Group related lemmas together (e.g., all properties of a single function)
  • Use meaningful names that reflect mathematical concepts, not implementation details

© 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 2 other files (references) in skills/program-to-model-extractor of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/extraction_patterns.md
  • references/isabelle_syntax.md

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Program To Model Extractor 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.

Program To Model Extractor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Program To Model Extractor this skillArabelaTso/Skills-4-SE253—~1.5kAutomated safety check: PassApache-2.0
Extractalirezarezvani/claude-skills28k—~1.4kAutomated safety check: PassMIT
Abstractbrycewang-stanford/Auto-Empirical-Research-Skills4.5k—~495Automated safety check: NotesCustom licence
Brand Extractnexu-io/open-design100k—~3.1kAutomated safety check: PassApache-2.0
Design Extractnexu-io/open-design100k—~549Automated safety check: PassApache-2.0
Kg Extractruvnet/ruflo74k—~751Automated safety check: NotesMIT

Similar skills

  • Extract

    alirezarezvani/claude-skills

    Turn a proven pattern or debugging solution into a standalone reusable skill with SKILL.md, reference docs, and examples.

    28k GitHub stars~1.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Abstract

    brycewang-stanford/Auto-Empirical-Research-Skills

    Reads the manuscript and notebooks to generate a structured abstract.

    4.5k GitHub stars~495 tokensUpdated 2 days ago
    Auto-check: notes
  • Brand Extract

    nexu-io/open-design

    Extract a complete Brand Kit from a live website by driving the in-app browser.

    100k GitHub stars~3.1k tokensUpdated today
    Productivity & AutomationAuto-check passed
  • Design Extract

    nexu-io/open-design

    Extract design tokens (color / typography / spacing) from imported source code, screenshots, or Figma exports into the canonical token bag token-map consumes.

    100k GitHub stars~549 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Kg Extract

    ruvnet/ruflo

    Extract entities and relations from source files to build a knowledge graph

    74k GitHub stars~751 tokensUpdated today
    Knowledge ManagementAuto-check: notes
  • A skill your agent uses when you need to apply functional programming principles in Java — including writing immutable objects and Records, pure functions, functional interfaces, lambda expressions…

    446 GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed

More from ArabelaTso/Skills-4-SE

All 150 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 Program To Model Extractor

What does Program To Model Extractor do?

Extract abstract mathematical models from functional code (Haskell, OCaml, F) for formal reasoning in Isabelle/HOL. Program To Model Extractor is an agent skill from ArabelaTso/Skills-4-SE. Extract abstract mathematical models from functional code (Haskell, OCaml, F) for formal reasoning in Isabelle/HOL.

When should I use Program To Model Extractor?

Program To Model Extractor fits situations like: convert functional programs to Isabelle definitions; extract high-level algorithm essence from implementation code; generate formal specifications and properties from code; create verification-ready models that capture mathematical properties while abstracting away implementation details.

How do I install Program To Model Extractor in Claude Code?

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

How do I install Program To Model Extractor in Codex?

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

Can I use Program To Model Extractor 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 program-to-model-extractor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/program-to-model-extractor, .gemini/skills/program-to-model-extractor, .github/skills/program-to-model-extractor and .opencode/skills/program-to-model-extractor in your project.

What does Program To Model Extractor need to run?

SKILL.md names no scripts, command-line tools or credentials: Program To Model Extractor is instructions for the agent only.

Does Program To Model Extractor 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 Program To Model Extractor 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 Program To Model Extractor use?

Program To Model Extractor 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 Program To Model Extractor use?

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

What are the alternatives to Program To Model Extractor?

Skills that share tags, products or a category with Program To Model Extractor: Extract (alirezarezvani/claude-skills, 28k stars), Abstract (brycewang-stanford/Auto-Empirical-Research-Skills, 4.5k stars), Brand Extract (nexu-io/open-design, 100k stars) and Design Extract (nexu-io/open-design, 100k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Program To Model Extractor?

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