agentleFS
mark2685mark2685/agent-tools/skills/flow-frontend/new-component/SKILL.md

new-component

Skill0 starsChanged 5 months agoMITView on GitHub

Scaffolds a new React component following project conventions. Use when user asks to "create a component", "add a new component", or "/new-component".

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a close match exists, extend or compose it instead of starting from scratch.

    line 26
  2. Distinctive:

    Create the component file:

    line 28
  3. Very specific:

    Add 'use client' directive only if it uses hooks, event handlers, or browser APIs

    line 29
  4. Very specific:

    Import UI primitives from @hadrian-mtv/ui-toolkit/*

    line 30
  5. Very specific:

    Use @hadrian-mtv/classname-variants for variant styling

    line 31
  6. Very specific:

    Use cnMerge from @hadrian-mtv/ui-toolkit for conditional classes

    line 32
  7. Very specific:

    Use Tailwind design tokens (surface-*, content-*, border-*) not hardcoded neutrals

    line 33
  8. Very specific:

    Create a types file in _lib/ if the component has non-trivial props

    line 39

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “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

/new-component

Scaffold a new React component following project conventions.

Steps

  1. Ask the user:
    • Component name
    • Which app: flow-factory or flow-global (or a shared package in packages/)
    • Feature directory (e.g., app/orders/_lib/components/)
  2. Before creating anything, search for something to reuse or extend. Hand-rolling a primitive that already exists is the most-flagged review defect. Search the full shared tier, not just one package:
    • packages/ui-toolkit/src/ — primitives (Button, Alert, Link, inputs)
    • packages/shared-utils/, packages/part-utils/ and other domain *-utils packages
    • any domain toolkit/UI package matching the feature (e.g. part-toolkit, factory-execution-ui — list them with ls packages/)
    • the target package's source directly — its package.json exports map and the src/ files it points to show what already exists. If a close match exists, extend or compose it instead of starting from scratch.
  3. Create the component file:
    • Add 'use client' directive only if it uses hooks, event handlers, or browser APIs
    • Import UI primitives from @hadrian-mtv/ui-toolkit/*
    • Use @hadrian-mtv/classname-variants for variant styling
    • Use cnMerge from @hadrian-mtv/ui-toolkit for conditional classes
    • Use Tailwind design tokens (surface-*, content-*, border-*) not hardcoded neutrals
    • Export with a named export (not default)
    • Prefer composition over boolean-prop accretion. A handful of isX/showY/hideZ booleans that combine into impossible states is a design smell — accept children or slot props (e.g. header, actions) so callers compose what they need.
  4. Create a types file in _lib/ if the component has non-trivial props
  5. Create a co-located .test.tsx by default. Skip it only if the user explicitly opts out. The test must assert rendered DOM or behavior — not that a helper returned a value:
    • @testing-library/react to render, @testing-library/user-event for interactions
    • Assert what the user sees: queried text/roles are present, the right state shows after an interaction. A test that renders without asserting anything is not a test.
    • Reuse mocks from @hadrian-mtv/vitest-utils where available

Gotchas

  • flow-frontend has no per-package SKILL.md indexes. Read package sources (package.json exports and the src/ files behind them) — don't assume index files exist.

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.