claude-mcp-workflow 0.1.6 → 0.1.8

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.
Files changed (42) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +50 -8
  3. package/build/engine.d.ts +8 -0
  4. package/build/engine.d.ts.map +1 -1
  5. package/build/engine.js +18 -4
  6. package/build/engine.js.map +1 -1
  7. package/build/index.js +4 -0
  8. package/build/index.js.map +1 -1
  9. package/build/loader.d.ts +12 -0
  10. package/build/loader.d.ts.map +1 -1
  11. package/build/loader.js +35 -0
  12. package/build/loader.js.map +1 -1
  13. package/build/storage.d.ts +20 -0
  14. package/build/storage.d.ts.map +1 -1
  15. package/build/storage.js +41 -0
  16. package/build/storage.js.map +1 -1
  17. package/build/types.d.ts +1 -0
  18. package/build/types.d.ts.map +1 -1
  19. package/build/types.js +1 -0
  20. package/build/types.js.map +1 -1
  21. package/hooks/workflow-cleanup.sh +54 -20
  22. package/package.json +1 -1
  23. package/templates/bug-fix.yaml +47 -17
  24. package/templates/code-review.yaml +20 -43
  25. package/templates/file-review.yaml +64 -7
  26. package/templates/planning.yaml +4 -0
  27. package/templates/skills/architecture/SKILL.md +77 -0
  28. package/templates/skills/aws-lambda/SKILL.md +44 -0
  29. package/templates/skills/build-cmake/SKILL.md +58 -0
  30. package/templates/skills/ci-github-actions/SKILL.md +144 -0
  31. package/templates/skills/claude-code-config/SKILL.md +122 -0
  32. package/templates/skills/coding-skill-selector/SKILL.md +27 -11
  33. package/templates/skills/domain-gamedev/SKILL.md +162 -0
  34. package/templates/skills/domain-pixi/SKILL.md +163 -0
  35. package/templates/skills/domain-reid/SKILL.md +51 -0
  36. package/templates/skills/domain-yolo/SKILL.md +23 -0
  37. package/templates/skills/lang-as3/SKILL.md +22 -0
  38. package/templates/skills/lang-haxe/SKILL.md +649 -0
  39. package/templates/skills/mcp-setup/SKILL.md +18 -0
  40. package/templates/skills/target-openfl-native/SKILL.md +555 -0
  41. package/templates/skills/target-openfl-native/references/build-and-versions.md +60 -0
  42. package/templates/skills/task-delegation/SKILL.md +1 -0
package/build/types.js CHANGED
@@ -98,4 +98,5 @@ export const WorkflowSessionsInputSchema = z.object({}).optional();
98
98
  export const MAX_STACK_DEPTH = 10;
99
99
  export const DEFAULT_MAX_TRANSITIONS = 50;
100
100
  export const LOCK_STALE_MS = 5000;
101
+ export const KEEP_TERMINAL_SESSIONS = 3;
101
102
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iDAAiD;AAEjD,0EAA0E;AAC1E,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAClD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE3B,4DAA4D;IAC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AQ,EAAE;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACvD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC;KACxC,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAE/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEnE,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC"}
@@ -1,28 +1,38 @@
1
1
  #!/bin/bash
2
- # SessionEnd hook: abandon active workflow sessions for this Claude Code instance.
2
+ # SessionEnd hook: abandon this Claude Code instance's active workflow sessions
3
+ # (and their descendants), then cap retained terminal sessions so the state
4
+ # dir keeps only the most recent few for history — never grows unbounded.
3
5
  # Skips sessions referenced in plan files (they should survive context clears).
4
- # Modifies JSON files directly — does NOT depend on MCP server / dashboard being alive.
6
+ # Modifies JSON files directly — does NOT depend on MCP server being alive.
5
7
  read -t 1 -r INPUT
6
8
  STATE_DIR="${STATE_DIR:-$HOME/.claude/workflow-state}"
7
9
  PLANS_DIR="$HOME/.claude/plans"
8
10
  NOW=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")
11
+ # Mirror of KEEP_TERMINAL_SESSIONS in src/types.ts
12
+ KEEP_TERMINAL=3
9
13
  ABANDONED_SIDS=()
10
14
 
11
- for f in "$STATE_DIR"/*.json; do
12
- [ -f "$f" ] || continue
13
- SID=$(jq -r "select(.stack | length > 0) | select(.context.claude_code_pid == $PPID) | .session_id" "$f" 2>/dev/null)
14
- [ -n "$SID" ] || continue
15
- # Skip if session referenced in plan files
16
- [ -d "$PLANS_DIR" ] && grep -rql "$SID" "$PLANS_DIR"/ 2>/dev/null && continue
17
- # Abandon: clear stack, set outcome, append history entry
18
- TMP="${f}.tmp"
19
- jq --arg now "$NOW" '
20
- .history += [{ frame: .active_frame, event: "abandon", at: $now }] |
15
+ is_planned() {
16
+ [ -d "$PLANS_DIR" ] && [ -n "$1" ] && grep -rqlF "$1" "$PLANS_DIR"/ 2>/dev/null
17
+ }
18
+
19
+ abandon() {
20
+ local f="$1" event="${2:-abandon}" TMP="${f}.tmp"
21
+ jq --arg now "$NOW" --arg event "$event" '
22
+ .history += [{ frame: .active_frame, event: $event, at: $now }] |
21
23
  .stack = [] |
22
24
  .active_frame = -1 |
23
25
  .outcome = "abandoned" |
24
26
  .updated_at = $now
25
27
  ' "$f" > "$TMP" 2>/dev/null && mv "$TMP" "$f" || rm -f "$TMP"
28
+ }
29
+
30
+ for f in "$STATE_DIR"/*.json; do
31
+ [ -f "$f" ] || continue
32
+ SID=$(jq -r "select(.stack | length > 0) | select(.context.claude_code_pid == $PPID) | .session_id" "$f" 2>/dev/null)
33
+ [ -n "$SID" ] || continue
34
+ is_planned "$SID" && continue
35
+ abandon "$f"
26
36
  ABANDONED_SIDS+=("$SID")
27
37
  done
28
38
 
@@ -34,14 +44,8 @@ cascade_abandon() {
34
44
  local child_sid
35
45
  child_sid=$(jq -r --arg pid "$parent_sid" 'select(.parent_session_id == $pid) | select(.stack | length > 0) | .session_id' "$f" 2>/dev/null)
36
46
  [ -n "$child_sid" ] || continue
37
- TMP="${f}.tmp"
38
- jq --arg now "$NOW" '
39
- .history += [{ frame: .active_frame, event: "cascade_abandon", at: $now }] |
40
- .stack = [] |
41
- .active_frame = -1 |
42
- .outcome = "abandoned" |
43
- .updated_at = $now
44
- ' "$f" > "$TMP" 2>/dev/null && mv "$TMP" "$f" || rm -f "$TMP"
47
+ is_planned "$child_sid" && continue
48
+ abandon "$f" cascade_abandon
45
49
  cascade_abandon "$child_sid"
46
50
  done
47
51
  }
@@ -49,3 +53,33 @@ cascade_abandon() {
49
53
  for sid in "${ABANDONED_SIDS[@]}"; do
50
54
  cascade_abandon "$sid"
51
55
  done
56
+
57
+ # Cap retained terminal sessions: keep the KEEP_TERMINAL with the newest
58
+ # .updated_at, delete older ones. Full parity with Storage.pruneTerminal in
59
+ # src/storage.ts:
60
+ # - sort by the JSON .updated_at field (not file mtime) — abandon() bumps
61
+ # mtime via mv, so mtime order would diverge from the engine's retention;
62
+ # - secondary sort by .session_id — cascade abandon stamps every child with
63
+ # one identical .updated_at, so a stable tiebreak keeps the retained set
64
+ # deterministic and identical to the engine;
65
+ # - no is_planned guard here — terminal (empty-stack) sessions can never be
66
+ # plan-referenced (plan resume requires an active stack), same invariant
67
+ # the engine's pruneTerminal documents and relies on.
68
+ TERM_FILES=()
69
+ for f in "$STATE_DIR"/*.json; do
70
+ [ -f "$f" ] || continue
71
+ jq -e '.stack | length == 0' "$f" >/dev/null 2>&1 && TERM_FILES+=("$f")
72
+ done
73
+ if [ "${#TERM_FILES[@]}" -gt "$KEEP_TERMINAL" ]; then
74
+ i=0
75
+ while IFS=$'\t' read -r _ _ f; do
76
+ i=$((i + 1))
77
+ [ "$i" -le "$KEEP_TERMINAL" ] && continue
78
+ rm -f "$f"
79
+ done < <(
80
+ for f in "${TERM_FILES[@]}"; do
81
+ meta=$(jq -r '[.updated_at // "", .session_id // ""] | @tsv' "$f" 2>/dev/null)
82
+ printf '%s\t%s\n' "$meta" "$f"
83
+ done | sort -r -t $'\t' -k1,2
84
+ )
85
+ fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-mcp-workflow",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Structured workflow orchestration for AI agents via finite-state machines",
5
5
  "author": "AxGord <axgord@gmail.com> (https://github.com/AxGord)",
6
6
  "license": "MIT",
@@ -17,9 +17,17 @@ states:
17
17
  - `visual` → UI/layout bug — requires debug bridge, screenshots, visual reproduction
18
18
  - `logic` → data/logic bug — reproducible via unit tests or logs
19
19
  transitions:
20
- visual: reproduce_visual
20
+ visual: load_skills_visual
21
21
  logic: reproduce_logic
22
22
 
23
+ load_skills_visual:
24
+ skills:
25
+ - coding-skill-selector
26
+ - ?debug-bridge
27
+ - ?project-skill-selector
28
+ transitions:
29
+ continue: reproduce_visual
30
+
23
31
  reproduce_visual:
24
32
  task: "Reproduce the bug visually"
25
33
  prompt: |
@@ -28,17 +36,23 @@ states:
28
36
  DO NOT fix the bug here. You may add trace/log statements to help reproduce,
29
37
  but do NOT modify production logic. The fix belongs in the `fix` state.
30
38
 
31
- MANDATORY FIRST ACTION read the skill descriptions in the system-reminder skills list
32
- and call `Skill(name)` for EVERY skill whose description relates to debug bridges,
33
- interactive debugging, UI interaction, or the current app's domain.
34
- Do NOT skip this. Working without relevant skills leads to wasted time and errors.
39
+ REPRODUCTION TOOLINGfind the right tool:
40
+ 1. Check available MCP tools for browser/screenshot/debug-bridge capabilities.
41
+ 2. Pick the tool matching the platform.
42
+ 3. Persist the choice for verify_visual:
43
+ `context_set({ key: "chosen_tool", value: "<short name + how to launch>" })`
44
+
45
+ "No tooling available" is almost never true for a visual app. Verify the MCP
46
+ tool list before choosing `cant_reproduce`. Do NOT `abort()` to escape this
47
+ gate — use `cant_reproduce` if genuinely blocked.
35
48
 
36
49
  MANDATORY STEPS (all required, in order):
37
50
  1. Understand the exact user path that triggers the bug (which button, which file, which action)
38
- 2. Build and launch the app with debug bridge
39
- 3. Follow the SAME path the user described to trigger the bug
40
- 4. Take a screenshot and VERIFY the bug is visible
41
- 5. Describe what you see compare with the user's report
51
+ 2. Build (if applicable native targets must be built before launch)
52
+ 3. Launch the app and connect with the tool chosen above
53
+ 4. Follow the SAME path the user described to trigger the bug
54
+ 5. Take a screenshot and VERIFY the bug is visible
55
+ 6. Describe what you see — compare with the user's report
42
56
 
43
57
  STOP — self-check before transitioning:
44
58
  - Did you LAUNCH the app and take a SCREENSHOT? If not, you haven't reproduced.
@@ -50,7 +64,9 @@ states:
50
64
  `cant_reproduce` = you tried but can't see it. This leads to asking the user for help.
51
65
  NEVER use `reproduced` when you haven't seen the bug yourself.
52
66
 
53
- If the bug requires file operations, use the tm-interactive-debug skill recipes.
67
+ If the bug requires simulated input or file operations, use the chosen tool's
68
+ recipes: Playwright `browser_evaluate` / `browser_press_key` for web,
69
+ tm-interactive-debug for native.
54
70
  transitions:
55
71
  reproduced: diagnose
56
72
  cant_reproduce: clarify
@@ -86,7 +102,7 @@ states:
86
102
  transition `try_visual` to reproduce via debug bridge instead.
87
103
  transitions:
88
104
  reproduced: diagnose
89
- try_visual: reproduce_visual
105
+ try_visual: load_skills_visual
90
106
  cant_reproduce: clarify
91
107
 
92
108
  diagnose:
@@ -279,19 +295,33 @@ states:
279
295
  - Visual bug → `visual` (needs screenshot verification)
280
296
  - Logic bug → `logic` (tests already passed in testing workflow)
281
297
  transitions:
282
- visual: verify_visual
298
+ visual: load_skills_verify
283
299
  logic: done
284
300
 
301
+ load_skills_verify:
302
+ skills:
303
+ - coding-skill-selector
304
+ - ?debug-bridge
305
+ - ?project-skill-selector
306
+ transitions:
307
+ continue: verify_visual
308
+
285
309
  verify_visual:
286
310
  task: "Verify the fix visually"
287
311
  prompt: |
288
312
  Verify the original bug is fixed VISUALLY.
289
313
 
314
+ Tool chosen at reproduction: {{context.chosen_tool}}
315
+ (If empty — context was lost. Re-pick a tool now using the same approach
316
+ as reproduce_visual: check available MCP tools, pick the one matching the
317
+ platform.)
318
+
290
319
  MANDATORY STEPS:
291
- 1. Build and launch the app with debug bridge
292
- 2. Follow the SAME path used during reproduction
293
- 3. Take a screenshot and VERIFY the bug is gone
294
- 4. Compare before/after describe the visual difference
320
+ 1. Build (if applicable — native targets must be built before launch; rebuild after the fix)
321
+ 2. Launch the app using the tool above
322
+ 3. Follow the SAME path used during reproduction
323
+ 4. Take a screenshot and VERIFY the bug is gone
324
+ 5. Compare before/after — describe the visual difference
295
325
 
296
326
  DO NOT transition to `confirmed` without a screenshot proving the fix works.
297
327
  transitions:
@@ -302,7 +332,7 @@ states:
302
332
  task: "Clarify bug details"
303
333
  prompt: "Ask the user for more details about the bug."
304
334
  transitions:
305
- got_info_visual: reproduce_visual
335
+ got_info_visual: load_skills_visual
306
336
  got_info_logic: reproduce_logic
307
337
 
308
338
  escalate:
@@ -245,7 +245,7 @@ states:
245
245
  - No debatable concerns → `all_clear`
246
246
  transitions:
247
247
  has_concerns: discuss
248
- all_clear: re_review
248
+ all_clear: done
249
249
 
250
250
  discuss:
251
251
  task: "Discuss debatable concerns"
@@ -269,65 +269,42 @@ states:
269
269
  transitions:
270
270
  plan: plan_changes
271
271
  code: code_changes
272
- skip: re_review
272
+ skip: done
273
273
 
274
274
  plan_changes:
275
275
  task: "Plan agreed changes"
276
276
  sub_workflow: planning
277
- on_complete: verify_functional
277
+ on_complete: done
278
278
  on_fail: done
279
279
 
280
280
  code_changes:
281
281
  task: "Apply agreed changes"
282
282
  sub_workflow: coding
283
- on_complete: verify_functional
283
+ on_complete: verify_impact
284
284
  on_fail: done
285
285
 
286
- verify_functional:
287
- task: "Verify build and test functional changes"
288
- prompt: |
289
- Code was changed after discussion — verify correctness.
290
-
291
- 1. Run the project's build/compile command. Check for errors.
292
- - Build fails → fix errors, rebuild until it passes.
293
-
294
- 2. Check if any agreed changes modified functionality (not just cosmetic).
295
- If yes → run tests for the changed behavior. Use the project's test
296
- framework, or if no automated tests cover the change, describe what
297
- manual testing is needed and ask the user to verify.
298
- If all changes were cosmetic → build passing is sufficient.
299
-
300
- After verification:
301
- - `pass` → proceed to re-review
302
- - `fail` → changes broke the build beyond repair, skip to re-review without the failed changes
303
- transitions:
304
- pass: re_review
305
- fail: re_review
306
-
307
- re_review:
308
- task: "Re-review changed files for cascading issues"
286
+ verify_impact:
287
+ task: "Verify build, tests, and cross-file impact"
309
288
  prompt: |
310
- Previous fixes may have unblocked new issues or introduced cascading problems.
311
- Re-review ALL files that were modified in previous phases (apply_fixes, code_changes).
289
+ Code was changed after discussion verify correctness and impact.
312
290
 
313
- 1. Get the list of files changed since the review started (git diff or track from context).
314
- 2. If no files were changed (e.g. discussion resulted in no changes) → `clean`.
315
- 3. Spawn file-review agents for changed files with `scope: diff`
316
- (review only the new changes, not the entire file again).
317
- Use the same agent spawning pattern as `review_delegate`.
318
- 4. Collect reports.
291
+ 1. Run the project's build/compile command. Fix errors and rebuild until green.
319
292
 
320
- If new issues found `has_issues` (back to summarize for another cycle).
321
- If clean pass (0 new findings) `clean`.
293
+ 2. Run tests for changed behavior. If no automated tests cover the change,
294
+ describe what manual testing is needed and ask the user to verify.
295
+ Cosmetic-only changes → build passing is sufficient.
322
296
 
323
- **Iteration limit**: check context key `re_review_count`. If >= 3, transition
324
- `clean` regardless diminishing returns after 3 cycles. Otherwise, increment
325
- the counter via `context_set(key: "re_review_count", value: "<N+1>")`.
297
+ 3. Cross-file impact check: for each file modified during discussion,
298
+ identify other files in the original review set that use its changed
299
+ APIs/symbols. Quickly inspect those call sites for compile-time or
300
+ obvious behavior breakage. This is NOT a full re-review — only check
301
+ consumers of what changed.
326
302
 
327
- The goal is to loop until a clean pass — fixes stabilize and no new issues appear.
303
+ After verification, transition `complete`. The coding sub-workflow already
304
+ reviewed the files it modified. Planning produces a plan only — review
305
+ happens later when the plan is executed via the coding workflow.
328
306
  transitions:
329
- has_issues: summarize
330
- clean: done
307
+ complete: done
331
308
 
332
309
  done:
333
310
  prompt: "Review complete."
@@ -26,6 +26,30 @@ states:
26
26
  Check if similar code already exists elsewhere that could be reused or unified.
27
27
  4. Understand what changed and why.
28
28
 
29
+ Then → transition `done`.
30
+ transitions:
31
+ done: determine_authorship
32
+
33
+ determine_authorship:
34
+ task: "Determine code authorship"
35
+ prompt: |
36
+ Decide whether this file is user-authored or external/forked/vendored —
37
+ this gates which personal rules apply downstream (style + architecture).
38
+
39
+ Strong signals it is external / forked / vendored (set "false"):
40
+ - `git remote -v` points to a third-party upstream the user does not control.
41
+ - README/CLAUDE.md mentions "fork of X", "based on X", "vendored from X".
42
+ - Path lives under `node_modules/`, `vendor/`, `third_party/`, a haxelib
43
+ cache, or similar dependency location.
44
+
45
+ Save the verdict:
46
+ - ANY strong external signal present → `context_set({ key: "is_user_authored", value: "false" })`
47
+ - Otherwise → `context_set({ key: "is_user_authored", value: "true" })`
48
+
49
+ Default to "true" when signals are ambiguous — external markers are reliably
50
+ detectable; user-authored markers are not, so ambiguity falls on the
51
+ personal-rules side. Do not block on user input.
52
+
29
53
  Then → transition `done`.
30
54
  transitions:
31
55
  done: build_checklist
@@ -33,7 +57,14 @@ states:
33
57
  build_checklist:
34
58
  task: "Build style checklist from skills"
35
59
  prompt: |
36
- Build a concrete style checklist from loaded skills:
60
+ Check `{{context.is_user_authored}}`. Treat empty as `"true"` (default).
61
+
62
+ If `"false"` → personal style rules do not apply. Output:
63
+ "Skipping personal-style checklist — file is external/forked/vendored.
64
+ check_style will use only language-agnostic checks."
65
+ Then → transition `done`.
66
+
67
+ Otherwise (user-authored), build a concrete style checklist from loaded skills:
37
68
 
38
69
  Process each loaded `lang-*` and `preferences-*` skill ONE AT A TIME.
39
70
  For each skill:
@@ -123,27 +154,46 @@ states:
123
154
  check_style:
124
155
  task: "Check code style"
125
156
  prompt: |
157
+ Authorship: `{{context.is_user_authored}}` (set in determine_authorship).
158
+ Treat empty as `"true"` (default).
159
+
160
+ If `"false"` (external / forked / vendored):
161
+ Skip the personal-style checklist entirely. Match THAT codebase's existing
162
+ style — a one-line patch into a foreign project should look like it belongs.
163
+ Only flag issues from the language-agnostic checks below.
164
+
165
+ Otherwise (user-authored):
126
166
  Go through EVERY item in your style checklist from build_checklist.
167
+ Personal rules are authoritative — a neighboring file violating the same
168
+ rule is a bug replicated in both places, not a valid pattern. Flag it.
169
+ Never dismiss a checklist hit with "the sibling does it this way".
170
+
127
171
  Scope: `diff` = scan only lines in the diff; `full` = scan entire file.
128
172
  If a line appears in the diff, it is part of the change and must meet
129
173
  current style standards. Report with file:line.
130
174
 
131
- Additionally check:
175
+ Language-agnostic checks (apply regardless of authorship):
132
176
  - [ ] Missing type annotations: if a variable/field/parameter has no explicit type
133
177
  and adding one would improve clarity, recommend it — but ONLY after you find
134
178
  the actual type definition in the codebase (via Grep/Read). Never guess types.
135
179
  Use short type names + import, not fully qualified paths (e.g. `MyClass`,
136
180
  not `com.package.MyClass`) — unless a name conflict or conditional compilation
137
181
  requires the full path (check loaded lang/preferences skills for specifics).
138
- - [ ] Naming: consistent with conventions in neighboring files
182
+ - [ ] Naming: consistent with the conventions of THIS codebase (the user's own
183
+ for user-authored, the upstream's for external).
139
184
  - [ ] Member ordering: new fields and methods must respect class member order
140
185
  (constants → public vars → private vars → constructor → instance methods →
141
186
  static methods). Check that added code is in the right section, not just
142
187
  appended next to related code.
143
188
  - [ ] Duplication: does this duplicate existing code? Search the codebase.
144
- - [ ] Dead code: unused imports, commented-out code (dead guards checked in check_correctness)
189
+ - [ ] Dead code: unused imports, commented-out code (dead guards checked in check_correctness).
190
+ Imports used only inside conditional-compilation blocks are dead in
191
+ the other branches — reference such symbols via fully qualified name
192
+ inside the conditional block instead of adding a top-level import.
145
193
  - [ ] Complexity: overly nested logic, functions doing too many things
146
- - [ ] Consistency: does new code follow patterns in the same module?
194
+ - [ ] Consistency: does new code follow patterns in the same module of THIS
195
+ codebase? (For user-authored code, this means the user's own conventions —
196
+ not a license to replicate violations from sibling files.)
147
197
 
148
198
  Then → transition `done`.
149
199
  transitions:
@@ -152,17 +202,24 @@ states:
152
202
  check_architecture:
153
203
  task: "Check architecture"
154
204
  prompt: |
155
- Check structural quality (scope: `diff` = changed code, `full` = entire file):
205
+ Authorship: `{{context.is_user_authored}}` (set in determine_authorship).
206
+ Treat empty as `"true"` (default).
207
+
208
+ Check structural quality (scope: `diff` = changed code, `full` = entire file).
209
+
210
+ Language-agnostic checks (apply regardless of authorship):
156
211
  - [ ] Unnecessary indirection: wrapper classes/methods that just forward calls
157
212
  - [ ] Dead abstractions: interface with one implementation, base class with one subclass
158
213
  - [ ] God class: file doing too many unrelated things — should it be split?
159
214
  - [ ] Overcomplicated: deep inheritance or nesting that could be flattened
160
215
  - [ ] Wrong level: logic placed in the wrong layer (UI doing data work, model doing display)
161
216
  - [ ] Stale patterns: old patterns that predate current codebase conventions
217
+ - [ ] Complexity without pain: abstractions, patterns, or layers added for hypothetical future needs
218
+
219
+ Architecture-skill checks (skip ONLY when `is_user_authored` is `"false"`):
162
220
  - [ ] Initialization in parent: parent manually triggers component's internal setup — should be inside the component
163
221
  - [ ] Serialization in runtime state: serialize/deserialize mixed into state classes — should be separate
164
222
  - [ ] Event re-dispatch duplication: re-dispatched event carries fields that duplicate event.target
165
- - [ ] Complexity without pain: abstractions, patterns, or layers added for hypothetical future needs
166
223
 
167
224
  Only flag real simplification opportunities — don't invent hypothetical improvements.
168
225
 
@@ -56,6 +56,10 @@ states:
56
56
  running automatically in its review/testing states. Including them causes
57
57
  the agent to run manual builds that conflict with the automated pipeline.
58
58
 
59
+ **Brevity**: fewer steps. Skip what the user can infer from the task. Don't
60
+ restate the task back at the top of the plan. No filler sections (`Overview`,
61
+ `Background`) unless the task is genuinely novel and context is needed.
62
+
59
63
  **Steps in plan mode:**
60
64
  1. Explore codebase (Read/Glob/Grep or Plan/Explore subagents)
61
65
  2. Design approach
@@ -43,6 +43,17 @@ When a component needs setup logic (creating initial children, dispatching init
43
43
 
44
44
  **Why:** Parent shouldn't know component's internal structure. If internals change, only the component changes — parent stays untouched.
45
45
 
46
+ ## Runtime State Belongs to the Element Owner
47
+
48
+ When a UI element's state depends on app data (enabled/disabled, tooltip, label), the **decision logic** belongs in the component that owns the element — not in a parent coordinator.
49
+
50
+ **DON'T:** Parent computes `blocked = ...`, then sets `child.button.disabled = blocked` and `tooltipManager.add(child.button, text)`
51
+ **DO:** Parent passes raw data (`updateState(hasX, count)`), the owner decides and applies
52
+
53
+ **Why:** The owner already manages the element's other state (tooltips on language change, default values). If the parent bypasses the owner, state changes from different sources (language change, limit check) overwrite each other. When the owner controls all paths, it can cache state and re-apply consistently.
54
+
55
+ **Symptom of violation:** a parent sets a custom tooltip on a child's element, then a language-change handler in the child overwrites it — because the child doesn't know about the parent's custom state.
56
+
46
57
  ## Serialization Doesn't Belong in Runtime State
47
58
 
48
59
  **DON'T:** Put `serialize()`/`deserialize()` methods directly in runtime/state classes
@@ -52,4 +63,70 @@ When a component needs setup logic (creating initial children, dispatching init
52
63
 
53
64
  **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
65
 
66
+ ## Event Re-dispatch: Don't Duplicate `target`
67
+
68
+ When a composite re-dispatches events from children, `event.target` already identifies the original source.
69
+
70
+ **DON'T:** Add a `targetSource` / `originalSender` field to carry the child reference through re-dispatch
71
+ **DO:** Only add fields for data the child genuinely doesn't know (e.g. its index in the parent's collection)
72
+
73
+ **Rule:** Every field in an event must have at least one consumer. "Might be useful later" fields are overengineering.
74
+
75
+ ## Trace Full Data Flow Before Designing
76
+
77
+ Before proposing ANY storage or data mechanism, trace the COMPLETE path:
78
+ 1. **Where is it written?** (file save, cache build, sync download)
79
+ 2. **How is it serialized?** (binary format, XML, DB column)
80
+ 3. **How is it loaded?** (deserialized, copied, transformed)
81
+ 4. **How does it reach the consumer?** (direct reference, copy, event)
82
+
83
+ **DON'T:** Propose new storage mechanisms (counters, file scanning, new DB columns) before checking if the project already has infrastructure for this type of data.
84
+ **DO:** Find how analogous fields in the same system are stored and propagated. Follow the same path.
85
+
86
+ Common mistake: understanding WHERE data is stored but not HOW it flows through intermediate layers (serialization, copy-on-read, event dispatch). Missing one copy step = silent data loss.
87
+
55
88
  When in doubt: **suggest the boring, proven, simple solution.**
89
+
90
+ ## Guard Externalization: Clean Up the Callee
91
+
92
+ When moving a conditional guard from inside a function to its call site (wrapping the call in `if`), immediately remove the now-redundant parameter/branch from the callee.
93
+
94
+ **DON'T:** Make the call conditional but leave the parameter that's now always the same value
95
+ **DO:** Remove the parameter entirely — the caller's `if` IS the guard now
96
+
97
+ **Why:** A parameter that's always `true` (or always `false`) is dead code. It misleads readers into thinking there's a second code path. Finish the refactor in one step.
98
+
99
+ ## Refactoring Toward Shared State: Preserve Semantic Categories
100
+
101
+ When moving filtering logic from a caller into a shared state manager (allocator, registry, cache), verify the manager's API distinguishes all semantic categories the original code handled.
102
+
103
+ **DON'T:** Replace an explicit filter with a generic state query that collapses distinct categories
104
+ **DO:** List every category the original filter distinguished, confirm the API preserves each — or extend the API
105
+
106
+ **Example:** A resource allocator tracks "taken by owner X". Original code built a `forbidden` set from only *manually* assigned resources — auto-assigned ones were excluded because reallocation would reassign them. Replacing `forbidden` with `allocator.isAvailable()` collapsed manual and auto into one check, blocking resources that should have been selectable.
107
+
108
+ **Rule:** A generic `isX()` that returns the same answer for semantically different states is a lossy abstraction. Before using it, check: does the original code care *why* the state is set, not just *that* it's set?
109
+
110
+ ## Refactoring Scope: Don't Escalate Lifecycle
111
+
112
+ When refactoring an inline operation into a two-phase approach (set intent + execute), match the original operation's lifecycle scope.
113
+
114
+ **DON'T:** Wrap the new orchestration in container-level stop/start if the original operated at element level
115
+ **DO:** Let existing element-level lifecycle (setters, listeners) handle transitions — they already work
116
+
117
+ **Example:** A self-contained `selectNext()` swapped one item inline (release + take + index setter handled stop/start). Refactored to set intent + reallocate(). Added container-level stop/start around it. But start had an `isAvailable()` gate requiring a minimum active count — a constraint the original inline operation never hit. The element-level index setter already stops the old item and starts the new one.
118
+
119
+ **Rule:** Before adding lifecycle management to a refactored operation, check: did the original operation need it? If the original worked within existing infrastructure (setters, listeners), the refactored version should too.
120
+
121
+ ## New Canonical Path → Ask About Legacy Parallels
122
+
123
+ When you add a new canonical input/output mechanism that does the same thing as existing legacy paths (e.g. UI buttons that replicate keyboard shortcuts, a typed API replacing an untyped one, a structured event replacing a string topic), the default urge is to keep the legacy paths "for compatibility" and build a coexistence shim. Don't.
124
+
125
+ **DON'T:** Silently keep legacy paths AND add a coexistence shim (coordinate gates, target-checks, debouncers) so the new and old don't fight.
126
+ **DO:** Surface the question explicitly: "should we remove the old paths, or keep them?" — and prefer single-source by default.
127
+
128
+ **Example:** Added UI panel buttons that already handle the full action flow. Kept the original canvas tap (= fire) AND keyboard shortcuts (= fire). Adding the buttons made every panel click double-fire (tap dispatched on both panel and canvas), so a Y-coord gate was introduced to suppress canvas handling over the panel area. After confirming "remove keys and canvas-click entirely, the buttons are the way" — the gate became dead code, deleted in the same pass.
129
+
130
+ **Symptom of violation:** you find yourself adding gating logic (coordinate checks, `if (ev.target === ...)` filters, `inflight` flags) just to make two input paths coexist when one is meant to subsume the other.
131
+
132
+ **Rule:** A new canonical mechanism is an opportunity to remove the old one, not to add a referee between them. If the user didn't explicitly ask to keep both, ask before keeping both.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: aws-lambda
3
+ description: AWS Lambda .NET deployment gotchas
4
+ ---
5
+
6
+ # AWS Lambda + .NET Gotchas
7
+
8
+ ## VPC Networking
9
+
10
+ - **Subnet IP exhaustion on scale-up.** Each ENI consumes an IP from subnet. ENI account limit = 350 default. New instances silently fail to start when exhausted.
11
+ - **ENI creation lag: up to 90s** when function is created or VPC config changes. Invocations during this window get unpredictable cold starts.
12
+ - **S3/Secrets Manager calls timeout silently (not connection refused)** when Lambda is in VPC without NAT/VPC Endpoint. Easy to misdiagnose as SDK bug.
13
+
14
+ ## Logging
15
+
16
+ - **`Console.Error.WriteLine()` does NOT appear in CloudWatch.** Use `ILambdaContext.Logger.LogLine()` in handler code or `ILogger` in ASP.NET pipeline.
17
+ - **Missing `logs:CreateLogGroup` permission = logs silently lost.** Log group created lazily on first invoke. No permission = no log group = nowhere to write = no error visible anywhere.
18
+
19
+ ## ASP.NET Core in Lambda
20
+
21
+ - **`UseHttpsRedirection()` hangs Lambda.** No Kestrel HTTPS port. Middleware hangs trying to discover one (aws-lambda-dotnet #1543). Only enable in Development.
22
+ - **Response > 6MB crashes INIT phase, not 413.** `APIGatewayHttpApiV2ProxyFunction` throws exception in Lambda runtime client during initialization, taking down the entire ASP.NET Core app instead of returning HTTP error.
23
+
24
+ ## S3 from Lambda
25
+
26
+ - **SDK default timeout = infinite, retry = 4 with exponential backoff.** Total wait 30-60s can exceed Lambda timeout. Always set `Timeout` and `MaxErrorRetry` on `AmazonS3Config`.
27
+ - **`AmazonS3Client` without explicit region defaults to `us-east-1`.** Cross-region requests are slower. No error if IAM allows it — silent performance degradation.
28
+ - **IMDS credential error is cached.** If Instance Metadata Service is transiently unavailable during first init, SDK caches the error. All subsequent requests fail until container restart.
29
+
30
+ ## .NET Cold Start
31
+
32
+ - **ReadyToRun (R2R) compiled on macOS/Windows is ignored in Lambda (Amazon Linux 2).** Must publish with `--runtime linux-x64`. R2R flag silently has no effect cross-platform.
33
+ - **Container deploy: INIT phase is billed. ZIP deploy: INIT phase is free.** For .NET with heavy startup, significant cost difference.
34
+ - **EF Core `Database.Migrate()` default command timeout = 30s.** Heavy migrations fail with EF timeout, not Lambda timeout. Set `CommandTimeout` explicitly.
35
+
36
+ ## Function URL
37
+
38
+ - **CORS headers not returned without `Origin` header in request.** Preflight without Origin returns 200 but no Access-Control-* headers. Browser blocks the actual request. Hard to diagnose — server returns 200.
39
+
40
+ ## IAM & Deployment
41
+
42
+ - **`UpdateFunctionCode` + `UpdateFunctionConfiguration` cannot run simultaneously.** Gives `ResourceConflictException`. CI/CD must wait for `LastUpdateStatus: Successful` between calls.
43
+ - **`State: Active` does NOT mean ready.** `LastUpdateStatus: InProgress` means API calls will fail with `ResourceConflictException`. Must check both fields.
44
+ - **Provisioned Concurrency on alias/version doesn't help `$LATEST`.** Must invoke the aliased version to benefit. CLI deploys without explicit alias still get cold starts.