skills/export-human-spec/SKILL.md
Generate a human-readable natural language specification document (Markdown) from a VDM-SL formal specification. Translates types, invariants, pre/post-conditions, and operations into clear prose that domain experts, project managers, and non-technical stakeholders can understand and review — without needing to learn VDM-SL. Use this skill whenever the user wants to: generate documentation from a VDM-SL spec, create a readable specification, export a spec for human review, convert VDM-SL to natural language, create a requirements document from formal specs, or produce a specification that non-engineers can read. Japanese triggers: 「VDM仕様から自然言語仕様を作りたい」「人間が読める仕様書を生成して」 「VDM-SLをドキュメントにして」「仕様書をエクスポートして」「形式仕様を読みやすくして」 「非エンジニア向けの仕様書を作って」「仕様のドキュメントを生成して」
npx skillsauth add kotaroyamame/formal-agent-contracts export-human-specInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Read a VDM-SL specification and produce a structured, clear natural language document that domain experts and non-technical stakeholders can review and understand.
VDM-SL仕様を読み取り、ドメインエキスパートや非技術者が理解・レビューできる 構造化された自然言語仕様書を生成する。
Formal specifications are precise but opaque to most stakeholders. In practice, formal specs need a "human-facing twin" — a document that says the same things in natural language so that:
This skill bridges formal precision and human accessibility. The generated document is not a simplification — it's a faithful translation that preserves all information while making it readable.
Ask the user for the .vdmsl file path (or find it in the workspace).
Parse and catalog the specification elements:
Report what was found:
📄 Specification Analysis: bank-account.vdmsl
Modules: 1 (BankAccount)
Types: 4 (Account, AccountId, Money, TransferResult)
State: 1 (BankSystem with 2 variables)
Invariants: 3
Operations: 5 (Deposit, Withdraw, Transfer, GetBalance, CloseAccount)
Pre-conditions: 4
Post-conditions: 5
Functions: 1 (CalculateInterest)
Before generating, clarify what the user needs. Different audiences need different levels of detail. Use AskUserQuestion:
Audience — Who will read this document?
Language — What language should the document be in?
Format — What structure?
Detail level — How much VDM-SL to include?
Each VDM-SL construct has a natural language equivalent. The goal is faithful translation — the reader should get the same understanding from the document as they would from the VDM-SL, just in plain language.
| VDM-SL | Natural Language |
|--------|-----------------|
| Account :: owner: Name, balance: Money | "An Account consists of an owner (a name) and a balance (a monetary amount)." |
| Status = <ACTIVE> \| <SUSPENDED> \| <CLOSED> | "A Status is one of: Active, Suspended, or Closed." |
| Money = real inv m == m >= 0 | "A monetary amount is a non-negative number (zero or greater)." |
| Accounts = map AccountId to Account | "The system tracks a collection of Accounts, each identified by a unique Account ID." |
| seq1 of char | "A non-empty text string" |
| [T] | "Optional (may be absent)" |
Invariants on types become natural rules:
VDM-SL: inv mk_Account(_, balance) == balance >= 0
Natural: "An account's balance can never be negative."
Translate state definitions as "the system maintains...":
VDM-SL:
state BankSystem of
accounts: map AccountId to Account
nextId: nat1
inv mk_BankSystem(accounts, nextId) ==
forall id in set dom accounts & id < nextId
end
Natural:
"The system maintains:
- A registry of all accounts, each with a unique ID
- A counter for generating the next account ID
Rule: Every existing account ID is smaller than the next-ID counter
(this ensures IDs are never reused)."
Translate as requirements or prerequisites using "before... can..., the following must hold":
VDM-SL: pre amount > 0 and accountId in set dom accounts
Natural: "Before a withdrawal can be made:
- The amount must be positive
- The account must exist in the system"
Explain the why when it's inferable — not just what the constraint is, but what goes wrong without it:
"The amount must be positive (to prevent zero or negative withdrawals,
which would be meaningless or equivalent to deposits)."
Translate as guarantees or outcomes:
VDM-SL: post accounts(accountId).balance = accounts~(accountId).balance + amount
Natural: "After a successful deposit, the account's balance increases by exactly
the deposited amount. No other accounts are affected."
The ~ (old state) notation translates naturally to "before/after" language.
Each operation becomes a section with:
### Withdraw
**Purpose:** Remove funds from an account.
**Prerequisites:**
- The account must exist
- The requested amount must be positive
- The account must have sufficient balance (balance ≥ amount)
**Behavior:**
The system reduces the account's balance by the withdrawal amount.
**Guarantees:**
- The balance decreases by exactly the withdrawn amount
- All other accounts remain unchanged
**Error cases:**
- If the account doesn't exist → operation cannot proceed
- If the amount is zero or negative → operation is rejected
- If insufficient funds → operation is rejected (balance remains unchanged)
Translate as formulas or algorithms in plain language:
VDM-SL: CalculateInterest: Money * real -> Money
CalculateInterest(principal, rate) == principal * rate / 100
Natural: "Interest Calculation: Multiply the principal by the rate,
then divide by 100. For example, 1000 at 5% yields 50."
Organize the output document following this structure. Adapt based on the audience preference from Step 2.
# [Module Name] — Specification Document
> Generated from: [filename.vdmsl]
> Date: [date]
> This document describes the formal specification in natural language.
> For the precise formal definition, refer to the VDM-SL source.
## 1. Overview
[One paragraph summarizing what this module/agent does and its role
in the larger system. Include the number of operations and key constraints.]
## 2. Glossary
[Define every domain term used in the spec. Even terms that seem obvious —
formal specs often give them precise meanings that differ from casual usage.]
| Term | Definition |
|------|-----------|
| Account | A record of a customer's balance and account information |
| Money | A non-negative real number representing a monetary value |
## 3. Data Model
[Describe all types and what they represent.
Group related types together. Include invariants as "Rules".]
### 3.1 Account
An Account consists of:
- **Owner**: A non-empty name (text)
- **Balance**: A monetary amount (non-negative)
**Rule:** An account's balance can never be negative.
### 3.2 System State
The system maintains:
- A registry of all accounts, each identified by a unique ID
- [...]
## 4. Operations
[One subsection per operation, following the template from Step 3.]
### 4.1 Open Account
**Purpose:** Create a new account for a customer.
**Prerequisites:** [...]
**Behavior:** [...]
**Guarantees:** [...]
### 4.2 Deposit
[...]
## 5. Business Rules
[Cross-cutting rules that affect multiple operations.
These come from state invariants and shared pre-conditions.]
1. **Non-negative balance rule**: No operation may result in a negative balance.
2. **Unique ID rule**: Once assigned, an account ID is never reused.
3. [...]
## 6. Constraints and Limitations
[Things the spec does NOT cover. Be explicit about boundaries.]
- This specification does not address authentication or authorization
- Performance characteristics are outside the scope of this spec
- [...]
If the user requested bilingual output, each section should have both languages, with the primary language first and the secondary indented or in a blockquote.
Before presenting the document, verify:
Completeness — Every VDM-SL element appears in the document. Count types, operations, invariants in both the VDM-SL and the document. If counts don't match, something was missed.
Faithfulness — The natural language says exactly what the VDM-SL says. No simplification that loses precision. No added interpretation that isn't in the formal spec. Watch especially for:
Readability — The document makes sense to someone who has never seen VDM-SL. No formal notation leaks into the prose unless the user requested it. Use concrete examples where abstract rules might be unclear.
Consistency — Terms are used consistently throughout. If "Account" is the term in one place, don't switch to "record" elsewhere.
Save the document to the workspace as [module-name]-spec.md (or the format
the user requested).
Inform the user that this document can be:
If the user wants to go from this document back to VDM-SL after stakeholder
review and changes, recommend the import-natural-spec skill to re-import
and reconcile changes.
ProcessItem, ask the user what the domain term is before writing
the document. The goal is a document that domain experts recognize as
describing their world.formal-methods-guide skill.testing
VDM-SL仕様の型チェック、構文検証、証明責務生成を実行するスキル
testing
Convert VDM-SL proof obligations (POs) to SMT-LIB and verify them with the Z3 solver. Triggered by "prove POs", "verify with SMT", "check with Z3", "auto-verify proof obligations", "prove the spec is correct", or "find counterexamples". Also responds to Japanese: 「POを証明して」「SMTで検証して」「Z3で確認して」等。 Used as the next step after PO generation with verify-spec, or for end-to-end PO generation + SMT verification.
development
Orchestrate the full reverse engineering pipeline: Extract provisional spec from existing code, refine through dialogue to uncover the true spec, then reconcile code with the confirmed spec. Optionally connects to the forward pipeline (verify → prove → generate → test). Triggered by: "reverse workflow", "extract and refine spec from code", "formalize existing code", "reverse engineer the specification", 「リバースワークフローで」「既存コードから仕様を起こして」「コードの仕様を明確にしたい」 「このプロジェクトを形式仕様で整理したい」「既存コードをリバースエンジニアリングして」
testing
Refine a provisional VDM-SL specification through dialogue with the user, uncovering the true specification that exists in the user's mind. The provisional spec (from extract-spec) serves as a scaffold for questions. Triggered by: "refine the spec", "review the provisional spec", 「仕様を磨きたい」「仮仕様をレビューして」「コードの意図を確認したい」「仕様を確認して」