intense-visions/harness-engineering/api-craft

Claude Code and agent skill by intense-visions/harness-engineering

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install intense-visions/harness-engineering/api-craft

SKILL.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 *-craft skills. 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 the harness natural-language router, which invoke every *-craft provider 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:

PreconditionSourceIf missing
apiStyleDeclareda 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
  1. Read project configuration. Shared craft config under craft.llm.* selects the judgment backend. maxFiles (default 60) caps the surface count.
  1. 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 root openapi: / 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 exported GET/POST handler, etc. --routes-dir points route discovery at an explicit directory; --spec-file names an explicit OpenAPI document; --files overrides discovery entirely.
  1. 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:

RubricTitleApplies to
API-R001Resources model the domain, not the implementationall
API-R002Resource naming and URL structure are predictableall
API-R003HTTP methods are honestall
API-R004Status codes are correct and meaningfulall
API-R005Error responses tell the consumer what to doall
API-R006Response shapes are predictable and consistentall
API-R007Collections paginate and filter consistentlyall
API-R008Mutations are idempotency-honestroute only
API-R009Evolves without breaking consumersall

For each (surface, rubric) where the rubric applies to the surface's kind:

  1. Build a prompt with the rubric description + surface kind + surface source (truncated to 8000 chars for cost).
  2. The LLM returns fenced JSON: null (rubric doesn't apply / the surface already clears the bar) OR { tier, impact, confidence, message }.
  3. On non-null: emit an ApiFinding with cite.rubricId populated for ADR 0020 traceability, and a derived priority for 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:

ts
{
findings: ApiFinding[];
summary: {
phaseRun: ['critique'];
mode: 'fast';
durationMs: number;
llmCalls: { provider, model, count, costUsd };
catalog: { rubricsApplied: string[]; exemplarsAvailable: number };
counts: { filesScanned, filesSkipped };
runId: string;
}
}

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 any foundational-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 from packages/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 in packages/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.rubricId populated 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 critiqueApiSurfaceFile works 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/intense-visions/harness-engineering/api-craft/badge)](https://verified-skill.com/skills/intense-visions/harness-engineering/api-craft)

Something wrong with this skill or its page? Tell us.