fe-plan
Use when a feature needs an implementation plan before code generation, either from an existing spec or through interactive requirements gathering.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- fe-plan
- description
- Use when a feature needs an implementation plan before code generation, either from an existing spec or through interactive requirements gathering.
- allowed-tools
- Read, Write, Glob, Grep, Bash, Agent
- argument-hint
- <feature-name> [--standalone]
- user-invocable
- true
02 资源文件 1
- 参考文档references/standalone.md2.2 KB
03 SKILL.md 正文
Implementation Plan Skill
Analyzes a functional specification (planning-plugin output) or gathers requirements interactively (standalone mode) and produces an implementation plan for production React code.
Conventions (fe-shared): ${CLAUDE_PLUGIN_ROOT}/skills/fe-shared/SKILL.md.
Files under references/ write the plugin root as {pluginRoot}, which is ${CLAUDE_PLUGIN_ROOT}.
Instructions
Step 0: Read Configuration
- Read
.claude/frontend-react-plugin.json→ extractrouterMode,appProfile,serverState,formStack,renderingDefault,mockFirst,baseDir,appDir,i18n, and the Phase 2 knobscomponentLibrary,apiLayer,i18nBinding,clientStorewith their companion objectsexternalComponents,apiPackage,i18nHook - If
baseDiris missing, use default value"src" - If
mockFirstis missing, use default valuetrue - If
appDiris missing, use default value"."(project root) - New-stack keys fall back to admin defaults when absent:
appProfile="admin",serverState="zustand-only",formStack="native";renderingDefaultapplies only whenrouterMode="framework"(default"ssr"). Phase 2 knobs fall back tocomponentLibrary="shadcn",apiLayer="feature-local",i18nBinding="react-i18next",clientStore="zustand"; pass a companion object only when present. Pass all of these through to the planner so it can plan rendering / queries / form schemas / component inventory / API reuse / i18n resources. - If the file does not exist:
"Frontend React Plugin has not been initialized. Please run
/frontend-react-plugin:fe-initfirst."- Stop here.
- Derive
srcPath— take the configbaseDirafter its default is applied and remove the leading{appDir}/(app/src+appDir=app→src;appDir="."→ unchanged;appDir == baseDir→.). Everynpx …path argument usessrcPath; the repo-relative source root stays available for file operations. See fe-shared § Build Command Working Directory.
Lock Acquire
fe-plan writes plan.json, delta-plan.json, and the progress file, so it is a state-mutating
skill and takes the feature lock like the others — a plan written while fe-gen is generating from
the previous plan leaves the two disagreeing about what exists.
Create the lock's parent first. docs/specs/{feature}/.implementation/frontend/ does not exist
for a feature being planned standalone for the first time, and lock creation fails there before the
steps that would create it ever run. Note whether the directory already existed, mkdir -p it, then
acquire.
Do not try to reject a mistyped feature name here — at this point the mode is unknown (Step 0.5
decides it), and a "spec must exist" check either kills the legitimate first-ever standalone run or,
if evaluated after the mkdir -p, always passes because the mkdir just created the directory being
checked. The existing nets downstream are the right ones: Step 0.5 auto-detection asks the user when
no spec exists, and Step 1 stops on a missing spec in spec mode. The one residue a typo can leave is
the directory this section created — so on any exit before the first artifact write, if this run
created the directory (it did not exist before the mkdir -p): delete this run's own lock file,
then remove the now-empty directories with non-recursive rmdir, innermost first. Never
rm -rf: between deleting our lock and removing the directory, another session may legitimately
acquire a new lock in it, and a recursive delete would destroy that live lock. rmdir on a
non-empty directory fails harmlessly, which is exactly the right outcome — someone else is using
it now. A pre-existing directory is never removed.
Acquire docs/specs/{feature}/.implementation/frontend/.lock with holder: "fe-plan", per
fe-shared § Lock file. Check the holder's pid before treating any lock as stale. Held by a live
holder → report holder and acquiredAt, then stop.
Everything from here to Step 5 runs under the lock — it is taken before Step 0.5 so that no branch (standalone, incremental, or full) can reach a write by jumping to Step 1, 1-S, 3, or 3-I. Release it on every exit below, including a user declining at Step 4-I or Step 4.
Step 0.5: Detect Mode
-
Check if
--standaloneflag is present in the argument- If
--standaloneis present:mode = "standalone", skip to Step 1-S - If absent: do not choose a mode here — continue to item 2, which decides. Setting
mode = "spec"here would bypass auto-detection entirely, so a first-ever standalone run without the flag would hit "spec not found" instead of being offered standalone mode.
- If
-
Auto-detection — the flag is absent, so check if
docs/specs/{feature}/.progress/{feature}.jsonexists:- If not found:
"No planning-plugin specification found for '{feature}'." "Options:" "1. Standalone mode (gather requirements interactively)" "2. Create specification first:
/planning-plugin:pp-spec {feature}"- If user chooses 1:
mode = "standalone", skip to Step 1-S - If user chooses 2: stop here.
- If user chooses 1:
- If found:
mode = "spec", proceed to Step 1
- If not found:
Step 1: Validate Spec
-
Check if
docs/specs/{feature}/.progress/{feature}.jsonexists- If not found:
"Functional specification not found:
docs/specs/{feature}/" "Please create the functional specification using planning-plugin first."- Stop here.
- If not found:
-
Read the progress file and check
status:"reviewing"or"finalized"→ proceed- If status is
"reviewing":"The specification is in 'reviewing' status — unresolved review issues may exist." "For the most accurate plan, finalize first:
/planning-plugin:pp-review {feature}" "Continue with current spec?"- If the user declines, stop here.
"drafting"or"analyzing"→"The functional specification is not yet complete (status: {status})." "Please finish writing the specification, then try again."
- Stop here.
-
Extract
workingLanguagefrom the progress file (default:"en") -
Language name mapping:
en= English,ko= Korean,vi= Vietnamese
Communication language: All user-facing output in this skill (summaries, questions, feedback presentations, next-step guidance) must be in {workingLanguage_name}.
Step 1-S: Standalone Requirements Gathering (standalone mode only)
Read ${CLAUDE_PLUGIN_ROOT}/skills/fe-plan/references/standalone.md and follow this section there.
Step 2: Check UI DSL
-
Check if
docs/specs/{feature}/ui-dsl/manifest.jsonexists- exists →
uiDslAvailable = true - not exists →
uiDslAvailable = false
- exists →
-
If
uiDslAvailableis false, display recommendation:"UI DSL is not available. The plan will be generated by inferring from the spec markdown." "For a more accurate plan, running
/planning-plugin:pp-design {feature}is recommended." -
Check if
prototypes/{feature}/exists →prototypeAvailable
Step 2.5: Detect Shared Layout
Standalone features skip this step entirely (read the progress file's standalone flag): the
standalone planner rule is "shared layout detection: skip", and item 2 below reads screens.md,
which standalone never creates — without this branch an existing standalone feature (spec mode by
auto-detection, since its progress file exists) dies here and never reaches Step 2.7's
incremental detection, making standalone replanning unreachable through this skill. Set
sharedLayoutIds = "none" and continue to Step 2.7.
- If
uiDslAvailableis true:- Read
docs/specs/{feature}/ui-dsl/manifest.json - Check
layoutsarray for entries with"source": "_shared" - If found:
sharedLayoutIds= list of layout IDs
- Read
- If
uiDslAvailableis false:- Read
docs/specs/{feature}/{workingLanguage}/screens.md - Check for
<!-- @layout: _shared/directive - If found: extract layout IDs
- Read
- If no shared layout references found:
sharedLayoutIds="none"
Step 2.7: Incremental Detection
Check if incremental mode is applicable:
- Check if
docs/specs/{feature}/.implementation/frontend/plan.jsonexists →existingPlanExists - If
existingPlanExists:- Read
docs/specs/{feature}/.progress/{feature}.json→ extractimplementation.status - If
implementation.statusis one ofgenerated,verified,verify-failed,reviewed,review-failed,fixing,resolved,done:"An existing implementation plan and generated code exist (status: {status})." "Options:" "1. Incremental update — detect spec changes, regenerate only affected files" "2. Full regeneration — discard all changes, create new plan from scratch"
- If user chooses 1:
planMode = "incremental", proceed to Step 3-I - If user chooses 2:
planMode = "full", proceed to Step 3
- If user chooses 1:
- If
implementation.statusisplanned,gen-failed, or absent:- No generated code to preserve →
planMode = "full", proceed to Step 3
- No generated code to preserve →
- Read
- If not
existingPlanExists:planMode = "full", proceed to Step 3
Step 3-I: Launch Planner Agent (Incremental Mode)
Only executed when planMode = "incremental".
Launch the implementation-planner agent in incremental mode:
Agent(subagent_type: "frontend-react-plugin:implementation-planner", prompt: "
Analyze spec changes for '{feature}' and produce a delta plan.
Parameters:
- feature: {feature}
- specDir: docs/specs/{feature}/{workingLanguage}/
- uiDslDir: docs/specs/{feature}/ui-dsl/ (available: {uiDslAvailable})
- prototypeDir: prototypes/{feature}/ (available: {prototypeAvailable})
- routerMode: {routerMode}
- appProfile: {appProfile}
- serverState: {serverState}
- formStack: {formStack}
- componentLibrary: {componentLibrary}
- externalComponents: {the config object, or omit the line when absent}
- apiLayer: {apiLayer}
- apiPackage: {the config object, or omit the line when absent}
- i18nBinding: {i18nBinding}
- i18nHook: {the config object, or omit the line when absent}
- clientStore: {clientStore}
- renderingDefault: {renderingDefault}
- mockFirst: {mockFirst}
- projectRoot: {cwd}
- baseDir: {baseDir}
- appDir: {appDir}
- srcPath: {srcPath}
- incrementalMode: true
- existingPlanFile: docs/specs/{feature}/.implementation/frontend/plan.json
- deltaOutputFile: docs/specs/{feature}/.implementation/frontend/delta-plan.json
- outputFile: docs/specs/{feature}/.implementation/frontend/plan.json
- i18n: {the config i18n block, or omit when absent}
Follow the process defined in agents/implementation-planner.md.
Execute Phase 3 (Incremental Mode) instead of Phase 2.
Write the delta plan to the deltaOutputFile path.
")
Step 4-I: Display Delta Summary & Confirm
Only executed when planMode = "incremental".
-
Read the generated
docs/specs/{feature}/.implementation/frontend/delta-plan.json -
Display the delta summary (as defined in the agent's Delta User Summary Template)
-
If
largeDeltaWarningistrue:"Warning: This delta affects more than 60% of implementation files." "Full regeneration may be more reliable and produce more consistent code." "Options:" "1. Proceed with delta (incremental update)" "2. Switch to full regeneration"
- If user chooses 2: discard delta-plan.json, set
planMode = "full", go to Step 3
- If user chooses 2: discard delta-plan.json, set
-
If no spec changes detected (
specChanges.added,modified, andremovedare all empty) andcontentComparisonUnavailableis empty:"No spec changes detected. The current plan is up to date." When
contentComparisonUnavailableis non-empty, this branch is forbidden — the honest statement is "no detectable changes", which is not the same thing. Display the listed objects and their source IDs with: "Content comparison unavailable for {N} object(s) (plan predates sourceHash). If any of these requirements changed, run full generation; incremental cannot see their edits." and keep the delta only if other changes exist; otherwise delete it and stop as below.- Delete the
delta-plan.jsonthe planner just wrote and leave the progress file untouched. Left in place, the session hook andfe-progressreport a pending delta, and following theirfe-genadvice executes a zero-change delta that resets the status togeneratedand clears valid E2E evidence — a full pipeline demotion with no code change behind it. - Stop here (release the lock).
- Delete the
-
Confirm:
"Proceed with incremental plan? Run
/frontend-react-plugin:fe-gen {feature}to apply the delta." -
Skip to Step 5-I.
Step 3: Launch Planner Agent
Create the output directory if it doesn't exist:
Migration check (backward compatibility):
- If
docs/specs/{feature}/.implementation/plan.jsonexists (old path) ANDdocs/specs/{feature}/.implementation/frontend/does NOT exist:- Move all files from
.implementation/to.implementation/frontend/(excluding subdirectories that are already namespaces) - Update embedded paths in progress file if present
- Display: "Migrated .implementation/ → .implementation/frontend/"
- Move all files from
- Otherwise: create
docs/specs/{feature}/.implementation/frontend/if it doesn't exist
docs/specs/{feature}/.implementation/frontend/
Launch the implementation-planner agent:
Agent(subagent_type: "frontend-react-plugin:implementation-planner", prompt: "
Analyze the functional specification for '{feature}' and produce an implementation plan.
Parameters:
- feature: {feature}
- specDir: docs/specs/{feature}/{workingLanguage}/
- uiDslDir: docs/specs/{feature}/ui-dsl/ (available: {uiDslAvailable})
- prototypeDir: prototypes/{feature}/ (available: {prototypeAvailable})
- routerMode: {routerMode}
- appProfile: {appProfile}
- serverState: {serverState}
- formStack: {formStack}
- componentLibrary: {componentLibrary}
- externalComponents: {the config object, or omit the line when absent}
- apiLayer: {apiLayer}
- apiPackage: {the config object, or omit the line when absent}
- i18nBinding: {i18nBinding}
- i18nHook: {the config object, or omit the line when absent}
- clientStore: {clientStore}
- renderingDefault: {renderingDefault}
- mockFirst: {mockFirst}
- projectRoot: {cwd}
- baseDir: {baseDir}
- appDir: {appDir}
- srcPath: {srcPath}
- outputFile: docs/specs/{feature}/.implementation/frontend/plan.json
- i18n: {the config i18n block, or omit when absent}
Follow the process defined in agents/implementation-planner.md.
Write the implementation plan to the outputFile path.
")
Step 4: Display Summary
- Read the generated
docs/specs/{feature}/.implementation/frontend/plan.json - Display the summary:
Implementation Plan for '{feature}':
Source: docs/specs/{feature}/ (status: {specStatus}, UI DSL: {available/not available})
Target: {baseDir}/ ({projectStructure} layout)
Router: {routerMode} mode
Files to create ({totalFiles}):
Shared layouts: {layout names} ({new/existing})
Types: {type names} ({count} files)
API: {api names} — {endpoint count} endpoints ({count} files)
Stores: {store names} ({count} files)
Components: {component names} ({count} files)
Pages: {page descriptions} ({count} files)
Routes: {entry count} entries under {parentRoute}
i18n: {namespace} namespace ({language count} languages)
Mocks: {fixture count} fixtures, {handler count} handler sets (MSW v2)
Tests: {testFiles} test files, {testCases} test cases
E2E: {e2eScenarios} scenarios
Components: {shadcn: "{missing count} shadcn/ui components need installation ({missing list})" | external: "{used count} from {package}, {gap count} ui-kit gaps ({gap list})"}
TDD Phases:
1. Foundation — shared-layouts + types + mocks (infra)
2. API TDD — RED: api tests → GREEN: api services
3. Store TDD — RED: store tests → GREEN: stores
4. Component TDD — RED: component tests → GREEN: components
5. Page TDD — RED: page tests → GREEN: pages
6. Integration — routes + i18n + MSW setup + barrel
Plan saved to: docs/specs/{feature}/.implementation/frontend/plan.json
Review and edit the plan, then run /frontend-react-plugin:fe-gen {feature}
Step 5: Update Progress
- Read
docs/specs/{feature}/.progress/{feature}.json - Add or update the
implementationfield:
{
"implementation": {
"status": "planned",
"planFile": "docs/specs/{feature}/.implementation/frontend/plan.json"
}
}
- Write the updated progress file back. Merge rule: preserve all existing fields in the progress file — only add or update the
implementationfields shown above.
Step 5-I: Update Progress (Incremental Mode)
Only executed when planMode = "incremental".
- Read
docs/specs/{feature}/.progress/{feature}.json - Add or update the
implementationfield — preserve the existing status (do NOT reset to"planned"):
{
"implementation": {
"deltaFile": "docs/specs/{feature}/.implementation/frontend/delta-plan.json",
"deltaDetectedAt": "{ISO timestamp}"
}
}
- Write the updated progress file back. Merge rule: preserve ALL existing fields in the progress file (including
status,planFile,tddPhases,generatedAt,verification,review,fix,debug) — only add thedeltaFileanddeltaDetectedAtfields.
Lock Release
Delete docs/specs/{feature}/.implementation/frontend/.lock.
Both Step 5 and Step 5-I end here — whichever branch ran, this is the last action. Release also on
every early exit after Lock Acquire (a declined confirmation at Step 4 or 4-I, a planner failure),
per fe-shared § Lock file: the lock is taken before those prompts, so a refusal that just stops
leaves the feature locked and fe-gen refusing it.
04 同仓库更多 Skills
hp-shared
Shared conventions for every homepage-plugin agent and skill — stack, code conventions, state-file writes, check commands and how to report them. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
fe-shared
Shared conventions for every frontend-react-plugin agent and skill — code conventions, state files and locks, accepted deviations, design principles, build working directory, router-mode command matrix, TypeScript check. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
be-spring-shared
Shared conventions for every backend-springboot-plugin agent and skill — tech stack, CQRS architecture, naming, coding standards, TDD, commit and build rules, state files. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
pp-translate
Use after directly editing the working language spec to sync changes to other supported languages.
pp-sync-stitch
Use when wireframes were manually edited on the Stitch website and need to be re-fetched to the local project.
pp-sync-notion
Use when a specification needs to be published or re-synced to Notion after finalization or manual edits.