Skip to content

docs(contributing): worked-example-first for new specialisms + three-gate test contract - #1394

Merged
bokelley merged 1 commit into
mainfrom
bokelley/contributing-worked-example-first
May 3, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/contributing-worked-example-first

Conversation

@bokelley

@bokelley bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1389. Two contributor-facing doc gaps from the PR #1373 lineage:

  1. CONTRIBUTING.md — "Adding a new specialism": a 6-step process putting the worked example before skill prose. Reverses the obvious order on purpose — building the worked examples in examples: hello_seller_adapter_signal_marketplace — worked passing reference #1274 + feat(examples): hello_{creative,seller,signals}_adapter_* — complete the worked-reference family #1373 surfaced ~12 adapter-author bugs that skill-prose-first would have missed for longer.

  2. docs/guides/EXAMPLE-TEST-CONTRACT.md (new): documents the three-gate CI test contract (strict tsc / storyboard / façade) implemented by runHelloAdapterGates(). Covers what each gate catches, the adversarial-sabotage validation pattern (which proves each gate is independently load-bearing), and when to add a fourth gate (adapter-specific invariants like the BuyerAgentRegistry auth-ordering check in signal-marketplace's test).

  3. runHelloAdapterGates.js JSDoc updated to point at the new guide.

Test plan

  • `npm run format:check` clean
  • No code-path changes; doc-only + JSDoc.
  • CONTRIBUTING.md and EXAMPLE-TEST-CONTRACT.md cross-reference each other correctly.

Refs

🤖 Generated with Claude Code

…gate test contract

Two doc gaps surfaced from the PR #1373 lineage. Closes #1389.

## CONTRIBUTING.md — "Adding a new specialism"

Reverses the obvious order on purpose: skill prose written before a
worked example tends to drift as the spec evolves; pattern-from-example
doesn't, because the test gates fail. The order:

  1. Mock-server with deterministic-seeded fixtures (fictional brand
     names — `acme-outdoor.example`, NOT real walled-garden brands).
  2. `examples/hello_<role>_adapter_<specialism>.ts` worked adapter
     with `// SWAP:` markers + a `FORK CHECKLIST` header.
  3. `test/examples/hello-<role>-adapter-<specialism>.test.js` using
     `runHelloAdapterGates()` — three gates per the test contract.
  4. Skill update — fork-target pointer, NOT inline pattern teaching.
  5. Add to fork-target map + composition guide.
  6. Optional: hello-cluster aspirational entrypoint.

The order matters: building the worked example surfaced ~12 distinct
adapter-author bugs (#1324, #1325, #1327, #1337, #1338, #1341, plus 7
more) that would have been caught by the blind-LLM matrix eventually
but weren't. Worked-example-first compresses that loop.

## docs/guides/EXAMPLE-TEST-CONTRACT.md (new)

Documents the three-gate CI test contract enforced by
`runHelloAdapterGates()`:

  Gate 1 — Strict tsc (`--strict --noUncheckedIndexedAccess
    --exactOptionalPropertyTypes --noPropertyAccessFromIndexSignature`
    + 2 hardening flags). Catches type-level mistakes at authorship.

  Gate 2 — Storyboard runner. Catches AdCP wire-shape regressions.

  Gate 3 — Façade gate (`/_debug/traffic` shows ≥1 hit per expected
    upstream route). Catches "wired the AdCP surface but didn't call
    upstream" — invisible to gates 1 and 2.

Includes the adversarial-sabotage validation pattern (sabotage one
upstream call, confirm the right gate fails — confirms each gate is
independently load-bearing) and guidance on when to add a fourth
gate (adapter-specific invariants like the BuyerAgentRegistry auth
ordering check in signal-marketplace's test).

## Helper JSDoc

`runHelloAdapterGates.js` JSDoc now references the contract guide so
contributors land on the right doc when reading the helper before
adding a new adapter.

Test plan:
- [x] `npm run format:check` clean
- [x] No code-path changes; doc-only + JSDoc.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(contributing): worked example is the first deliverable for any new specialism + three-gate CI test as the contract

1 participant