api-contract-migration
Skill2 starsChanged 7 days agoMITView on GitHub
Plan, implement, benchmark, or review a migration from one published API request and response contract to another, including REST-to-GraphQL or RPC changes. Use when existing consumers and observable behavior must survive a transport, query, batching, or response-shape change. Do not use for a greenfield API, an internal refactor with no contract change, or routine version-compatible schema evolution.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-artifactSkill
- agent-discoverySkill
- agent-run-supervisionSkill
- changelog-updateSkill
- change-reviewSkill
- ci-reviewSkill
- claims-auditSkill
- dependency-auditSkill
- derivation-auditSkill
- durable-cacheSkill
- engineering-auditSkill
- infer-conventionsSkill
- operational-signal-intakeSkill
- planned-releaseSkill
- preferred-stackSkill
- pressure-benchmarkingSkill
- public-surface-reconSkill
- rfc-processSkill
- security-auditSkill
- session-reviewSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Treat the change as a per-surface contract migration.
- Very specific: line 24
Read references/client-query-cache.md only when a client query cache or normalized entity store is part of the proposed behavior.
- Distinctive: line 29
Write an equivalence matrix per surface.
- Distinctive: line 38
Prefer one representative read surface before broad conversion.
- Distinctive: line 40
Keep response assembly proportional to requested and returned work.
- Distinctive: line 43
Keep successful primary writes distinct from later refresh, projection, or delivery failures.
- Distinctive: line 47
Never average these planes into one result:
- Distinctive: line 64
Prefer the smallest conclusion that the evidence supports:
- Distinctive: line 70
leave the decision unresolved because the paths were not comparable.
- Distinctive: line 72
After accepted consumers move, remove the old route, resolver, serializer, schema shape, generated artifact, dependency, and compatibility …
- Distinctive: line 86
When a runnable model or agent harness is absent, call this a structural and engineering benchmark, not an agent-quality benchmark.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API contract migration
Treat the change as a per-surface contract migration. Do not presume that either contract is faster, smaller, safer, or simpler.
For review-only requests, inspect and report without changing code or external state. For an authorized implementation, make the smallest reversible slice, validate it, and leave unrelated surfaces unchanged.
Quick reference
name surfaces -> freeze observable equivalence -> implement one slice -> measure separate planes -> migrate consumers -> retire old pathRead references/client-query-cache.md only when a client query cache or normalized entity store is part of the proposed behavior. Read references/flexible-query-endpoint.md only when callers can submit field selections, nested queries, aliases, fragments, batches, or multiple operations.
Establish the migration contract
- Inventory each operation and consumer. Name request identity, authentication, authorization, validation, pagination, ordering, null and omission semantics, errors, side effects, idempotency, and retry behavior.
- Write an equivalence matrix per surface. Separate behavior that must remain equivalent from an intentional contract change. An equivalent outcome need not have the same wire shape.
- State non-claims. Examples: no expected request-count reduction for an already single-request surface; no backend-work reduction without source evidence; no warm-cache gain when the client has no reusable identity.
- Name compatibility and rollback windows. Keep the old path only until named consumers have moved and rollback evidence is adequate; remove it when the window closes.
- Identify added runtime, generation, schema, or build dependencies. Route their selection and upgrade effects through dependency review when that skill is available.
Equivalence comes before speed. Create or update contract tests before changing the implementation when executable behavior changes. Exercise both paths against the same fixtures until the accepted intentional differences are the only differences.
Migrate one surface
- Prefer one representative read surface before broad conversion. Include a write only when write behavior is part of the decision.
- Reuse the same domain authorization and validation rules. A new endpoint must not become a second policy implementation.
- Keep response assembly proportional to requested and returned work. Caller-selected fields do not prove that storage reads, joins, external calls, or serialization were avoided.
- Make batching or loading conditional on actual selected associations and observed repeated source access. Bound keys, fan-out, concurrency, and memory.
- Preserve stable identifiers needed for reconciliation. Do not invent duplicate identifiers when the domain already has one.
- Keep successful primary writes distinct from later refresh, projection, or delivery failures. Report each committed effect honestly.
Measure separate planes
Never average these planes into one result:
- Contract plane: equivalence pass and fail by named operation and scenario.
- Serving plane: application latency, process CPU when available, allocations or peak memory when available, source-query count and time, external calls, serialization time, and response bytes.
- Request plane: end-to-end wall time, request count, transferred bytes, status, retries, and cache outcome as observed by the real client boundary.
- Interface plane: cold navigation, warm revisit or remount, visible loading transitions, mutation coherence, background refresh, and retained work. Run only when a person-facing client exists.
For every sample, record surface, fixture and cardinality, build revision, asset revision, authentication state, cache state, concurrency, measurement point, tool version, and raw value. Warm both paths, alternate their order, repeat enough times to expose variance, and report distributions or raw samples rather than only the best run.
Match effective work. If the old client performs independent requests concurrently, do not compare their summed durations with one new request's wall time. Record critical-path wall time and total serving work separately. A one-request baseline removes request-count headroom, but it does not decide payload, server work, cache coherence, or contract-maintenance effects.
HTTP cache directives alone do not establish a cold run. Use an isolated client profile, cleared cache, a deliberately unique request identity, or another verified miss, and confirm the observed cache outcome. If browser Resource Timing supplies request evidence, size its buffer for the run and verify that entry counts agree with another request signal; a full buffer may drop later entries.
Decide from evidence
Accept or reject the migration per surface. Name the observed benefit, regression, or unchanged plane. Treat results from one shape and cardinality as evidence for that case, not as a general protocol ranking.
Prefer the smallest conclusion that the evidence supports:
- migrate the surface;
- retain the old contract;
- migrate for a non-performance contract benefit while recording the measured cost;
- revise the implementation and rerun the same comparison;
- leave the decision unresolved because the paths were not comparable.
After accepted consumers move, remove the old route, resolver, serializer, schema shape, generated artifact, dependency, and compatibility test that no longer has an owner. Preserve tests for the surviving observable contract.
Report
Return:
- scope and named surfaces;
- equivalence matrix and intentional differences;
- per-plane measurements with raw sample location;
- security, cache, dependency, and rollback limits;
- surface-by-surface decision;
- remaining old-path owners and deletion condition;
- unsupported, partially supported, or unresolved claims.
When a runnable model or agent harness is absent, call this a structural and engineering benchmark, not an agent-quality benchmark. A routing benchmark needs fixed positive, negative, and boundary requests, a fixed model and skill set, repeated runs, and raw selection and execution outcomes.
Primary references
- HTTP caching and
no-store: https://www.rfc-editor.org/rfc/rfc9111.html - Browser Resource Timing buffers: https://www.w3.org/TR/resource-timing/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

