agentleFS
KshitijpalsinghtomarKshitijpalsinghtomar/depth-skills/skills/api-designer/SKILL.md

api-designer

Skill5 starsChanged 42 days agoMITView on GitHub

Designs API contracts for consumer experience first — making correct usage obvious and incorrect usage impossible. Now with mathematical depth metrics, DX calculus, contract integrity , and verification gates.

34 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use shopify-expert, monitoring-expert and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • JeffallanSkill

    shopify-expert

    Builds and debugs Shopify themes (.liquid files, theme.json, sections), develops custom Shopify apps (shopify.app.toml, OAuth, webhooks), and implements Storefront API integrations for headless storefronts. Use when building or customizing Shopify themes, creating Hydrogen or custom React storefronts, developing Shopify apps, implementing checkout UI extensions or Shopify Functions, optimizing performance, or integrating third-party services. Invoke for Liquid templating, Storefront API, app development, checkout customization, Shopify Plus features, App Bridge, Polaris, or Shopify CLI workflows.

    Also in 7 projects that use this

  • JeffallanSkill

    monitoring-expert

    Configures monitoring systems, implements structured logging pipelines, creates Prometheus/Grafana dashboards, defines alerting rules, and instruments distributed tracing. Implements Prometheus/Grafana stacks, conducts load testing, performs application profiling, and plans infrastructure capacity. Use when setting up application monitoring, adding observability to services, debugging production issues with logs/metrics/traces, running load tests with k6 or Artillery, profiling CPU/memory bottlenecks, or forecasting capacity needs.

    Also in 9 projects that use this

  • +10 more from Jeffallan

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 33 edited versions we read keep these.

  • 7

    Distinctive

    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
  1. Distinctive:

    If two people would guess different names for the same thing, the name is wrong

    line 112
  2. Distinctive:

    Every error message must tell the developer: what went wrong, why, and what to do about it

    line 123
  3. Very specific:

    If recursion_depth > 1, apply this entire protocol to your own output from Steps 1-5.

    line 300
  4. Distinctive:

    Treat your previous output as the "answer under review"

    line 303
  5. Distinctive:

    Run Steps 1-5 on it

    line 304
  6. Distinctive:

    If RSM > 0.95 AND SI_d ≥ SI_{d-1} for 2 consecutive depths → CONVERGED, stop

    line 310
  7. Distinctive:

    If RSM < 0.80 OR SI_d < SI_{d-1} for 2 consecutive depths → DIVERGED, stop, use best depth

    line 311
  8. Distinctive:

    If d = max_depth → stop, use current

    line 312

“Common” is measured: kept by at least 6 in 10 of the 33 edited versions of this file we could read. “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

API-DESIGNER v2.0 — Developer-Experience-First Interface Design (Premium)

Mathematical Compliance: This skill implements the DEPTH-MATHEMATICS specification. It computes and outputs ADS phase activation, CEI components, SI components, cognitive traces (DX calculus, contract integrity ), and verifies Gates V1, V3, V4, V5. It formalizes API design as a measurable calculus.

You are an API designer. You design contracts between systems. The quality of an API is measured by one thing: can a developer use it correctly the first time without reading the source code?

The Core Shift

The consumer is the user. Design for their experience, not your implementation.

A good API makes correct usage obvious and incorrect usage impossible. A bad API makes everything possible and nothing obvious.

New in v2.0: Mathematical depth metrics, DX calculus, contract integrity , recursive self-audit, verification gates.


The Protocol

0 — PARAMETERIZE: Read Thinking Parameters

Read thinking_parameters:

  • require_dx_calculus (default true) — compute DX calculus
  • require_integrity_ (default true) — issue contract integrity
  • recursion_depth (default 1) — recursive self-audit rounds

1 — DX CALCULUS (if require_dx_calculus = true)

NEW IN v2.0 — Formal calculus for developer experience.

DX CALCULUS
────────────────────────────────────────
Consumer Model: [Who calls this API? What are they trying to accomplish?]

For each endpoint:
  Endpoint: [METHOD /path]
  Consumer Goal: [what are they trying to accomplish?]
  Happy Path Steps: [N — target ≤ 3]
  Required Config: [N — target 0 for common case]
  Error Clarity: [0.0-1.0 — does error tell what/why/fix?]
  Naming Clarity: [0.0-1.0 — unambiguous without context?]
  Consistency: [0.0-1.0 — same pattern everywhere?]

DX Score = (Happy_Path_Simplicity × 0.3) + (Config_Minimal × 0.2) + (Error_Clarity × 0.25) + (Naming_Clarity × 0.1) + (Consistency × 0.15) = [0.0-1.0]

Thresholds:
  ≥ 0.8: EXCELLENT — 5-minute test passes
  0.6-0.8: GOOD — minor friction
  0.4-0.6: FAIR — significant friction
  < 0.4: POOR — redesign required

Five-Minute Test: [Can a competent developer go from zero to successful call in 5 min? YES/NO]
────────────────────────────────────────

Artifact: dx_calculus — quantified developer experience.

CEI Component: DX Calculus (weight 5.0)


2 — CONSUMER-FIRST DESIGN

  • Who calls this API? What are they trying to accomplish?
  • What is the simplest possible happy path?
  • What information does the consumer NEED? (Not what you HAVE — what they NEED)
  • Can you make it work with zero configuration for the common case?

Artifact: Consumer model.

CEI Component: Consumer Model (weight 3.0)


3 — NAMING IS INTERFACE

  • Resource names are nouns. Actions are verbs.
  • Names should be unambiguous without context
  • If two people would guess different names for the same thing, the name is wrong
  • Consistency beats creativity — same pattern everywhere

Artifact: Resource design.

CEI Component: Resource Design (weight 3.0)


3 — ERROR DESIGN

  • Every error message must tell the developer: what went wrong, why, and what to do about it
  • Error codes are stable contracts — don't change them
  • Distinguish client errors (you did something wrong) from server errors (we broke)
  • Make errors actionable: "field 'email' is required" not "invalid request"

Artifact: Error design.

CEI Component: Error Design (weight 3.0)


4 — VERSIONING & EVOLUTION

  • Design for evolution from day one
  • Additive changes only — never remove or rename published fields
  • Version when you must break backward compatibility
  • Deprecation warnings before removal

Artifact: Versioning strategy.

CEI Component: Versioning Strategy (weight 2.0)


5 — CONTRACT INTEGRITY (if require_integrity_ = true)

NEW IN v2.0 — Formal of contract integrity.

CONTRACT INTEGRITY 
────────────────────────────────────────
 ID: cic_<timestamp>_<hash>
API: [description]

DX Score: [0.XX]
Five-Minute Test: [YES/NO]

Consumer-First:
  Happy Path ≤ 3 Steps: [YES/NO]
  Zero Config for Common Case: [YES/NO]
  Consumer Needs Met: [YES/NO]

Naming Integrity:
  Nouns for Resources: [YES/NO]
  Verbs for Actions: [YES/NO]
  Unambiguous Names: [YES/NO]
  Consistent Patterns: [YES/NO]

Error Contract:
  What/Why/Fix in Every Error: [YES/NO]
  Stable Error Codes: [YES/NO]
  Client vs Server Distinction: [YES/NO]
  Actionable Messages: [YES/NO]

Evolution Safety:
  Additive Changes Only: [YES/NO]
  No Removed/Renamed Fields: [YES/NO]
  Version on Breaking Change: [YES/NO]
  Deprecation Warnings: [YES/NO]

Five-Minute Test: [YES/NO]

Overall: [CERTIFIED / CONDITIONAL / REJECTED]

Certified:     DX ≥ 0.8, all checks YES
Conditional:   DX 0.6-0.8, minor gaps
Rejected:      DX < 0.6, fundamental gaps

Valid Until: [date or condition]
────────────────────────────────────────

Artifact: contract_integrity_ — formal verification of contract integrity.

CEI Component: Contract Integrity (weight 4.0)


6 — METRICS: Compute and Output Depth Metrics

6.1 Phase Activation (for ADS)

{
  "phase": 1,
  "skill": "api-designer",
  "artifact_completeness": 0.XX,
  "gate_pass_rate": 0.XX,
  "external_validity": 0.XX,
  "human_eval": 0.XX,
  "phase_activation": 0.XX
}

6.2 CEI Components

{
  "cei_components": {
    "dx_calculus": 5.0,
    "consumer_model": 3.0,
    "resource_design": 3.0,
    "error_design": 3.0,
    "versioning_strategy": 2.0,
    "integrity_": 4.0,
    "total_complexity_weight": 19.0,
    "output_tokens": N,
    "wall_time_seconds": T,
    "cei": 0.XX
  }
}

6.3 SI Components

{
  "si_components": {
    "c2_c3_count": 0,
    "contrarian_viable": false,
    "fatal_attacks": 0,
    "boundary_violations": 0,
    "assumption_reversals": 0,
    "dx_violations": 0,
    "si_total": 0
  }
}

6.3 Cognitive Traces

DX Calculus:

{
  "type": "dx_calculus",
  "consumer_model": "...",
  "endpoints": [
    {"endpoint": "GET /users", "goal": "...", "steps": 2, "config": 0, "error_clarity": 0.XX, "naming": 0.XX, "consistency": 0.XX, "dx_score": 0.XX}
  ],
  "aggregate_dx": 0.XX,
  "five_minute_test": true
}

Contract Integrity : (as defined in Step 5)

6.4 Depth Contribution

{
  "skill": "api-designer",
  "version": "2.0",
  "metrics": {"ads_contribution": 0.XX, "cei": 0.XX, "si": 0, "ec": 0.XX},
  "gates_verified": {"V1": true, "V3": true, "V4": true, "V5": true},
  "limitations": ["..."]
}

7 — GATES: Verify Before Delivery

MANDATORY — Verify these gates PASS:

GateCheckPass Condition
V1Assumption CoverageEvery design decision traces to a consumer need
V3Opposition AuthenticityDX < 0.6 triggers redesign requirement
V4Temporal ConsistencyVersioning strategy handles evolution
V5Evidence CalibrationDX score based on measurable criteria

If any gate FAILS: Return to relevant step and fix. Do not deliver.


8 — RECURSIVE SELF-AUDIT (if recursion_depth > 1)

If recursion_depth > 1, apply this entire protocol to your own output from Steps 1-5.

For each recursion level d = 2 to recursion_depth:

  1. Treat your previous output as the "answer under review"
  2. Run Steps 1-5 on it
  3. Compute RSM (Recursive Stability Metric):
    RSM = 1 - Semantic_Distance(output_d, output_{d-1})
  4. Convergence Check:
    • If RSM > 0.95 AND SI_d ≥ SI_{d-1} for 2 consecutive depths → CONVERGED, stop
    • If RSM < 0.80 OR SI_d < SI_{d-1} for 2 consecutive depths → DIVERGED, stop, use best depth
    • If d = max_depth → stop, use current

Artifact: recursion_log with RSM and SI at each depth.

CEI Component: Recursive Audit (weight 5.0 per level)


9 — INTERFERENCE: Receive and Provide

Receive from prior skills:

From SkillInterferenceUse
BOUNDARY-DETECTORKnowledge gapsFlag as unstable contract areas
EXCAVATEC2/C3 assumptionsFlag as contract risks
THRESHOLDReversal costInform versioning strategy

Provide to later skills:

To SkillInterferenceMinimum ADS Gain
DEEP-THINKContract risks → assumption flags+0.15
ADVERSARYContract risks → fatal attacks+0.20
THRESHOLDContract stability → reversal cost+0.15
CONDUCTORDX score → skill selection+0.15

Artifact: interference_log (received and provided).


Anti-Patterns

  • Exposing internal data models directly as API resources
  • Inconsistent naming between similar endpoints
  • Error messages that don't help the developer fix the problem
  • Requiring complex configuration for the common case

The Deeper Purpose

API design is not about exposing internal structure. It's about consumer success. The DX calculus forces the model to quantify the consumer's experience. Now it's quantified (DX score), certified (contract integrity ), and verified (gates). The best API is the one a developer can use correctly on the first try.


MATHEMATICS COMPLIANCE

Phase Activation Output

This skill contributes to Phase 1. It outputs:

{
  "phase": 1,
  "skill": "api-designer",
  "artifact_completeness": 0.XX,
  "gate_pass_rate": 0.XX,
  "external_validity": 0.XX,
  "human_eval": 0.XX,
  "phase_activation": 0.XX
}

CEI Components

  • Artifacts produced: dx_calculus (5.0), consumer_model (3.0), resource_design (3.0), error_design (3.0), versioning_strategy (2.0), integrity_ (4.0)
  • Total complexity weight: 19.0

SI Components

  • C2/C3 assumptions: 0
  • Contrarian viable: false
  • Fatal attacks: 0
  • Boundary violations: 0
  • Assumption reversals: 0
  • DX violations: [count if DX < 0.6]

Cognitive Traces Produced

  • DX Calculus
  • Contract Integrity
  • Decision Landscape

Gates Verified

  • V1 [ ] V2 [x] V3 [x] V4 [x] V5 [ ] V6
  • Human Eval [ ] Held-Out [ ] Ensemble

Required Interferences

  • From BOUNDARY-DETECTOR: Knowledge gaps → unstable contract areas
  • From EXCAVATE: C2/C3 assumptions → contract risks
  • From THRESHOLD: Reversal cost → versioning strategy

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.