Skills Reference
Complete reference for all 15 skills in the Formal Agent Contracts plugin. Includes both the forward pipeline (define → verify → prove → generate → test + import/export) and the reverse pipeline (extract true specs from existing code).
Overview
| Skill | Purpose | Version | Requires |
|---|---|---|---|
define-contract | Natural language → VDM-SL spec | v2.0.0 | — |
verify-spec | Syntax/type check + PO generation | v2.0.0 | VDMJ |
smt-verify | PO → SMT-LIB → Z3 proving | v0.2.0 | Z3 |
generate-code | VDM-SL → TypeScript/Python | v0.4.0 | — |
generate-tests | VDM-SL + design docs → contract tests | v2.1.0 | Node.js + Vitest/Jest |
generate-db-schema | VDM-SL types/invariants → DB schema (DDL) | v2.1.0 | sqlite3 / PostgreSQL (optional) |
route-models | Contract complexity → per-module model tier | v1.0.0 | — |
integrated-workflow | Full pipeline orchestration | v2.1.0 | VDMJ (Z3 optional) |
formal-methods-guide | VDM-SL reference knowledge | v0.1.0 | — |
import-natural-spec | Markdown spec → VDM-SL (interactive) | v1.0.0 | — |
export-human-spec | VDM-SL → human-readable Markdown | v1.0.0 | — |
define-contract
v2.0.0Interactively converts natural language requirements into VDM-SL formal specifications and Phase 2 design documents (PROTOCOL.md, API-SIGNATURES.md) through a guided dialogue.
Trigger phrases:
Workflow steps:
- Gather agent information — name, role, inputs, outputs, relationships
- Generate type definitions — map natural language to VDM-SL types
- Define operations and contracts — capture pre/post/inv through questions
- Generate the VDM-SL specification — complete module with all definitions
- Review and iterate — present spec for user validation
Output:
.vdmsl specification file + design documents (PROTOCOL.md, API-SIGNATURES.md)Built-in templates:
- Transform Agent — stateless input/output conversion
- CRUD Agent — create, read, update, delete with state
- Pipeline Agent — sequential data processing stages
- Mediator Agent — orchestrates multiple sub-agents
- Validation Agent — input validation and sanitization
- Design Document Template (v2.0.0) — Phase 2 protocol/API design documents
- Hybrid Decision Agent (v2.0.0) — score-based compound decisions
verify-spec
v2.0.0Runs VDMJ syntax checking, type checking, and proof obligation generation on VDM-SL files, then explains results in plain language. Also checks design documents (PROTOCOL.md, API-SIGNATURES.md) for completeness and consistency with the spec.
Trigger phrases:
Workflow steps:
- Locate VDM-SL files — find .vdmsl files in workspace
- Syntax and type checking — run VDMJ with error reporting
- Generate proof obligations — run VDMJ with -p flag
- Interpret and explain — translate each PO to plain language
- Categorize POs — rank by urgency (critical / standard / info)
- Suggest next steps — offer to proceed to SMT verification
Output:
PO list with natural language explanations, categorized by urgencysmt-verify
v0.2.0Converts proof obligations to SMT-LIB format and proves them with the Z3 solver. Reports results as proved, counterexample found, or unknown.
Trigger phrases:
Workflow steps:
- Accept POs — from verify-spec output or direct input
- Generate type declarations — map VDM-SL types to SMT-LIB sorts
- Generate auxiliary definitions — invariants, pre/post as define-fun
- Convert PO expressions — transform VDM-SL logic to SMT-LIB formulas
- Negate and check-sat — reflexive verification: assert(not PO)
- Execute Z3 — run solver on each .smt2 file
- Interpret results — unsat=proved, sat=counterexample, unknown=timeout
Output:
.smt2 files and per-PO verification reportgenerate-code
v0.4.0Generates TypeScript or Python implementation scaffolds from VDM-SL specifications, with runtime contract enforcement for pre-conditions, post-conditions, and invariants.
Trigger phrases:
Workflow steps:
- Read VDM-SL file — parse specification
- Confirm target language — TypeScript, Python, or both
- Transform types — map VDM-SL to target language types
- Generate type definitions — interfaces/dataclasses with invariants
- Generate contract code — validation functions for pre/post/inv
- Generate operation stubs — function scaffolds with contract wrappers
- Output files — save to generated/ directory
Output:
TypeScript (.ts) or Python (.py) files with runtime contractsgenerate-tests
v2.1.0Generates Jest/Vitest-compatible contract tests from VDM-SL specifications and design documents (PROTOCOL.md, API-SIGNATURES.md). Covers type invariants, pre/post-conditions, state transitions, and boundary values.
Trigger phrases:
Workflow steps:
- Read the VDM-SL spec and design documents — catalog invariants, contracts, protocol rules
- Generate type invariant tests
- Generate pre/post-condition tests
- Generate protocol tests from the design documents: message-type/payload consistency and state transitions (PROTOCOL.md), API signatures (API-SIGNATURES.md)
- Generate boundary value tests
- Output test files — Jest/Vitest compatible
Output:
Jest/Vitest contract test filesgenerate-db-schema
v2.1.0Derives a database schema (DDL) from VDM-SL types and invariants by numbered mapping rules (R1–R18) rather than free-writing. Records infidelities as a DEVIATIONS retrenchment table (e.g. nat→BIGINT, transition rules) and maps every invariant to its enforcement point in a TRACEABILITY matrix.
Trigger phrases:
Workflow steps:
- Parse the spec — identify persistent state: record types, quote unions, state components, invariants, atomic operations
- Confirm target DBMS (PostgreSQL/MySQL/SQLite) and naming conventions
- Apply mapping rules R1–R18: record→table, map state→keyed table, quote union→ENUM/CHECK, invariant→CHECK/UNIQUE/FK/trigger, atomic→transaction boundary
- Generate DEVIATIONS.md (retrenchment table) — record each infidelity with a concrete compensation (trigger / app-layer contract check / contract test)
- Generate TRACEABILITY.md — map every invariant and operation contract to its enforcement point; no unaccounted invariant allowed
- Validate the DDL (executable check for SQLite / psql / Docker) and completeness
Output:
schema.sql (DDL) + DEVIATIONS.md + TRACEABILITY.mdroute-models
v1.0.0Scores each module from objective complexity signals in the VDM-SL contract (implicit definitions, invariants, quantifiers, recursion, cross-module dependencies, PO counts) and assigns the lightest capable model tier (light / standard / heavy). Produces a machine-readable model-routing.json and a rationale-backed MODEL-ROUTING.md, consumed by generate-code / generate-tests via per-module subagent execution. A module that fails verification twice escalates one tier automatically — quality is guaranteed by the verification gates.
Trigger phrases:
Workflow steps:
- Read the spec and split it into modules
- Collect complexity signals per module (reusing a verify-spec PO report if available)
- Assign tiers via the scoring rubric (fast paths: types-only → light; any implicit definition → never light)
- Present the routing table for user confirmation with per-row overrides
- Write model-routing.json (next to the spec) and MODEL-ROUTING.md
Output:
model-routing.json (machine-readable, with the tier → model mapping) + MODEL-ROUTING.md (rationale and expected savings)integrated-workflow
v2.1.0Orchestrates the full pipeline — Define → Verify → Prove → Generate → Test — in a single guided session, with error recovery and session reporting.
Trigger phrases:
Workflow steps:
- Session setup — gather agent name, starting point, target language, SMT toggle
- Phase 1: Define — invoke define-contract for VDM-SL generation
- Phase 2: Verify — invoke verify-spec for syntax/type/PO checks
- Phase 3: Prove (optional) — invoke smt-verify for Z3 proving
- Phase 4: Generate — invoke generate-code for TS/Python scaffolds
- Phase 5: Test — invoke generate-tests for contract tests, then run them
- Session report — comprehensive summary of all phases
Output:
Complete agent: .vdmsl + generated code + tests + session reportformal-methods-guide
v0.1.0Provides reference knowledge on VDM-SL syntax, type system, and all 38 proof obligation types. Acts as background knowledge for other skills.
Trigger phrases:
Workflow steps:
- Identify the concept — match user question to reference material
- Provide explanation — plain language with VDM-SL examples
- Link to context — connect to the user's current specification
Output:
Plain language explanations with code examplesimport-natural-spec
v1.0.0Reads a Markdown requirements document and interactively converts it to VDM-SL. Identifies ambiguities (vague quantifiers, missing error cases, implicit constraints, boundary conditions) and resolves them through structured dialogue.
Trigger phrases:
Workflow steps:
- Read and parse the MD document — identify structure, headings, lists, tables
- Classify requirements — map each to types, constraints, operations, or rules
- Detect ambiguities — vague quantifiers, undefined terms, missing error cases, boundary conditions
- Interactive resolution — present ambiguities in priority order, resolve through dialogue
- Generate VDM-SL — produce tagged specification with [REQ-nnn] traceability
- Gap analysis — forward/backward/completeness checks
- Connect to pipeline — recommend verify-spec or refine-spec as next step
Output:
.vdmsl specification file with requirement traceabilityexport-human-spec
v1.0.0Generates a structured natural language specification document (Markdown) from VDM-SL. Types become "what things exist", pre-conditions become "prerequisites", post-conditions become "guarantees". Designed for domain experts and non-technical stakeholders.
Trigger phrases:
Workflow steps:
- Read VDM-SL specification — catalog types, state, operations, invariants
- Ask about output preferences — audience, language, format, detail level
- Translate each construct — types→definitions, pre→prerequisites, post→guarantees
- Structure the document — overview, glossary, data model, operations, business rules
- Quality checks — completeness, faithfulness, readability, consistency
- Save and present — output as Markdown, suggest next steps
Output:
Structured Markdown specification documentReverse Pipeline
NEWA reverse pipeline for extracting specifications from existing codebases. The reverse-workflow skill orchestrates this:
Existing Code → Extract Provisional Spec → Dialogue Refinement → Code Reconciliation → (Can connect to forward pipeline)| Skill | Version | Purpose |
|---|---|---|
extract-spec | v1.1.0 | Extract a provisional VDM-SL spec from existing code. Tagged [PROVISIONAL] and presented as dialogue scaffolding |
refine-spec | v1.2.0 | Use the provisional spec as a scaffold for dialogue with the user, uncovering the true specification. Differences recorded as Findings |
reconcile-code | v1.3.0 | Compare confirmed spec vs existing code item-by-item. Generate diff report, code fixes, and auto-tests |
reverse-workflow | v1.4.0 | Orchestrate the full reverse pipeline: Extract → Refine → Reconcile. Can connect to forward pipeline |
Skill Pipeline
Skills can be used independently, but are designed to chain together. The integrated-workflow skill automates this pipeline: New in v2.0.0: Phase 2 design documents (PROTOCOL.md / API-SIGNATURES.md) and automatic contract test generation with generate-tests.