claude-mcp-workflow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +13 -0
- package/.mcp.json +9 -0
- package/LICENSE +21 -0
- package/README.md +260 -0
- package/build/dashboard.d.ts +4 -0
- package/build/dashboard.d.ts.map +1 -0
- package/build/dashboard.js +91 -0
- package/build/dashboard.js.map +1 -0
- package/build/engine.d.ts +55 -0
- package/build/engine.d.ts.map +1 -0
- package/build/engine.js +486 -0
- package/build/engine.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +60 -0
- package/build/index.js.map +1 -0
- package/build/loader.d.ts +29 -0
- package/build/loader.d.ts.map +1 -0
- package/build/loader.js +166 -0
- package/build/loader.js.map +1 -0
- package/build/modifier.d.ts +42 -0
- package/build/modifier.d.ts.map +1 -0
- package/build/modifier.js +96 -0
- package/build/modifier.js.map +1 -0
- package/build/storage.d.ts +12 -0
- package/build/storage.d.ts.map +1 -0
- package/build/storage.js +62 -0
- package/build/storage.js.map +1 -0
- package/build/tools.d.ts +7 -0
- package/build/tools.d.ts.map +1 -0
- package/build/tools.js +316 -0
- package/build/tools.js.map +1 -0
- package/build/types.d.ts +417 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +82 -0
- package/build/types.js.map +1 -0
- package/dashboard/dagre.min.js +801 -0
- package/dashboard/index.html +652 -0
- package/hooks/hooks.json +24 -0
- package/hooks/workflow-cleanup.sh +51 -0
- package/hooks/workflow-start.sh +79 -0
- package/package.json +44 -0
- package/templates/bug-fix.yaml +283 -0
- package/templates/code-review.yaml +164 -0
- package/templates/coding.yaml +176 -0
- package/templates/debugging.yaml +162 -0
- package/templates/explore.yaml +90 -0
- package/templates/file-code.yaml +69 -0
- package/templates/file-review.yaml +164 -0
- package/templates/investigate.yaml +84 -0
- package/templates/master.yaml +202 -0
- package/templates/new-feature.yaml +41 -0
- package/templates/planning.yaml +85 -0
- package/templates/refactoring.yaml +56 -0
- package/templates/reflection.yaml +61 -0
- package/templates/skills/architecture/SKILL.md +55 -0
- package/templates/skills/coding-skill-selector/SKILL.md +25 -0
- package/templates/skills/lang-haxe/SKILL.md +257 -0
- package/templates/skills/lang-python/SKILL.md +16 -0
- package/templates/skills/math/SKILL.md +14 -0
- package/templates/skills/preferences/SKILL.md +25 -0
- package/templates/skills/task-delegation/SKILL.md +53 -0
- package/templates/skills/web-reading/SKILL.md +62 -0
- package/templates/subagent.yaml +67 -0
- package/templates/testing.yaml +120 -0
- package/templates/web-research.yaml +53 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: investigate
|
|
2
|
+
description: "Investigation workflow — resolve unknowns before deciding on action. For tasks that describe desired changes but contain questions, uncertainties, or assumptions that need verification first."
|
|
3
|
+
initial: parse
|
|
4
|
+
max_transitions: 25
|
|
5
|
+
|
|
6
|
+
states:
|
|
7
|
+
parse:
|
|
8
|
+
prompt: |
|
|
9
|
+
The user's task contains unknowns that need investigation before coding.
|
|
10
|
+
|
|
11
|
+
1. Extract from the user's message:
|
|
12
|
+
- **Goal**: what the user ultimately wants changed
|
|
13
|
+
- **Unknowns**: questions, uncertainties, assumptions to verify
|
|
14
|
+
(markers: "вроде", "кажется", "если это так", "не уверен", "should",
|
|
15
|
+
"not sure", "?", conditional language, hedging)
|
|
16
|
+
- **Knowns**: concrete facts or behaviors stated as certain
|
|
17
|
+
|
|
18
|
+
2. Formulate 1-3 specific investigation questions to resolve the unknowns
|
|
19
|
+
|
|
20
|
+
Present the breakdown to the user briefly, then → transition `explore`.
|
|
21
|
+
transitions:
|
|
22
|
+
explore: run_explore
|
|
23
|
+
|
|
24
|
+
run_explore:
|
|
25
|
+
sub_workflow: explore
|
|
26
|
+
on_complete: assess
|
|
27
|
+
on_fail: assess
|
|
28
|
+
|
|
29
|
+
assess:
|
|
30
|
+
prompt: |
|
|
31
|
+
Investigation complete. Review findings against the original unknowns.
|
|
32
|
+
|
|
33
|
+
Present to the user:
|
|
34
|
+
1. For each unknown — what did investigation reveal?
|
|
35
|
+
2. Does the desired change still make sense given the findings?
|
|
36
|
+
3. Recommended action and scope
|
|
37
|
+
|
|
38
|
+
Choose transition:
|
|
39
|
+
- `trivial` → fix is obvious and small (1-3 lines), apply it now
|
|
40
|
+
- `needs_plan` → changes needed but require planning (multi-file, risk, unclear scope)
|
|
41
|
+
- `no_action` → investigation showed the change is unnecessary or already works correctly
|
|
42
|
+
- `unclear` → still unclear after investigation, need user input
|
|
43
|
+
transitions:
|
|
44
|
+
trivial: quick_fix
|
|
45
|
+
needs_plan: needs_plan
|
|
46
|
+
no_action: done
|
|
47
|
+
unclear: clarify
|
|
48
|
+
|
|
49
|
+
clarify:
|
|
50
|
+
prompt: |
|
|
51
|
+
Present findings and remaining questions to the user.
|
|
52
|
+
Use AskUserQuestion for critical decisions.
|
|
53
|
+
|
|
54
|
+
After getting user's answer → transition based on clarity:
|
|
55
|
+
- `reassess` → re-evaluate with new info
|
|
56
|
+
- `done` → user says no action needed
|
|
57
|
+
transitions:
|
|
58
|
+
reassess: assess
|
|
59
|
+
done: done
|
|
60
|
+
|
|
61
|
+
quick_fix:
|
|
62
|
+
prompt: |
|
|
63
|
+
MANDATORY FIRST ACTION — call `Skill("coding-skill-selector")` to load
|
|
64
|
+
language/domain skills BEFORE writing code.
|
|
65
|
+
|
|
66
|
+
The fix is trivial (1-3 lines). Apply it directly.
|
|
67
|
+
After fixing → transition `done`.
|
|
68
|
+
transitions:
|
|
69
|
+
done: fixed
|
|
70
|
+
|
|
71
|
+
fixed:
|
|
72
|
+
prompt: "Investigation + quick fix complete."
|
|
73
|
+
terminal: true
|
|
74
|
+
outcome: complete
|
|
75
|
+
|
|
76
|
+
needs_plan:
|
|
77
|
+
prompt: "Investigation complete. Changes need planning — escalating."
|
|
78
|
+
terminal: true
|
|
79
|
+
outcome: fail
|
|
80
|
+
|
|
81
|
+
done:
|
|
82
|
+
prompt: "Investigation complete. No code changes needed."
|
|
83
|
+
terminal: true
|
|
84
|
+
outcome: complete
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
name: master
|
|
2
|
+
description: "Master workflow — single entry point replacing skill-selector. Analyzes task, loads knowledge skills, routes to process sub-workflows."
|
|
3
|
+
initial: route
|
|
4
|
+
max_transitions: 100
|
|
5
|
+
|
|
6
|
+
states:
|
|
7
|
+
route:
|
|
8
|
+
prompt: |
|
|
9
|
+
STOP. This is a routing state. Do NOT perform any work. Do NOT answer the user.
|
|
10
|
+
The ONLY tool calls allowed here are list and transition.
|
|
11
|
+
|
|
12
|
+
**Step 1 — Check for project workflows.**
|
|
13
|
+
Call `list`. Look for workflows NOT in the global set (coding, debugging,
|
|
14
|
+
bug-fix, new-feature, refactoring, code-review, explore, web-research, planning,
|
|
15
|
+
testing, reflection, investigate, master). If a project workflow exists and its description
|
|
16
|
+
matches the user's task → transition `project` and set context key
|
|
17
|
+
`project_workflow` to that workflow's name.
|
|
18
|
+
|
|
19
|
+
**Step 2 — Standard routing (only if no project workflow matched).**
|
|
20
|
+
|
|
21
|
+
Plan mode active in system prompt? → plan
|
|
22
|
+
|
|
23
|
+
Plan override — always `plan` when ANY apply:
|
|
24
|
+
- 5+ files touched, mixed actions, cascade risk, user asks to plan
|
|
25
|
+
|
|
26
|
+
Route the user's message:
|
|
27
|
+
- understand/investigate → debugging or explore (NEVER coding)
|
|
28
|
+
- questions about code behavior ("will X break?", "how does Y work?",
|
|
29
|
+
"what happens when Z?") → explore (requires reading code before answering)
|
|
30
|
+
- task describes desired changes BUT contains unknowns, questions, or
|
|
31
|
+
uncertainty about current behavior → investigate (NEVER coding)
|
|
32
|
+
Markers: "вроде", "кажется", "если это так", "не уверен", "should X?",
|
|
33
|
+
"not sure if", conditional "если/if", multiple interleaved questions,
|
|
34
|
+
hedging language. When in doubt between coding and investigate → investigate.
|
|
35
|
+
- write/modify code (1-4 files), scope is clear → coding
|
|
36
|
+
- new feature e2e → feature
|
|
37
|
+
- fix known bug → bug_fix
|
|
38
|
+
- restructure code → refactoring
|
|
39
|
+
- review PR/code → code_review
|
|
40
|
+
- look up docs/web → research
|
|
41
|
+
- conversation that does NOT require reading code (greetings, meta-questions
|
|
42
|
+
about workflow, preferences, general knowledge) → chat
|
|
43
|
+
- unclear → unclear
|
|
44
|
+
|
|
45
|
+
Code reference in system-reminder → code-related (code_review, explore, or coding), NEVER chat.
|
|
46
|
+
|
|
47
|
+
→ Call transition NOW.
|
|
48
|
+
transitions:
|
|
49
|
+
plan: plan
|
|
50
|
+
project: run_project
|
|
51
|
+
coding: run_coding
|
|
52
|
+
feature: run_feature
|
|
53
|
+
bug_fix: run_bug_fix
|
|
54
|
+
debugging: run_debugging
|
|
55
|
+
investigate: run_investigate
|
|
56
|
+
refactoring: run_refactoring
|
|
57
|
+
code_review: run_code_review
|
|
58
|
+
research: run_research
|
|
59
|
+
explore: run_explore
|
|
60
|
+
chat: chat
|
|
61
|
+
unclear: clarify
|
|
62
|
+
|
|
63
|
+
clarify:
|
|
64
|
+
prompt: |
|
|
65
|
+
The task is unclear. Ask the user to clarify:
|
|
66
|
+
- What exactly do they need?
|
|
67
|
+
- Is this a bug fix, new feature, refactoring, research, or codebase exploration?
|
|
68
|
+
- What files/areas are involved?
|
|
69
|
+
|
|
70
|
+
After getting clarification → transition `got_info` to re-analyze.
|
|
71
|
+
transitions:
|
|
72
|
+
got_info: route
|
|
73
|
+
|
|
74
|
+
plan:
|
|
75
|
+
sub_workflow: planning
|
|
76
|
+
on_complete: route_execution
|
|
77
|
+
on_fail: reflect
|
|
78
|
+
|
|
79
|
+
route_execution:
|
|
80
|
+
prompt: |
|
|
81
|
+
The plan has been approved. Now route to the correct execution workflow.
|
|
82
|
+
|
|
83
|
+
Read the plan file — check the "Execution workflow" field in the Workflow section.
|
|
84
|
+
|
|
85
|
+
Choose transition:
|
|
86
|
+
- `coding` → plan says coding
|
|
87
|
+
- `refactoring` → plan says refactoring
|
|
88
|
+
- `feature` → plan says feature
|
|
89
|
+
- `bug_fix` → plan says bug_fix
|
|
90
|
+
- `project` → plan says project-specific workflow (set context key `project_workflow`)
|
|
91
|
+
- `dynamic` → plan says dynamic (complex multi-step, needs create)
|
|
92
|
+
transitions:
|
|
93
|
+
coding: run_coding
|
|
94
|
+
refactoring: run_refactoring
|
|
95
|
+
feature: run_feature
|
|
96
|
+
bug_fix: run_bug_fix
|
|
97
|
+
project: run_project
|
|
98
|
+
dynamic: create_dynamic
|
|
99
|
+
|
|
100
|
+
create_dynamic:
|
|
101
|
+
prompt: |
|
|
102
|
+
The dynamic workflow was already created during planning.
|
|
103
|
+
|
|
104
|
+
1. Read context key `dynamic_workflow` to get the workflow name
|
|
105
|
+
2. Call `modify` to add execution state:
|
|
106
|
+
- add_state: {name: "run_dynamic", sub_workflow: "<workflow name>", on_complete: "reflect", on_fail: "reflect"}
|
|
107
|
+
- add_transition: {from: "create_dynamic", name: "execute", to: "run_dynamic"}
|
|
108
|
+
3. Transition `execute`
|
|
109
|
+
transitions:
|
|
110
|
+
execute: reflect
|
|
111
|
+
|
|
112
|
+
run_project:
|
|
113
|
+
prompt: |
|
|
114
|
+
A project-specific workflow was selected. Wire it up dynamically:
|
|
115
|
+
|
|
116
|
+
1. Read context key `project_workflow` to get the workflow name
|
|
117
|
+
2. Call `modify` to update THIS state:
|
|
118
|
+
- add_state: {name: "run_project_sub", sub_workflow: "<workflow name>", on_complete: "reflect", on_fail: "reflect"}
|
|
119
|
+
- add_transition: {from: "run_project", name: "execute", to: "run_project_sub"}
|
|
120
|
+
3. Transition `execute`
|
|
121
|
+
transitions:
|
|
122
|
+
execute: reflect
|
|
123
|
+
|
|
124
|
+
run_investigate:
|
|
125
|
+
sub_workflow: investigate
|
|
126
|
+
on_complete: reflect
|
|
127
|
+
on_fail: plan
|
|
128
|
+
|
|
129
|
+
run_coding:
|
|
130
|
+
sub_workflow: coding
|
|
131
|
+
on_complete: reflect
|
|
132
|
+
on_fail: reflect
|
|
133
|
+
|
|
134
|
+
run_debugging:
|
|
135
|
+
sub_workflow: debugging
|
|
136
|
+
on_complete: reflect
|
|
137
|
+
on_fail: reflect
|
|
138
|
+
|
|
139
|
+
run_feature:
|
|
140
|
+
sub_workflow: new-feature
|
|
141
|
+
on_complete: reflect
|
|
142
|
+
on_fail: reflect
|
|
143
|
+
|
|
144
|
+
run_bug_fix:
|
|
145
|
+
sub_workflow: bug-fix
|
|
146
|
+
on_complete: reflect
|
|
147
|
+
on_fail: reflect
|
|
148
|
+
|
|
149
|
+
run_code_review:
|
|
150
|
+
sub_workflow: code-review
|
|
151
|
+
on_complete: done
|
|
152
|
+
on_fail: done
|
|
153
|
+
|
|
154
|
+
run_refactoring:
|
|
155
|
+
sub_workflow: refactoring
|
|
156
|
+
on_complete: reflect
|
|
157
|
+
on_fail: reflect
|
|
158
|
+
|
|
159
|
+
run_research:
|
|
160
|
+
sub_workflow: web-research
|
|
161
|
+
on_complete: done
|
|
162
|
+
on_fail: done
|
|
163
|
+
|
|
164
|
+
run_explore:
|
|
165
|
+
sub_workflow: explore
|
|
166
|
+
on_complete: explore_outcome
|
|
167
|
+
on_fail: done
|
|
168
|
+
|
|
169
|
+
explore_outcome:
|
|
170
|
+
prompt: |
|
|
171
|
+
Exploration is complete. Decide what happens next based on the findings:
|
|
172
|
+
|
|
173
|
+
- If the findings indicate code changes are needed (delete dead code, refactor,
|
|
174
|
+
fix a bug, implement something) → transition `plan` to enter planning.
|
|
175
|
+
- If the exploration was purely informational (understand how something works,
|
|
176
|
+
answer a question, no action needed) → transition `done`.
|
|
177
|
+
|
|
178
|
+
Review the synthesized findings and decide.
|
|
179
|
+
transitions:
|
|
180
|
+
plan: plan
|
|
181
|
+
done: done
|
|
182
|
+
|
|
183
|
+
chat:
|
|
184
|
+
terminal: true
|
|
185
|
+
outcome: complete
|
|
186
|
+
prompt: |
|
|
187
|
+
Pure conversation — no code, no sub-workflow.
|
|
188
|
+
|
|
189
|
+
Answer the user's question or respond to their message directly.
|
|
190
|
+
|
|
191
|
+
If the user's next message changes scope (coding, research, etc.) → transition `next_task`.
|
|
192
|
+
transitions:
|
|
193
|
+
next_task: route
|
|
194
|
+
|
|
195
|
+
reflect:
|
|
196
|
+
sub_workflow: reflection
|
|
197
|
+
on_complete: done
|
|
198
|
+
on_fail: done
|
|
199
|
+
|
|
200
|
+
done:
|
|
201
|
+
terminal: true
|
|
202
|
+
outcome: complete
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: new-feature
|
|
2
|
+
description: "New feature implementation workflow"
|
|
3
|
+
initial: requirements
|
|
4
|
+
max_transitions: 80
|
|
5
|
+
|
|
6
|
+
states:
|
|
7
|
+
requirements:
|
|
8
|
+
task: "Clarify requirements"
|
|
9
|
+
prompt: "Clarify requirements with the user. What exactly should this feature do?"
|
|
10
|
+
transitions:
|
|
11
|
+
clear: plan
|
|
12
|
+
|
|
13
|
+
plan:
|
|
14
|
+
sub_workflow: planning
|
|
15
|
+
on_complete: implement
|
|
16
|
+
on_fail: requirements
|
|
17
|
+
|
|
18
|
+
implement:
|
|
19
|
+
task: "Implement the feature"
|
|
20
|
+
prompt: |
|
|
21
|
+
MANDATORY FIRST ACTION — call `Skill("coding-skill-selector")` to load language/domain skills BEFORE doing anything else in this state. Do NOT skip this step.
|
|
22
|
+
|
|
23
|
+
Implement the feature according to the plan.
|
|
24
|
+
transitions:
|
|
25
|
+
done: test
|
|
26
|
+
|
|
27
|
+
test:
|
|
28
|
+
sub_workflow: testing
|
|
29
|
+
on_complete: review
|
|
30
|
+
on_fail: implement
|
|
31
|
+
|
|
32
|
+
review:
|
|
33
|
+
task: "Review implementation"
|
|
34
|
+
prompt: "Review the implementation. Check for edge cases, code quality, and adherence to project conventions."
|
|
35
|
+
transitions:
|
|
36
|
+
approved: done
|
|
37
|
+
changes_needed: implement
|
|
38
|
+
|
|
39
|
+
done:
|
|
40
|
+
prompt: "Feature implemented, tested, and reviewed."
|
|
41
|
+
terminal: true
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: planning
|
|
2
|
+
description: "Planning sub-workflow — explore, design plan, record workflow context"
|
|
3
|
+
initial: explore_needed
|
|
4
|
+
max_transitions: 30
|
|
5
|
+
|
|
6
|
+
states:
|
|
7
|
+
explore_needed:
|
|
8
|
+
prompt: |
|
|
9
|
+
Determine if codebase exploration is needed before planning.
|
|
10
|
+
|
|
11
|
+
1. Check loaded skills, MEMORY.md, and project CLAUDE.md
|
|
12
|
+
2. Read the user's task description — do you already understand the scope?
|
|
13
|
+
|
|
14
|
+
Choose transition:
|
|
15
|
+
- `explore` → need to explore codebase first
|
|
16
|
+
- `skip` → scope is clear, go straight to planning
|
|
17
|
+
transitions:
|
|
18
|
+
explore: run_explore
|
|
19
|
+
skip: design
|
|
20
|
+
|
|
21
|
+
run_explore:
|
|
22
|
+
sub_workflow: explore
|
|
23
|
+
on_complete: design
|
|
24
|
+
on_fail: design
|
|
25
|
+
|
|
26
|
+
design:
|
|
27
|
+
prompt: |
|
|
28
|
+
Load architecture skill: `Skill("architecture")`.
|
|
29
|
+
|
|
30
|
+
Design the implementation plan.
|
|
31
|
+
|
|
32
|
+
**Plan mode**: if system prompt says "Plan mode is active" — you're already in it,
|
|
33
|
+
do NOT call EnterPlanMode. Otherwise call `EnterPlanMode`.
|
|
34
|
+
|
|
35
|
+
**Dynamic check**: If the task is operational/multi-step (not pure code changes —
|
|
36
|
+
e.g. git operations, deployment, file management, CI/CD setup) → transition `dynamic`
|
|
37
|
+
to create the execution workflow directly instead of writing a text plan.
|
|
38
|
+
|
|
39
|
+
**Steps in plan mode:**
|
|
40
|
+
1. Explore codebase (Read/Glob/Grep or Plan/Explore subagents)
|
|
41
|
+
2. Design approach
|
|
42
|
+
3. Write plan to the plan file specified in plan mode system prompt
|
|
43
|
+
4. Plan file MUST end with Workflow section (get session_id via `status`):
|
|
44
|
+
```
|
|
45
|
+
## Workflow
|
|
46
|
+
- **Session**: `<session_id>`
|
|
47
|
+
- **Current state**: `planning @ design`
|
|
48
|
+
- **After approve**: transition `planned` → returns to parent
|
|
49
|
+
- **Execution workflow**: coding / refactoring / dynamic
|
|
50
|
+
- **Resume**: `transition("<session_id>", "planned")`
|
|
51
|
+
```
|
|
52
|
+
5. Call `ExitPlanMode` for user approval
|
|
53
|
+
|
|
54
|
+
**After plan approved → transition `planned`.**
|
|
55
|
+
transitions:
|
|
56
|
+
planned: done
|
|
57
|
+
dynamic: create_workflow
|
|
58
|
+
|
|
59
|
+
create_workflow:
|
|
60
|
+
prompt: |
|
|
61
|
+
The task is operational/dynamic — create the execution workflow directly.
|
|
62
|
+
The workflow IS the plan.
|
|
63
|
+
|
|
64
|
+
**Plan mode**: if system prompt says "Plan mode is active" — you're already in it,
|
|
65
|
+
do NOT call EnterPlanMode. Otherwise call `EnterPlanMode`.
|
|
66
|
+
|
|
67
|
+
1. Design the step-by-step workflow
|
|
68
|
+
2. Call `create("task-<name>", definition)` with focused states
|
|
69
|
+
- Each state should be small and actionable
|
|
70
|
+
- Always have `done` (terminal, outcome: complete) and `failed` (terminal, outcome: fail)
|
|
71
|
+
- Use `on_fail` for recovery paths
|
|
72
|
+
3. Save workflow name to context: `context_set(session_id, "dynamic_workflow", "task-<name>")`
|
|
73
|
+
4. Write plan file with:
|
|
74
|
+
- Brief context of what the workflow does
|
|
75
|
+
- Reference to the created workflow name
|
|
76
|
+
- Workflow section with `Execution workflow: dynamic`
|
|
77
|
+
5. Call `ExitPlanMode` for user approval
|
|
78
|
+
|
|
79
|
+
**After plan approved → transition `planned`.**
|
|
80
|
+
transitions:
|
|
81
|
+
planned: done
|
|
82
|
+
|
|
83
|
+
done:
|
|
84
|
+
prompt: "Plan approved. Returning to parent workflow for execution."
|
|
85
|
+
terminal: true
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: refactoring
|
|
2
|
+
description: "Refactoring workflow — bring every touched file to current standards"
|
|
3
|
+
initial: prepare
|
|
4
|
+
max_transitions: 40
|
|
5
|
+
|
|
6
|
+
states:
|
|
7
|
+
prepare:
|
|
8
|
+
prompt: |
|
|
9
|
+
MANDATORY FIRST ACTION — call `Skill("coding-skill-selector")` to load language/domain skills BEFORE doing anything else in this state. Do NOT skip this step.
|
|
10
|
+
|
|
11
|
+
Before writing any code:
|
|
12
|
+
|
|
13
|
+
1. **Read every file you will touch** — understand before changing
|
|
14
|
+
|
|
15
|
+
Refactoring = bringing touched files to standards from loaded skills.
|
|
16
|
+
Don't cargo-cult the original — it may predate current skills.
|
|
17
|
+
|
|
18
|
+
When files are read and understood → transition `ready`.
|
|
19
|
+
transitions:
|
|
20
|
+
ready: write
|
|
21
|
+
|
|
22
|
+
write:
|
|
23
|
+
prompt: |
|
|
24
|
+
Apply refactoring. For each touched file, apply ALL loaded preference/lang skill checklists.
|
|
25
|
+
|
|
26
|
+
Check every pattern against loaded skills before preserving it.
|
|
27
|
+
|
|
28
|
+
Choose transition:
|
|
29
|
+
- `review` → done writing, ready for review
|
|
30
|
+
transitions:
|
|
31
|
+
review: review
|
|
32
|
+
|
|
33
|
+
review:
|
|
34
|
+
prompt: |
|
|
35
|
+
Review the complete refactoring:
|
|
36
|
+
|
|
37
|
+
1. Compare before/after — verify no behavior changes
|
|
38
|
+
2. Check all touched files against ALL loaded skills at once
|
|
39
|
+
3. Look for new extraction opportunities created by refactoring
|
|
40
|
+
4. Dead code — remove anything made unnecessary
|
|
41
|
+
|
|
42
|
+
Choose transition:
|
|
43
|
+
- `verify` → review passed, ready for testing
|
|
44
|
+
- `fix` → found issues, go back to write
|
|
45
|
+
transitions:
|
|
46
|
+
verify: verify
|
|
47
|
+
fix: write
|
|
48
|
+
|
|
49
|
+
verify:
|
|
50
|
+
sub_workflow: testing
|
|
51
|
+
on_complete: done
|
|
52
|
+
on_fail: write
|
|
53
|
+
|
|
54
|
+
done:
|
|
55
|
+
prompt: "Refactoring complete. All touched files conform to current standards. Tests pass."
|
|
56
|
+
terminal: true
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: reflection
|
|
2
|
+
description: "Self-reflection after significant tasks — evaluate, classify, act"
|
|
3
|
+
initial: evaluate
|
|
4
|
+
max_transitions: 15
|
|
5
|
+
|
|
6
|
+
states:
|
|
7
|
+
evaluate:
|
|
8
|
+
prompt: |
|
|
9
|
+
Evaluate the completed task:
|
|
10
|
+
|
|
11
|
+
- Was it a clean pass, or were there errors/retries?
|
|
12
|
+
- Any hallucinations (made-up names, paths, APIs)?
|
|
13
|
+
- Unnecessary complexity added?
|
|
14
|
+
- User had to correct you or wait?
|
|
15
|
+
|
|
16
|
+
Choose transition:
|
|
17
|
+
- `has_lesson` → found something worth recording
|
|
18
|
+
- `clean` → task went smoothly
|
|
19
|
+
transitions:
|
|
20
|
+
has_lesson: classify
|
|
21
|
+
clean: done
|
|
22
|
+
|
|
23
|
+
classify:
|
|
24
|
+
prompt: |
|
|
25
|
+
Classify the lesson — where does it belong?
|
|
26
|
+
|
|
27
|
+
| Type | Destination | Example |
|
|
28
|
+
|------|------------|---------|
|
|
29
|
+
| Factual error, gotcha | Skill (ENRICH) | "Fib(47) overflows Int32" |
|
|
30
|
+
| Missing domain knowledge | New skill (CREATE) | No skill for gRPC |
|
|
31
|
+
| Process/approach pattern | Skill (ENRICH) | "Always verify packages" |
|
|
32
|
+
| Project-specific quirk | MEMORY.md | "Custom ORM, not EF" |
|
|
33
|
+
| Project build/config | MEMORY.md | "Needs --legacy-peer-deps" |
|
|
34
|
+
|
|
35
|
+
Choose transition:
|
|
36
|
+
- `enrich_skill` → update existing skill via skill-manager ENRICH
|
|
37
|
+
- `create_skill` → systemic gap, create new skill via skill-manager CREATE
|
|
38
|
+
- `update_memory` → project-specific, write to MEMORY.md
|
|
39
|
+
transitions:
|
|
40
|
+
enrich_skill: action
|
|
41
|
+
create_skill: action
|
|
42
|
+
update_memory: action
|
|
43
|
+
|
|
44
|
+
action:
|
|
45
|
+
prompt: |
|
|
46
|
+
Execute the classified action:
|
|
47
|
+
|
|
48
|
+
- **ENRICH**: identify which skill → research correct answer → use skill-manager ENRICH
|
|
49
|
+
- **CREATE**: only if systemic gap → use skill-manager CREATE
|
|
50
|
+
- **MEMORY.md**: write project-specific knowledge to auto-memory
|
|
51
|
+
|
|
52
|
+
After acting, acknowledge the lesson to the user honestly.
|
|
53
|
+
|
|
54
|
+
Choose transition:
|
|
55
|
+
- `done` → action completed
|
|
56
|
+
transitions:
|
|
57
|
+
done: done
|
|
58
|
+
|
|
59
|
+
done:
|
|
60
|
+
prompt: "Reflection complete."
|
|
61
|
+
terminal: true
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture
|
|
3
|
+
description: Simplicity-first architecture decisions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Architecture — Behavioral Correction
|
|
7
|
+
|
|
8
|
+
Claude's #1 architecture mistake: **adding complexity before pain exists.**
|
|
9
|
+
|
|
10
|
+
## Before Suggesting ANY Pattern
|
|
11
|
+
|
|
12
|
+
Three questions (if you can't answer all three concretely, suggest the simpler option):
|
|
13
|
+
1. **What specific pain exists RIGHT NOW?** (not theoretical)
|
|
14
|
+
2. **What's the simplest thing that solves just this pain?**
|
|
15
|
+
3. **How will I know when this decision becomes wrong?** (exit criteria)
|
|
16
|
+
|
|
17
|
+
## The Interface Trap (Verified Gotcha)
|
|
18
|
+
|
|
19
|
+
**DON'T:** Create interfaces "for testability" or "future flexibility"
|
|
20
|
+
**DO:** Create interfaces when you have 2+ real implementations OR a package boundary
|
|
21
|
+
**GOTCHA:** Single implementation behind interface is ceremony, not architecture
|
|
22
|
+
**EXCEPTION:** Public library APIs only
|
|
23
|
+
|
|
24
|
+
Sonnet defaults to "interfaces for testing are fine" — this skill corrects that.
|
|
25
|
+
|
|
26
|
+
## Response Template
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Simple approach: [simplest solution]
|
|
30
|
+
This works until: [specific pain point]
|
|
31
|
+
|
|
32
|
+
If you hit that pain, then consider: [next step up]
|
|
33
|
+
This adds: [specific cost]
|
|
34
|
+
But solves: [specific problem]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Initialization Belongs to the Owner
|
|
38
|
+
|
|
39
|
+
When a component needs setup logic (creating initial children, dispatching init events, setting initial state), that logic belongs **inside** the component — not in its parent.
|
|
40
|
+
|
|
41
|
+
**DON'T:** Parent creates component, then manually triggers component's internal logic from outside
|
|
42
|
+
**DO:** Component exposes an `open()` / `init()` method or handles it in constructor — parent just calls that
|
|
43
|
+
|
|
44
|
+
**Why:** Parent shouldn't know component's internal structure. If internals change, only the component changes — parent stays untouched.
|
|
45
|
+
|
|
46
|
+
## Serialization Doesn't Belong in Runtime State
|
|
47
|
+
|
|
48
|
+
**DON'T:** Put `serialize()`/`deserialize()` methods directly in runtime/state classes
|
|
49
|
+
**DO:** Keep serialization in a separate class or in the persistence layer
|
|
50
|
+
|
|
51
|
+
**Why:** Runtime state manages current values, interpolation, transitions. Serialization is I/O concern — different reason to change, different dependencies (XML, JSON, etc.). Mixing them inflates the class and hides the boundary.
|
|
52
|
+
|
|
53
|
+
**GOTCHA at review:** Inline serialization "works" and passes tests — the violation is structural, not functional. Actively check for it: if a class has both state logic AND `serialize`/`deserialize`, flag it.
|
|
54
|
+
|
|
55
|
+
When in doubt: **suggest the boring, proven, simple solution.**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coding-skill-selector
|
|
3
|
+
description: Select and load coding skills by file extensions and domains
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Coding skill selector
|
|
7
|
+
|
|
8
|
+
Load coding skills for files/context in this task.
|
|
9
|
+
|
|
10
|
+
1. Always: `Skill("preferences")` + `Skill("architecture")`
|
|
11
|
+
2. By extension:
|
|
12
|
+
- .py → `Skill("lang-python")`
|
|
13
|
+
- .hx → `Skill("lang-haxe")`
|
|
14
|
+
<!-- Add your own language/domain mappings here, e.g.: -->
|
|
15
|
+
<!-- - .cs → `Skill("preferences-csharp")` -->
|
|
16
|
+
3. By domain:
|
|
17
|
+
<!-- Add domain-specific skills here, e.g.: -->
|
|
18
|
+
<!-- - gamedev → `Skill("domain-gamedev")` -->
|
|
19
|
+
<!-- - CMake → `Skill("build-cmake")` -->
|
|
20
|
+
4. If 3+ files: `Skill("task-delegation")`
|
|
21
|
+
|
|
22
|
+
Call `Skill(name)` for EVERY matched skill.
|
|
23
|
+
|
|
24
|
+
**Gap check**: If files involve a language/domain with no matching skill,
|
|
25
|
+
ask the user: "No skill for [X] — proceed without, or create one first?"
|