You are setting up a lightweight reusable workflow system for Claude Code. Follow these steps exactly.
Implement a simple, maintainable system that:
- Routes large non-domain tasks through
general-purpose - Tracks reusable task patterns
- Promotes stable patterns into skills or subagents
- Avoids file clutter and duplication
- Preserves existing valid project instructions
Before making any changes:
-
Analyze the current project for:
- existing
CLAUDE.md .claude/agents/,.claude/skills/,.claude/rules/- any existing workflow, routing, or automation patterns
- existing
-
Identify:
- what already exists
- what overlaps with this system
- what can be reused vs needs modification
-
Produce a short plan:
- what will be created
- what will be updated
- what will be merged
- what will be left unchanged
Do not begin implementation until this plan is complete.
Do not proceed if the plan would:
- duplicate existing structures
- overwrite important instructions
- create unnecessary new files
If prior Claude chat history is available, you MUST perform a one-time review during setup to identify repeated successful task patterns.
Only capture patterns that are clearly reusable.
Do not copy full prompts or one-off tasks.
Convert valid patterns into initial entries in .claude/task-pattern-registry.md.
If no prior chat history is available, skip this step.
After bootstrap, do not rely on chat history. The registry becomes the source of truth.
If CLAUDE.md already exists:
-
Read the entire file first.
-
Identify instructions related to:
- task routing
- subagent usage
- reusable workflows
- promotion or tracking logic
-
Preserve all unrelated valid instructions.
-
For overlapping instructions:
- keep more specific instructions if compatible
- merge compatible guidance
- replace only directly conflicting parts
-
Do not remove any instruction unless it is clearly:
- duplicated
- contradictory
- obsolete due to this system
-
Ensure this system becomes the single source of truth only for:
- non-domain task routing
- reusable workflow tracking
- promotion into skills and subagents
-
Keep
CLAUDE.mdconcise (target under ~200 lines) -
Do not store examples, logs, or pattern data in
CLAUDE.md
Before finalizing changes, produce a merge audit:
- Kept unchanged:
- Merged:
- Replaced:
- Removed:
Do not finalize if any removed instruction is not clearly justified.
Ensure CLAUDE.md contains:
Use an existing domain subagent or skill whenever the task clearly matches one.
For large non-domain tasks (multi-step, multi-file, or likely high tool usage), use general-purpose with an inline prompt that includes:
- objective
- likely affected files
- expected result
- constraints
Do not use a subagent for small non-domain tasks.
When using general-purpose:
- write the prompt inline
- do not route through a manager subagent
After a successful large task, record only reusable patterns in one project registry. Do not log one-off prompts.
Promote a pattern only when all are true:
- success count ≥ 2
- task shape is materially the same across uses
- prompt skeleton remains mostly stable
- no existing skill or subagent already covers it
When promoting:
- MUST check for an existing skill or subagent before creating a new one
- update existing if overlap exists
- create new only if clearly distinct
Promotion target:
- Skill → repeatable procedure or checklist
- Subagent → reusable delegated specialist role
Keep CLAUDE.md limited to routing and promotion policy only.
Create: .claude/task-pattern-registry.md
Add:
Track only reusable, repeatable patterns. Do not store one-off tasks.
- name:
- task type:
- domain guess:
- prompt skeleton:
- key files:
- success count:
- last used:
- stability note:
- target (skill or subagent):
Rules:
- Match existing entries before creating new ones
- Update success count instead of duplicating entries
Ensure these folders exist:
.claude/agents/ .claude/skills/
When completing a large task:
- Determine if the pattern is reusable
- If yes, update or create a registry entry
- Do NOT store full prompts, only skeletons
Only promote when:
- success count ≥ 2
- pattern is consistent
- prompt is stable
When promoting:
- Prefer updating existing skills/subagents
- Use clear, consistent names (short, descriptive, domain-based)
- For subagents, include a clear “when to use” description
To prevent clutter:
- Merge similar patterns
- Remove or ignore rarely reused patterns
- Merge or remove redundant skills/subagents
- Prefer expanding existing ones over adding new ones
- Do not rely on chat history after bootstrap
- Do not create many files for patterns
- Do not promote unstable or one-off patterns
- Keep everything minimal and maintainable
The system should:
- Learn from repeated successful work
- Gradually produce high-quality reusable skills and subagents
- Stay simple (single registry, minimal files)
- Avoid duplication and long-term clutter