agentleFS
HenryCordesHenryCordes/ai-engineering-workflow/.claude/skills/scaffold-module/SKILL.md

scaffold-module

Skill0 starsChanged 4 months agoMITView on GitHub

Use when adding a new self-contained module under src/ — "scaffold a module", "new module for X", "add a src/ folder for Y". Creates the types + implementation + colocated test trio following the repo's existing worked examples.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. theyashgupta/dispatch★ 3same name
    2. abgmgp/simple-agentic-project-template★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is 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.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Check the target: If src/<name>/ already exists, stop and ask — don't merge into it blindly.

    line 26
  2. Distinctive:

    Create a module without a test — the test is the guardrail, not an afterthought.

    line 36
  3. Distinctive:

    Add a dependency to scaffold a module.

    line 37

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

Scaffold Module

Overview

A module here is a folder under src/ with a single clear purpose, a typed surface, and a colocated test. This skill scaffolds that trio consistently so a new module matches the two existing worked examples (src/feature-flags/, src/http/) instead of inventing its own shape. Starting points for the three files live in templates/ — adapt them, don't copy blindly.

Input

  • A module name (kebab-case folder, camelCase export) and a one-line purpose.
  • Whether it's sync/pure (like feature-flags) or async/has an I/O boundary (like http) — this decides the test approach.

Workflow

  1. Refuse generic names. utils, helpers, common, misc name a junk drawer, not a responsibility. Ask for a name that says what the module does.
  2. Check the target. If src/<name>/ already exists, stop and ask — don't merge into it blindly.
  3. Create the trio:
    • src/<name>/types.ts — the public types (options, results, typed errors). Make illegal states unrepresentable.
    • src/<name>/<name>.ts — the implementation. Pure where possible; inject I/O (e.g. an injected fetch) so it's testable without globals.
    • src/<name>/<name>.test.ts — Vitest. For sync/pure: assert inputs -> outputs directly. For async/I-O: inject a fake and use vi.useFakeTimers() instead of real waiting.
  4. No barrel file. Callers import from the direct path; don't add an index.ts re-export.
  5. Prove it green: pnpm lint && pnpm typecheck && pnpm test before calling it done.

Do not

  • Create a module without a test — the test is the guardrail, not an afterthought.
  • Add a dependency to scaffold a module; the toolchain stays minimal.
  • Reach for a class when a function and plain data will do (KISS).

Lessons

Failures this skill has absorbed (see the improve-skill skill for how entries get here; full stories in docs/CASE_STUDY.md):

  • 2026-06-19 — Fake-timer test left a rejection unhandled: await advanceTimersByTimeAsync() ran before a handler was attached to the promise under test → attach the handler first, then race both with Promise.all([...]).
  • 2026-06-19 — toMatchObject() silently skipped Error.cause (non-enumerable), so the test passed without checking what it claimed → assert cause and other non-enumerable properties directly.
  • 2026-06-19 — Node-context tooling scripts (.husky/, .claude/workflows/) tripped no-undef under the app's ESLint config → harness scripts stay scoped out of the app lint config; don't "fix" them by weakening src/ rules.

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.