Mock

From stefvw93/weft · View interactive version

Mock is an AI agent skill from the GitHub repository stefvw93/weft. Step 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.

How to use this skill

Skill file

/mock: API surface mocks (TDD step 2)

Write the feature's complete API surface as type-level mocks (declare) in its real source file, matching the approved spec.

When to run

Procedure

  1. 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.
  1. Write the mock surface in the real source file (the file the implementation will live in, not a separate *.mock.ts). Use the declare keyword for anything that would need a runtime body. Cover the complete surface:
  1. JSDoc everything exported. All exported functions, types, and values get JSDoc now. It is part of the surface, and /document later only has to sync it, not create it. Omit @type annotations; describe non-obvious parameters.
  1. Follow the standards while shaping the surface: readonly extensively, Option > undefined > null, generic constraints over flexibility, Schema for unknown/I-O boundaries, no JSX-style deferred component descriptors.
  1. Mock-vs-spec review checklist. Finish by walking it explicitly:

If the checklist exposes a spec gap: pause, return to /spec, then redo this step.

  1. Hand off. Next step is /type-tests.

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.