contract-coding

An extra coding workflow that uses an approved written requirement as the source for implementation. It checks which requirement applies and maps diagrams, rules, and database tables to code.

In plain words
What is it for?
It is for implementing or changing code when the project has intent-gate requirement folders under .harness/requests/.
Why use it?
It prevents the agent from guessing which requirement to follow or implementing against an unapproved or inconsistent specification.

Skill for Claude CodeCodex

Part of the intent-gate plugin — 4 skills, 1 hook, 1 MCP server shipped together

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.

agentmods
npx agentmods add skills/baixinghao/intent-gate/contract-coding
Any agent
npx skills add baixinghao/intent-gate --skill contract-coding
Clone the repo
git clone --depth 1 https://github.com/baixinghao/intent-gate

Made for: Claude Code, Codex.

Or install intent-gate, the plugin that ships this one along with the rest of its 4 skills, 1 hook, 1 MCP server.

Per session 121 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,117 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00121 $0.01117
Opus 5 $0.00060 $0.00558
Sonnet 5 $0.00024 $0.00223
Haiku 4.5 $0.00012 $0.00112

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

Security

Grade A, and why

contract-coding 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 3d 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/contract-coding/SKILL.md · 62 lines

What it actually says

Contract-Driven Coding(附加层,非编码 skill)

本 skill 是附加层,不是编码 skill。 你的项目自有编码 skill、superpowers、 CLAUDE.md/AGENTS.md 规约继续拥有"怎么写代码"(架构、风格、模式)的全部决定权。 本 skill 只管一件事:当 intent-gate 契约存在时,代码从契约生成,且绝不违背契约。 代码风格/结构上的任何冲突,以项目自有规则为准;契约保真这件事,本 skill 不让步。

契约路由(多需求并存,🔴 禁止猜)

  1. 人类点名了需求 → 精确匹配 .harness/requests/{需求名}/。没有同名目录 = 该需求没有契约,走第 3 条——🔴 禁止模糊匹配到别需求的契约 ("授信提交"套"提现确认"的 mermaid 是事故,不是便捷)。文件夹名即唯一标识, 文件系统保证不重名,无需另造 ID。
  2. 人类没点名 → 列出 .harness/requests/ 下的契约清单让人类选,禁止自己挑。
  3. 点名的需求无契约、但项目里已有其他契约(说明本工作流已启用)→ 告知人类"该需求还没有契约",给两条路:先跑 requirement-alignment 出契约, 或人类明确说"不要契约直接写"——后者合法,人类指令优先。 (仅当整个项目没有任何 .harness/requests/ 时才完全静默、按原方式编码。)
  4. 采用契约前交叉验证:任务的领域词汇(实体/动作)应命中契约的术语表; 明显对不上 → 停,向人类确认是否拿错了契约。

开工门禁(机械项,无商量)

  1. 路由确认契约后读 frontmatter:status: approved 才动工; pending_review / blocked → 停下报回人类。approved 只有两条合法来源: 蓝军 PASS 或人类直接拍板——红蓝评审是可选项,人类说"不用评审,我拍板" 即合法开工,任何人不得强制走红蓝。
  2. _review/lint-report.md:CRITICAL > 0 → 契约自身带机械错误, 禁止对着它编码,报回人类先修契约。

🔴 门禁拒绝的正确动作是停下报回人类——契约状态是人类拍板的事, 不是"再分析一遍"的事。禁止因为 status ≠ approved 或 lint 未归零就转入 requirement-alignment 重启/续跑意图对齐流程。

从契约施工

  • mermaid 状态机 / 时序图 / 决策表 + DDL 就是规格。每个实现任务可回溯到锚点: 哪条边 → 哪个接口/方法;哪条 BR 规则 → 哪个校验分支;哪张表 → 哪个实体/Mapper。
  • 只实现契约里有的。 图里没有的逻辑不许出现在代码里——无契约逻辑就是 意图对齐要消灭的"静默猜测"在编码期的复活。
  • 术语沿用契约词汇表(wiki 对齐版),禁止新造命名。

漂移 = 停线

编码中发现契约错了/不够用(现实逼着偏离图):

  1. 停下,禁止顺手绕过去;
  2. dispatch_question 升级(对话框通道直接向人类提问);
  3. 先改契约(重新对齐 + 重跑 lint),再改代码。

mermaid 与代码漂移即 bug——无论哪个方向。

完工

  • 契约若有修订,重跑 lint_summary(CRITICAL 归零)。
  • 说明每处改动实现了契约的哪些锚点,让评审能从代码回溯到契约。
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. 3d ago First seen · 62 lines · 0 tokens per session scan A f9712fbf8c5d

Subscribe to this mod's changes

contract-coding is a skill published in the GitHub repository baixinghao/intent-gate (2 stars, last pushed 18d ago), licensed MIT. It adds 121 tokens to every session and 1,117 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.

Related

Other skills, from other repositories

build-teaql-app

Build or change a TeaQL application in Java, Rust, Go, Swift, Python, C#/.NET, or TypeScript, including Kotlin/JVM applications that consume Java-generated libraries. Mandatory order: first draft and save a complete KSML model, then verify the client and evaluate that saved model, repair it through repeated evaluation…

teaql/teaql-agent-kit · 112 tokens

mcpfusion-development

How to build production MCP servers with MCP Fusion using the MVA (Model-View-Agent) pattern. Use this skill whenever writing, modifying, or reviewing MCP Fusion code — including tools, Presenters, Models, middleware, prompts, routers, tests, or server configuration. Activate even when the user just says "create a…

vinkius-labs/mcpfusion · 119 tokens

vinkius-deploy

How to deploy MCP servers to Vinkius Edge using mcpfusion deploy. Use this skill whenever deploying, configuring remote settings, preparing an entrypoint for edge deployment, or troubleshooting deploy-related errors. Activate when the user says "deploy", "publish to edge", "mcpfusion deploy", "push to Vinkius"…

vinkius-labs/mcpfusion · 94 tokens

verifying-compose-ui

Verifying Compose UI by rendering components or previews and inspecting the resulting images and state transitions. Activate for visual behavior that requires runtime rendering; use ordinary tests for nonvisual logic.

rnett/gradle-mcp · 40 tokens

raindrop-mcp-publishing

Automates and manages the complete publishing workflow for @adeze/raindrop-mcp from version bumping through npm registry deployment.

adeze/raindrop-mcp · 0 tokens

mcp-testing

MCP Testing Strategies with Vitest, Inspector, and Integration Tests.

adeze/raindrop-mcp · 17 tokens