extract-spec

extract-spec is a skill for Claude Code from kotaroyamame/formal-agent-contracts. It costs 111 tokens per session (3,346 once invoked), scanned A, original, MIT.

A tool that turns existing source code into a provisional VDM-SL specification, a formal description of what software contains and does. It treats the result as questions for discussion, not as the confirmed requirements.

In plain words
What is it for?
Use it to inspect selected files or directories and discuss the code’s structure and behaviour before writing a formal specification.
Why use it?
It gives you a starting point when the intended behaviour was never written down. This helps reveal differences between what the code does and what you actually want.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the formal-agent-contracts plugin — 15 skills shipped together

Good fit Use it to inspect selected files or directories and discuss the code’s structure and behaviour before writing a formal specification.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kotaroyamame/formal-agent-contracts/extract-spec
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 kotaroyamame/formal-agent-contracts --skill extract-spec
Clone the repo
git clone --depth 1 https://github.com/kotaroyamame/formal-agent-contracts

Made for: Claude Code.

Or install formal-agent-contracts, the plugin that ships this one along with the rest of its 15 skills.

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 extract-spec

README.md
[![agentmods](https://agentmods.dev/badge/skills/kotaroyamame/formal-agent-contracts/extract-spec/github.svg)](https://agentmods.dev/skills/kotaroyamame/formal-agent-contracts/extract-spec)
Your own site
<a href="https://agentmods.dev/skills/kotaroyamame/formal-agent-contracts/extract-spec"><img src="https://agentmods.dev/badge/skills/kotaroyamame/formal-agent-contracts/extract-spec/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 extract-spec

Your own site · 80×15
<a href="https://agentmods.dev/skills/kotaroyamame/formal-agent-contracts/extract-spec"><img src="https://agentmods.dev/badge/skills/kotaroyamame/formal-agent-contracts/extract-spec.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,346 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.
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.00111 $0.03346
Opus 5 $0.00056 $0.01673
Sonnet 5 $0.00022 $0.00669
Haiku 4.5 $0.00011 $0.00335

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

Security

Grade A, and why

extract-spec 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/extract-spec/SKILL.md · 329 lines

How it starts

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

Extracting Provisional VDM-SL Specifications from Source Code

Extract structural and behavioral information from existing code and generate a PROVISIONAL VDM-SL specification as a starting point for dialogue with the user.

Critical principle: The spec extracted from code is NOT the true spec. It is a provisional scaffold for dialogue. The true spec exists in the user's head. Every extracted item must be tagged [PROVISIONAL] and framed as a question, not a statement.

既存のコードから構造情報と動作情報を抽出し、ユーザーとの対話の出発点となる 暫定的なVDM-SL仕様を生成する。

重要な原則: コードから抽出した仕様は「真の仕様」ではない。それはあくまで対話のための 暫定的な足がかりである。真の仕様はユーザーの頭の中に存在する。抽出した全ての項目には [PROVISIONAL]というタグをつけ、陳述ではなく質問として表現する。

Dialogue Flow

Step 1: Scope Identification

Ask the user which files or directories to analyze.

Questions to guide the scope:

  1. Which files or directories should I analyze?
  2. Are there entry points (main functions, API endpoints)?
  3. Are there any main modules or key classes I should focus on?
  4. Are there tests, documentation, or comments that explain the behavior?

ユーザーに、どのファイルまたはディレクトリを分析するかを質問する。

スコープを確定するための質問:

  1. どのファイルまたはディレクトリを分析すべきか?
  2. エントリーポイント(メイン関数、APIエンドポイント)はあるか?
  3. 注目すべきメインモジュールやキークラスはあるか?
  4. 動作を説明するテスト、ドキュメント、またはコメントはあるか?

Step 2: Structural Analysis

Read the code and extract candidates for:

Data Types

  • Classes, interfaces, structs, dataclasses → VDM-SL record type candidates
  • Enums → quote union candidates
  • Optional/nullable types → optional type [T] candidates
  • Union types → VDM-SL union type candidates
  • Collections (arrays, lists, sets, maps) → sequence/set/map type candidates

Functions and Operations

  • Function/method signatures → VDM-SL function/operation candidates
  • Parameters and return types → type mappings
  • State mutations (if any) → operation vs. function classification

Constraints and Validation Logic

  • If-guards, assertions, validation functions → pre-condition candidates
  • Return value patterns and state postconditions → post-condition candidates
  • Invariants, decorators, schema validators → invariant candidates
  • Test assertions → implicit specification evidence

Read the full file on GitHub · 329 lines

Files

What ships with it

1 file 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 · 329 lines · 111 tokens per session scan A 08cfe20f9fe4

Subscribe to this mod's changes

extract-spec is a skill published in the GitHub repository kotaroyamame/formal-agent-contracts (1 stars, last pushed 2mo ago), licensed MIT. It adds 111 tokens to every session and 3,346 once invoked, about $0.0006 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-31.