implement-guide
Skill4 starsChanged 15 days agoMITView on GitHub
Draft a plan, stress-test it with a parallel review council, then implement in the main session. Only plan review is delegated; drafting and implementation stay single-agent.
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- analyze-deps-guideSkill
- design-planSkill
- docs-writingSkill
- frontend-designSkill
- implement-guideSkill
- implement-test-guideSkill
- modern-web-guidanceSkill
- pr-fix-guideSkill
- pr-review-follow-upSkill
- pr-review-guideSkill
- shadcn-adapt-guideSkill
- shadcnSkill
- ui-audit-guideSkill
- analyze-deps-guideSkill
- design-planSkill
- docs-writingSkill
- frontend-designSkill
- implement-test-guideSkill
- pr-fix-guideSkill
- pr-review-follow-upSkill
- pr-review-guideSkill
- shadcn-adapt-guideSkill
- shadcnSkill
- ui-audit-guideSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
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
- Distinctive: line 48
Before designing, understand the technologies involved.
- Distinctive: line 219
After user approves the plan, implement one phase at a time.
- Distinctive: line 234
Before writing any code, research every third-party dependency you will use:
- Distinctive: line 298
When a reflex fires and you're not certain of the spec, open the linked rule file.
- Distinctive: line 302
Follow existing patterns in the codebase exactly
- Very specific: line 303
Use proper TypeScript types -- no any
- Distinctive: line 305
Keep code readable and explicit
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Implement Guide
Purpose
Plan and implement features in the main session. You draft the plan and do all implementation yourself; the one delegated step is a parallel review council that stress-tests the draft plan against the codebase before you finalize it. Implementation is never delegated.
Rules
The full ruleset lives in .claude/rules/*.md — those files are the spec. Don't try to keep all of them in working memory.
The Reflex Check in Part 2 → Step 3 names the actions that should evoke a rule mid-write and points at the relevant file. Read the Reflex Check at the start of every phase; open a full rule file only when a reflex actually fires while you're writing.
Operational rules (docs-mcp.md, github.md, project-stage.md) are referenced inline by the step they govern.
Part 1: Planning
Step 1: Understand Requirements
If a GitHub issue is referenced:
gh issue view {number} --json number,title,body,labels,state,url- Extract key information:
- What problem is being solved?
- What are the acceptance criteria?
- Any constraints or requirements?
- Linked designs or references?
Step 2: Research Technology Context
Before designing, understand the technologies involved.
- Identify technologies in scope — check
package.jsonfor versions - Research using WebSearch:
- Latest best practices
- Version-specific features or limitations
- Known issues, deprecations, or breaking changes
- Recommended patterns from official docs
Key questions:
Question Why It Matters What version are we using? APIs differ between versions What's the recommended pattern? Avoid deprecated approaches Any known issues? Prevent predictable problems What's new in this version? Leverage latest features
Step 3: Explore Existing Architecture
- Find related code:
- How do similar features work?
- What patterns are established?
- What can be reused?
- Identify integration points:
- What existing modules will this touch?
- What APIs/interfaces exist?
- What dependencies are involved?
- Note constraints:
- Performance requirements
- Backwards compatibility
- Security considerations
Step 4: Design the Solution
- Consider multiple approaches with trade-offs
- Choose the best approach based on:
- Alignment with existing patterns
- Maintainability
- Scalability
- Simplicity (avoid over-engineering)
- Define the architecture:
- File structure
- Data flow
- Component/module boundaries
- Interfaces between parts
Step 5: Create the Draft Plan
Break the work into ordered, independently testable phases. This is the draft — Steps 6 and 7 review and revise it before the user sees it.
For each phase, specify:
- What files to create/modify
- What the code should do
- What patterns to follow
- What to test
Planning Output Format
## Implementation Plan
### Task
- **Source:** {GitHub issue #N | spec file | conversation}
- **Complexity:** {Low|Medium|High}
- **Phases:** {count}
### Overview
{1-2 sentence summary}
### Architecture Decision
**Approach:** {chosen approach}
**Why:**
- {reason 1}
- {reason 2}
**Alternatives considered:**
| Alternative | Why Not |
|-------------|---------|
| {option} | {reason} |
### File Structure
{path}/
+-- {file1} -- {purpose}
+-- {file2} -- {purpose}
### Phases
#### Phase 1: {name}
**Goal:** {what this phase accomplishes}
**Files:**
- Create `{path/file}` -- {description}
- Modify `{path/file}` -- {description}
**Key Notes:**
- {note}
**Verification:**
- {how to verify}
#### Phase 2: {name}
{same structure}
### Risks & Decisions
| Item | Type | Notes |
| ------ | ------------- | --------- |
| {item} | Risk/Decision | {details} |Step 6: Plan Review Council
The draft is a hypothesis. Before the user sees it, fan it out to a review council — independent subagents that each attack the plan from one lens and report gaps, wrong assumptions about existing code, and over-reach. Lenses are organized by what they attack, not by job title, so coverage doesn't overlap.
Spawn all four in a single message so they run concurrently. Each receives the full draft plan and the task source, applies one lens, and verifies every claim against the actual source.
| Lens | Agent | Attacks |
| Codebase reality-check | Explore | Do the files, APIs, helpers, and patterns the plan assumes actually exist and behave as claimed? Every claim about existing code is verified file:line. |
| Architecture & ripple | principal-architect | Integration points and callers/callees the plan ignores; whether the change respects the ripple-effect rule and the pre-production stage (delete, don't shim); whether the phase split is sound. (ripple-effect.md, project-stage.md) |
| Simplicity & reuse | sde2 | Over-engineering, speculative abstraction, a second copy of a helper that already exists, scope drifting past the issue. (code-quality.md) |
| Edge cases & states | tester | Boundary inputs and failure modes the plan omits; missing loading / empty / error states; phases with no concrete verification step. |
Return contract — each agent returns ONLY a findings list, no preamble, no restating the plan. Per finding:
| Field | Value |
severity | blocker | should-fix | optional |
claim | the plan assumption or step being challenged |
evidence | file:line, or one-line reasoning |
change | the concrete plan edit being proposed |
A lens that finds nothing returns No gaps found.
Step 7: Synthesize the Revised Plan
Collect every finding and finalize the plan yourself — not by accepting all of them, but by ruling on each.
- Dedup first — multiple lenses flagging one gap collapse to a single entry.
- Accept → edit the plan to incorporate the change.
- Reject → drop it with a one-line reason (already covered, out of scope, factually wrong).
- No silent scope creep — a finding that broadens the work past the issue's acceptance criteria is rejected-with-reason, unless it is a correctness
blocker(in scope by definition — seeno-follow-up-deferral.md). - Blockers are never deferred — a
blockeris fixed in the revised plan, or the plan was wrong.
Output the revised plan (same Planning Output Format) followed by a Council Delta so the review's effect is visible:
### Council Delta
| Finding | Lens | Verdict | Note |
| ------- | ------ | ------------------- | ------------------------------ |
| {gap} | {lens} | Accepted / Rejected | {what changed, or why dropped} |After presenting the revised plan and Council Delta: WAIT for user approval before implementing.
Part 2: Implementation
After user approves the plan, implement one phase at a time.
Per-Phase Process
Step 1: Explore Existing Code
Before writing anything:
- Find similar implementations -- how do existing features work?
- Identify reusable utilities, hooks, and types -- if a near-equivalent helper, formatter, dialog, or component already exists, extend it instead of writing a second copy
- Note file structure and naming conventions
- Understand patterns established by already-completed phases
Step 2: Research Dependencies
Before writing any code, research every third-party dependency you will use:
"{library} best practices {current year}"
"{library} {version} documentation"
"{library} common mistakes"This is mandatory -- do not guess how a library works.
Step 3: Implement
Reflex Check — read at the start of the phase, then re-fire whenever a trigger lights up while you write. Triggers are written as the action you're about to take; the action line is what to do instead.
Reshaping existing code
- Modifying, renaming, replacing, or removing existing code?
-> Ripple sweep: grep for the old name / pattern. Walk all four corners — callers (do they get simpler now?), callees (do they need less now?), adjacent code (any similar block nearby that now reads inconsistent?), dead weight (variables, imports, destructured fields, helper functions, orphan files that only existed to support the old shape — delete them). The change isn't done until the area reads natural end-to-end. (
ripple-effect.md) - Adding a new helper, formatter, hook, dialog, route handler, or component from scratch?
-> Grep first. If something near-equivalent exists, extend it. A second copy that "differs only in
hvshr", "differs only by one default arg", or is "near-byte-identical" is the drift smell that keeps getting flagged in review. (code-quality.md)
Control flow
- Wrapping real work inside an
if (ok) { ... }chain, writingelseafter areturn, or assembling a multi-field result with branching ternaries? -> Flip preconditions toif (!ok) returnso the happy path stays at column 0. Dropelseafter any terminating statement. For branchy result-builders, split into per-branch helpers that each return a nullable, and pick the live branch with a fallback at the call site. (guard-clauses.md)
React and JSX
- About to type
useEffect? -> Only for syncing with an external system (browser API, subscription, third-party widget, manual DOM measurement). Anything that orchestrates React state — derive during render, move into the event handler that caused it, use akeyprop to reset, or useuseSyncExternalStore. Never suppressexhaustive-deps. (useeffect-escape-hatch.md) - Defining a component prop interface?
-> Reject render-callback props (
(...) => ReactNode), component-as-prop props (ComponentType<...>), andmode/variantdiscriminators that gate two different render branches — usechildren(or namedReactNodeslots), or split into per-mode components. (composition-over-render-props.md) - Writing an inline arrow in a JSX prop (
onClick={() => { ... }},onSubmit={...},onChange={...})? -> If the body is 3+ lines, branches, or nests a callback, extract a named function (handleX) abovereturnand pass it by reference. One- and two-line handlers stay inline. Don't wrap a bare reference in an arrow —onClick={() => doThing()}is justonClick={doThing}. (extract-inline-handlers.md)
Components and styling
- Authoring or restyling a component, or writing any
nx:utility? ->nx:prefix on every utility, before every modifier (nx:hover:,nx:[&>svg]:,nx:lg:— neverhover:nx:). Semantic tokens only, full paths (nx:bg-primary-background— nevernx:bg-primary, never a primitive likenx:bg-blue-500); nodark:on a semantic token (it already adapts — the modifier is a no-op). Size controls by copying thesizevariants inbutton.tsx/input.tsx; never acontrol-*spacing token (dropped in #489).@containerfor component-internal responsive; viewport prefixes (nx:lg:) are page-shell only (Dialog is the one viewport-driven exception). Focus = a real outline: controlsnx:focus-visible:outline-2 nx:focus-visible:outline-focus-default, Button addsnx:focus-visible:outline-offset-2, fields usenx:focus-visible:outline-defaultplusnx:focus-visible:border-focus-defaultbecause the border is the ring's inner half and both halves read one borderwidth token. Never pairnx:outline-nonewith a focus-outline class on one element — it blanks the ring. Never putnx:transition-colorson an element that paints a ring — it includesoutline-color, so it fades the ring in instead of landing it with the keypress (pnpm lintfails the pair). Use the ring-safe pair:nx:transition-control(color, background-color, border-color) for controls and Buttons,nx:transition-field(color, background-color) for field surfaces, whose border is the ring's inner half. Never usenx:ring-*.data-slotalways;data-variant/data-sizewhen the prop exists. CVA for enum variants; boolean props as ternaries in the body, not CVA.asChildvia RadixSlotfor interactive components. (responsive.md) - Reaching for a CSS variable at runtime (inline style, SVG, canvas), or porting a shadcn/ui component?
-> Runtime vars are the prefixed form —
var(--nx-color-foo),var(--nx-spacing-4)— never the build-time@themenames (var(--color-foo),var(--spacing-4)), which don't exist at runtime. For a shadcn port, map every token throughshadcn-divergences.md(e.g.bg-destructive→nx:bg-error-background, but keep thedestructiveprop name) — or just run the/shadcn-adaptskill. (shadcn-divergences.md)
Tests
- Adding or changing a component, hook, or utility?
-> Components: stories are the tests — no
*.test.tsx; write play functions in*.stories.tsx, importing fromstorybook/test(never@storybook/testor@testing-library/react). Cover the required-story matrix (Default, each variant + size, Disabled, Click + Keyboard interaction, WithDataAttributes,asChildif applicable, edge cases, and theAllVariantsshowcase). a11y is automatic via addon-a11y — don't add manualaxe()calls; colour contrast is APCA-gated, not axe-gated (pnpm audit:contrast). Everything else: the only non-story tests are the three intesting.md§ Scope — core engine,cnmerge, ESLint rules. Hooks, apps, and repo scripts get none, and nothing takes a snapshot. Assert input → output with partial matching on real inputs; never commitskip/only. (testing-react.md,testing.md)
Diagnostic noise
- Adding a log call?
-> One dense canonical end-of-operation line beats ten incremental "I am about to do X" lines. Drop it unless it catches an anomaly worth investigating, signals something Sentry / OTEL / framework events won't, or carries data the canonical summary can't. (
logging-proportionality.md) - Writing a comment, or typing "for now" / "follow-up" / "later" / "TODO" anywhere — in code, in commit bodies, in PR descriptions?
-> Default: no comment. Comment only non-obvious logic — not rationale, not tradeoffs, not "why we chose X" (that goes in the PR body). TODO is allowed only as
// TODO(#295):pointing at a tracked issue. Deferral framing ("not blocking, monitor post-launch", "flag for later rollout") without a cited issue number is rejected — fix it in this PR. (code-comments.md,no-follow-up-deferral.md)
Pre-production hygiene
- About to create a feature flag, backcompat shim, deprecation comment,
_unusedrename, or// removed in Xmarker? -> Don't. Delete instead of deprecate; rename in place instead of shim; remove unused exports entirely. There is no live deployment to protect. (project-stage.md)
When a reflex fires and you're not certain of the spec, open the linked rule file. The reflex list above is the trigger; the rule file is the answer.
Then write the code:
- Follow existing patterns in the codebase exactly
- Use proper TypeScript types -- no
any - Handle errors appropriately
- Keep code readable and explicit
- Implement only this phase -- do not begin the next one
Step 4: Verify
Run after completing:
pnpm typecheck
pnpm lintFix all errors before presenting your summary.
Step 5: Commit (MANDATORY)
You MUST commit after every phase before moving on. Do NOT batch commits or defer to the end.
git add -A && git commit -m "phase {n}: {phase name}"Per-Phase Output Format
### Phase {n} Complete: {phase name}
#### Changes Made
| File | Change |
| ------------------ | ------------- |
| `path/to/file.tsx` | {description} |
#### Key Code
{Most important snippet with file:line reference}
#### Verification
- TypeScript: {No errors | N errors fixed}
- Lint: {No warnings | N warnings fixed}
- Commit: {commit hash}After each phase: commit, then proceed immediately to the next phase. Do NOT wait for user confirmation between phases.
Principles
- Read before write -- understand existing patterns first
- Research before coding -- look up libraries, never guess
- Follow loaded rules --
.claude/rules/files are source of truth - One phase at a time -- do not implement beyond the current phase
- Plan is not code -- planning and implementation are distinct steps
- Draft, then review -- the council reviews the plan before approval; implementation stays in the main session
- Ask when blocked -- surface ambiguity rather than assuming
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
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.

