intense-visions/harness-engineering/api-craft
Claude Code and agent skill by intense-visions/harness-engineering
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install intense-visions/harness-engineering/api-craftSKILL.md
The same SKILL.md was published earlier as intense-visions/harness-engineering/api-craft.
API Craft
LLM-judgment critique of API design quality — the ceiling counterpart to rule-based API checks (OpenAPI-format compliance and webhook-format validation). A linter can confirm a path is documented and a schema validates; only judgment can tell whether the endpoint sits at the right abstraction, whether the HTTP verb is honest, whether a resource name belongs in the URL or a query param, whether a stranger could predict the response shape, and whether the error tells the consumer what to do. Emits 3-axis findings (tier × impact × confidence per ADR 0019).
When to Use
- During PR review on a new or substantially-changed endpoint, resource, or OpenAPI contract
- Before publishing an API (or a new resource family) to consumers, to catch design debt the format floor cannot see
- Periodically, to audit whether a growing API surface has stayed consistent (resource naming, verb use, error shapes, pagination)
- On a project's own OpenAPI/Swagger documents and route/handler definitions — the natural inputs
- As the API critic alongside copy-craft (which owns error-message prose) and the rule-based API floor (OpenAPI/webhook format compliance)
- NOT for whether a schema validates or a path is documented (that is the mechanical floor, not this skill)
- NOT for the wording of a single error string in isolation (use copy-craft — it owns prose-in-code)
- NOT for authentication/authorization vulnerabilities or injection (use security-craft and the security floor)
- NOT for autofix / contract rewriting (this is judgment-only)
Capability Roles
<!-- Capability seam: this skill participates in a real extension point whose three roles are named and concrete. A seam with only one role filled is accidental single-implementation lock-in. See harness-skill-authoring Phase 1C. -->
- Defines (Service Definition): the shared craft critique contract (
packages/cli/src/shared/craft/) —LlmProvider+ finding/axes schema + run store — shared across all*-craftskills. This skill implements, and does not own, that contract. - Provides (Provider): this skill — a API-design critique implemented over the shared contract (
packages/cli/src/api-craft/). - Consumes (Consumer):
craft-fleet(the craft-pipeline elevation sweep) and theharnessnatural-language router, which invoke every*-craftprovider uniformly through the shared critique/finding shape
Process
B' precondition check (every invocation)
api-craft is the ceiling; it runs regardless of setup, but its critique sharpens when a project declares its API conventions. Before critiquing, note the state:
| Precondition | Source | If missing | |
|---|---|---|---|
apiStyleDeclared | a project API style guide (e.g. docs/**/API.md) | Run with the generic seed rubrics; note in the summary that a style guide would sharpen critique and offer to seed one (progressive upgrade — the same posture as docs-craft's B'). |
When no style guide exists, api-craft still runs with the seed rubrics (degraded, not blocked). It never refuses to critique just because a project has not written its API conventions down.
Phase 1: DISCOVER — Find API surfaces
- Read project configuration. Shared craft config under
craft.llm.*selects the judgment backend.maxFiles(default 60) caps the surface count.
- Discover the API surface. Two kinds are collected:
- OpenAPI / Swagger documents (YAML or JSON) under the project root and conventional roots (
docs,spec,specs,api,openapi,src), matched by filename (openapi.yaml,swagger.json) or a rootopenapi:/swagger:key. - Route / handler definitions in code under the conventional roots (
src/routes,src/api,src/controllers,src/handlers,app/api,pages/api,routes,api, …), included only when the file carries a route SIGNAL — a.get(/.post(call, an@Get()/@Controller()decorator, an exportedGET/POSThandler, etc.--routes-dirpoints route discovery at an explicit directory;--spec-filenames an explicit OpenAPI document;--filesoverrides discovery entirely.
- Exclude non-API surfaces. Tests / specs, type declarations, barrels and registries (
index.ts,_registry.ts), build / dependency trees (node_modules,dist), and helper modules under an API root that define no endpoint are skipped — they are not authored API surfaces.
Phase 2: CRITIQUE — Per (surface, rubric) loop, kind-filtered
9 seed rubrics, each declaring which surface kinds it applies to:
| Rubric | Title | Applies to | |
|---|---|---|---|
API-R001 | Resources model the domain, not the implementation | all | |
API-R002 | Resource naming and URL structure are predictable | all | |
API-R003 | HTTP methods are honest | all | |
API-R004 | Status codes are correct and meaningful | all | |
API-R005 | Error responses tell the consumer what to do | all | |
API-R006 | Response shapes are predictable and consistent | all | |
API-R007 | Collections paginate and filter consistently | all | |
API-R008 | Mutations are idempotency-honest | route only | |
API-R009 | Evolves without breaking consumers | all |
For each (surface, rubric) where the rubric applies to the surface's kind:
- Build a prompt with the rubric description + surface kind + surface source (truncated to 8000 chars for cost).
- The LLM returns fenced JSON:
null(rubric doesn't apply / the surface already clears the bar) OR{ tier, impact, confidence, message }. - On non-null: emit an
ApiFindingwithcite.rubricIdpopulated for ADR 0020 traceability, and a derivedpriorityfor sorting.
Idempotency (API-R008) is a handler-behavior concern a declarative spec rarely captures, so it critiques route surfaces only; an OpenAPI document is critiqued against the other eight rubrics. This is the API analogue of cli-ergonomics-craft's leaf/group filter.
A small curated exemplar set anchors the catalog — Stripe, Linear's GraphQL API, GitHub's REST API, Resend, and the Anthropic API — each a public reference point for one API-quality dimension (Stripe for idempotent requests, cursor pagination, and dated versioning; Linear for domain-mirroring types; GitHub for a guessable path grammar; Resend for a right-sized resource surface; Anthropic for honest methods and a consistent error contract). The exemplars ground the rubric sources today and seed a future BENCHMARK phase, the direct analogue of docs-craft's exemplar corpus.
Phase 3: REPORT — Aggregate + cost telemetry
Emit ApiCraftOutput:
Harness Integration
- `harness api-craft` — CLI entry.
--files <glob>/--routes-dir <dir>/--spec-file <file>/--exclude-dirs <dirs...>/--max-files <n>/--json/--verbose. Exits non-zero when anyfoundational-tier finding is present. - `mcp__harness__api_craft` — MCP tool. Two modes (see "In-session flow" below).
- `mcp__harness__api_craft_finalize` — MCP tool that completes the in-session flow.
- Cross-cutting API:
critiqueApiSurfaceFile(file, opts)exported frompackages/cli/src/api-craft/index.ts. Another craft skill (or an orchestrator) can critique a single spec or route file without re-walking the project. - Shared craft infrastructure:
LlmProvider,MockLlmProvider,derivePriority, and the 3-axis types all live inpackages/cli/src/shared/craft/. - Sibling boundaries: copy-craft owns error-message and log prose; security-craft owns trust-boundary and least-authority critique; the rule-based API floor owns OpenAPI/webhook format compliance. api-craft owns the SHAPE of the API contract — resource modeling, naming, verbs, status codes, error contracts, response shapes, pagination, idempotency, and compatible evolution.
Invoked as a review hook
api-craft auto-activates as an advisory review hook whenever a diff touches the surface it owns — harness-autopilot at after:REVIEW / after:FINAL_REVIEW, and harness-code-review at after:mechanical. The domain table is CRAFT_REVIEW_DOMAINS and the per-host events are CRAFT_REVIEW_EVENTS_BY_HOST, both in packages/core/src/hooks/craft-review-hooks.ts. The host forwards the subset of the diff this domain owns:
- `files` — this domain's owned subset of the changed files, as ABSOLUTE paths. The host
reads it from plan.files["api-craft"], which holds repo-relative POSIX paths, and resolves each entry against the project root before calling mcp__harness__api_craft. Absolute is the recommended form, not a correctness requirement for this domain: its collector resolves a relative entry against the tool's path (never the process CWD), so a repo-relative entry forwarded unresolved still reads the in-diff file (pinned by packages/cli/tests/shared/craft/relative-files-scope.test.ts). Only mcp__harness__design_craft still requires absolute paths.
- `promptBudget` — accepted; raises the prompt ceiling for the forwarded scope when the diff subset is large.
Findings from a hook-triggered run are advisory: reported, never blocking, never counted toward review severity, and never entered into a host's mechanical exclusion set. A hook-triggered run that fails is a missing opinion, not a broken gate.
Success Criteria
See docs/changes/api-craft/proposal.md for the full success criteria. Highlights:
- 9 seed rubrics ship at
catalog/rubrics/<slug>.ts(file-per-rubric, matching the craft family) - 3-axis output preserved (tier × impact × confidence, never collapsed)
cite.rubricIdpopulated on every finding (ADR 0020)- Kind-aware rubric filtering (the idempotency rubric never fires on a static OpenAPI document)
- A curated exemplar set anchors the catalog and grows without a schema change
- Cross-cutting
critiqueApiSurfaceFileworks on a single surface without a project walk - Graceful degradation: runs with seed rubrics when no API style guide is declared
Rationalizations to Reject
These are common rationalizations that sound reasonable but lead to incorrect results. When you catch yourself thinking any of these, stop and follow the documented process instead.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagents/skills/cursor/api-craft/SKILL.md
Popularity
- Repository stars
- 18
- Repository forks
- 11
- 7-day trend score
- 15
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/intense-visions/harness-engineering/api-craft)