define-contract

define-contract is a skill for Claude Code from kotaroyamame/formal-agent-contracts. It costs 240 tokens per session (6,518 once invoked), scanned A, original, MIT.

A formal way to define how software agents share responsibilities, data, and messages. It uses VDM-SL, a precise language for describing rules and data, and can produce protocol and API design documents.

In plain words
What is it for?
Use it to define agent roles, data types, preconditions and postconditions, communication protocols, API signatures, and proposed contract tests.
Why use it?
It removes ambiguity about what each agent accepts, returns, and promises to do in a multi-agent system. Clear contracts make agent boundaries and communication easier to review.

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 define agent roles, data types, preconditions and postconditions, communication protocols, API signatures, and proposed contract tests.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/kotaroyamame/formal-agent-contracts/define-contract"><img src="https://agentmods.dev/badge/skills/kotaroyamame/formal-agent-contracts/define-contract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 240 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,518 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.00240 $0.06518
Opus 5 $0.00120 $0.03259
Sonnet 5 $0.00048 $0.01304
Haiku 4.5 $0.00024 $0.00652

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

Security

Grade A, and why

define-contract 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 10d 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/define-contract/SKILL.md · 544 lines

How it starts

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

エージェント契約定義スキル (v2.0.0)

形式的エージェント契約を段階的に定義し、VDM-SL(Vienna Development Method Specification Language)仕様と設計文書(PROTOCOL.md、API-SIGNATURES.md)を生成するスキルです。v2.0.0では Phase 1(ドメイン論理)の VDM-SL 仕様に加えて、Phase 2(プロトコル・API 仕様)の設計文書生成に対応し、複雑なマルチエージェントシステムに対応しています。

概要

このスキルは以下のワークフローを実行します:

  1. ステップ1:エージェントロール抽出 - 対象エージェントの責務と境界を明確化
  2. ステップ2:データ型定義 - エージェントが扱うデータ構造を形式化(Phase 1: ドメイン論理) 2b. ステップ2b:通信プロトコル層定義(新機能) - 設計文書(PROTOCOL.md、API-SIGNATURES.md)を生成(Phase 2: プロトコル・API仕様)
  3. ステップ3:契約定義 - 前提条件と後提条件を含む契約を記述(Phase 1: ドメイン論理)
  4. ステップ4:VDM-SL生成 - Phase 1 VDM-SL仕様書を自動生成
  5. ステップ5:仕様レビュー - 生成された仕様と設計文書を検証
  6. ステップ6:契約テスト生成の提案 - 自動テスト生成スキルの実行を提案

ステップ1:エージェントロール抽出

目的:対象エージェントの明確な責務定義

ユーザーに以下の情報を聞き出します:

  • エージェント名:e.g., HybridJudgeAgent, MessageValidator
  • 主要責務:このエージェントが何をするか(1-2文)
  • 入力の形態:どのようなデータを受け取るか
  • 出力の形態:どのようなデータを返すか
  • 状態管理:ステートレスか、ステートフルか
  • 外部依存:他のエージェントやシステムへの依存関係

出力例

エージェント:HybridJudgeAgent
責務:チケットの自動返信可否を判定し、処理方法(自動応答/オペレータ連携/オペレータのみ)を決定する
入力:Ticket型(ID、本文、顧客情報、優先度、複雑度スコア)
出力:Action型(<AutoReply> | <OperatorAndLLM> | <OperatorOnly>)
状態:ステートレス(判定時点の入力値のみに依存)
依存:MessageValidator(メッセージ検証)、ScoreCalculator(スコア計算)

ステップ2:データ型定義

目的:エージェントが扱う全データ型を形式化

以下の形式でデータ型を定義します:

-- 基本型
Score = nat1  -- 1から100までのスコア
Priority = <Low> | <Medium> | <High>

-- レコード型
Ticket :: 
  id : nat1
  content : seq of char
  priority : Priority
  complexity_score : Score

各型について以下を明確にします:

  • 型の名前と分類(基本型、レコード型、合成型)
  • 不変式(invariant):型が満たすべき制約
  • 値域:取り得る値の範囲
  • デフォルト値:必要に応じて定義

ユーザーへの質問

  • このエージェントが扱う全てのデータ型は何か?
  • 各型にどのような制約があるか?(例:スコアは1-100、優先度は3値)
  • これらの型がどのような不変式を満たすべきか?

ステップ2b:通信プロトコル層定義(新機能 v2.0.0)

目的:マルチエージェント間の通信仕様を設計文書として形式化

このステップは複数のエージェント間で通信が存在する場合に適用します。ここで生成される成果物は PROTOCOL.mdAPI-SIGNATURES.md という設計ドキュメントであり、VDM-SL コードではありません。これらの文書はプロトコル実装エージェントと API 実装エージェントが直接参照します。

2b-1. メッセージ型レジストリ

全てのメッセージ型を正規名として宣言。Markdown テーブル形式で記録:

メッセージ型(正規名) 送信元 受信先 同期/非同期 説明
TicketCreate User Server 同期 ユーザーがチケットを作成
TicketUpdate User Server 同期 ユーザーがチケットを更新
EscalationRequest User Server 同期 ユーザーがエスカレーションをリクエスト
ReplyManual Operator Server 同期 オペレータが手動返信
TicketCreated Server User 非同期 サーバーがチケット作成完了を通知
AutoReply Server User 非同期 サーバーが自動返信を送信
OperatorReply Server User 非同期 サーバーがオペレータからの返信を転送

Read the full file on GitHub · 544 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. 10d ago First seen · 544 lines · 240 tokens per session scan A 2972f118ee5e

Subscribe to this mod's changes

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

drift-testing

Verifies API implementations against OpenAPI specifications using the Drift CLI, catching spec drift and supporting Bi-Directional Contract Testing (BDCT). Use when the user mentions Drift, API contract testing, provider contract testing, provider verification, spec drift, API conformance testing, OpenAPI…

pactflow/pactflow-agent-skills · 158 tokens

api-audit

API and endpoint integrity audit across 10 dimensions (D1-D10) plus optional contract stability (D11) and optional OWASP API Security Top 10 (D12: BOLA/BOPLA/BFLA, mass assignment, JWT alg-confusion, GraphQL introspection). Covers validation, payloads, pagination, errors, caching, HTTP semantics, waterfalls, rate…

greglas75/zuvo · 135 tokens

performance-audit

Full-stack performance health check across 12 dimensions. Rendering, bundles, assets, API/network, algorithms, memory, database, caching, Web Vitals, backend runtime, concurrency, and framework-specific pathologies. Evidence-based Impact Models with confidence tiers and a prioritized optimization roadmap. Switches…

greglas75/zuvo · 90 tokens

openapi-parser

Parses complex OpenAPI specs and generates Drift test cases from them. Use whenever the user wants to generate, write, or scaffold Drift tests from an OpenAPI spec — especially when the spec contains complex schemas: anyOf/oneOf/allOf, discriminators, polymorphism, inheritance, $ref chains, regex patterns, enums, or…

pactflow/pactflow-agent-skills · 145 tokens

validate-api

Run the project's Hurl scenarios with an OIDC access token passed as a secret variable.

johnkozaris/jko-claude-plugins · 20 tokens

auth-doctor

Diagnose and fix issues in existing auth setups. Scans environment, files, security, middleware, OAuth, database, and dangerous code patterns. Produces scored health report with actionable fixes.

ShipWithAI/shipwithai-plugins · 42 tokens