api-writer

api-writer is a skill for Claude Code, Codex from TestAny-io/testany-agent-skills. It costs 65 tokens per session (3,066 once invoked), scanned A, original, MIT.

A writing workflow for an API contract, the agreed format for how software systems communicate through requests, responses, events, or files.

In plain words
What is it for?
Use it to define OpenAPI, AsyncAPI, GraphQL, gRPC, WebSocket, SSE, webhook, SDK, file-format, or command-line interface contracts from an approved PRD.
Why use it?
It prevents teams from making different assumptions about interfaces and keeps later design and implementation tied to one shared definition.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present. Also seen: names the AskUserQuestion tool.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is **语言规则**:默认跟随用户输入语言;用户显式指定时以用户指定为准;不要因为本 `SKILL.md` 是中文而强制输出中文;`TRACEABILITY-METADATA` 的字段名、枚举值、ID、comment markers 始终保持英文。若本 skill 使用模板或派发子任务,继续传递同一个 `output_la.

Part of the testany-eng plugin — 24 skills, 24 commands shipped together

Good fit Use it to define OpenAPI, AsyncAPI, GraphQL, gRPC, WebSocket, SSE, webhook, SDK, file-format, or command-line interface contracts from an approved PRD.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/TestAny-io/testany-agent-skills
agentmods
npx agentmods add skills/testany-io/testany-agent-skills/api-writer

Made for: Claude Code, Codex.

Or install testany-eng, the plugin that ships this one along with the rest of its 24 skills, 24 commands.

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 api-writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/testany-io/testany-agent-skills/api-writer/github.svg)](https://agentmods.dev/skills/testany-io/testany-agent-skills/api-writer)
Your own site
<a href="https://agentmods.dev/skills/testany-io/testany-agent-skills/api-writer"><img src="https://agentmods.dev/badge/skills/testany-io/testany-agent-skills/api-writer/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 api-writer

Your own site · 80×15
<a href="https://agentmods.dev/skills/testany-io/testany-agent-skills/api-writer"><img src="https://agentmods.dev/badge/skills/testany-io/testany-agent-skills/api-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,066 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00065 $0.03066
Opus 5.5 $0.00026 $0.01226
Sonnet 5.5 $0.00013 $0.00613
Haiku 4.5 $0.00006 $0.00307

Measured 1mo ago against content hash 9284d5f811e2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-writer 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 1mo 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.

plugins/testany-eng/skills/api-writer/SKILL.md · 235 lines

How it starts

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

API Writer

执行前读取 工作流执行约定:先取证再提问、按实际工具能力回退,并从本次安装位置定位资源。

语言规则:默认跟随用户输入语言;用户显式指定时以用户指定为准;不要因为本 SKILL.md 是中文而强制输出中文;TRACEABILITY-METADATA 的字段名、枚举值、ID、comment markers 始终保持英文。若本 skill 使用模板或派发子任务,继续传递同一个 output_language。详见 ../../references/language-policy.md。

你是一个接口契约/协议文档写作助手。基于 PRD 与边界确认,输出可审查的 contract,降低前后端/多团队对接口认知漂移。

先选工作模式

  • formal_design:用户要求完整新功能文档或正式全量准出,执行下文完整流程、模板、追溯和适用门禁。
  • bounded_change(amendment):在已有有效基线和明确授权的变更范围内,读取 有限增量规则,直接执行“读取基线与授权 -> 核对影响边界 -> 修改获授权增量 -> 检查差异与验证 -> 交付范围限定的结果”。不回补全套历史文档,不把草稿或自检升级为批准。
  • 模式由实际职责、信任、契约、失败语义与批准范围决定,不按行数/文件数判断。“两行修改”改变权限边界仍需对应有权 Owner 决策。

下文全量模板、全局覆盖矩阵与整套前置文档是 formal_design 的要求;有限增量沿用既有工件格式、有效批准及相关追溯,不因缺某种历史文件格式自动改成新项目启动。

核心原则

  1. 契约是事实源:HLD/实现必须引用契约版本,禁止在 HLD 中新增接口。
  2. 有依据才定案:正式设计需相关批准需求;有限增量可用既有契约及有权 Owner 的具体决定。不要求同一种 PRD 文件格式,但真实行为或批准依据缺失时不自行定案。
  3. 基于证据,不猜测:现有接口/服务/规范必须有文档依据;缺证据就问。
  4. 边界先行:先确认服务/模块/数据所有权,再写接口。
  5. 复用优先:优先复用已有接口/模块/第三方能力,避免重复造轮子。
  6. 兼容性默认保守:默认向后兼容,破坏性变更必须显式标注与迁移计划。
  7. 只写接口,不写实现:不写内部架构、数据库、算法和部署细节。
  8. 不替代决策者:边界或选型不清时只给选项和影响,不擅自定夺。
  9. 先做 Guardrails trigger check:如果本次 contract 会定义项目级默认规则,先判断是否必须更新 Guardrails。

执行进度清单

按任务需要跟踪以下进度;使用可用计划工具或简短清单,标记真实完成状态:

□ 阶段 0:上下文收集
  □ 0.1 使用 Glob 扫描 PRD/需求文档、已有 API 规范、现有服务说明
  □ 0.2 读取并核验最新批准基线,仅询问剩余缺口
  □ 0.3 执行 Guardrails trigger check

□ 阶段 1:边界/所有权确认
  □ 1.1 AskUserQuestion 确认服务/模块边界
  □ 1.2 确认数据所有权(source of truth)
  □ 1.3 确认主要消费者与调用方向
  □ 1.4 确认与既有接口/能力的关系

□ 阶段 2:合同类型选择
  □ 2.1 AskUserQuestion 确认 contract 类型(HTTP/GraphQL/gRPC/Event/...)
  □ 2.2 确认输出格式

□ 阶段 3:契约撰写
  □ 3.1 若多协议,先生成 Contract Index
  □ 3.2 按选定模板生成各协议契约文档
  □ 3.3 生成 PRD → Contract 映射表
  □ 3.4 标注兼容性与版本策略、已复用能力、待确认项

□ 阶段 4:一致性自检
  □ 4.1 PRD 需求覆盖率检查(100% 被映射)
  □ 4.2 与现有契约冲突/重复检查
  □ 4.3 兼容性/版本策略是否明确
  □ 4.4 错误契约、权限、幂等性是否缺失
  □ 4.5 多协议间数据模型与错误码一致性检查

契约内容边界(强制遵守)

应该包含

  • 契约基本信息:名称、版本、状态、Owner、消费者、PRD 引用
  • 范围与边界:覆盖能力、非覆盖项、数据所有权
  • 接口清单与定义:路径/事件/函数签名、请求/响应/错误
  • 安全与权限:认证/授权/数据级权限
  • 兼容性与版本策略:升级、弃用、breaking change 规则
  • 关键非功能约束:SLO、幂等性、分页、限流等
  • 示例与约束:典型请求/响应/事件样例

Read the full file on GitHub · 235 lines

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. 1mo ago Changed · +13 lines · +14 tokens per session 9284d5f811e2
  2. 1mo ago First seen · 222 lines · 51 tokens per session scan A ee430e221451

Subscribe to this mod's changes

api-writer is a skill published in the GitHub repository TestAny-io/testany-agent-skills (82 stars, last pushed yesterday), licensed MIT. It adds 65 tokens to every session and 3,066 once invoked, about $0.0003 per session on Opus 5.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-30.