generate-code

generate-code is a skill for Claude Code from kotaroyamame/formal-agent-contracts. It costs 102 tokens per session (1,756 once invoked), scanned A, original, MIT.

A code generator that reads VDM-SL specifications—a formal description of data types, functions, operations, and rules—and creates TypeScript or Python implementation scaffolds.

In plain words
What is it for?
Creating TypeScript or Python starter code, type definitions, and runtime checks from .vdmsl files.
Why use it?
It removes the need to start the implementation from an empty file and helps keep the code aligned with the specification. Generated code can also include checks for required inputs, outputs, and invariants while it runs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents; names the AskUserQuestion tool; mentions Claude Code.

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

Good fit Creating TypeScript or Python starter code, type definitions, and runtime checks from .vdmsl files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kotaroyamame/formal-agent-contracts/generate-code
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 generate-code
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 generate-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/kotaroyamame/formal-agent-contracts/generate-code.svg)](https://agentmods.dev/skills/kotaroyamame/formal-agent-contracts/generate-code)
Your own site
<a href="https://agentmods.dev/skills/kotaroyamame/formal-agent-contracts/generate-code"><img src="https://agentmods.dev/badge/skills/kotaroyamame/formal-agent-contracts/generate-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,756 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.00102 $0.01756
Opus 5 $0.00051 $0.00878
Sonnet 5 $0.00020 $0.00351
Haiku 4.5 $0.00010 $0.00176

Measured 7d ago against content hash 3a4a6f0de2ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

generate-code 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 7d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (examples/test_po.py, examples/test-po.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/generate-code/SKILL.md · 174 lines

How it starts

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

Code Generation from VDM-SL Specifications

Read VDM-SL specifications (types, functions, operations, invariants) and generate TypeScript or Python implementation scaffolds. Includes runtime verification (pre/post/inv checks).

VDM-SL仕様を読み取り、TypeScript/Pythonの実装スキャフォールドを生成する。 ランタイム検証(pre/post/inv チェック)も含める。

Generation Flow

Step 1: Read the Specification File

Read the .vdmsl file specified by the user. If no file is specified, search for .vdmsl files in the workspace.

ユーザーが指定した .vdmsl ファイルを読み取る。指定がなければワークスペース内を探索。

Step 2: Confirm Target Language

If the user hasn't specified, ask with AskUserQuestion:

  • TypeScript
  • Python
  • Both

ユーザーが明示しない場合、AskUserQuestionで確認する。

Step 2.5: Check for Model Routing (optional, token saving)

If a model-routing.json (produced by the route-models skill) exists next to the spec file:

  • Process each module as a separate subagent with the module's assigned model (Claude Code: the Task tool's model parameter). Read the tier → model mapping from the routing file — never hard-code model names.
  • Modules not listed in the file use defaults.tier.
  • Verification is unchanged: generated code must pass the same gates as without routing. If a module's output fails its gate twice, escalate one tier, regenerate, append to escalation.history, and add the same row to the "Escalations" section of MODEL-ROUTING.md (see the route-models skill, references/routing-rules.md).
  • If the runtime does not support per-subagent model selection, present the routing table as a recommendation and continue normally. Never fail the phase because routing is unavailable.

仕様ファイルの隣に model-routing.jsonroute-models スキルの成果物)があれば、 モジュールごとに割り当てモデルのサブエージェントで生成する(層→モデル対応は必ず ファイルから読む)。検証はルーティング無しのときと同一で、同一モジュールが2回 失敗したら1層上げて再生成し、escalation.history と MODEL-ROUTING.md の両方に追記する。モデル指定が使えない環境では 推奨表の提示に留め、通常どおり進める。

Step 3: VDM-SL → Code Conversion

Follow the conversion rules in references/typescript-rules.md or references/python-rules.md.

Read the full file on GitHub · 174 lines

Files

What ships with it

4 files 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. 7d ago First seen · 174 lines · 102 tokens per session scan A 3a4a6f0de2ce

Subscribe to this mod's changes

generate-code is a skill published in the GitHub repository kotaroyamame/formal-agent-contracts (1 stars, last pushed 2mo ago), licensed MIT. It adds 102 tokens to every session and 1,756 once invoked, about $0.0005 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.

Related

Other skills, from other repositories

language-patterns

Provides language-specific patterns for TypeScript, Python, and React including idioms, best practices, and common patterns. Use when implementing features in these languages.

sequenzia/agent-alchemy · 35 tokens

claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

hashgraph-online/awesome-codex-plugins · 53 tokens

plankton-code-quality

Write-time code quality enforcement using Plankton — auto-formatting, linting, and Claude-powered fixes on every file edit via hooks.

loulanyue/awesome-claude-notes · 34 tokens

writing-typescript

Idiomatic TypeScript development. Use when writing TypeScript code, Node.js services, React apps, or TypeScript design advice. Emphasizes strict typing, boundary validation, composition, fast feedback, behavior tests, and project-configured tooling. NOT for Go, Python, Rust, plain HTML/CSS/JS, or server-rendered…

alexei-led/cc-thingz · 78 tokens

writing-python

Idiomatic Python 3.12+ development. Use when writing Python code, CLI tools, scripts, or services. Emphasizes stdlib, type hints, fast pytest feedback, uv/ruff/pyright toolchain, and minimal dependencies. NOT for Go, Rust, TypeScript, or shell-only tasks.

alexei-led/cc-thingz · 67 tokens

inline-lambda-functions

How to eliminate verbose multi-line helper boilerplate by using concise inline lambda expressions and arrow functions, cutting callback token generation by 55%.

alivirgo/Major-AI-Skills · 32 tokens