/mock: API surface mocks (TDD step 2)
SkillFiles & storageStep 2 of the Weft TDD workflow. Use after /spec has produced an approved specs.md: writes the feature's complete API surface as declare-based mocks in the real source file location, to be replaced in-place by /implement. Refuses to run if the co-located specs.md is missing.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the /mock: API surface mocks (TDD step 2) skill
What this skill tells your AI
The instructions your AI receives, as published by stefvw93/weft in .claude/skills/mock/SKILL.md and read by ahel’s review.
Write the feature's complete API surface as type-level mocks (declare) in its real source file, matching the approved spec.
When to run
- Previous step:
/spec(an approved, co-locatedspecs.mdmust exist). - Next step:
/type-tests. - Gate (enter): if the co-located
specs.mdis missing, refuse to run and direct the user to/specfirst. No exceptions.
Procedure
-
Read the spec. Load the co-located
specs.md. Every acceptance criterion must be attributable to some part of the surface you are about to write. -
Write the mock surface in the real source file (the file the implementation will live in, not a separate
*.mock.ts). Use thedeclarekeyword for anything that would need a runtime body. Cover the complete surface:- Function signatures (including overloads)
- Classes and their methods
- Constants and variables
- Type definitions and interfaces
- Exports (named exports; follow module-organization rules for barrels)
- The Effect error union: declare every tagged error type the feature can fail with
-
JSDoc everything exported. All exported functions, types, and values get JSDoc now. It is part of the surface, and
/documentlater only has to sync it, not create it. Omit@typeannotations; describe non-obvious parameters. -
Follow the standards while shaping the surface:
readonlyextensively,Option>undefined>null, generic constraints over flexibility, Schema for unknown/I-O boundaries, no JSX-style deferred component descriptors. -
Mock-vs-spec review checklist. Finish by walking it explicitly:
- Every acceptance criterion in
specs.mdmaps to a declared signature, type, or error. - Every declared export is justified by the spec (no speculative surface).
- The error union covers every failure mode named in the spec.
- Types are complete: a consumer could compile against this surface.
If the checklist exposes a spec gap: pause, return to
/spec, then redo this step. - Every acceptance criterion in
-
Hand off. Next step is
/type-tests.
Rules
- Mocks live in the real source file and are replaced in-place by
/implement. Signatures must be final-quality, not sketches. - No runtime implementation in this step;
declareonly. - Changing this surface later (during
/implementor beyond) requires the pause rule: back to/spec+/mockfirst.
Signals
- GitHub stars
- 44
- Forks
- 1
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
mock-stefvw93- Source
- github.com/stefvw93/weft