graph-api-design
API governance and design audit using OpenAPI/Swagger spec generation, REST maturity model, contract validation, and breaking change detection
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
API governance and design audit using OpenAPI/Swagger spec generation, REST maturity model, contract validation, and breaking change detection
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Accessibility compliance audit using WCAG 2.2 AA standards, ARIA validation, screen reader testing, keyboard navigation, color contrast analysis, and i18n readiness
Execute the ANALYZE phase of the lifecycle via the `agf` CLI — PRD creation, requirements, Definition of Ready (7 checks), cross-project learning
Architecture governance using C4 Model, ADR lifecycle, Architecture Fitness Functions, layer boundary enforcement, and drift detection
Human-in-the-loop PLANNING skill — investigates the project (graph + git + harness/gaps) and runs the whole ANALYZE→DESIGN→PLAN chain in one faceted loop to produce a COMPLETE PRD injected as graph backlog (epics, tasks, testable AC) for a separate agent to implement. Applies the project's planning methodologies — Impact Mapping + OKR per epic, JTBD, MoSCoW, WSJF/Cost-of-Delay, User Story Mapping, Example Mapping (Rules/Examples → Given-When-Then AC), SPIDR splitting, INVEST, Definition of Ready, Risk Matrix; the full catalogue lives in the skill body. Stops for the human after each complete PRD and iterates the next cycle from the project's own findings (dogfood). Does NOT implement. Triggers — graph-backlog-generation, gerar backlog, criar PRD, planejar feature, detalhar épico, novo ciclo, "plan the next thing", "what should we build next".
Automated bug discovery through static analysis, LSP diagnostics, pattern detection, regression hotspot analysis, and error catalog mining
Bug discovery + structured fix (5-Whys) with regression test, driven by the `agf` CLI — zero MCP
| name | graph-api-design |
| description | API governance and design audit using OpenAPI/Swagger spec generation, REST maturity model, contract validation, and breaking change detection |
| triggers | ["graph-api-design"] |
| version | 1.1.0 |
| author | Diego Nogueira |
| date | "2026-06-21T00:00:00.000Z" |
API governance and design audit using OpenAPI/Swagger spec generation, REST maturity model, contract validation, and breaking change detection. Ensures consistent naming, validated contracts, backward compatibility, and comprehensive documentation across all API surfaces.
endpoint inventory --> naming conventions --> contract validation --> breaking changes --> versioning --> documentation --> report --> write_memory
Catalog all API routes (src/api/routes/) and MCP tools (src/mcp/tools/). Count endpoints per resource. Verify RESTful naming: pluralized nouns for resources, HTTP verbs for actions. Flag non-RESTful patterns.
server.tool() calls/nodes, /edges, /knowledge)/getNodes instead of GET /nodes)Check route naming consistency: kebab-case paths, consistent pluralization, no verbs in URLs (use HTTP methods instead). For MCP tools: snake_case names, consistent parameter naming. Compare against existing patterns.
/code-graph, not /codeGraph)/nodes, not /node)import_prd, not importPrd)nodeId everywhere, not mixed node_id/nodeId)From [[swe-at-google]] Ch1: "With a sufficient number of users of an API, all observable behaviors will be depended on by somebody." Apply this as the first design law — not a caution, a guarantee.
Seven behaviors that silently become implicit contracts:
next_cursor vs nextCursor, presence of total — all become expected.For each of the 7: mark Y (currently documented + tested) or N (implicit, untested risk). Any N = design debt.
Verify all endpoints have Zod schema validation on input (validateBody/validateQuery middleware). Check all MCP tools have z.string()/z.number() params. Flag endpoints accepting unvalidated input. Verify response shapes are consistent.
validateBody() or validateQuery() middleware usagereq.body or req.query access without prior validation middleware{ data, meta } or { result })From [[swe-at-google]] Ch1/Ch15/Ch21 — classify every detected change before deciding if it needs a version bump.
| Change Type | Classification | Action Required |
|---|---|---|
| Add optional field to response | Additive — safe | None |
| Add optional request parameter | Additive — safe | None |
| Add new endpoint | Additive — safe | None |
| Remove field from response | Breaking | Major version bump + migration path |
| Remove or rename endpoint | Breaking | Major version bump + migration path |
| Change field type (string → number) | Breaking | Major version bump + migration path |
| Make optional param required | Breaking | Major version bump + migration path |
| Change observable behavior (Hyrum) | Breaking by Hyrum | Treat as breaking even if spec says safe |
| Change error message text | Breaking by Hyrum | Announce in changelog; avoid if possible |
Run: git diff HEAD~10..HEAD -- src/api/routes/ src/mcp/tools/ to enumerate recent changes, then classify each.
Three compatibility types to verify per change (from [[swe-at-google]] Ch21):
| Type | Breaks When | Check |
|---|---|---|
| Source | A client must change its source code to compile | Parameter rename, type change, removal |
| Behavioral | A client's runtime behavior changes without source change | Semantics shift, Hyrum-covered behaviors |
| Contract | A documented guarantee is revoked | SLA, idempotency, ordering, pagination |
A change that is source-compatible can still be behavioral-breaking. All three axes must be evaluated.
From [[swe-at-google]] Ch15 — advisory-only deprecations rarely complete. Use compulsory pattern with staffed migration:
Announce → Warn → Sunset → Remove
| Phase | Duration | Action |
|---|---|---|
| Announce | Day 0 | Publish changelog; mark @deprecated with replacement reference |
| Warn | 30–90 days | Surface warning at call time (log line, response header); provide migration guide |
| Sunset | End of warn period | Stop accepting new dependents; existing callers still work |
| Remove | After sunset | Delete endpoint; callers get 410 Gone or tool registration removed |
Deprecation warnings must be actionable (link to replacement) and relevant (surface at call time, not in batch emails). From [[swe-at-google]] Ch15: alert fatigue is real — one clear warning beats ten vague ones.
Verify API routes have JSDoc comments. Check MCP tools have description strings in server.tool() registration. Flag undocumented public endpoints. Verify parameter descriptions exist.
description string in its registrationdocs/reference/MCP-TOOLS-REFERENCE.md is up to date with current tool listdocs/reference/REST-API-REFERENCE.md is up to date with current route listGenerate the full audit report. Score 0-100 per dimension.
agf parse-api openapi.yaml --select data.endpoints # spec → endpoints + schemas, deterministic
agf spec --validate openapi.yaml # spec conformance before the review reads prose
agf memory write api-design-audit-<date> --content "<scores, breaking changes, undocumented endpoints>"
Each breaking change is a node: agf node add --type risk --tags api,breaking.
Economia de tokens. Os levers compartilhados por todas as skills —
--select,agf retrieve-command,agf exec chain, reuso antes de criação — vivem em_shared.md→ Token Economy. Fonte única: um parágrafo repetido em trinta arquivos é o trigésimo primeiro que envelhece sozinho.
Não precisa de flags. CLI gerencia compressão automaticamente com --ai ativo.
Consulte comandos com agf retrieve-command "<intenção>".
Ver _agf-rag.md para detalhes.