/compforge:craft [frontend task]from compforge
Execute frontend component work with the smallest appropriate path.
Ships in compforge. Installing the plugin adds it to Claude Code.
If the user request is exactly COMPFORGE_ACTIVATION_PROBE, output these three
lines and stop without reading other files:
COMPFORGE_LOADED
Assumptions
Component Contract
The workflow text is inlined at the end of this command; use the paths only if it is missing. Read and execute the first path that exists:
${CLAUDE_PLUGIN_ROOT}/skills/workflow/craft.md — session plugin~/.claude/skills/compforge/workflow/craft.md — symlink installThe files below are inlined in full. Execute them as written and do not read them again. Read any other file they name only when the task needs it.
Contents: Purpose · Startup procedure · Execution-path selection · Size gate · Ambiguity resolution (before implementation) · Assumptions (before Contract) · Component Contract · Craft checks · Stage boundaries
Run a frontend task via the smallest appropriate execution path. The goal is not code volume. Add or change code only when the selected path requires it. Components render; hooks decide; every piece of state has one home.
skills/workflow/gates.md.skills/principles/component-discipline.md.component-discipline #11).gates.md Verification and Completion report gates, plus the Craft checks below.| Request signal | Execution path |
|---|---|
| Design or split a single component | skills/react/component-boundary.md |
| Where should this state live; server/client/URL data | skills/react/state-placement.md |
| Extract a custom hook; effect cleanup; logic reuse | skills/react/hooks-discipline.md |
| Add a behavior or screen slice to an existing feature | skills/playbooks/feature.md |
| Fix a UI bug, wrong state, regression, or broken interaction | skills/playbooks/bug-fix.md |
| God component, moving responsibility, behavior-preserving cleanup | skills/workflow/refactor.md |
| Derived state in useEffect, fetch chains in effects | skills/antipatterns/useeffect-abuse.md |
| Props passed through 3+ levels | skills/antipatterns/prop-drilling.md |
| New feature area or large screen | the full workflow starting at skills/workflow/discovery.md |
| Not a frontend change (environment, tooling, docs, ops, investigation) | say so in one line; skip Assumptions and Component Contract; keep Verification and Scope drift |
| Advisory request that wants a recommendation only | recommend the smallest path and do not implement |
| Execution request but a decision is missing ("make a todo app") | fill the decision via Ambiguity resolution below, then select a path |
Decide once, after selecting the path. A task is small when all hold:
On the small path only the paperwork shrinks. Hard Rules, tests, and Scope drift still apply, and no continuity work doc is created.
none.Contract: n/a — small change (<why>).gates.md.If the work grows past these limits, say so and switch to the standard path.
When the intent is execution but a decisive input is empty (stack, folder architecture, state approach, styling, supported screens/edge cases), resolve it once before code — do not interrogate; propose defaults.
skills/lang/frontend-stack.md scope gate. If unspecified, steer to TypeScript + React (Vite); for an unsupported stack (Vue, Angular, Svelte) state that Compforge does not apply (plain build only if insisted).examples/ todo family (feature / FSD / Next) as a reference menu.Continue this, or a new request instead? is that question. Do not invent a default that drops unfinished previous work.For any standard-size Craft task that requires implementation, fill this once before the Component Contract
(component-discipline #10). Keep it short. If nothing is uncertain, write none with a reason.
## Assumptions
Assumptions:
Alternatives considered:
Why this path:
If interpretations diverge and the choice changes architecture or scope, list the options in one sentence and ask — do not silently pick one.
For any standard-size Craft task that requires implementation, fill in the form below once before writing code.
For items that do not apply, write none and leave a reason.
## Component Contract
Feature:
Component Tree (new/changed nodes):
State Placement (each piece → home):
Props Crossing Boundaries:
Server Data (queries/mutations):
Test Targets (hooks/components):
In addition to the gates.md Verification gate:
skills/antipatterns/ symptoms on the diff (god component, useEffect abuse, prop drilling).component-discipline #7).component-discipline #14).component-discipline #13): no narration; each new comment is a why with an existing anchor; no code changed only to match a comment.{pack}/docs/reference/reviewer-checklist.md.A new feature area or large screen keeps the existing Discovery -> Test stages and human approvals. Craft does not erase these boundaries. It performs focused work on an existing codebase more strictly.
Craft, Refactor, Test, and Crucible open and close with these gates. Each workflow adds only its own steps; none repeats them.
continuity.md): list .craft/. If previous work exists, read
next-session-prompt.md first and emit the Resume block before any other
output — even if the user did not mention it. Re-scope an inherited prompt
to one decision; it is evidence, not a session scope. If none exists and this
is an execution task (feature, refactor, bug fix), create
.craft/<kind>-<slug>.md and announce it in one line. Skip this for advisory
or tiny tasks, or when AGENTS.md contains Compforge continuity: off.~/.compforge, skill paths). If pwd is the pack root
during app work, confirm the agent was started from the target project. When
maintaining Compforge itself, the pack root is the target.@…, absolute, or relative) against the work
target, never under {pack}/docs/… or ~/.compforge/…. If it is missing,
confirm the absolute path or project root with the user.When the user names an approved plan — a Delivery Plan, Design, or planning document from Consult — or the work doc links one, read it before the code:
A draft or unapproved plan is evidence, not a decision.
verify:).AGENTS.md,
skills/principles/hard-rules.md) against the changed files and name them.none, or list every out-of-request change with a
reason.test.md) is opt-in: launch the app only when the user asked or
Compforge live run: on is set. Otherwise report Live run: not run and what
to check by hand.Small path (Craft's Size gate) — three lines:
Changed: <file — what changed>
Verified: <command and result | not run — why>
Scope drift: none | <change — why>
Standard path:
## Design Decisions
-
## Verification
- Tests:
- Project rules:
- Scope drift: none | <file/change — why>
## Remaining Risks
-
Add ## Environment Facts only when this session learned one: something the
next session would otherwise relearn the hard way, such as a hook that breaks
the dev server or a check slow enough to run once at the end. Offer to add it to
the target project's AGENTS.md, and add it only after the user agrees. Never
keep it only in agent memory or in .craft/.
Completion gate: if a continuity work doc exists, update it
(Status/Progress/Decisions) before reporting done. If the unit is done but work
remains, write .craft/next-session-prompt.md before reporting done — do not
wait to be asked (continuity Session cut).
Contents: The ladder · 1. Components render; hooks decide · 2. Define boundaries before code · 3. Name the state's home before creating it · 4. Immutability is non-negotiable · 5. Composition before configuration · 6. Failing test before bug fix · 7. Subtract before abstracting · 8. Encode lessons in structure · 9. Duplicate before the wrong abstraction · 10. Surface assumptions before coding · 11. Surgical changes only · 12. Evidence before cause · 13. Comment discipline · 14. Product language at the human boundary · Rationalizations (do not accept these from yourself)
Read this before starting frontend work. In the completion report, mention only the principles that actually changed a design decision.
Decide what not to write, then where state lives. Climb from the top; stop at the first rung that holds.
Before writing a component
1. Does it need to exist? -> no: don't build it
2. Platform feature? -> use it (<dialog>, <form>, CSS, the URL)
3. Framework or installed dep? -> use it
Before storing a value
4. Derivable from what you have? -> derive at render; don't store it
5. Comes from the server? -> query layer, never useState
6. Belongs in the URL? -> search params / route params
7. Shared across distant nodes? -> composition first, then context or store
8. Only then -> local state, the minimum that works
Both halves are the same move: don't create it; if it must exist, it has exactly one home.
Never on the chopping block: loading, error, and empty states; accessible names and roles; focus management and keyboard paths; input validation. These cost lines and are the first thing a brevity heuristic deletes. Small code is a consequence of building only what the screen needs, never a target.
The rungs are expanded by principles #3 and #7 below.
Business logic belongs in custom hooks or pure functions, not in JSX bodies, event-handler lambdas, or render-time expressions.
Example: prefer const { canSubmit, submit } = useCheckout(cart) over 50 lines of logic inside the component.
Before writing code, first write down the component tree, the state each node owns, where server data enters, and which props cross which boundaries.
Every piece of state has exactly one correct home — walk rungs 4–8 of the ladder before creating any of it.
Storing derived or server data in useState is the root of most React bugs.
Never mutate state, props, or store objects. Produce new values. If an update looks awkward immutably, the state shape is wrong — fix the shape.
When a component grows variants, reach for children and slot props before
boolean flags. Three is* props on one component is a split signal.
Fix a bug by first writing a reproducible failing test (hook test or component test). Then resolve it with the smallest change.
Writing code is the last resort — walk rungs 1–3 of the ladder before adding any.
Essential vs accidental. The ladder cuts only accidental complexity (needless abstraction, wrapper components, unused flexibility). Essential complexity (feature boundaries, state placement, typed contracts) is deliberate structure and is not subject to the ladder.
Earn the exemption; do not claim it. Anything can be called a feature boundary. A structure is essential only when you can name both:
If the name is one the user never used, the structure goes back on rung 1. Calling it "the query layer" is not evidence.
This rule is evidence that a structure is needed, not a reason to ask the user about every name. Ask only about public names — routes, endpoint paths, error codes, user-visible text, domain concepts. Give internal names (components, hooks, modules, files) a default that follows the project's existing convention, and list them once for the user to override.
Leave a marker for what you defer. If you intentionally do the minimum, mark the spot with what you deferred and the upgrade path.
When you find yourself explaining the same mistake twice, do not write more docs. Capture it as a test, an eslint rule, or an example.
DRY removes duplication of knowledge (rules), not every JSX block that looks alike.
Do not silently pick one interpretation when several are plausible. Before writing UI logic, state what you are assuming, what you considered, and why this path — then proceed or ask.
Touch only what the request requires. Match existing style; do not "improve" adjacent code, comments, formatting, or naming while delivering the task.
Before recording a cause, secure one observation that would differ if that cause were false. Prefer mechanism over correlation; if two environments behave differently, compare the thing you believe differs before documenting it.
Carry intent in a name, a type, or a test that fails when it breaks. Comment only a why none of these can hold, and point it at an existing test or link. Never narrate code. Doc comments and tool directives are out of scope.
A comment is a claim, not evidence. If it contradicts the code, act only on a test or on history showing which side changed last; otherwise change neither and report it. Fix comments your change made stale; report the rest.
The Component Contract is a contract with the agent, not a screen for a person. Feature, hook, slice, query key, and any name you invented stay in the Contract and the code — not in what you ask someone to approve.
| Excuse | Reality |
|---|---|
| "I'll just add this state here for now" | Misplaced state is the bug you will debug later. Use the ladder (#3). |
| "A useEffect is the quickest way to sync this" | Sync effects are the defect, not the fix (antipatterns/useeffect-abuse.md). |
| "This component is already long, a bit more won't hurt" | 200 lines is the line. Split before adding (react/component-boundary.md). |
| "Tests after the UI is done" | Untested logic hooks do not ship (Hard Rule). Hooks first, with tests. |
| "It's just a prototype" | Prototypes become production. Structure is cheapest now. |
| "That bug was already there, it's out of scope" | Not once your feature makes it worse. A per-keystroke version of a per-click bug is yours (#11). |
| "The skeleton stage is overhead for this" | Skipping boundaries is how god components start. Small task? Use Craft's small paths instead. |
User request:
$ARGUMENTS
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
7 commands in this plugin
/consultAsk, compare, review, or explicitly document frontend work without implementation changes./crucibleRun one frontend change end to end — Consult plan, Craft, Refactor when earned, Test — with one mandatory stop at plan approval./jiraWrite one Jira task, story, bug, epic, or backlog item, or the child tasks of one existing epic or story, in the fixed Korean template without changing code./refactorImprove frontend structure while preserving behavior.npx claudepluginhub loosung/compforge --plugin compforgeOther plugins' commands for the same job