agentleFS
theyashguptatheyashgupta/dispatch/.claude/skills/scaffold-module/SKILL.md

scaffold-module

Skill3 starsChanged 11 days agoMITView on GitHub

Use for /scaffold-module <feature>. Creates src/web/modules/<feature>/ with six layer folders, a barrel, a view, a query key factory and domain tests.

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. abgmgp/simple-agentic-project-template★ 0same name
    2. HenryCordes/ai-engineering-workflow★ 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 repository3 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Make sure that the name is kebab-case.

    line 19
  2. Very specific:

    Make sure that src/web/modules/<feature>/ does not exist.

    line 20
  3. Distinctive:

    Create the six layer folders.

    line 24
  4. Very specific:

    Write src/web/modules/<feature>/views/<Feature>View.tsx with this content:

    line 35
  5. Very specific:

    Write src/web/modules/<feature>/queries/<feature>-queries.ts with this content.

    line 74
  6. Very specific:

    Put each file in one of the six layer folders.

    line 103
  7. Very specific:

    Import a file in another folder with the @/ alias.

    line 105
  8. Distinctive:

    Do not import a sibling module.

    line 106
  9. Very specific:

    Do not use the JSX style prop.

    line 107
  10. Very specific:

    Call fetch and import src/web/lib/http.ts only in queries/.

    line 108
  11. Very specific:

    Put a <subject>.test.ts file next to each domain file and each *-queries.ts file.

    line 110
  12. Very specific:

    Do not add comments to a .tsx file.

    line 111
  13. Distinctive:

    Run these commands. Each command must pass.

    line 116
  14. Very specific:

    Run env -u NODE_ENV npm run deadcode.

    line 126

≈ “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 a frontend module

The rules are in docs/standards/frontend-architecture.md, in the sections "Layer definitions", "Import matrix", "Naming" and "Tests".

Names

  • <feature> is the module name in kebab-case. Example: card-detail.
  • <Feature> is the same name in PascalCase. Example: CardDetail.
  • <featureCamel> is the same name in camelCase. Example: cardDetail.

Before you start

  1. Get the module name from the argument of the command.
  2. Make sure that the name is kebab-case. If the name is not kebab-case, stop and tell the user.
  3. Make sure that src/web/modules/<feature>/ does not exist. If it exists, stop and tell the user.

Procedure

  1. Create the six layer folders. Use these six commands. Do not use brace expansion.

    mkdir -p src/web/modules/<feature>/views
    mkdir -p src/web/modules/<feature>/containers
    mkdir -p src/web/modules/<feature>/components
    mkdir -p src/web/modules/<feature>/hooks
    mkdir -p src/web/modules/<feature>/domain
    mkdir -p src/web/modules/<feature>/queries
  2. Write src/web/modules/<feature>/views/<Feature>View.tsx with this content:

    export function <Feature>View() {
      return (
        <section className="flex flex-col gap-2">
          <h1 className="text-lg font-semibold"><Feature></h1>
        </section>
      );
    }
  3. Write src/web/modules/<feature>/domain/<feature>-label.ts with this content:

    /**
     * Return the display label for one <feature> item.
     */
    export function <featureCamel>Label(title: string): string {
      return title.trim() || "Untitled";
    }
  4. Write src/web/modules/<feature>/domain/<feature>-label.test.ts with this content:

    import { test } from "node:test";
    import assert from "node:assert/strict";
    import { <featureCamel>Label } from "./<feature>-label.js";
    
    test("<featureCamel>Label trims the title", () => {
      assert.equal(<featureCamel>Label("  One  "), "One");
    });
    
    test("<featureCamel>Label returns Untitled for an empty title", () => {
      assert.equal(<featureCamel>Label("   "), "Untitled");
    });
  5. Write src/web/modules/<feature>/queries/<feature>-queries.ts with this content. This file holds the query key factory.

    export const <featureCamel>Keys = {
      all: ["<feature>"] as const,
      detail: (id: string) => ["<feature>", "detail", id] as const,
    };
  6. Write src/web/modules/<feature>/queries/<feature>-queries.test.ts with this content:

    import { test } from "node:test";
    import assert from "node:assert/strict";
    import { <featureCamel>Keys } from "./<feature>-queries.js";
    
    test("<featureCamel>Keys.detail starts with the module key", () => {
      assert.deepEqual(<featureCamel>Keys.detail("1"), ["<feature>", "detail", "1"]);
    });
  7. Write src/web/modules/<feature>/index.ts with this content:

    export { <Feature>View } from "@/modules/<feature>/views/<Feature>View";

Rules for the next files

  1. Put each file in one of the six layer folders. Do not put other files in the module root. The module root holds only index.ts.
  2. Export only views and queryOptions factories from index.ts.
  3. Import a file in another folder with the @/ alias. Import a file in the same layer folder with a relative path.
  4. Do not import a sibling module.
  5. Do not use the JSX style prop. Do not write a hex colour. Use Tailwind token classes.
  6. Call fetch and import src/web/lib/http.ts only in queries/.
  7. Give each new .tsx file a PascalCase name. Give each new .ts file a kebab-case name.
  8. Put a <subject>.test.ts file next to each domain file and each *-queries.ts file.
  9. Do not add comments to a .tsx file. Add a JSDoc block only to a function in a .ts file.

Checks

  1. Format the new files with env -u NODE_ENV npx oxfmt <each new file>. A long name can make a line too long for the template layout.
  2. Run these commands. Each command must pass.

    env -u NODE_ENV npm run format:check
    env -u NODE_ENV npm run lint
    env -u NODE_ENV npm run typecheck
    env -u NODE_ENV npm run depcruise
    env -u NODE_ENV npm run test
  3. Run env -u NODE_ENV npm run deadcode. Until a route imports the module barrel, knip reports the files of the new module. This result is correct. Do not add a route for this reason. Add a route only when the user asks for it.
  4. Git does not keep an empty folder. The empty layer folders stay on disk until a file goes into them.

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.