claude-dev-env 1.93.1 → 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.
- package/_shared/pr-loop/CLAUDE.md +1 -0
- package/_shared/pr-loop/audit-contract.md +1 -1
- package/_shared/pr-loop/gh-payloads.md +3 -3
- package/_shared/pr-loop/post-audit-thread-contract.md +51 -0
- package/_shared/pr-loop/scripts/README.md +2 -2
- package/_shared/pr-loop/scripts/fix_hookspath.py +47 -12
- package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +0 -69
- package/_shared/pr-loop/scripts/tests/test_fix_hookspath.py +497 -374
- package/_shared/pr-loop/state-schema.md +3 -22
- package/bin/CLAUDE.md +1 -1
- package/bin/install.mjs +2 -7
- package/bin/install.test.mjs +10 -4
- package/hooks/blocking/CLAUDE.md +2 -0
- package/hooks/blocking/pii_commit_command.py +398 -0
- package/hooks/blocking/pii_payload_scan.py +133 -0
- package/hooks/blocking/pii_prevention_blocker.py +151 -449
- package/hooks/blocking/test_pii_prevention_blocker.py +299 -0
- package/hooks/blocking/test_verdict_directory_write_blocker.py +42 -7
- package/hooks/hooks_constants/CLAUDE.md +2 -2
- package/hooks/hooks_constants/code_rules_path_utils_constants.py +0 -2
- package/hooks/hooks_constants/local_identity.py +65 -15
- package/hooks/hooks_constants/pii_prevention_constants.py +16 -0
- package/hooks/hooks_constants/pr_description_enforcer_constants.py +1 -1
- package/hooks/hooks_constants/test_local_identity.py +68 -0
- package/package.json +1 -1
- package/scripts/CLAUDE.md +10 -1
- package/scripts/Get-SessionAccount.ps1 +210 -0
- package/scripts/tests/CLAUDE.md +15 -1
- package/scripts/tests/Get-SessionAccount.Tests.ps1 +350 -0
- package/skills/CLAUDE.md +3 -25
- package/skills/anthropic-plan/SKILL.md +1 -13
- package/skills/autoconverge/CLAUDE.md +5 -2
- package/skills/autoconverge/SKILL.md +112 -387
- package/skills/autoconverge/reference/CLAUDE.md +4 -1
- package/skills/autoconverge/reference/closing-report.md +9 -2
- package/skills/autoconverge/reference/convergence.md +26 -22
- package/skills/autoconverge/reference/headless-safety.md +44 -0
- package/skills/autoconverge/reference/multi-pr.md +88 -0
- package/skills/autoconverge/reference/self-closing-loop.md +84 -0
- package/skills/autoconverge/reference/stop-conditions.md +21 -13
- package/skills/autoconverge/workflow/converge.clean-audit.test.mjs +87 -27
- package/skills/autoconverge/workflow/converge.contract.test.mjs +40 -10
- package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +179 -47
- package/skills/autoconverge/workflow/converge.fix-progress.test.mjs +1 -1
- package/skills/autoconverge/workflow/converge.mjs +284 -94
- package/skills/bugteam/CLAUDE.md +1 -1
- package/skills/bugteam/CONSTRAINTS.md +3 -3
- package/skills/bugteam/PROMPTS.md +8 -19
- package/skills/bugteam/SKILL.md +13 -14
- package/skills/bugteam/reference/CLAUDE.md +1 -1
- package/skills/bugteam/reference/audit-and-teammates.md +2 -2
- package/skills/bugteam/reference/copilot-gap-analysis.md +2 -0
- package/skills/bugteam/reference/github-pr-reviews.md +56 -38
- package/skills/bugteam/reference/team-setup.md +11 -11
- package/skills/bugteam/scripts/CLAUDE.md +6 -6
- package/skills/bugteam/scripts/README.md +20 -8
- package/skills/bugteam/scripts/bugteam_code_rules_gate.py +13 -1463
- package/skills/bugteam/scripts/bugteam_fix_hookspath.py +23 -358
- package/skills/bugteam/scripts/bugteam_preflight.py +13 -315
- package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +2 -3
- package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +34 -1053
- package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +30 -347
- package/skills/bugteam/scripts/test_bugteam_preflight.py +30 -305
- package/skills/copilot-finding-triage/SKILL.md +80 -28
- package/skills/copilot-finding-triage/reference/tier-rubric.md +70 -11
- package/skills/copilot-finding-triage/templates/notification.md +8 -3
- package/skills/everything-search/SKILL.md +1 -2
- package/skills/grokify/SKILL.md +58 -0
- package/skills/grokify/templates/handoff-template.md +92 -0
- package/skills/orchestrator/SKILL.md +12 -8
- package/skills/orchestrator-refresh/SKILL.md +3 -3
- package/skills/pr-converge/SKILL.md +132 -233
- package/skills/pr-converge/reference/convergence-gates.md +102 -66
- package/skills/pr-converge/reference/examples.md +37 -25
- package/skills/pr-converge/reference/fix-protocol.md +7 -7
- package/skills/pr-converge/reference/multi-pr-orchestration.md +10 -4
- package/skills/pr-converge/reference/per-tick.md +64 -41
- package/skills/pr-converge/reference/state-schema.md +27 -2
- package/skills/pr-converge/scripts/CLAUDE.md +8 -0
- package/skills/pr-converge/scripts/README.md +4 -3
- package/skills/pr-converge/scripts/_pr_converge_path_setup.py +23 -0
- package/skills/pr-converge/scripts/check_convergence.py +189 -645
- package/skills/pr-converge/scripts/check_convergence_gates.py +235 -0
- package/skills/pr-converge/scripts/check_convergence_thread_gates.py +219 -0
- package/skills/pr-converge/scripts/conftest.py +8 -0
- package/skills/pr-converge/scripts/pr_converge_scripts_constants/CLAUDE.md +1 -0
- package/skills/pr-converge/scripts/pr_converge_scripts_constants/convergence_gate_constants.py +36 -0
- package/skills/pr-converge/scripts/test__pr_converge_path_setup.py +26 -0
- package/skills/pr-converge/scripts/test_check_convergence.py +73 -228
- package/skills/pr-converge/scripts/test_check_convergence_contract.py +321 -0
- package/skills/pr-converge/scripts/test_check_convergence_gates.py +68 -0
- package/skills/pr-converge/scripts/test_check_convergence_thread_gates.py +75 -0
- package/skills/privacy-hygiene/SKILL.md +4 -3
- package/skills/reviewer-gates/SKILL.md +26 -8
- package/skills/session-log/SKILL.md +11 -12
- package/skills/session-tidy/SKILL.md +40 -30
- package/skills/skill-builder/CLAUDE.md +13 -10
- package/skills/skill-builder/SKILL.md +31 -31
- package/skills/skill-builder/references/CLAUDE.md +10 -6
- package/skills/skill-builder/references/delegation-map.md +13 -4
- package/skills/skill-builder/references/description-field.md +113 -0
- package/skills/skill-builder/references/self-audit-checklist.md +21 -4
- package/skills/skill-builder/references/skill-modularity.md +113 -0
- package/skills/skill-builder/references/skill-types.md +4 -0
- package/skills/skill-builder/templates/CLAUDE.md +4 -4
- package/skills/skill-builder/templates/gap-analysis.md +25 -1
- package/skills/skill-builder/workflows/CLAUDE.md +6 -4
- package/skills/skill-builder/workflows/improve-skill.md +17 -16
- package/skills/skill-builder/workflows/new-skill.md +34 -10
- package/skills/skill-builder/workflows/polish-skill.md +59 -43
- package/skills/usage-pause/SKILL.md +10 -14
- package/skills/bdd-protocol/CLAUDE.md +0 -26
- package/skills/bdd-protocol/SKILL.md +0 -30
- package/skills/bdd-protocol/references/CLAUDE.md +0 -10
- package/skills/bdd-protocol/references/anti-patterns.md +0 -26
- package/skills/bdd-protocol/references/example-mapping.md +0 -23
- package/skills/bg-agent/CLAUDE.md +0 -17
- package/skills/bg-agent/SKILL.md +0 -69
- package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_code_rules_gate_constants.py +0 -55
- package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_fix_hookspath_constants.py +0 -26
- package/skills/bugteam/scripts/bugteam_scripts_constants/bugteam_preflight_constants.py +0 -35
- package/skills/caveman/CLAUDE.md +0 -15
- package/skills/caveman/SKILL.md +0 -38
- package/skills/code/CLAUDE.md +0 -17
- package/skills/code/SKILL.md +0 -178
- package/skills/deep-research/CLAUDE.md +0 -17
- package/skills/deep-research/SKILL.md +0 -80
- package/skills/findbugs/CLAUDE.md +0 -20
- package/skills/findbugs/SKILL.md +0 -241
- package/skills/fixbugs/CLAUDE.md +0 -19
- package/skills/fixbugs/SKILL.md +0 -142
- package/skills/gh-paginate/CLAUDE.md +0 -18
- package/skills/gh-paginate/SKILL.md +0 -84
- package/skills/gotcha/CLAUDE.md +0 -33
- package/skills/gotcha/SKILL.md +0 -73
- package/skills/implement/CLAUDE.md +0 -27
- package/skills/implement/SKILL.md +0 -66
- package/skills/implement/scripts/CLAUDE.md +0 -22
- package/skills/implement/scripts/append_note.py +0 -133
- package/skills/implement/scripts/implement_scripts_constants/CLAUDE.md +0 -22
- package/skills/implement/scripts/implement_scripts_constants/__init__.py +0 -0
- package/skills/implement/scripts/implement_scripts_constants/notes_constants.py +0 -12
- package/skills/implement/scripts/test_append_note.py +0 -191
- package/skills/log-audit/CLAUDE.md +0 -20
- package/skills/log-audit/SKILL.md +0 -66
- package/skills/log-audit/reference/CLAUDE.md +0 -9
- package/skills/log-audit/reference/charter.md +0 -52
- package/skills/log-audit/scripts/CLAUDE.md +0 -27
- package/skills/log-audit/scripts/cluster_recurrences.py +0 -261
- package/skills/log-audit/scripts/collect_log_window.py +0 -199
- package/skills/log-audit/scripts/log_audit_constants/CLAUDE.md +0 -12
- package/skills/log-audit/scripts/log_audit_constants/__init__.py +0 -0
- package/skills/log-audit/scripts/log_audit_constants/cluster_recurrences_constants.py +0 -23
- package/skills/log-audit/scripts/log_audit_constants/collect_log_window_constants.py +0 -24
- package/skills/log-audit/scripts/log_audit_constants/mine_copilot_findings_constants.py +0 -49
- package/skills/log-audit/scripts/mine_copilot_findings.py +0 -302
- package/skills/log-audit/scripts/test_cluster_recurrences.py +0 -160
- package/skills/log-audit/scripts/test_collect_log_window.py +0 -111
- package/skills/log-audit/scripts/test_mine_copilot_findings.py +0 -126
- package/skills/logifix/CLAUDE.md +0 -36
- package/skills/logifix/SKILL.md +0 -69
- package/skills/logifix/scripts/CLAUDE.md +0 -16
- package/skills/logifix/scripts/logifix.ps1 +0 -205
- package/skills/monitor-open-prs/CLAUDE.md +0 -34
- package/skills/monitor-open-prs/SKILL.md +0 -88
- package/skills/monitor-open-prs/scripts/CLAUDE.md +0 -17
- package/skills/monitor-open-prs/scripts/discover_open_prs.py +0 -69
- package/skills/monitor-open-prs/scripts/test_discover_open_prs.py +0 -149
- package/skills/monitor-open-prs/test_skill_contract.py +0 -27
- package/skills/post-audit-findings/SKILL.md +0 -80
- package/skills/pr-consistency-audit/CLAUDE.md +0 -34
- package/skills/pr-consistency-audit/SKILL.md +0 -116
- package/skills/pr-consistency-audit/reference/CLAUDE.md +0 -16
- package/skills/pr-consistency-audit/reference/detection-rules.md +0 -96
- package/skills/pr-consistency-audit/reference/illustrations.md +0 -78
- package/skills/pr-fix-protocol/SKILL.md +0 -65
- package/skills/pr-review-responder/CLAUDE.md +0 -35
- package/skills/pr-review-responder/EXAMPLES.md +0 -590
- package/skills/pr-review-responder/PRINCIPLES.md +0 -533
- package/skills/pr-review-responder/README.md +0 -168
- package/skills/pr-review-responder/SKILL.md +0 -203
- package/skills/pr-review-responder/TESTING.md +0 -350
- package/skills/pr-scope-resolve/SKILL.md +0 -45
- package/skills/pre-compact/CLAUDE.md +0 -24
- package/skills/pre-compact/SKILL.md +0 -134
- package/skills/qbug/CLAUDE.md +0 -40
- package/skills/qbug/SKILL.md +0 -387
- package/skills/qbug/test_qbug_skill_audit_schema.py +0 -152
- package/skills/qbug/test_qbug_skill_post_fix_audit.py +0 -103
- package/skills/refine/CLAUDE.md +0 -44
- package/skills/refine/SKILL.md +0 -262
- package/skills/refine/templates/CLAUDE.md +0 -17
- package/skills/refine/templates/implementation-notes-template.html +0 -56
- package/skills/refine/templates/plan-template.md +0 -60
- package/skills/research-mode/CLAUDE.md +0 -35
- package/skills/research-mode/SKILL.md +0 -53
- package/skills/structure-prompt/CLAUDE.md +0 -42
- package/skills/structure-prompt/SKILL.md +0 -44
- package/skills/structure-prompt/reference/CLAUDE.md +0 -28
- package/skills/structure-prompt/reference/adversarial-tuning.md +0 -62
- package/skills/structure-prompt/reference/block-classification.md +0 -27
- package/skills/structure-prompt/reference/canonical-case.md +0 -48
- package/skills/structure-prompt/reference/citation-depth.md +0 -70
- package/skills/structure-prompt/reference/cleanup.md +0 -33
- package/skills/structure-prompt/reference/constraints.md +0 -33
- package/skills/structure-prompt/reference/directives.md +0 -37
- package/skills/structure-prompt/reference/examples.md +0 -72
- package/skills/structure-prompt/reference/instantiation.md +0 -51
- package/skills/structure-prompt/reference/output-contract.md +0 -72
- package/skills/structure-prompt/reference/per-category.md +0 -23
- package/skills/structure-prompt/reference/persona.md +0 -38
- package/skills/structure-prompt/reference/research.md +0 -33
- package/skills/structure-prompt/reference/structure.md +0 -28
- package/skills/verified-build/CLAUDE.md +0 -33
- package/skills/verified-build/SKILL.md +0 -33
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# findbugs
|
|
2
|
-
|
|
3
|
-
Audits the current branch's pull request for bugs by spawning the `code-quality-agent` against the full PR diff in a clean room. Triggered by `/findbugs`, `find bugs in this PR`, `audit the PR`, or `bug audit on the branch`.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
Read-only. The skill resolves PR scope via the `pr-scope-resolve` skill, writes the diff to a scoped temp file, and spawns two `code-quality-agent` instances (primary sonnet + secondary haiku) with a self-contained, context-free prompt covering all A–P audit categories. After both return it merges findings (de-dup, max-wins severity), posts one audit review to the PR via the `post-audit-findings` skill (APPROVE on clean, REQUEST_CHANGES with inline anchored comments on dirty), and reports totals and cleared categories to the user.
|
|
8
|
-
|
|
9
|
-
## Key file
|
|
10
|
-
|
|
11
|
-
| File | Purpose |
|
|
12
|
-
|---|---|
|
|
13
|
-
| `SKILL.md` | Five-step process: resolve scope (`pr-scope-resolve` skill), capture diff to a scoped temp path, spawn agents (clean-room prompt XML), post audit review (`post-audit-findings` skill), surface findings and offer `/fixbugs`. Includes refusals and the output format. |
|
|
14
|
-
|
|
15
|
-
## Constraints
|
|
16
|
-
|
|
17
|
-
- Never edits files, never commits, never pushes.
|
|
18
|
-
- One audit review per invocation is posted back to the PR — required so the unresolved-thread gate sees the audit pass.
|
|
19
|
-
- Disabled by `CLAUDE_REVIEWS_DISABLED=bugteam` (shared token across the audit-skill family).
|
|
20
|
-
- Always ask before running `/fixbugs`; never auto-spawn the fixer.
|
package/skills/findbugs/SKILL.md
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: findbugs
|
|
3
|
-
description: >-
|
|
4
|
-
Audits the current branch's pull request as a whole for bugs by spawning the
|
|
5
|
-
code-quality-agent against the full PR diff with zero conversation context.
|
|
6
|
-
Returns P0/P1/P2 findings with file:line evidence and a verified-clean
|
|
7
|
-
coverage list. Read-only — never modifies code. Triggers: '/findbugs',
|
|
8
|
-
'find bugs in this PR', 'audit the PR', 'bug audit on the branch'.
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Findbugs
|
|
12
|
-
|
|
13
|
-
**Core principle:** A clean-room bug audit on the entire pull request. The audit agent receives the PR diff and nothing else — no chat history, no prior framing, no implicit "we already looked at this." Independence is the point.
|
|
14
|
-
|
|
15
|
-
## Transport check (before any GitHub step)
|
|
16
|
-
|
|
17
|
-
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.
|
|
18
|
-
|
|
19
|
-
## When this skill applies
|
|
20
|
-
|
|
21
|
-
User types `/findbugs` or asks for a bug audit on the current branch's PR. Typical moment: PR is up (draft or ready), and the user wants an independent second pair of eyes before merge or before requesting human review.
|
|
22
|
-
|
|
23
|
-
If the current branch has no associated PR and no diff against the default branch, say so and stop. Do not invent scope.
|
|
24
|
-
|
|
25
|
-
## Refusals
|
|
26
|
-
|
|
27
|
-
First match wins; respond with the quoted line exactly and stop:
|
|
28
|
-
|
|
29
|
-
- **Disabled via environment.** When `CLAUDE_REVIEWS_DISABLED` carries the
|
|
30
|
-
token `bugteam`:
|
|
31
|
-
`/findbugs is disabled via CLAUDE_REVIEWS_DISABLED.` Run the check via
|
|
32
|
-
`python "$HOME/.claude/_shared/pr-loop/scripts/reviews_disabled.py" --reviewer bugteam`
|
|
33
|
-
(exit 0 = disabled). `/findbugs` is a PR bug-audit skill in the same family
|
|
34
|
-
as `/bugteam` and `/qbug`, so the shared `bugteam` token disables all three.
|
|
35
|
-
The gate semantics live in the `reviewer-gates` skill (`../reviewer-gates/SKILL.md`).
|
|
36
|
-
|
|
37
|
-
## The Process
|
|
38
|
-
|
|
39
|
-
### Step 1: Resolve PR scope
|
|
40
|
-
|
|
41
|
-
Apply the `pr-scope-resolve` skill (`../pr-scope-resolve/SKILL.md`) with caller `findbugs`. Findbugs consumes the resolved `owner`, `repo`, `number`, `head_ref`, `base_ref`, and `url`; when no PR exists, the ladder's merge-base rung sets the audit scope. When no target exists, respond exactly with the sub-skill's canonical refusal line and stop:
|
|
42
|
-
|
|
43
|
-
`No PR or upstream diff. /findbugs needs a target.`
|
|
44
|
-
|
|
45
|
-
### Step 2: Capture the full PR diff
|
|
46
|
-
|
|
47
|
-
Resolve the temp diff path **once, Claude-side**, before invoking any shell command. Use Python's `tempfile.gettempdir()` which honors `TMPDIR`, `TEMP`, and `TMP` in the platform-correct order and falls back to `C:\Users\<user>\AppData\Local\Temp` on Windows or `/tmp` on Unix. Avoid hand-rolled env var chains. The lookup works on macOS, Linux, Windows cmd.exe, and PowerShell:
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
import tempfile
|
|
51
|
-
diff_temp_path = Path(tempfile.gettempdir()) / f"findbugs-pr-{os.getpid()}.patch"
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
`os.getpid()` supplies the per-invocation suffix that prevents collisions with parallel `/findbugs` runs (a UUID or timestamp is equally acceptable). Capture the resolved absolute path as `<diff_temp_path>` and pass that **literal** path to every shell command that follows. Shell-side parameter expansion (`${TMPDIR:-/tmp}`, `$$`, `%TEMP%`) is forbidden because cmd.exe and PowerShell do not honor it.
|
|
55
|
-
|
|
56
|
-
When a PR exists: call `pull_request_read(method="get_diff", pullNumber=N, owner=O, repo=R)` and save the returned diff content to `"<diff_temp_path>"`.
|
|
57
|
-
|
|
58
|
-
When falling back to merge-base diff: `git diff <merge-base>...HEAD > "<diff_temp_path>"`.
|
|
59
|
-
|
|
60
|
-
The audit's authoritative scope is this single diff file. Do not inject extra files, related history, or "files Claude edited this session" — those introduce anchoring bias.
|
|
61
|
-
|
|
62
|
-
### Step 3: Spawn the code-quality-agent — clean room
|
|
63
|
-
|
|
64
|
-
Call the Agent tool twice in a single message (primary + Haiku secondary per the audit contract's Haiku secondary section):
|
|
65
|
-
|
|
66
|
-
- Primary: `subagent_type: code-quality-agent`, `model: sonnet`, `description: "PR bug audit"`, `run_in_background: false`
|
|
67
|
-
- Secondary: `subagent_type: code-quality-agent`, `model: haiku`, `description: "PR bug audit (secondary)"`, `run_in_background: false`
|
|
68
|
-
|
|
69
|
-
After both return, merge per the contract's Haiku secondary section (de-dup key, max-wins severity, malformed-output fallback) before reporting to the user.
|
|
70
|
-
|
|
71
|
-
**The agent prompt must be self-contained and context-free.** Specifically:
|
|
72
|
-
|
|
73
|
-
- **No references to the orchestrator's conversation.** Forbidden phrases: "as we discussed," "the earlier issue," "given our prior work," "the bug from last turn," "you previously identified."
|
|
74
|
-
- **No hints about expected outcomes.** Do not pre-stage findings, do not suggest where bugs probably are, do not name files as "the suspicious one." The agent forms its own hypotheses.
|
|
75
|
-
- **No instructions to favor or skip particular categories** beyond the standard category list. No "skip the typing stuff" or "focus on the clipboard logic" — those bias the audit.
|
|
76
|
-
- **Minimal background.** Identify the repo, branch, base branch, and PR URL only. Do not summarize what the PR does.
|
|
77
|
-
|
|
78
|
-
The XML prompt skeleton:
|
|
79
|
-
|
|
80
|
-
```xml
|
|
81
|
-
<context>
|
|
82
|
-
<repo>owner/repo</repo>
|
|
83
|
-
<branch>head ref</branch>
|
|
84
|
-
<base_branch>base ref</base_branch>
|
|
85
|
-
<pr_url>url or "none"</pr_url>
|
|
86
|
-
</context>
|
|
87
|
-
|
|
88
|
-
<scope>
|
|
89
|
-
<diff_path><diff_temp_path> (absolute scoped temp path from Step 2)</diff_path>
|
|
90
|
-
<scope_rule>Audit only lines added or modified in the diff. Pre-existing code on untouched lines is out of scope.</scope_rule>
|
|
91
|
-
</scope>
|
|
92
|
-
|
|
93
|
-
<bug_categories>
|
|
94
|
-
Investigate each explicitly:
|
|
95
|
-
A. API contract verification
|
|
96
|
-
B. Selector / query / engine compatibility
|
|
97
|
-
C. Resource cleanup and lifecycle
|
|
98
|
-
D. Variable scoping, ordering, and unbound references
|
|
99
|
-
E. Dead code and unused imports
|
|
100
|
-
F. Silent failures
|
|
101
|
-
G. Off-by-one, bounds, integer overflow
|
|
102
|
-
H. Security boundaries
|
|
103
|
-
I. Concurrency hazards
|
|
104
|
-
J. CODE_RULES.md compliance
|
|
105
|
-
K. Codebase conflicts (incomplete propagation)
|
|
106
|
-
L. Behavior-equivalence for refactors
|
|
107
|
-
M. Producer/consumer cardinality vs collection-type contract
|
|
108
|
-
N. Test-name scenario verifier
|
|
109
|
-
O. Docstring / fixture-prose vs implementation drift
|
|
110
|
-
P. Name / regex / word-list vs behavior-contract precision
|
|
111
|
-
|
|
112
|
-
The category list above is a summary. The binding definition of each
|
|
113
|
-
category is its rubric file under $HOME/.claude/audit-rubrics/category_rubrics/
|
|
114
|
-
(ready-to-send prompt variants under $HOME/.claude/audit-rubrics/prompts/).
|
|
115
|
-
Read the rubric files before auditing.
|
|
116
|
-
</bug_categories>
|
|
117
|
-
|
|
118
|
-
<constraints>
|
|
119
|
-
Read-only. Report findings only. Do not modify code, do not propose
|
|
120
|
-
full diffs, do not commit, do not push. Cite file:line for every claim.
|
|
121
|
-
When the diff alone does not provide enough context to confirm or deny
|
|
122
|
-
a bug, list it under "Open questions" rather than asserting.
|
|
123
|
-
</constraints>
|
|
124
|
-
|
|
125
|
-
<output_format>
|
|
126
|
-
Follow the shared audit contract at $HOME/.claude/_shared/pr-loop/audit-contract.md:
|
|
127
|
-
|
|
128
|
-
- Severity: P0 = will not run / data corruption; P1 = regression or silent
|
|
129
|
-
failure; P2 = dead code, minor smell.
|
|
130
|
-
- Per category, produce either Shape A (structured finding) or Shape B
|
|
131
|
-
(proof-of-absence). Bare "verified clean" labels are REJECTED.
|
|
132
|
-
- Run the contract's adversarial second pass after the primary list.
|
|
133
|
-
|
|
134
|
-
Preamble: `Total: N (P0=N, P1=N, P2=N)`. Emit findings and proof-of-absence
|
|
135
|
-
entries in the JSON shapes defined by the contract. Include an "Open
|
|
136
|
-
questions" section for items the diff alone cannot resolve.
|
|
137
|
-
</output_format>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Step 4: Post the audit review
|
|
141
|
-
|
|
142
|
-
Every `/findbugs` invocation posts one audit review back to the PR. The
|
|
143
|
-
unresolved-thread gate counts review threads, so a findbugs pass that
|
|
144
|
-
returns findings without posting them as inline comments is invisible
|
|
145
|
-
to the gate. Findbugs remains read-only on code — the review post is
|
|
146
|
-
the only side effect.
|
|
147
|
-
|
|
148
|
-
Capture `<head_sha>` once at the start of Step 4 via `git rev-parse
|
|
149
|
-
HEAD` in the worktree the diff was scoped against.
|
|
150
|
-
|
|
151
|
-
After the agent (and Haiku secondary) return and the merge is complete,
|
|
152
|
-
apply the `post-audit-findings` skill (`../post-audit-findings/SKILL.md`)
|
|
153
|
-
with `--skill findbugs`. That skill owns the findings-JSON mapping, the
|
|
154
|
-
anchored-only serialization (unanchored findings surface via Step 5's
|
|
155
|
-
user-facing output), the CLEAN/DIRTY decision, the self-PR reviewer
|
|
156
|
-
toggle, and the exit codes. On exit 0, surface the emitted review
|
|
157
|
-
`html_url` alongside the totals in Step 5. On exit 2, tell the user the
|
|
158
|
-
review post failed and that the unresolved-thread gate will not see this
|
|
159
|
-
audit pass; do not retry silently.
|
|
160
|
-
|
|
161
|
-
### Step 5: Surface findings, then clean up
|
|
162
|
-
|
|
163
|
-
When the agent returns, report concisely:
|
|
164
|
-
|
|
165
|
-
- One-line totals: `N P0 / N P1 / N P2 — K categories cleared`
|
|
166
|
-
- Each finding's `file:line`, category, and one-sentence description
|
|
167
|
-
- The cleared categories so the user can see coverage breadth
|
|
168
|
-
- Any open questions the agent could not resolve from the diff alone
|
|
169
|
-
|
|
170
|
-
Offer the next step without auto-executing it: `Want me to run /fixbugs for the P0/P1 findings?`
|
|
171
|
-
|
|
172
|
-
Delete the scoped temp diff at `<diff_temp_path>` after the audit completes (or moves to a fix flow). Temporary diff files do not belong in the working tree.
|
|
173
|
-
|
|
174
|
-
Do not paste the full agent transcript or the XML prompt unless the user asks.
|
|
175
|
-
|
|
176
|
-
## Output Format
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
N P0 / N P1 / N P2 — K categories cleared
|
|
180
|
-
|
|
181
|
-
P1 — short title
|
|
182
|
-
file/path.py:NN — one-sentence description (category: <name>)
|
|
183
|
-
|
|
184
|
-
P2 — short title
|
|
185
|
-
file/path.py:NN — one-sentence description (category: <name>)
|
|
186
|
-
|
|
187
|
-
Verified clean: <category>, <category>, <category>
|
|
188
|
-
|
|
189
|
-
Open questions:
|
|
190
|
-
<if any>
|
|
191
|
-
|
|
192
|
-
Want me to run /fixbugs for the P0/P1 findings?
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## Constraints
|
|
196
|
-
|
|
197
|
-
- **Read-only on code.** The skill never edits files, never pushes, never commits. One audit review per invocation gets posted back to the PR (Step 4) — that is the only side effect, and it is required so the unresolved-thread gate sees the audit pass.
|
|
198
|
-
- **Foreground spawn.** The user is waiting for the result on this turn.
|
|
199
|
-
- **PR-scoped, not session-scoped.** The audit covers the entire PR diff regardless of which files were edited in this conversation.
|
|
200
|
-
- **Clean-room prompt.** The agent's prompt is self-contained — no references to chat history, no anchoring hints, no expected outcomes.
|
|
201
|
-
- **No clean-coder auto-spawn.** Always ask before fixing.
|
|
202
|
-
- **Trust the agent's verdict.** Pass through P0/P1/P2 categorizations as the agent assigned them; do not re-rank.
|
|
203
|
-
- **Temp file cleanup.** Delete the scoped `<diff_temp_path>` when the audit ends.
|
|
204
|
-
|
|
205
|
-
## Examples
|
|
206
|
-
|
|
207
|
-
<example>
|
|
208
|
-
User: `/findbugs`
|
|
209
|
-
Claude: [resolves PR #42 from current branch, fetches full diff, spawns code-quality-agent foreground with self-contained prompt, returns]
|
|
210
|
-
|
|
211
|
-
`1 P0 / 2 P1 / 0 P2 — 11 categories cleared`
|
|
212
|
-
|
|
213
|
-
`P0 — race condition on shared cache write`
|
|
214
|
-
` src/cache.py:88 — concurrent writers can both pass the existence check before either writes (category: I — Concurrency hazards)`
|
|
215
|
-
|
|
216
|
-
`P1 — silent paste failure`
|
|
217
|
-
` utils/clipboard.py:33 — validated_paste returns success without verifying the post-paste state (category: F — Silent failures)`
|
|
218
|
-
|
|
219
|
-
`P1 — unbound variable on early-exception path`
|
|
220
|
-
` src/processor.py:283 — scheduling_log referenced after try/finally where it may be unbound (category: D — Variable scoping, ordering, and unbound references)`
|
|
221
|
-
|
|
222
|
-
`Verified clean: API contract, selector compatibility, resource cleanup, dead code, off-by-one, security boundaries, CODE_RULES.md compliance, codebase conflicts, behavior-equivalence, producer/consumer cardinality, Test-name scenario verifier`
|
|
223
|
-
|
|
224
|
-
`Open questions: none`
|
|
225
|
-
|
|
226
|
-
`Want me to run /fixbugs for the P0 + P1s?`
|
|
227
|
-
</example>
|
|
228
|
-
|
|
229
|
-
<example>
|
|
230
|
-
User: `/findbugs`
|
|
231
|
-
Claude: `No PR or upstream diff. /findbugs needs a target.`
|
|
232
|
-
</example>
|
|
233
|
-
|
|
234
|
-
<example>
|
|
235
|
-
User: `/findbugs` (branch with no PR but commits ahead of main)
|
|
236
|
-
Claude: [falls back to `git diff origin/main...HEAD`, runs audit on that diff scope]
|
|
237
|
-
</example>
|
|
238
|
-
|
|
239
|
-
## Why this design
|
|
240
|
-
|
|
241
|
-
Anchoring bias is the failure mode of context-rich audits. An agent that inherits "we just fixed three bugs in clipboard_utils.py" subconsciously scopes its hunt around clipboard_utils.py and pattern-matches on the same bug shapes. A clean-room audit on the full PR diff treats every file equally, considers every category, and surfaces things the orchestrator session never looked at. The diff is the contract; everything else is noise.
|
package/skills/fixbugs/CLAUDE.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# fixbugs
|
|
2
|
-
|
|
3
|
-
Bridges `/findbugs` audit results to `/agent-prompt` for automated fixing. Triggered by `/fixbugs`, `fix all the bugs`, `apply the audit fixes`, or `implement the findbugs results`.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
A thin bridge: recover the prior `/findbugs` findings from the current conversation, apply an optional severity filter (`P0`, `P0+P1`, `P1`, or all), re-resolve PR scope, then hand the filtered finding list to `/agent-prompt` as a structured goal string. `/agent-prompt` authors the XML prompt, shows an Outcome preview, asks for confirmation, and spawns a background sonnet `clean-coder` agent to apply all fixes in one commit.
|
|
8
|
-
|
|
9
|
-
This skill never audits, never edits files, and never spawns agents directly. The `/agent-prompt` confirmation gate is always preserved.
|
|
10
|
-
|
|
11
|
-
## Key file
|
|
12
|
-
|
|
13
|
-
| File | Purpose |
|
|
14
|
-
|---|---|
|
|
15
|
-
| `SKILL.md` | Four-step process: recover findings, apply severity filter, re-resolve PR scope, hand off to `/agent-prompt` with a goal string in the exact expected shape. Includes refusal cases (no findings, zero bugs, empty filter, missing `agent-prompt` skill) and the implementer constraints (one commit, no `--force`, no rebase, explicit `git add` by path). |
|
|
16
|
-
|
|
17
|
-
## Invocation order
|
|
18
|
-
|
|
19
|
-
Run `/findbugs` first, then `/fixbugs`. Running `/fixbugs` with no prior `/findbugs` in the session returns `No findings in this session. Run /findbugs first.`
|
package/skills/fixbugs/SKILL.md
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: fixbugs
|
|
3
|
-
description: >-
|
|
4
|
-
Fixes the bugs from the latest /findbugs run by handing them to /agent-prompt,
|
|
5
|
-
which spawns a background agent to apply every fix in one commit. An optional
|
|
6
|
-
argument filters by severity (e.g. /fixbugs P0). Triggers: '/fixbugs', 'fix
|
|
7
|
-
all the bugs', 'apply the audit fixes', 'apply the findbugs results'.
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Fixbugs
|
|
11
|
-
|
|
12
|
-
**Core principle:** A thin bridge between `/findbugs` (read-only audit) and `/agent-prompt` (structured prompt authoring + spawn). /fixbugs recovers the prior findings, packages them as a goal, and hands off. It does not author prompts itself, does not spawn agents directly, and does not run audits.
|
|
13
|
-
|
|
14
|
-
## Transport check (before any GitHub step)
|
|
15
|
-
|
|
16
|
-
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, route every `gh` operation in this skill through its substitution matrix, and carry the same routing into the goal string handed to `/agent-prompt` so the spawned fix agent inherits it.
|
|
17
|
-
|
|
18
|
-
## When this skill applies
|
|
19
|
-
|
|
20
|
-
Right after `/findbugs` returned findings on the current branch and the user wants the bugs fixed without further triage. Bare `/fixbugs` defaults to all severities (P0 + P1 + P2). Argument-filtered invocations (e.g. `/fixbugs P0`, `/fixbugs P0+P1`, `/fixbugs P0 P1`) narrow the target set.
|
|
21
|
-
|
|
22
|
-
Refusal cases:
|
|
23
|
-
|
|
24
|
-
- **No findings in session.** Respond exactly: `No findings in this session. Run /findbugs first.` and stop.
|
|
25
|
-
- **Most recent /findbugs returned zero bugs.** Respond exactly: `No bugs to fix.` and stop.
|
|
26
|
-
- **Filter excludes every finding.** Respond: `No bugs match the filter <args>.` and stop.
|
|
27
|
-
- **Agent-prompt skill not installed.** Before Step 1, verify the `agent-prompt` skill is in the available skills list. If missing, respond: `agent-prompt skill not installed. /fixbugs hands off to it; install it first.` and stop.
|
|
28
|
-
|
|
29
|
-
## The Process
|
|
30
|
-
|
|
31
|
-
### Step 1: Recover the findings
|
|
32
|
-
|
|
33
|
-
Locate the most recent `/findbugs` output in the current conversation. For each finding, capture:
|
|
34
|
-
|
|
35
|
-
- Severity (`P0` / `P1` / `P2`)
|
|
36
|
-
- `file:line`
|
|
37
|
-
- Category (the A–P letter or category name `/findbugs` reported)
|
|
38
|
-
- One-sentence description as `/findbugs` wrote it
|
|
39
|
-
|
|
40
|
-
Apply the severity filter from `$ARGUMENTS` if present:
|
|
41
|
-
|
|
42
|
-
- `P0` → P0 only
|
|
43
|
-
- `P0+P1` or `P0 P1` → P0 and P1
|
|
44
|
-
- `P1` → P1 only
|
|
45
|
-
- absent → all severities
|
|
46
|
-
|
|
47
|
-
If the filtered set is empty, refuse per the refusal cases above.
|
|
48
|
-
|
|
49
|
-
### Step 2: Re-resolve PR scope
|
|
50
|
-
|
|
51
|
-
Apply the `pr-scope-resolve` skill (`../pr-scope-resolve/SKILL.md`) with caller `fixbugs` to resolve the same PR target `/findbugs` used — the fixes stay scoped to the files the `/findbugs` findings from Step 1 name. When no target exists, respond with the sub-skill's canonical refusal line and stop:
|
|
52
|
-
|
|
53
|
-
`No PR or upstream diff. /fixbugs needs a target.`
|
|
54
|
-
|
|
55
|
-
Capture: `<owner>/<repo>`, head branch, base branch, PR number, PR URL.
|
|
56
|
-
|
|
57
|
-
### Step 3: Hand off to /agent-prompt
|
|
58
|
-
|
|
59
|
-
Invoke the `agent-prompt` skill with a goal string of this exact shape:
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
Fix the following bugs surfaced by /findbugs on
|
|
63
|
-
<owner>/<repo> @ <head_branch> (PR #<number>, base <base_branch>):
|
|
64
|
-
|
|
65
|
-
[for each filtered finding, one bullet:]
|
|
66
|
-
- [<severity>] <file:line> (<category>): <description>
|
|
67
|
-
|
|
68
|
-
Deploy a background implementer (model: sonnet) to implement all fixes
|
|
69
|
-
in one commit on the existing branch and push. The implementer must **Read** the clean-coder agent file first (`~/.claude/agents/clean-coder.md`; Windows `%USERPROFILE%\.claude\agents\clean-coder.md`) and treat it as binding; on Cursor use `Task` + `generalPurpose` with that Read in the prompt when `clean-coder` is not a valid `Task` subtype. Constraints:
|
|
70
|
-
- Modify only the files referenced in the bug list above.
|
|
71
|
-
- Do NOT change the PR base, do NOT rebase, do NOT amend, do NOT --force.
|
|
72
|
-
- Do NOT skip git hooks (no --no-verify, no --no-gpg-sign).
|
|
73
|
-
- Use git add by explicit path; never `git add .` or `git add -A`.
|
|
74
|
-
- Preserve existing comments on lines you do not modify.
|
|
75
|
-
- Type hints on every signature you touch.
|
|
76
|
-
|
|
77
|
-
After push, report: commit SHA, per-file lines added/removed, hook output
|
|
78
|
-
summary, and confirmation that each bug above was addressed.
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
`/agent-prompt` then runs its own workflow end-to-end: prompt-generator authoring, Outcome preview, AskUserQuestion confirmation gate, background spawn. The confirmation gate is preserved — fixes are write operations and the user must approve the final XML before the agent runs.
|
|
82
|
-
|
|
83
|
-
### Step 4: Hand-off complete
|
|
84
|
-
|
|
85
|
-
`/fixbugs` produces no further output. `/agent-prompt` owns the visible chat from this point: the XML fence, the Outcome digest, the AskUserQuestion, and the spawn confirmation. Do not duplicate any of those, do not summarize them, do not add commentary.
|
|
86
|
-
|
|
87
|
-
## Output Format
|
|
88
|
-
|
|
89
|
-
When `/fixbugs` proceeds, the visible output is `/agent-prompt`'s output — nothing from `/fixbugs` itself.
|
|
90
|
-
|
|
91
|
-
When `/fixbugs` short-circuits (no findings, no PR, empty filter, zero bugs), the visible output is the single-line refusal message and nothing else.
|
|
92
|
-
|
|
93
|
-
## Constraints
|
|
94
|
-
|
|
95
|
-
- **Sequencing.** `/fixbugs` runs AFTER `/findbugs`. It does not perform audits.
|
|
96
|
-
- **Scope inheritance.** Fixes target only files referenced in the prior `/findbugs` findings — the PR diff scope. Do not expand to unrelated files.
|
|
97
|
-
- **No silent spawn.** `/agent-prompt`'s confirmation gate is preserved on every run.
|
|
98
|
-
- **One commit per `/fixbugs` run.** All filtered fixes batch into a single commit.
|
|
99
|
-
- **No `--force`, no `--amend`, no rebase, no base change.** Standard git workflow applies to the spawned agent.
|
|
100
|
-
- **Sonnet for the implementer.** Always pass `model: sonnet` to the spawn — keeps cost predictable and matches the agent's training fit for code edits.
|
|
101
|
-
- **Background spawn.** The user typed `/fixbugs` to delegate, not to wait. The agent runs in the background and notifies on completion.
|
|
102
|
-
|
|
103
|
-
## Examples
|
|
104
|
-
|
|
105
|
-
<example>
|
|
106
|
-
User: `/findbugs` → returns `1 P0 / 2 P1 / 0 P2`
|
|
107
|
-
User: `/fixbugs`
|
|
108
|
-
Claude: [recovers all 3 findings, resolves PR scope, invokes /agent-prompt with a goal targeting all 3 bugs; /agent-prompt presents the XML + Outcome digest + AskUserQuestion; on Launch it, the background sonnet implementer spawns]
|
|
109
|
-
</example>
|
|
110
|
-
|
|
111
|
-
<example>
|
|
112
|
-
User: `/findbugs` → returns `1 P0 / 2 P1 / 1 P2`
|
|
113
|
-
User: `/fixbugs P0+P1`
|
|
114
|
-
Claude: [filters to 3 findings (the P2 is dropped), hands the filtered set to /agent-prompt]
|
|
115
|
-
</example>
|
|
116
|
-
|
|
117
|
-
<example>
|
|
118
|
-
User: `/fixbugs` (no prior /findbugs in session)
|
|
119
|
-
Claude: `No findings in this session. Run /findbugs first.`
|
|
120
|
-
</example>
|
|
121
|
-
|
|
122
|
-
<example>
|
|
123
|
-
User: `/findbugs` → returns `0 P0 / 0 P1 / 0 P2`
|
|
124
|
-
User: `/fixbugs`
|
|
125
|
-
Claude: `No bugs to fix.`
|
|
126
|
-
</example>
|
|
127
|
-
|
|
128
|
-
<example>
|
|
129
|
-
User: `/findbugs` → returns `0 P0 / 0 P1 / 1 P2`
|
|
130
|
-
User: `/fixbugs P0`
|
|
131
|
-
Claude: `No bugs match the filter P0.`
|
|
132
|
-
</example>
|
|
133
|
-
|
|
134
|
-
## Why this design
|
|
135
|
-
|
|
136
|
-
Three skills, three responsibilities:
|
|
137
|
-
|
|
138
|
-
- `/findbugs` audits in a clean room, returns findings.
|
|
139
|
-
- `/fixbugs` packages findings as a goal, delegates.
|
|
140
|
-
- `/agent-prompt` authors the XML and spawns the agent (with confirmation).
|
|
141
|
-
|
|
142
|
-
Each skill stays small and reuses what already exists. `/fixbugs` adds value by recovering findings from chat, filtering by severity, and writing the goal in `/agent-prompt`'s expected shape — not by reimplementing prompt authoring or spawn logic. The `/agent-prompt` confirmation gate is non-negotiable because fixes write code, push to a PR, and are visible to reviewers; the friction is the safety.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# gh-paginate skill
|
|
2
|
-
|
|
3
|
-
Provides the safe-pagination rule and patterns for `gh api` calls against paginated GitHub list endpoints (PR reviews, PR comments, issue comments, pulls, issues). The rule prevents two silent-truncation defects: default page truncation and per-page `--jq` evaluation.
|
|
4
|
-
|
|
5
|
-
**Trigger:** Loaded by the `gh-paginate` skill name or when any skill or rule references the pagination rule.
|
|
6
|
-
|
|
7
|
-
## Key files
|
|
8
|
-
|
|
9
|
-
| File | Purpose |
|
|
10
|
-
|---|---|
|
|
11
|
-
| `SKILL.md` | The complete rule: affected endpoints, safe `--paginate --slurp \| jq` pattern, single-page bound pattern, single-object pattern, newest-first walk pattern, and enforcement notes |
|
|
12
|
-
|
|
13
|
-
## Conventions
|
|
14
|
-
|
|
15
|
-
- The preferred pattern pipes `--paginate --slurp` to an **external** `jq` invocation so cross-page operations (`sort_by`, `last`, `reverse`) run on the merged array-of-pages. The built-in `--jq` flag is incompatible with `--slurp` and runs per-page, producing wrong cross-page results.
|
|
16
|
-
- Single-object endpoints (e.g., `pulls/<number>`) are not paginated; `--paginate` is unnecessary and `gh --jq` is safe.
|
|
17
|
-
- The single-page bound pattern (`?per_page=100` without `--paginate`) is acceptable only when the list is confirmed to stay under 100 entries.
|
|
18
|
-
- This skill ships as documentation only; enforcement via a future PreToolUse hook is noted in `SKILL.md`.
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gh-paginate
|
|
3
|
-
description: Safe pagination for gh api reads of paginated GitHub list endpoints (PR reviews/comments/files, issue comments, pulls, issues) — --paginate --slurp piped to external jq, single-page bounds, newest-first walks. Use before composing any gh api list-endpoint call or any cross-page jq operation (sort_by | last, reverse).
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# gh API Pagination Rule
|
|
7
|
-
|
|
8
|
-
**Root cause:** GitHub REST API list endpoints paginate by default. Without `--paginate --slurp`, callers see only the oldest page, and cross-page jq operations (e.g., `sort_by | last`) operate within a single page — producing wrong-but-confident results.
|
|
9
|
-
|
|
10
|
-
**Rule:** All `gh api` calls that read `pulls/<number>/reviews`, `pulls/<number>/comments`, `issues/<number>/comments`, or any other paginated GitHub list endpoint **must** request the full set of pages AND apply any cross-page jq operation through external `jq`, not through `gh`'s built-in `--jq`. Use `--paginate --slurp | jq` (preferred — see [Safe patterns](#safe-patterns)). Never call these endpoints with their default pagination, and never use `gh`'s `--jq` for cross-page operations like `sort_by | last` or `| reverse | .[0]`.
|
|
11
|
-
|
|
12
|
-
## Two defects, one rule
|
|
13
|
-
|
|
14
|
-
This rule guards against two distinct silent-truncation defects that compound:
|
|
15
|
-
|
|
16
|
-
1. **Default page truncation.** Without `--paginate`, only the first page is fetched.
|
|
17
|
-
2. **`--jq` runs per-page, not on the concatenated result.** Per [GitHub CLI #10459](https://github.com/cli/cli/issues/10459), `gh api --paginate --jq '<filter>'` applies `<filter>` to each page **separately** and emits one output per page. Cross-page operations like `sort_by(.submitted_at) | last` therefore operate within each page independently, not across the merged result set.
|
|
18
|
-
|
|
19
|
-
The safe patterns below fix both defects together: `--paginate --slurp` walks every page AND emits a single merged structure, and an **external** `jq` then runs cross-page operations on that merged structure.
|
|
20
|
-
|
|
21
|
-
## Affected endpoints
|
|
22
|
-
|
|
23
|
-
The rule applies to every paginated read from the GitHub REST API. Common offenders in PR-loop skills:
|
|
24
|
-
|
|
25
|
-
- `gh api repos/<owner>/<repo>/pulls/<number>/reviews`
|
|
26
|
-
- `gh api repos/<owner>/<repo>/pulls/<number>/comments`
|
|
27
|
-
- `gh api repos/<owner>/<repo>/pulls/<number>/files`
|
|
28
|
-
- `gh api repos/<owner>/<repo>/issues/<number>/comments`
|
|
29
|
-
- `gh api repos/<owner>/<repo>/pulls`
|
|
30
|
-
- `gh api repos/<owner>/<repo>/issues`
|
|
31
|
-
|
|
32
|
-
The same rule applies to any other endpoint documented as paginated by GitHub (see [GitHub REST API pagination](https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api)).
|
|
33
|
-
|
|
34
|
-
Single-object endpoints (e.g., `repos/<owner>/<repo>/pulls/<number>` returning one PR object) are not paginated — `?per_page=...` is silently ignored, and neither `--paginate` nor external `jq` is required. Use `gh`'s `--jq` directly on those endpoints.
|
|
35
|
-
|
|
36
|
-
## Safe patterns
|
|
37
|
-
|
|
38
|
-
### Preferred — `--paginate --slurp` piped to external `jq`
|
|
39
|
-
|
|
40
|
-
`gh api ... --paginate --slurp` walks every page and emits a single merged JSON array of page-arrays (`[[page1_items...], [page2_items...], ...]`). Pipe to external `jq` to flatten and filter across the full result set:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
gh api 'repos/<owner>/<repo>/pulls/<number>/reviews?per_page=100' --paginate --slurp \
|
|
44
|
-
| jq '[.[][] | select(.user.login=="cursor[bot]")] | sort_by(.submitted_at) | last'
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The `.[][]` flattens the array-of-pages into one stream of items before the cross-page operators (`sort_by`, `last`, `reverse`) run. Combine with `?per_page=100` to reduce round-trips on long PRs.
|
|
48
|
-
|
|
49
|
-
`gh`'s `--jq` flag and `--slurp` flag are mutually exclusive (gh CLI rejects `--paginate --slurp --jq` with `the --slurp option is not supported with --jq or --template`), which is why the filter must run in an external `jq` invocation.
|
|
50
|
-
|
|
51
|
-
### Acceptable — single-page bound on a paginated list endpoint when result fits
|
|
52
|
-
|
|
53
|
-
When you have an explicit reason to read at most one page from a **paginated** list endpoint (e.g., a known-small list), document the bound in a comment and use `?per_page=100` without `--paginate`. Cross-page operators are not in play here, so `gh`'s `--jq` is safe:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
# Bound: a freshly created issue is expected to have <= 100 comments.
|
|
57
|
-
gh api 'repos/<owner>/<repo>/issues/<number>/comments?per_page=100' \
|
|
58
|
-
--jq '[.[] | select(.user.login=="cursor[bot]")] | length'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
This pattern is only safe when the endpoint is confirmed to return a list smaller than 100 entries. Lists that grow over the PR's lifetime (reviews, comments) must use `--paginate --slurp` plus external `jq`.
|
|
62
|
-
|
|
63
|
-
### Single-object endpoints — no pagination needed
|
|
64
|
-
|
|
65
|
-
Endpoints that return a single object (e.g., `pulls/<number>`, `issues/<number>`) are not paginated. `?per_page=...`, `--paginate`, and `--slurp` are all unnecessary. Use `gh`'s built-in `--jq` directly:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
gh api 'repos/<owner>/<repo>/pulls/<number>' --jq '.head.sha'
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Newest-first walk
|
|
72
|
-
|
|
73
|
-
Pair pagination with explicit reverse-sort so the consumer reads newest-first regardless of the API's internal order:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
gh api 'repos/<owner>/<repo>/pulls/<number>/reviews?per_page=100' --paginate --slurp \
|
|
77
|
-
| jq '[.[][] | select(.user.login=="cursor[bot]")] | sort_by(.submitted_at) | reverse'
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
This is the canonical pattern for the bugbot <-> bugteam convergence loop: walk newest-first, stop at the first clean review.
|
|
81
|
-
|
|
82
|
-
## Enforcement
|
|
83
|
-
|
|
84
|
-
This rule is documentation-only at present. A future PreToolUse hook may pattern-match `Bash` invocations of `gh api repos/.../pulls/<n>/(reviews|comments)` without `--paginate --slurp` (or with `--paginate --jq` doing cross-page operations) and return a corrective message. Until that hook lands, treat this rule as binding by review and rely on it during skill authoring.
|
package/skills/gotcha/CLAUDE.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# gotcha skill
|
|
2
|
-
|
|
3
|
-
Captures an obstacle encountered during a skill run and records it as a gotcha entry in the relevant skill file, then opens a draft PR via the `fresh-branch` skill.
|
|
4
|
-
|
|
5
|
-
**Trigger:** `/gotcha`, "add a gotcha", "document this gotcha", "record this obstacle".
|
|
6
|
-
|
|
7
|
-
## Key files
|
|
8
|
-
|
|
9
|
-
| File | Purpose |
|
|
10
|
-
|---|---|
|
|
11
|
-
| `SKILL.md` | Full workflow: collect obstacle details, delegate to `bg-agent`, confirm to user |
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
1. Distill the obstacle into: which skill file was affected, what happened, what the user did to resolve it, and what to do differently next time.
|
|
16
|
-
2. Invoke `/bg-agent` with a self-contained prompt that instructs the agent to use `/fresh-branch` (branch name `gotcha/<short-slug>`), append to or create a `## Gotchas` section at the bottom of the skill file, commit, push, and open a draft PR.
|
|
17
|
-
3. Confirm to the user that the recording is running in the background.
|
|
18
|
-
|
|
19
|
-
## Gotcha entry format
|
|
20
|
-
|
|
21
|
-
Each entry is a bullet under `## Gotchas`:
|
|
22
|
-
|
|
23
|
-
```markdown
|
|
24
|
-
- **<title>:** <what happens>. <what to do instead>.
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Repo routing
|
|
28
|
-
|
|
29
|
-
| Skill location | Target repo |
|
|
30
|
-
|---|---|
|
|
31
|
-
| `packages/claude-dev-env/skills/<name>/` | `jl-cmd/claude-dev-env` |
|
|
32
|
-
| `~/.claude/skills/<name>/` | `jl-cmd/claude-dev-env` |
|
|
33
|
-
| Project `.claude/skills/<name>/` | That project's repo |
|
package/skills/gotcha/SKILL.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gotcha
|
|
3
|
-
description: When a skill encounters an obstacle requiring user intervention, this skill invokes bg-agent to add the gotcha to the skill file's gotcha section and creates a PR via fresh-branch. Triggers on "/gotcha", "add a gotcha", "document this gotcha", "record this obstacle".
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# gotcha
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
When a skill is executed and hits an obstacle that requires user intervention to resolve, `/gotcha` captures that knowledge so future invocations avoid the same trap. It delegates the mechanical work to `bg-agent`, which writes the gotcha entry and opens a PR using `fresh-branch`.
|
|
11
|
-
|
|
12
|
-
**Announce at start:** "Recording this gotcha and opening a PR."
|
|
13
|
-
|
|
14
|
-
## Instructions
|
|
15
|
-
|
|
16
|
-
### Step 1 — Collect the gotcha
|
|
17
|
-
|
|
18
|
-
The caller provides the obstacle context. Distill it into:
|
|
19
|
-
|
|
20
|
-
- **Which skill file** hit the obstacle (full path, e.g. `packages/claude-dev-env/skills/rebase/SKILL.md`).
|
|
21
|
-
- **What happened** — the specific failure or blocker, in one or two sentences.
|
|
22
|
-
- **What the user had to do** to resolve it.
|
|
23
|
-
- **What to do differently next time** (the actionable gotcha).
|
|
24
|
-
|
|
25
|
-
Determine which repo the skill lives in. Usually this is `claude-dev-env`, but if the skill is in another repo (e.g. a project-specific `.claude/skills/` directory), use that repo instead.
|
|
26
|
-
|
|
27
|
-
### Step 2 — Delegate to bg-agent
|
|
28
|
-
|
|
29
|
-
Invoke `/bg-agent` with a task like:
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
bg-agent add a gotcha to <skill-file-path> in repo <repo-name>. The gotcha is: "<one-line summary>". Details: "<what happened, what the user did, and what to do next time>."
|
|
33
|
-
|
|
34
|
-
Steps:
|
|
35
|
-
1. Use /fresh-branch to create a branch named gotcha/<short-slug>.
|
|
36
|
-
2. In <skill-file-path>, add the gotcha entry under a ## Gotchas section (create the section at the bottom of the file if it does not exist).
|
|
37
|
-
3. Format each gotcha as a bullet: "- **<title>:** <description>."
|
|
38
|
-
4. Commit with message "fix(<skill-name>): add gotcha — <title>".
|
|
39
|
-
5. Push and create a draft PR.
|
|
40
|
-
6. Report the PR URL.
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
The bg-agent will pick a suitable agent type and run the full workflow in the background.
|
|
44
|
-
|
|
45
|
-
### Step 3 — Confirm
|
|
46
|
-
|
|
47
|
-
Tell the user: "Recording gotcha in the background. You will be notified when the PR is ready."
|
|
48
|
-
|
|
49
|
-
## Gotcha entry format
|
|
50
|
-
|
|
51
|
-
Every gotcha entry follows this format:
|
|
52
|
-
|
|
53
|
-
```markdown
|
|
54
|
-
## Gotchas
|
|
55
|
-
|
|
56
|
-
- **<title>:** <what happens>. <what to do instead>.
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
If a `## Gotchas` section already exists, append to it. If not, create it at the bottom of the skill file.
|
|
60
|
-
|
|
61
|
-
## Which repo
|
|
62
|
-
|
|
63
|
-
| Skill location | Repo |
|
|
64
|
-
|---|---|
|
|
65
|
-
| `packages/claude-dev-env/skills/<name>/` | `jl-cmd/claude-dev-env` |
|
|
66
|
-
| `~/.claude/skills/<name>/` | `jl-cmd/claude-dev-env` (user skills) |
|
|
67
|
-
| Project `.claude/skills/<name>/` | That project's repo |
|
|
68
|
-
|
|
69
|
-
When unsure, ask the user which repo. Otherwise, default to `claude-dev-env`.
|
|
70
|
-
|
|
71
|
-
## Gotchas
|
|
72
|
-
|
|
73
|
-
- **The bg-agent prompt must be self-contained.** The background agent has no access to this conversation. Include the skill file path, the gotcha text, the repo, and the exact workflow steps in the prompt.
|