claude-dev-env 1.93.0 → 1.94.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.
Files changed (220) hide show
  1. package/_shared/pr-loop/CLAUDE.md +1 -0
  2. package/_shared/pr-loop/audit-contract.md +1 -1
  3. package/_shared/pr-loop/gh-payloads.md +3 -3
  4. package/_shared/pr-loop/post-audit-thread-contract.md +51 -0
  5. package/_shared/pr-loop/scripts/README.md +2 -2
  6. package/_shared/pr-loop/scripts/code_rules_gate.py +127 -13
  7. package/_shared/pr-loop/scripts/fix_hookspath.py +47 -12
  8. package/_shared/pr-loop/scripts/pr_loop_shared_constants/code_rules_gate_constants.py +4 -0
  9. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +146 -69
  10. package/_shared/pr-loop/scripts/tests/test_fix_hookspath.py +497 -374
  11. package/_shared/pr-loop/state-schema.md +3 -22
  12. package/bin/CLAUDE.md +1 -1
  13. package/bin/install.mjs +2 -7
  14. package/bin/install.test.mjs +10 -4
  15. package/hooks/blocking/CLAUDE.md +2 -0
  16. package/hooks/blocking/pii_commit_command.py +398 -0
  17. package/hooks/blocking/pii_payload_scan.py +133 -0
  18. package/hooks/blocking/pii_prevention_blocker.py +151 -449
  19. package/hooks/blocking/pii_scanner.py +26 -1
  20. package/hooks/blocking/test_code_rules_enforcer_dead_config_field.py +2 -2
  21. package/hooks/blocking/test_pii_prevention_blocker.py +299 -0
  22. package/hooks/blocking/test_pii_scanner.py +27 -2
  23. package/hooks/blocking/test_verdict_directory_write_blocker.py +42 -7
  24. package/hooks/hooks_constants/CLAUDE.md +2 -2
  25. package/hooks/hooks_constants/code_rules_path_utils_constants.py +0 -2
  26. package/hooks/hooks_constants/local_identity.py +65 -15
  27. package/hooks/hooks_constants/pii_prevention_constants.py +20 -8
  28. package/hooks/hooks_constants/pr_description_enforcer_constants.py +1 -1
  29. package/hooks/hooks_constants/test_local_identity.py +68 -0
  30. package/package.json +1 -1
  31. package/scripts/CLAUDE.md +10 -1
  32. package/scripts/Get-SessionAccount.ps1 +210 -0
  33. package/scripts/tests/CLAUDE.md +15 -1
  34. package/scripts/tests/Get-SessionAccount.Tests.ps1 +350 -0
  35. package/skills/CLAUDE.md +3 -25
  36. package/skills/anthropic-plan/SKILL.md +1 -13
  37. package/skills/autoconverge/CLAUDE.md +5 -2
  38. package/skills/autoconverge/SKILL.md +112 -387
  39. package/skills/autoconverge/reference/CLAUDE.md +4 -1
  40. package/skills/autoconverge/reference/closing-report.md +9 -2
  41. package/skills/autoconverge/reference/convergence.md +26 -22
  42. package/skills/autoconverge/reference/headless-safety.md +44 -0
  43. package/skills/autoconverge/reference/multi-pr.md +88 -0
  44. package/skills/autoconverge/reference/self-closing-loop.md +84 -0
  45. package/skills/autoconverge/reference/stop-conditions.md +21 -13
  46. package/skills/autoconverge/workflow/converge.clean-audit.test.mjs +87 -27
  47. package/skills/autoconverge/workflow/converge.contract.test.mjs +40 -10
  48. package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +179 -47
  49. package/skills/autoconverge/workflow/converge.fix-progress.test.mjs +1 -1
  50. package/skills/autoconverge/workflow/converge.mjs +284 -94
  51. package/skills/bugteam/CLAUDE.md +1 -1
  52. package/skills/bugteam/CONSTRAINTS.md +3 -3
  53. package/skills/bugteam/PROMPTS.md +8 -19
  54. package/skills/bugteam/SKILL.md +13 -14
  55. package/skills/bugteam/reference/CLAUDE.md +1 -1
  56. package/skills/bugteam/reference/audit-and-teammates.md +2 -2
  57. package/skills/bugteam/reference/copilot-gap-analysis.md +2 -0
  58. package/skills/bugteam/reference/github-pr-reviews.md +56 -38
  59. package/skills/bugteam/reference/team-setup.md +11 -11
  60. package/skills/bugteam/scripts/CLAUDE.md +6 -6
  61. package/skills/bugteam/scripts/README.md +20 -8
  62. package/skills/bugteam/scripts/bugteam_code_rules_gate.py +13 -1463
  63. package/skills/bugteam/scripts/bugteam_fix_hookspath.py +23 -358
  64. package/skills/bugteam/scripts/bugteam_preflight.py +13 -315
  65. package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +2 -3
  66. package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +34 -1053
  67. package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +30 -347
  68. package/skills/bugteam/scripts/test_bugteam_preflight.py +30 -305
  69. package/skills/copilot-finding-triage/SKILL.md +80 -28
  70. package/skills/copilot-finding-triage/reference/tier-rubric.md +70 -11
  71. package/skills/copilot-finding-triage/templates/notification.md +8 -3
  72. package/skills/everything-search/SKILL.md +1 -2
  73. package/skills/grokify/SKILL.md +58 -0
  74. package/skills/grokify/templates/handoff-template.md +92 -0
  75. package/skills/orchestrator/SKILL.md +12 -8
  76. package/skills/orchestrator-refresh/SKILL.md +3 -3
  77. package/skills/pr-converge/SKILL.md +132 -233
  78. package/skills/pr-converge/reference/convergence-gates.md +102 -66
  79. package/skills/pr-converge/reference/examples.md +37 -25
  80. package/skills/pr-converge/reference/fix-protocol.md +7 -7
  81. package/skills/pr-converge/reference/multi-pr-orchestration.md +10 -4
  82. package/skills/pr-converge/reference/per-tick.md +64 -41
  83. package/skills/pr-converge/reference/state-schema.md +27 -2
  84. package/skills/pr-converge/scripts/CLAUDE.md +8 -0
  85. package/skills/pr-converge/scripts/README.md +4 -3
  86. package/skills/pr-converge/scripts/_pr_converge_path_setup.py +23 -0
  87. package/skills/pr-converge/scripts/check_convergence.py +189 -645
  88. package/skills/pr-converge/scripts/check_convergence_gates.py +235 -0
  89. package/skills/pr-converge/scripts/check_convergence_thread_gates.py +219 -0
  90. package/skills/pr-converge/scripts/conftest.py +8 -0
  91. package/skills/pr-converge/scripts/pr_converge_scripts_constants/CLAUDE.md +1 -0
  92. package/skills/pr-converge/scripts/pr_converge_scripts_constants/convergence_gate_constants.py +36 -0
  93. package/skills/pr-converge/scripts/test__pr_converge_path_setup.py +26 -0
  94. package/skills/pr-converge/scripts/test_check_convergence.py +73 -228
  95. package/skills/pr-converge/scripts/test_check_convergence_contract.py +321 -0
  96. package/skills/pr-converge/scripts/test_check_convergence_gates.py +68 -0
  97. package/skills/pr-converge/scripts/test_check_convergence_thread_gates.py +75 -0
  98. package/skills/privacy-hygiene/SKILL.md +8 -7
  99. package/skills/reviewer-gates/SKILL.md +26 -8
  100. package/skills/session-log/SKILL.md +11 -12
  101. package/skills/session-tidy/SKILL.md +40 -30
  102. package/skills/skill-builder/CLAUDE.md +13 -10
  103. package/skills/skill-builder/SKILL.md +31 -31
  104. package/skills/skill-builder/references/CLAUDE.md +10 -6
  105. package/skills/skill-builder/references/delegation-map.md +13 -4
  106. package/skills/skill-builder/references/description-field.md +113 -0
  107. package/skills/skill-builder/references/self-audit-checklist.md +21 -4
  108. package/skills/skill-builder/references/skill-modularity.md +113 -0
  109. package/skills/skill-builder/references/skill-types.md +4 -0
  110. package/skills/skill-builder/templates/CLAUDE.md +4 -4
  111. package/skills/skill-builder/templates/gap-analysis.md +25 -1
  112. package/skills/skill-builder/workflows/CLAUDE.md +6 -4
  113. package/skills/skill-builder/workflows/improve-skill.md +17 -16
  114. package/skills/skill-builder/workflows/new-skill.md +34 -10
  115. package/skills/skill-builder/workflows/polish-skill.md +59 -43
  116. package/skills/usage-pause/SKILL.md +10 -14
  117. package/skills/bdd-protocol/CLAUDE.md +0 -26
  118. package/skills/bdd-protocol/SKILL.md +0 -30
  119. package/skills/bdd-protocol/references/CLAUDE.md +0 -10
  120. package/skills/bdd-protocol/references/anti-patterns.md +0 -26
  121. package/skills/bdd-protocol/references/example-mapping.md +0 -23
  122. package/skills/bg-agent/CLAUDE.md +0 -17
  123. package/skills/bg-agent/SKILL.md +0 -69
  124. package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_code_rules_gate_constants.py +0 -55
  125. package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_fix_hookspath_constants.py +0 -26
  126. package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_preflight_constants.py +0 -35
  127. package/skills/caveman/CLAUDE.md +0 -15
  128. package/skills/caveman/SKILL.md +0 -38
  129. package/skills/code/CLAUDE.md +0 -17
  130. package/skills/code/SKILL.md +0 -178
  131. package/skills/deep-research/CLAUDE.md +0 -17
  132. package/skills/deep-research/SKILL.md +0 -80
  133. package/skills/findbugs/CLAUDE.md +0 -20
  134. package/skills/findbugs/SKILL.md +0 -241
  135. package/skills/fixbugs/CLAUDE.md +0 -19
  136. package/skills/fixbugs/SKILL.md +0 -142
  137. package/skills/gh-paginate/CLAUDE.md +0 -18
  138. package/skills/gh-paginate/SKILL.md +0 -84
  139. package/skills/gotcha/CLAUDE.md +0 -33
  140. package/skills/gotcha/SKILL.md +0 -73
  141. package/skills/implement/CLAUDE.md +0 -27
  142. package/skills/implement/SKILL.md +0 -66
  143. package/skills/implement/scripts/CLAUDE.md +0 -22
  144. package/skills/implement/scripts/append_note.py +0 -133
  145. package/skills/implement/scripts/implement_scripts_constants/CLAUDE.md +0 -22
  146. package/skills/implement/scripts/implement_scripts_constants/__init__.py +0 -0
  147. package/skills/implement/scripts/implement_scripts_constants/notes_constants.py +0 -12
  148. package/skills/implement/scripts/test_append_note.py +0 -191
  149. package/skills/log-audit/CLAUDE.md +0 -20
  150. package/skills/log-audit/SKILL.md +0 -66
  151. package/skills/log-audit/reference/CLAUDE.md +0 -9
  152. package/skills/log-audit/reference/charter.md +0 -52
  153. package/skills/log-audit/scripts/CLAUDE.md +0 -27
  154. package/skills/log-audit/scripts/cluster_recurrences.py +0 -261
  155. package/skills/log-audit/scripts/collect_log_window.py +0 -199
  156. package/skills/log-audit/scripts/log_audit_constants/CLAUDE.md +0 -12
  157. package/skills/log-audit/scripts/log_audit_constants/__init__.py +0 -0
  158. package/skills/log-audit/scripts/log_audit_constants/cluster_recurrences_constants.py +0 -23
  159. package/skills/log-audit/scripts/log_audit_constants/collect_log_window_constants.py +0 -24
  160. package/skills/log-audit/scripts/log_audit_constants/mine_copilot_findings_constants.py +0 -49
  161. package/skills/log-audit/scripts/mine_copilot_findings.py +0 -302
  162. package/skills/log-audit/scripts/test_cluster_recurrences.py +0 -160
  163. package/skills/log-audit/scripts/test_collect_log_window.py +0 -111
  164. package/skills/log-audit/scripts/test_mine_copilot_findings.py +0 -126
  165. package/skills/logifix/CLAUDE.md +0 -36
  166. package/skills/logifix/SKILL.md +0 -69
  167. package/skills/logifix/scripts/CLAUDE.md +0 -16
  168. package/skills/logifix/scripts/logifix.ps1 +0 -205
  169. package/skills/monitor-open-prs/CLAUDE.md +0 -34
  170. package/skills/monitor-open-prs/SKILL.md +0 -88
  171. package/skills/monitor-open-prs/scripts/CLAUDE.md +0 -17
  172. package/skills/monitor-open-prs/scripts/discover_open_prs.py +0 -69
  173. package/skills/monitor-open-prs/scripts/test_discover_open_prs.py +0 -149
  174. package/skills/monitor-open-prs/test_skill_contract.py +0 -27
  175. package/skills/post-audit-findings/SKILL.md +0 -80
  176. package/skills/pr-consistency-audit/CLAUDE.md +0 -34
  177. package/skills/pr-consistency-audit/SKILL.md +0 -116
  178. package/skills/pr-consistency-audit/reference/CLAUDE.md +0 -16
  179. package/skills/pr-consistency-audit/reference/detection-rules.md +0 -96
  180. package/skills/pr-consistency-audit/reference/illustrations.md +0 -78
  181. package/skills/pr-fix-protocol/SKILL.md +0 -65
  182. package/skills/pr-review-responder/CLAUDE.md +0 -35
  183. package/skills/pr-review-responder/EXAMPLES.md +0 -590
  184. package/skills/pr-review-responder/PRINCIPLES.md +0 -533
  185. package/skills/pr-review-responder/README.md +0 -168
  186. package/skills/pr-review-responder/SKILL.md +0 -203
  187. package/skills/pr-review-responder/TESTING.md +0 -350
  188. package/skills/pr-scope-resolve/SKILL.md +0 -45
  189. package/skills/pre-compact/CLAUDE.md +0 -24
  190. package/skills/pre-compact/SKILL.md +0 -134
  191. package/skills/qbug/CLAUDE.md +0 -40
  192. package/skills/qbug/SKILL.md +0 -387
  193. package/skills/qbug/test_qbug_skill_audit_schema.py +0 -152
  194. package/skills/qbug/test_qbug_skill_post_fix_audit.py +0 -103
  195. package/skills/refine/CLAUDE.md +0 -44
  196. package/skills/refine/SKILL.md +0 -262
  197. package/skills/refine/templates/CLAUDE.md +0 -17
  198. package/skills/refine/templates/implementation-notes-template.html +0 -56
  199. package/skills/refine/templates/plan-template.md +0 -60
  200. package/skills/research-mode/CLAUDE.md +0 -35
  201. package/skills/research-mode/SKILL.md +0 -53
  202. package/skills/structure-prompt/CLAUDE.md +0 -42
  203. package/skills/structure-prompt/SKILL.md +0 -44
  204. package/skills/structure-prompt/reference/CLAUDE.md +0 -28
  205. package/skills/structure-prompt/reference/adversarial-tuning.md +0 -62
  206. package/skills/structure-prompt/reference/block-classification.md +0 -27
  207. package/skills/structure-prompt/reference/canonical-case.md +0 -48
  208. package/skills/structure-prompt/reference/citation-depth.md +0 -70
  209. package/skills/structure-prompt/reference/cleanup.md +0 -33
  210. package/skills/structure-prompt/reference/constraints.md +0 -33
  211. package/skills/structure-prompt/reference/directives.md +0 -37
  212. package/skills/structure-prompt/reference/examples.md +0 -72
  213. package/skills/structure-prompt/reference/instantiation.md +0 -51
  214. package/skills/structure-prompt/reference/output-contract.md +0 -72
  215. package/skills/structure-prompt/reference/per-category.md +0 -23
  216. package/skills/structure-prompt/reference/persona.md +0 -38
  217. package/skills/structure-prompt/reference/research.md +0 -33
  218. package/skills/structure-prompt/reference/structure.md +0 -28
  219. package/skills/verified-build/CLAUDE.md +0 -33
  220. package/skills/verified-build/SKILL.md +0 -33
@@ -1,134 +0,0 @@
1
- ---
2
- name: pre-compact
3
- description: >-
4
- Composes a focus directive for /compact and copies the full "/compact <directive>"
5
- string to the clipboard, pinning the session's load-bearing identifiers (branch, PR,
6
- HEAD, worktree, in-flight work, decisions, blockers, files in play) after validating
7
- each against its live source. Use on /pre-compact or any ask to prep for compaction.
8
- disable-model-invocation: true
9
- ---
10
-
11
- # Pre-Compact
12
-
13
- `/compact [instructions]` accepts a focus directive that steers the
14
- compaction-summary LLM toward high-signal content. This skill writes that
15
- directive from the live session and copies the full `/compact <directive>`
16
- string to the operator's clipboard.
17
-
18
- **Announce at start:** "I'm composing your compact focus directive."
19
-
20
- ## Step 1 — Confirm the next-session intent
21
-
22
- Before composing anything, ask the operator what they intend to work on in
23
- the next chat. Do not infer it silently from the conversation, and do not
24
- ask it raw — use `AskUserQuestion` with two to four options drawn from the
25
- session context (the threads left open, the obvious next actions, the task
26
- the operator last steered toward); the tool's free-text fallback covers
27
- anything unlisted. The selected intent is the directive's forward task:
28
- Step 2 scopes every field to what that intent needs, and the rendered
29
- `In-flight` line states it.
30
-
31
- ## Step 2 — Read and validate the live session
32
-
33
- Validate every identifier directly before stating it. Conversation context
34
- goes stale within a session — a PR merges, HEAD advances, a worktree
35
- advances to a newer commit — so confirm each value against its live source
36
- at compose time rather than carrying it from memory. Run the command in
37
- each field's Source column; for a PR, capture its merge state
38
- (`gh pr view --json state,mergedAt`) and state `merged` or `open` from that
39
- result, never from recollection. A value that cannot be confirmed against a
40
- live source is not dropped silently — surface it to the operator via
41
- `AskUserQuestion` to clarify (offer the candidate values found plus the
42
- free-text fallback) and use the answer. Omit it only when the operator
43
- chooses to skip it.
44
-
45
- | Field | What to capture | Source |
46
- |---|---|---|
47
- | `branch` | Active branch name | `git branch --show-current` |
48
- | `pr` | Active PR number and its merge state (open / merged), when one exists | `gh pr view --json number,state,mergedAt` |
49
- | `head` | Short HEAD SHA (whatever `git rev-parse --short` outputs) | `git rev-parse --short HEAD` |
50
- | `worktree` | Absolute path to the working directory | `pwd` |
51
- | `in_flight` | One sentence describing what is being worked on right now | conversation |
52
- | `decisions` | Architectural choices, library picks, tradeoffs settled this session | conversation |
53
- | `blockers` | Failures observed, root causes identified, fixes pending | conversation |
54
- | `files` | Paths the operator is iterating on (edited or read more than once) | conversation |
55
- | `follow_ups` | What the user asked to be remembered or revisited | conversation |
56
-
57
- A field whose value cannot be stated as a concrete identifier is omitted
58
- from the directive.
59
-
60
- Scope every field to what the Step 1 intent needs next. Compaction carries
61
- forward the slice of session history the remaining work needs: capture a
62
- `decision`, `blocker`, or `in_flight` detail when a next step relies on
63
- it, and leave a detail the next steps do not touch (a settled question, a
64
- resolved blocker, a path not taken) out by simply not listing it. When a
65
- settled decision still constrains the next step, list its outcome as one
66
- line, not the deliberation behind it.
67
-
68
- ## Step 3 — Render the directive
69
-
70
- Render this exact shape, populating only the fields with concrete values:
71
-
72
- ```
73
- Preserve:
74
- - Branch: <name>
75
- - PR: #<number>
76
- - HEAD: <short-sha>
77
- - Worktree: <path>
78
- - In-flight: <one sentence>
79
- - Decisions: <bullet per decision>
80
- - Blockers: <bullet per blocker>
81
- - Files: <path>, <path>, <path>
82
- - Follow-ups: <bullet per follow-up>
83
- ```
84
-
85
- The directive lists only what the next steps consume, so the summarizer
86
- preserves that with high fidelity and compresses the rest of the trace on
87
- its own — naming what to keep is a clearer instruction than enumerating
88
- what to cut. Keep the list tight: a `Preserve:` block padded with finished
89
- or out-of-scope context dilutes the summarizer's focus on what happens
90
- next.
91
-
92
- Source: [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
93
- — "start by maximizing recall to ensure your compaction prompt captures
94
- every relevant piece of information from the trace, then iterate to improve
95
- precision by eliminating superfluous content."
96
-
97
- ## Step 4 — Copy `/compact <directive>` to the clipboard
98
-
99
- Write the full `/compact <directive>` string to a temporary file via the
100
- Write tool, then copy the file contents to the clipboard with PowerShell:
101
-
102
- ```
103
- pwsh -NoProfile -Command "Get-Content -LiteralPath '<temp file path>' -Raw | Set-Clipboard"
104
- ```
105
-
106
- `Get-Content -LiteralPath … -Raw` reads the file as a single string with
107
- no wildcard expansion, and `Set-Clipboard` writes it verbatim. The intermediate file keeps the directive content out
108
- of any shell-parsing path: session text passes through `Get-Content`
109
- unmodified regardless of which characters it contains.
110
-
111
- A reasonable temp path under `$env:TEMP` (Windows) or `$TMPDIR` (POSIX)
112
- works; clean it up after the `Set-Clipboard` call returns.
113
-
114
- ## Step 5 — Hand off
115
-
116
- Print this confirmation line to the operator:
117
-
118
- > Copied `/compact …` to your clipboard. Paste it as your next prompt to
119
- > compact this conversation with focus.
120
-
121
- Then list up to the first three `Preserve:` bullets (or fewer when the
122
- directive omits fields) inline so the operator can spot-check before
123
- pasting.
124
-
125
- ---
126
-
127
- ## References
128
-
129
- - `/compact [instructions]` — [Claude Code commands](https://code.claude.com/docs/en/commands)
130
- - Compaction strategy — [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
131
-
132
- ## Folder map
133
-
134
- - `SKILL.md` — hub. No companions.
@@ -1,40 +0,0 @@
1
- # qbug
2
-
3
- Quick baseline PR audit: one clean-coder subagent loops audit → fix → commit → push until the PR is clean or stuck.
4
-
5
- **Trigger:** `/qbug`, "quick bug audit", "solo bug audit", "baseline PR review", "bugteam without a team".
6
-
7
- ## Purpose
8
-
9
- `/qbug` is the required baseline review for every new PR. It runs the same A–P bug category rubric and CODE_RULES gate as `/bugteam` but with a single persistent subagent (no TeamCreate, no per-loop clean-room, no loop cap). Escalate to `/bugteam` when bias isolation across loops matters.
10
-
11
- ## Key files
12
-
13
- | File | Purpose |
14
- |---|---|
15
- | `SKILL.md` | The complete skill — four steps (pre-flight, resolve PR scope via the `pr-scope-resolve` skill, spawn subagent cycle, final report). The subagent XML prompt is inline and points the embedded agent at the `post-audit-findings` and `pr-fix-protocol` skills for review posting and reply/resolve mechanics. |
16
-
17
- ## Shared artifacts (referenced by path, not copied)
18
-
19
- The skill references shared scripts from `../_shared/pr-loop/scripts/`:
20
-
21
- | Script | Role |
22
- |---|---|
23
- | `preflight.py` | Git hooks path check, pytest, optional pre-commit |
24
- | `code_rules_gate.py` | CODE_RULES gate run before every AUDIT |
25
- | `post_audit_thread.py` | Posts one GitHub review per loop (APPROVE or REQUEST_CHANGES) |
26
- | `audit-reply-template.md` | Unified reply body shape for resolved threads |
27
-
28
- Bug category rubric A–P lives at `../bugteam/PROMPTS.md`. Audit contract (finding schema, proof-of-absence, Haiku secondary, self-audit) lives at `../../_shared/pr-loop/audit-contract.md`.
29
-
30
- ## Subagent structure
31
-
32
- - **Primary:** `clean-coder` — runs the full audit → fix → commit → push cycle internally.
33
- - **Secondary:** `code-quality-agent` (Haiku model) — audit-only, read-only; findings merged before FIX step.
34
- - No `TeamCreate`. No loop cap. Exits on `converged`, `stuck`, or `error`.
35
-
36
- ## Conventions
37
-
38
- - The lead resolves the temp directory via Python's `tempfile.gettempdir()` and passes the absolute path to the subagent.
39
- - Each loop: one `code_rules_gate.py` pre-audit, one GitHub review posted, one commit on fix.
40
- - Self-PR toggle, findings-JSON mapping, and anchored-only serialization live in the `post-audit-findings` skill; reply-and-resolve mechanics live in the `pr-fix-protocol` skill.
@@ -1,387 +0,0 @@
1
- ---
2
- name: qbug
3
- description: >-
4
- Required baseline review for every new PR: runs the /bugteam audit, fix,
5
- commit, and push cycle through one clean-coder subagent (not a full team),
6
- looping until convergence or stuck. Triggers: '/qbug', 'quick bug audit',
7
- 'solo bug audit', 'baseline PR review', 'bugteam without a team'.
8
- ---
9
-
10
- # qbug
11
-
12
- **Core principle:** One `clean-coder` subagent loops audit → fix → commit → push until converged or stuck. The subagent's context persists across loops (no per-loop clean-room) — that is the explicit trade vs /bugteam.
13
-
14
- **When to reach for /qbug vs /bugteam:** `/qbug` is the required baseline review for every new PR (fastest path from "ready" to "merged-safe"). Escalate to `/bugteam` when the PR is large enough that anchoring-bias across loops becomes a convergence risk, or when a hard loop cap is required for cost control.
15
-
16
- Shared artifacts with /bugteam are referenced below by path, using the `${CLAUDE_SKILL_DIR}` host-substitution convention (both skills land under `~/.claude/skills/` after install):
17
-
18
- - Pre-flight script: `${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/preflight.py`
19
- - Code-rules gate script: `${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/code_rules_gate.py`
20
- - Bug category rubric A–P: [`bugteam/PROMPTS.md`](../bugteam/PROMPTS.md#audit-spawn-prompt-xml-bugfind-teammate)
21
- - **Audit contract** (finding schema, proof-of-absence, adversarial pass, Haiku secondary, post-fix self-audit, diagnostics JSON): [`_shared/pr-loop/audit-contract.md`](../../_shared/pr-loop/audit-contract.md)
22
- - PR comment lifecycle shape: [`bugteam/SKILL.md`](../bugteam/SKILL.md#audit-posting)
23
-
24
- ## Transport check (before any GitHub step)
25
-
26
- Run `command -v gh`; when it succeeds, run `gh auth status`; once the PR scope is resolved, run `gh api repos/<owner>/<repo> --jq .permissions.push` and take `true` as the pass. When any check fails, run the `pr-loop-cloud-transport` skill first and route every `gh` operation in this skill through its substitution matrix.
27
-
28
- ## When this skill applies
29
-
30
- `/qbug` once authorizes the full cycle (no loop cap — runs until `converged` or `stuck`; user can interrupt at any time).
31
-
32
- Refusals — first match wins; respond with the quoted line exactly and stop:
33
-
34
- - **Disabled via environment.** When `CLAUDE_REVIEWS_DISABLED` carries the
35
- token `bugteam`:
36
- `/qbug is disabled via CLAUDE_REVIEWS_DISABLED.` Run the check via
37
- `python "$HOME/.claude/_shared/pr-loop/scripts/reviews_disabled.py" --reviewer bugteam`
38
- (exit 0 = disabled). `/qbug` is the bugteam
39
- baseline review and shares the `bugteam` token with `/bugteam`; the shared
40
- pre-flight script also exits 7 in this case so any caller invoking it
41
- directly halts on the same signal. The gate semantics live in the
42
- `reviewer-gates` skill (`../reviewer-gates/SKILL.md`).
43
- - **No PR or upstream diff.** `No PR or upstream diff. /qbug needs a target.`
44
- - **Dirty tree.** `Uncommitted changes detected. Stash, commit, or revert before /qbug.`
45
- - **Missing subagent.** Before Step 2, confirm `clean-coder` exists. Else: `Required subagent type clean-coder not installed. /qbug needs clean-coder available.`
46
-
47
- ## Progress checklist
48
-
49
- ```
50
- [ ] Step 0: pre-flight clean
51
- [ ] Step 1: PR scope resolved
52
- [ ] Step 2: subagent cycle complete (converged | stuck | error)
53
- [ ] Step 3: PR description refreshed
54
- [ ] Step 4: final report printed
55
- ```
56
-
57
- ## Step 0: Pre-flight
58
-
59
- ```bash
60
- python "${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/preflight.py"
61
- ```
62
-
63
- `${CLAUDE_SKILL_DIR}` is host-substituted before the shell runs. Non-zero → fix before continuing. `BUGTEAM_PREFLIGHT_SKIP=1` is emergency only. Add `--pre-commit` when `.pre-commit-config.yaml` exists.
64
-
65
- Pre-flight checks (in order):
66
-
67
- 1. **Git hooks path** — verifies `git -C <repository_root> config --get core.hooksPath` resolves to a path ending in `hooks/git-hooks`. Queries the repository-effective config so repo-level overrides (Husky, lefthook) are detected. If unset or pointing elsewhere, exits non-zero:
68
- ```
69
- Git-side CODE_RULES enforcement is not active on this host.
70
- Run: npx claude-dev-env .
71
- Or: git config --global core.hooksPath ~/.claude/hooks/git-hooks
72
- ```
73
- 2. **pytest** — runs the test suite when `pytest.ini` or `[tool.pytest]` is present.
74
- 3. **pre-commit** — runs when `--pre-commit` flag is passed and `.pre-commit-config.yaml` exists.
75
-
76
- ## Step 1: Resolve PR scope (lead)
77
-
78
- Apply the `pr-scope-resolve` skill (`../pr-scope-resolve/SKILL.md`) with caller `qbug`. When no target exists, refuse per § When this skill applies with the sub-skill's canonical line.
79
-
80
- Capture: `owner/repo`, `baseRefName`, `headRefName`, PR `number`, `url`, `starting_sha = git rev-parse HEAD`.
81
-
82
- Resolve the scoped temp directory once, lead-side, before spawning the subagent. Use Python's `tempfile.gettempdir()` so the path is correct on macOS, Linux, Windows cmd.exe, and PowerShell — do not hardcode `/tmp/` because Windows runners do not honor it. Pass the resolved absolute path along with the PR metadata to the subagent:
83
-
84
- ```python
85
- import tempfile
86
- from pathlib import Path
87
-
88
- pr_number: int = ... # from pull_request_read MCP response above
89
- qbug_temp_dir: Path = Path(tempfile.gettempdir()) / f"qbug-pr-{pr_number}"
90
- qbug_temp_dir.mkdir(parents=True, exist_ok=True)
91
- ```
92
-
93
- ## Step 2: Spawn the primary and secondary audit agents
94
-
95
- Before calling `Agent`, the lead resolves the three absolute paths the subagent needs and substitutes them into the prompt template (the `<gate_script>`, `<categories_file>`, and `<qbug_temp_dir>` placeholders in § Subagent cycle prompt):
96
-
97
- ```python
98
- import os
99
- from pathlib import Path
100
-
101
- skill_dir = Path(os.environ["CLAUDE_SKILL_DIR"])
102
- gate_script_path = (skill_dir / ".." / ".." / "_shared" / "pr-loop" / "scripts" / "code_rules_gate.py").resolve()
103
- categories_file_path = (skill_dir / ".." / "bugteam" / "PROMPTS.md").resolve()
104
- ```
105
-
106
- Then call `Agent` twice in the same message — the primary clean-coder and the Haiku secondary run in parallel per the audit contract. The Haiku secondary receives an **audit-only** prompt (no FIX step, no git operations) and returns findings to the lead only. The lead merges their findings before the FIX step:
107
-
108
- ```
109
- Agent(
110
- subagent_type="clean-coder",
111
- description="qbug primary audit/fix cycle for PR <number>",
112
- prompt="<filled cycle XML; see § Subagent cycle prompt>",
113
- run_in_background=False
114
- )
115
-
116
- Agent(
117
- subagent_type="code-quality-agent",
118
- model="haiku",
119
- description="qbug Haiku secondary audit for PR <number>",
120
- prompt="<audit-only prompt: read the PR diff, apply A–P categories from <categories_file>, return structured findings. No FIX, no git add, no git commit, no git push.>",
121
- run_in_background=False
122
- )
123
- ```
124
-
125
- The Haiku secondary is a read-only auditor per `audit-contract.md` — it returns findings to the lead and never modifies the working tree. The lead merges primary and Haiku secondary findings per the de-dup rules in the audit contract before proceeding. No `TeamCreate`, no `team_name`, no teammate shutdown protocol. The primary subagent returns when it has exited the cycle (`converged`, `stuck`, or `error`).
126
-
127
- ## Subagent cycle prompt
128
-
129
- The subagent receives this prompt and loops internally — the lead does not re-invoke between loops. The prompt is self-contained: it restates the bug-category rubric by path rather than assuming prior context, and it states its full scope upfront. Before passing the prompt to `Agent()`, the lead substitutes every `{{UPPER_SNAKE}}` slot: `{{OWNER_REPO}}`, `{{HEAD_REF}}`, `{{BASE_REF}}`, `{{PR_URL}}`, `{{STARTING_SHA}}` (from Step 1) and `{{QBUG_TEMP_DIR}}`, `{{GATE_SCRIPT}}`, `{{CATEGORIES_FILE}}` (resolved in Step 2).
130
-
131
- ```xml
132
- <role>
133
- You are the lone audit-fix worker for this pull request. Run the full
134
- audit → fix → commit → push cycle in this one subagent session. The
135
- lead has already resolved scope and pre-flight; your job is to take
136
- the cycle to an exit state and report back.
137
- </role>
138
-
139
- <context>
140
- <repo>{{OWNER_REPO}}</repo>
141
- <branch>{{HEAD_REF}}</branch>
142
- <base_branch>{{BASE_REF}}</base_branch>
143
- <pr_url>{{PR_URL}}</pr_url>
144
- <starting_sha>{{STARTING_SHA}}</starting_sha>
145
- <qbug_temp_dir>{{QBUG_TEMP_DIR}}</qbug_temp_dir>
146
- <gate_script>{{GATE_SCRIPT}}</gate_script>
147
- <categories_file>{{CATEGORIES_FILE}}</categories_file>
148
- </context>
149
-
150
- <exit_conditions>
151
- The cycle stops when ONE of these is true. Check on every iteration:
152
- - converged: most recent AUDIT returned zero findings AND
153
- post_fix_audit_clean is true for the committing loop.
154
- - stuck: most recent FIX left `git rev-parse HEAD` unchanged.
155
- - error: three consecutive pre-audit gate rounds failed (three is
156
- chosen because two is within normal clean-coder variance; four
157
- rounds typically indicates a gate defect rather than fixable
158
- violations).
159
- There is no loop-count cap. A pathological diff with ever-changing
160
- findings will still exit via `stuck` once a FIX produces no commit.
161
- </exit_conditions>
162
-
163
- <cycle>
164
- Maintain inline across iterations:
165
- loop_count = 0
166
- last_action = "fresh" # fresh | audited | fixed
167
- last_findings = {p0, p1, p2, total}
168
- loop_comment_index = {}
169
- audit_log = []
170
-
171
- Iteration:
172
- 1. Dispatch on last_action:
173
- - "audited" and last_findings.total == 0 → exit "converged"
174
- - "fixed" and `git rev-parse HEAD` equals the sha captured
175
- immediately before FIX → exit "stuck"
176
- - "fresh" or "fixed" → run pre-audit, then AUDIT
177
- - "audited" and last_findings.total > 0 → run FIX
178
-
179
- 2. Pre-audit (before every AUDIT):
180
- Run the gate script at <gate_script> with `--base origin/<base_branch>`.
181
- Non-zero exit → fix the reported violations inline and re-run the
182
- same command. Count consecutive failures. Three failed rounds →
183
- exit "error: code rules gate failed pre-audit".
184
- On exit 0: increment loop_count, proceed to AUDIT.
185
-
186
- 3. AUDIT:
187
- Call `pull_request_read(method="get_diff", pullNumber=<pr_number>, owner=<owner>, repo=<repo>)` via MCP and save the diff to `<qbug_temp_dir>/loop-<loop_count>.patch`
188
-
189
- - Read the patch file.
190
- - Audit only added/modified lines. Read <categories_file> for the
191
- A–P category definitions; investigate each category explicitly.
192
- - Follow the shared audit contract at
193
- $HOME/.claude/_shared/pr-loop/audit-contract.md. Per category:
194
- produce either a Shape A structured finding or a Shape B
195
- structured proof-of-absence. Bare "verified clean" labels are
196
- REJECTED.
197
- - Run the contract's adversarial second pass after the primary
198
- finding list.
199
- - The LEAD spawns the Haiku secondary auditor in parallel with
200
- this primary audit per the contract's Haiku secondary section.
201
- - Partition findings into anchored (line appears in the diff) vs
202
- unanchored (line does not).
203
-
204
- Persist the merged audit result to
205
- <qbug_temp_dir>/loop-<loop_count>-audit.json per the contract's
206
- persistence schema.
207
-
208
- Post ONE review per loop. Read
209
- $HOME/.claude/skills/post-audit-findings/SKILL.md and apply it
210
- with `--skill qbug`. That skill owns the findings-JSON mapping,
211
- the anchored-only serialization, the CLEAN/DIRTY decision, the
212
- self-PR reviewer toggle, and the exit codes. qbug-specific
213
- persistence: write the anchored findings JSON to
214
- `<qbug_temp_dir>/loop-<loop_count>-findings.json` and pass that
215
- path as `--findings-json`. Unanchored findings surface in the
216
- loop's user-facing summary rather than as inline anchored
217
- comments.
218
-
219
- On exit 0, harvest ids per that skill's "Harvest ids for the fix
220
- loop" section: each `loop_comment_index[finding_id]` entry must
221
- carry `finding_comment_id` (numeric, used by
222
- `add_reply_to_pull_request_comment`), `finding_comment_url`, and
223
- `thread_node_id` (`PRRT_kwDOxxx`, used by `resolve_thread`) so
224
- the FIX step can reply against the comment and resolve the
225
- thread.
226
-
227
- Exit 2 means retry exhaustion — exit
228
- `error: post_audit_thread retry exhausted` without retrying and
229
- without falling back to a flat issue comment. A hard blocker on
230
- the audit-posting path is a halt condition, not a fallback
231
- opportunity.
232
-
233
- Update state: last_action="audited", last_findings=counts.
234
- Append `<N> audit: <P0>P0 / <P1>P1 / <P2>P2` to audit_log.
235
-
236
- 4. FIX:
237
- Capture the pre-FIX sha: `pre_fix_sha = git rev-parse HEAD`.
238
- Capture pre-fix file contents for every file this FIX will touch.
239
-
240
- Apply each fix. Read every file before editing. Preserve existing
241
- comments on lines you do not modify. Add type hints on every
242
- signature you touch.
243
-
244
- Validate each modified Python file with `python -m py_compile`
245
- (or the language-equivalent compile check).
246
-
247
- Compute fix_diff: the diff between pre-fix and post-fix file contents
248
- for every modified file.
249
-
250
- Post-fix self-audit: follow the contract's post-fix self-audit
251
- sequence at $HOME/.claude/_shared/pr-loop/audit-contract.md. Paranoid mode
252
- (Haiku secondary in parallel), internal iteration cap = 3, exit
253
- "stuck: post-fix audit not converging" after 3 rounds with fresh
254
- findings. Only when gate_findings empty AND post_fix_findings
255
- empty: proceed to git add.
256
-
257
- Stage each modified path by explicit name: `git add <path>`.
258
- Create one commit summarizing the fixed findings. Let every git
259
- hook run. If a hook blocks the commit, capture its stderr, mark
260
- every finding in this loop `status=hook_blocked`, and move on to
261
- the next iteration without retrying this loop.
262
-
263
- Push with a plain fast-forward: `git push`.
264
-
265
- Write <qbug_temp_dir>/loop-<loop_count>-diagnostics.json per the
266
- contract's diagnostics schema (all eight keys required).
267
-
268
- For each finding, read
269
- $HOME/.claude/skills/pr-fix-protocol/SKILL.md and apply its
270
- reply-and-resolve unit: atomically (a) post the fix reply via
271
- `add_reply_to_pull_request_comment` against
272
- `loop_comment_index[finding_id].finding_comment_id`, using the
273
- body template at
274
- $HOME/.claude/_shared/pr-loop/audit-reply-template.md, then
275
- (b) call `pull_request_review_write(method="resolve_thread",
276
- threadId=<loop_comment_index[finding_id].thread_node_id>)` for
277
- the same thread. Per-path `<status_line>`:
278
- - `status=fixed`: `Fixed in <short_sha>` (first 7 chars).
279
- - `status=could_not_address`: `Could not address this loop`.
280
- - `status=hook_blocked`: `Hook blocked the fix commit`.
281
- Body text is passed directly as string parameters — no temp
282
- files, no jq, no shell pipes.
283
-
284
- Update state: last_action="fixed". Append
285
- `<N> fix: <short_sha> — <fixed>/<could_not_address>/<hook_blocked>`
286
- to audit_log.
287
-
288
- 5. Return to step 1.
289
- </cycle>
290
-
291
- <example_finding_body>
292
- Populate these two fields on each finding entry of the JSON payload
293
- consumed by `post_audit_thread.py` (the script renders the inline
294
- comment body via `INLINE_COMMENT_BODY_TEMPLATE`):
295
-
296
- ```json
297
- {
298
- "description": "Two writers can both pass the existence check at line 88 before either commits the write at line 91 — whichever writes second overwrites the first under contention.",
299
- "fix_summary": "Hold the cache lock across the check and the write, or use a compare-and-swap primitive. Validation: pytest -k cache_concurrent with the threaded-writer fixture."
300
- }
301
- ```
302
- </example_finding_body>
303
-
304
- <constraints>
305
- - Edit only files reachable from the PR diff's scope.
306
- - Keep the branch linear: append one new commit per FIX loop and push
307
- fast-forward only.
308
- - Preserve existing comments on lines you do not modify.
309
- - Every signature you touch has complete type hints.
310
- - Every file is read before you edit it (investigate before answering).
311
- - Complete the entire cycle in this one subagent session using your
312
- available tools directly; keep all audit and fix work inside this
313
- session.
314
- </constraints>
315
-
316
- <output_format>
317
- Return to the lead with exactly these fields:
318
- - exit_reason: "converged" | "stuck" | "error: <detail>"
319
- - loop_count: integer
320
- - final_commit_sha: `git rev-parse HEAD` at exit
321
- - audit_log: ordered list of per-loop lines
322
- - unresolved: array of {file, line, severity, title, reason}
323
- (present only when exit_reason == "stuck")
324
- </output_format>
325
- ```
326
-
327
- ## Step 3: PR description refresh (lead)
328
-
329
- Compose the body directly against `docs/PR_DESCRIPTION_GUIDE.md` — no agent spawn — from the final PR diff and the original body. Apply via `update_pull_request(pullNumber=<number>, owner=<owner>, repo=<repo>, body=<new_body>)`.
330
-
331
- On error exit paths: best-effort; log the failure in the final report and continue.
332
-
333
- ## Step 4: Final report (lead)
334
-
335
- Use the same shape as [`bugteam/SKILL.md` Step 6](../bugteam/SKILL.md#step-6-final-report) with two deltas:
336
-
337
- - Header substitutes `/qbug` for `/bugteam`.
338
- - Exit states are `converged | stuck | error` (no `cap reached` state, since `/qbug` has no loop cap).
339
-
340
- Delete the resolved `<qbug_temp_dir>` tree and any `.qbug-*.md` temp files in the working directory. The lead captured the dir as an absolute path via `tempfile.gettempdir()` in Step 1; reuse that literal for cleanup.
341
-
342
- ## Constraints
343
-
344
- - **One primary + one secondary auditor, not a team.** Lead spawns a `clean-coder` primary (audit + fix cycle) and a `code-quality-agent` Haiku secondary (audit-only, read-only — no FIX, no git). No `TeamCreate`. Neither subagent spawns further subagents.
345
- - **No loop cap.** Cycle runs until `converged`, `stuck`, or `error`. User can interrupt.
346
- - **Code rules gate before every AUDIT.** Same `validate_content` logic as /bugteam.
347
- - **One commit per FIX action.** Linear branch, fast-forward push only.
348
- - **Categories A–P.** Same rubric as [`bugteam/PROMPTS.md`](../bugteam/PROMPTS.md).
349
- - **One review per loop.** Anchored findings as `comments[]`; unanchored findings surface in the calling skill's user-facing output (chat reply to the user) rather than in the PR review body.
350
- - **PR description rewrite on every exit**, same as /bugteam Step 4.5.
351
- - **Temp file cleanup on every exit path.**
352
- - **No per-loop clean-room.** The single subagent's context accumulates across loops — that is the explicit trade vs /bugteam. For convergence-critical audits where bias isolation matters, use /bugteam.
353
-
354
- ## Examples
355
-
356
- <example>
357
- User: `/qbug`
358
- Lead: [preflight, resolves PR #42, spawns ONE clean-coder subagent with the cycle prompt]
359
- Subagent: [runs loops internally, returns]
360
-
361
- `Loop 1 audit: 1P0 / 2P1 / 0P2`
362
- `Loop 1 fix: commit a1b2c3d (3 files, +18/-7) — 3 fixed, 0 skipped`
363
- `Loop 2 audit: 0P0 / 1P1 / 0P2`
364
- `Loop 2 fix: commit e4f5g6h (1 file, +5/-2) — 1 fixed, 0 skipped`
365
- `Loop 3 audit: 0P0 / 0P1 / 0P2 → converged`
366
-
367
- `/qbug exit: converged`
368
- `Loops: 3`
369
- `Starting commit: 9d8c7b6`
370
- `Final commit: e4f5g6h`
371
- `Net change: 4 files, +23/-9`
372
- </example>
373
-
374
- <example>
375
- User: `/qbug`
376
- Subagent: [loop 4 fix produces no commit despite findings]
377
-
378
- `Loop 4 fix: no changes — could not address remaining 2 findings`
379
- `/qbug exit: stuck`
380
- `Unresolved: src/cache.py:88 (P0 race condition); src/parser.py:44 (P1 unbound reference)`
381
- </example>
382
-
383
- <example>
384
- User: `/qbug` (no PR or upstream diff)
385
- Lead: `No PR or upstream diff. /qbug needs a target.`
386
- </example>
387
-