agentleFS
relvo-labsrelvo-labs/agent-runtime/.agents/skills/public-api-evolution/SKILL.md

public-api-evolution

Skill0 starsChanged 47 days agoApache-2.0View on GitHub

Add, change or remove anything reachable from a package entry point, with a compiling consumer example and an explicit compatibility classification.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when a change adds, renames, removes or retypes anything reachable from a package's declared entry points — values, types, …

    line 13
  2. Distinctive:

    Do not use this skill when:

    line 19
  3. Very specific:

    Write the consumer proof: Add or extend a file under examples/consumer-smoke/src/.

    line 65
  4. Very specific:

    import only from package specifiers (@relvo-labs/agent-runtime), never a path

    line 67
  5. Very specific:

    avoid any, as unknown as, and @ts-expect-error except when the _point_ of the assertion is that something must not compile

    line 69

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Public API evolution

Trigger

Use this skill when a change adds, renames, removes or retypes anything reachable from a package's declared entry points — values, types, interfaces, enums, error classes, or the shape of a returned object.

Counter-trigger

Do not use this skill when:

  • the symbol is not exported from an entry point (internal refactor — no policy applies)
  • the change is only to a Zod schema's wire semantics — start with runtime-contract-evolution, then return here for the TypeScript surface
  • the change is to build output or the exports map itself — use package-artifact-validation

Owns

  • examples/consumer-smoke — the compiling consumer of every public entry point
  • docs/adr/ADR-0011-public-api-and-versioning.md — compatibility classification rules

Does not own

  • packages/protocol/src — owned by runtime-contract-evolution
  • packages/*/package.json#exports — owned by package-artifact-validation
  • .changeset — owned by changesets-release

Relationships

  • boundary-with → runtime-contract-evolution — wire compatibility is decided there; TypeScript-surface compatibility and the consumer example are decided here.
  • boundary-with → package-artifact-validation — this skill decides the API; that skill proves it survives packing. A declaration that does not survive packing is not a public API, whatever the source says.
  • delegates-to → changesets-release — this skill produces the classification; that skill turns it into a version bump.

Procedure

  1. Classify before editing. Record the class in the PR body and the changeset.

    ChangeClassPre-1.0 bump
    add a new exportadditiveminor
    add an optional property to a returned objectadditiveminor
    add a required parameter, or a property to an input typebreakingminor (0.x)
    narrow a return type / widen a parameter typeadditiveminor
    widen a return type / narrow a parameter typebreakingminor (0.x)
    remove or rename an exportbreakingminor (0.x)
    add a member to a union that consumers switch onbreaking-ishminor + note

    While the packages are 0.x, "breaking" still means a minor bump — but it must be flagged in the changeset body with a BREAKING: line so the changelog is honest.

  2. Two exports maps, one truth. A symbol is public only if it is reachable from a path listed in exports. Anything else is internal even if exported in source. Do not document internals.
  3. Write the consumer proof. Add or extend a file under examples/consumer-smoke/src/. It must:

    • import only from package specifiers (@relvo-labs/agent-runtime), never a path
    • exercise the new symbol in a way that would fail to compile if the type were wrong
    • avoid any, as unknown as, and @ts-expect-error except when the point of the assertion is that something must not compile

    examples/consumer-smoke is typechecked against the packed tarballs, not the source tree, so a symbol that is missing from the published .d.ts fails here.

  4. Deprecate before removing. Mark with /** @deprecated use X instead */, keep for at least one minor, then remove in a change that says so.
  5. No type-only escape hatches at the boundary. A public function must not accept or return any, a bare object, or an un-exported type. If a consumer cannot name a type they receive, export it.

Verification

pnpm build
pnpm artifacts:check     # packs, installs and typechecks examples/consumer-smoke
pnpm typecheck
pnpm gate

pnpm artifacts:check runs Are The Types Wrong across the packed tarballs; a resolution failure there (FalseESM, MissingExportEquals, masked .d.ts) is a release blocker, not a warning.

Provenance

  • Source: independent — authored for this repository against the npm semver specification, the TypeScript "declaration files / publishing" documentation, and the Are The Types Wrong problem catalogue.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.