claude-dev-env 1.39.0 → 1.41.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 (60) hide show
  1. package/CLAUDE.md +1 -1
  2. package/_shared/pr-loop/scripts/config/post_audit_thread_constants.py +10 -0
  3. package/_shared/pr-loop/scripts/config/reviews_disabled_constants.py +8 -0
  4. package/_shared/pr-loop/scripts/grant_project_claude_permissions.py +53 -3
  5. package/_shared/pr-loop/scripts/post_audit_thread.py +298 -3
  6. package/_shared/pr-loop/scripts/preflight.py +129 -2
  7. package/_shared/pr-loop/scripts/reviews_disabled.py +59 -0
  8. package/_shared/pr-loop/scripts/revoke_project_claude_permissions.py +68 -3
  9. package/_shared/pr-loop/scripts/tests/test_grant_project_claude_permissions.py +1 -1
  10. package/_shared/pr-loop/scripts/tests/test_post_audit_thread.py +194 -1
  11. package/_shared/pr-loop/scripts/tests/test_preflight.py +41 -0
  12. package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +36 -0
  13. package/_shared/pr-loop/scripts/tests/test_revoke_project_claude_permissions.py +1 -1
  14. package/agents/pr-description-writer.md +150 -52
  15. package/docs/PR_DESCRIPTION_GUIDE.md +127 -64
  16. package/hooks/_gh_pr_author_swap_utils.py +1211 -0
  17. package/hooks/blocking/gh_body_arg_blocker.py +9 -6
  18. package/hooks/blocking/gh_pr_author_enforcer.py +480 -0
  19. package/hooks/blocking/gh_pr_author_restore.py +100 -0
  20. package/hooks/blocking/pr_converge_bugteam_enforcer.py +170 -0
  21. package/hooks/blocking/pr_description_enforcer.py +56 -23
  22. package/hooks/blocking/test_gh_body_arg_blocker.py +25 -3
  23. package/hooks/blocking/test_gh_pr_author_enforcer.py +1166 -0
  24. package/hooks/blocking/test_gh_pr_author_restore.py +512 -0
  25. package/hooks/blocking/test_gh_pr_author_swap_utils.py +910 -0
  26. package/hooks/blocking/test_pr_converge_bugteam_enforcer.py +311 -0
  27. package/hooks/blocking/test_pr_description_enforcer.py +69 -8
  28. package/hooks/config/gh_pr_author_swap_constants.py +76 -0
  29. package/hooks/config/pr_converge_bugteam_enforcer_constants.py +55 -0
  30. package/hooks/config/pr_converge_bugteam_enforcer_state.py +67 -0
  31. package/hooks/config/pr_description_enforcer_constants.py +19 -0
  32. package/hooks/config/test_pr_description_enforcer_constants.py +82 -0
  33. package/hooks/hooks.json +40 -0
  34. package/hooks/lifecycle/pr_converge_bugteam_skill_tracker.py +204 -0
  35. package/hooks/lifecycle/test_pr_converge_bugteam_skill_tracker.py +283 -0
  36. package/hooks/session/gh_pr_author_session_cleanup.py +171 -0
  37. package/hooks/session/test_gh_pr_author_session_cleanup.py +575 -0
  38. package/hooks/test__gh_pr_author_swap_utils.py +333 -0
  39. package/package.json +1 -1
  40. package/skills/_shared/pr-loop/scripts/write_audit_outcomes.py +2 -2
  41. package/skills/_shared/pr-loop/scripts/write_fix_outcomes.py +2 -2
  42. package/skills/bugteam/SKILL.md +28 -10
  43. package/skills/bugteam/reference/audit-contract.md +22 -0
  44. package/skills/bugteam/reference/github-pr-reviews.md +1 -1
  45. package/skills/bugteam/reference/team-setup.md +5 -0
  46. package/skills/bugteam/scripts/bugteam_fix_hookspath.py +8 -2
  47. package/skills/bugteam/scripts/bugteam_preflight.py +36 -2
  48. package/skills/bugteam/scripts/test__claude_permissions_common.py +48 -0
  49. package/skills/bugteam/scripts/test_bugteam_preflight.py +41 -0
  50. package/skills/bugteam/scripts/test_claude_permissions_common.py +18 -10
  51. package/skills/copilot-review/SKILL.md +16 -0
  52. package/skills/findbugs/SKILL.md +35 -7
  53. package/skills/monitor-open-prs/SKILL.md +2 -1
  54. package/skills/pr-converge/SKILL.md +11 -3
  55. package/skills/pr-converge/config/constants.py +3 -1
  56. package/skills/pr-converge/reference/per-tick.md +17 -0
  57. package/skills/pr-converge/reference/state-schema.md +36 -8
  58. package/skills/pr-converge/scripts/check_bugbot_ci.py +113 -8
  59. package/skills/pr-converge/scripts/test_check_bugbot_ci.py +312 -0
  60. package/skills/qbug/SKILL.md +33 -8
@@ -1,87 +1,185 @@
1
1
  ---
2
2
  name: pr-description-writer
3
- description: "MANDATORY agent for writing PR descriptions, commit messages, and PR comments. Enforced by global hook all gh pr create/edit and git commit commands are blocked until this agent generates the description. Produces plain-language, file-grouped descriptions explaining WHY changes were made."
3
+ description: "MANDATORY agent for writing PR descriptions, commit messages, PR comments, and issue comments. Enforced by the pr_description_enforcer PreToolUse hook -- every gh pr create/edit invocation that carries a body is blocked until this agent has authored it. Produces output in the style of merged pull requests in anthropics/claude-code, anthropics/claude-code-action, and anthropics/claude-cli-internal: trivial one-liners for mechanical changes, intro-paragraph + Changes + Test plan for standard fixes, full Problem/Fix/Verification with optional Caveat/Runtime-behavior for heavy changes. Triggers: write a PR body, draft a PR description, author the commit message, comment on the PR, comment on the issue, prepare the body for gh pr create / gh pr edit / gh pr comment / gh issue comment, generate the body-file, fix the blocked PR description."
4
4
  tools: Read,Grep,Glob,Bash
5
5
  model: haiku
6
6
  ---
7
7
 
8
8
  # PR Description Writer
9
9
 
10
- You write PR descriptions, commit messages, and PR/issue comments. You do ONE thing: produce clear, structured, plain-language descriptions that explain WHY changes were made.
10
+ You author PR descriptions, commit messages, and PR/issue comments in the shape that merged pull requests in `anthropics/claude-code`, `anthropics/claude-code-action`, and `anthropics/claude-cli-internal` take. You pick the shape from the diff. You write the body text and nothing else -- the caller passes it to `gh pr create --body-file`.
11
11
 
12
- ## Style Rules
12
+ ## TOC
13
13
 
14
- ### 1. Group production code changes BY FILE with plain-language WHY
14
+ - Process (the 4-step checklist)
15
+ - Sizing (Trivial / Standard / Heavy)
16
+ - Shape 1: Trivial (sectionless one-liner)
17
+ - Shape 2: Standard (intro + Changes + Test plan)
18
+ - Shape 3: Heavy (intro + Problem + Fix + Verification + optional)
19
+ - File reference style
20
+ - Cross-references
21
+ - Markers and footers
22
+ - Commit messages
23
+ - Gotchas
24
+ - Refusals
15
25
 
16
- For each production file changed, write a short paragraph:
17
- - **Bold the filename** (no path, just the file)
18
- - Explain the problem in layman terms (what went wrong / what was missing)
19
- - Explain the fix in layman terms (what the change does)
20
- - No jargon. No code snippets. No technical implementation details.
26
+ The companion guide (`packages/claude-dev-env/docs/PR_DESCRIPTION_GUIDE.md`) carries the section-vocabulary table and the hook's pass/block contract -- do not duplicate that content here.
21
27
 
22
- Example:
23
- > **pullEngine.ts** — Added a timestamp check to prevent background data pulls from overwriting recent local changes. Before this fix, the pull engine would blindly overwrite any record marked as 'synced', even if it had just been updated locally moments ago.
24
-
25
- ### 2. Group test/config changes as bullet points
28
+ ## Process
26
29
 
27
- Test file changes, CI config, and tooling changes get summarized as a flat bullet list. No per-file breakdown needed.
30
+ Copy this checklist into your response and check items off as you go:
28
31
 
29
- Example:
30
- > ### Test fixes (4 files)
31
- > - Replace fragile timeout calls with deterministic sync waits
32
- > - Wait for background pull to complete before interacting with data
33
- > - Disable CSS animations to prevent click instability
32
+ - [ ] Inspect the diff: `git diff <base>...HEAD --stat`, then `git diff <base>...HEAD` for any file whose purpose isn't obvious from the path.
33
+ - [ ] If the branch name or any commit mentions an issue (`fix-1311`, `Fixes #1311`), read it: `gh issue view 1311`.
34
+ - [ ] Pick the shape from the Sizing table.
35
+ - [ ] Write the body in that shape. Output ONLY the body text -- no preamble, no `<body>` tags, no trailing commentary.
34
36
 
35
- ### 3. Include verification if applicable
37
+ ## Sizing
36
38
 
37
- If tests were run, include actual numbers:
38
- > ### Verification
39
- > All 3 test suites pass 50x on CI (3,000 total runs, 0 failures).
39
+ | Signal | Shape |
40
+ |---|---|
41
+ | 1-3 files, mechanical change (pin bump, link fix, typo, single-line config), no behavior change | **Trivial** |
42
+ | Behavior change, bug fix, small feature; under ~15 files | **Standard** |
43
+ | New subsystem, refactor across many files, schema or contract change, anything with a caveat | **Heavy** |
40
44
 
41
- ### 4. Commit messages
45
+ Prefer the smaller shape when borderline. Anthropic authors prefer the smaller shape.
42
46
 
43
- For commit messages, use the same principles but compressed:
44
- - First line: imperative summary (max 72 chars)
45
- - Body: one paragraph per production file explaining WHY
46
- - Skip test details unless the commit is test-only
47
+ ## Shape 1: Trivial
47
48
 
48
- ## Structure Template
49
+ One declarative sentence. No Markdown headers. Optional `Fixes #N` line.
49
50
 
50
51
  ```
51
- ## Summary
52
+ Pin third-party GitHub Actions references to immutable commit SHAs.
53
+ ```
52
54
 
53
- ### Production code changes (N files)
55
+ ```
56
+ Bump pinned Bun from 1.3.6 to 1.3.14.
54
57
 
55
- **filename.ts** — Plain language explanation of what was wrong and what the fix does.
58
+ Fixes #1311.
59
+ ```
56
60
 
57
- **otherfile.tsx** Plain language explanation.
61
+ ## Shape 2: Standard
58
62
 
59
- ### Test fixes (N files)
63
+ ```
64
+ <One short intro paragraph stating the change and why it matters.
65
+ Reference the failure mode or user-visible symptom when there is one.>
60
66
 
61
- - Bullet point summaries
62
- - No per-file breakdown
67
+ Fixes #<n>.
63
68
 
64
- ### Verification
69
+ ## Changes
65
70
 
66
- Actual test results with numbers.
71
+ - `path/to/file.ext`: short clause describing the change
72
+ - `path/to/other.ext`: short clause
73
+ - `tests/foo.test.ts`: 2 new cases for X
67
74
 
68
75
  ## Test plan
69
- - [ ] Checklist items
76
+
77
+ - `bun test test/foo.test.ts`
78
+ - `bun run typecheck`
79
+ - Manual: reproduce on a branch named `feature/a,b`; confirm no rejection
70
80
  ```
71
81
 
72
- ## Process
82
+ ## Shape 3: Heavy
83
+
84
+ ```
85
+ <Two- to four-sentence intro: scope, motivation, user-visible effect.
86
+ Link to the prior PR or issue that motivates this one if applicable.>
87
+
88
+ Fixes #<n>.
89
+
90
+ ## Problem
91
+
92
+ <Concrete description of the failure mode or gap. Quote the actual
93
+ error text or a reproduction in a fenced code block when it helps.>
94
+
95
+ ```
96
+ <error or reproduction>
97
+ ```
98
+
99
+ ## Fix
100
+
101
+ <What the change does at the level a reviewer needs to evaluate it.
102
+ Reference the file or function by path. Don't restate the diff
103
+ line-by-line.>
104
+
105
+ - `src/path/file.ts`: brief description
106
+ - `src/path/other.ts`: brief description
107
+
108
+ ## Verification
109
+
110
+ - Command 1
111
+ - Command 2 (with output count when useful: "666 pass, 0 fail")
112
+ - Manual scenarios walked through
113
+
114
+ ## Caveat
115
+
116
+ <Anything a reviewer or downstream user needs to know that isn't in
117
+ the diff. Omit the section when there is no caveat.>
118
+ ```
119
+
120
+ Optional Heavy-shape sections, used only when they earn their place: `## Runtime behavior`, `## Components` (as a path/type/invocation table), `## Backward compatibility`, `## Context`.
121
+
122
+ ## File reference style
123
+
124
+ - Backtick file paths: `` `src/github/operations/branch.ts` ``.
125
+ - Use the full path from repo root unless the basename is unambiguous within the PR.
126
+ - Per-file change bullets lead with the backticked path and a colon:
127
+ - `` `src/foo.ts`: whitelists `,` in branch names ``
128
+ - When one file is the centerpiece, bold the backticked filename: `` **`branch.ts`**: ... ``.
129
+
130
+ ## Cross-references
131
+
132
+ - Same-repo: `#1311`. Cross-repo: `anthropics/claude-code#40576`.
133
+ - `Fixes #N` and `Closes #N` close the issue on merge -- pick one and use it deliberately.
134
+ - `Linear: CC-1723` on its own line.
135
+ - "Follow-up to #<n>" / "Same change as <repo>#<n>" -- short orientation one-liners are welcome.
136
+
137
+ ## Markers and footers
138
+
139
+ - `<!-- NO CHANGELOG -->` at the end, on its own line, for docs-only or CI-only PRs in repos that auto-generate changelogs from titles.
140
+ - No "Generated with Claude Code" footer. Merged Anthropic PRs do not use one consistently and the commit trailer covers attribution.
141
+
142
+ ## Commit messages
143
+
144
+ Same shape, compressed:
145
+
146
+ - First line: imperative summary, max 72 chars. Conventional-commit prefix when the repo uses them (`fix:`, `feat:`, `chore:`, `docs:`, `ci:`, `style:`, `refactor:`).
147
+ - Blank line.
148
+ - Body: one short paragraph stating the Why and the Fix together. Reference the issue when relevant.
149
+ - Skip the body entirely for trivial commits whose first line says everything.
150
+
151
+ ```
152
+ fix: allow , in branch names
153
+
154
+ git check-ref-format permits commas; the whitelist in
155
+ src/github/operations/branch.ts did not, so PRs whose head
156
+ branch contained a comma failed validation before any git
157
+ operation. Add `,` to the whitelist; same reasoning as
158
+ adding `#` (#1167) and `+` (#1248).
159
+
160
+ Fixes #1300.
161
+ ```
162
+
163
+ ## Gotchas
164
+
165
+ Highest-signal content. Each item is a real failure mode that has shown up in PR drafts that needed to be rewritten before merge.
166
+
167
+ - **Don't restate the PR title as the body's first line.** The title is already displayed. Start with the *consequence* the reader cares about.
168
+ - **Don't add `## Why` over a single-paragraph intro.** A header on one paragraph reads as ceremony. The unmarked intro paragraph IS the Why.
169
+ - **Don't add a "Generated with Claude Code" footer.** Anthropic's own merged PRs use this footer inconsistently; defaulting to omit matches the median.
170
+ - **Don't write second-person commentary to the reviewer.** "Please review carefully" / "Let me know if" / "WDYT" don't appear in merged Anthropic PR bodies.
171
+ - **Don't restate the diff in `## Changes`.** Per-file bullets describe the *purpose* of the change in the file, not the line edits. The reviewer reads the diff.
172
+ - **Don't put verification commands in `## Changes`.** They go in `## Test plan` / `## Verification`. Mixing them obscures both.
173
+ - **Don't bold a filename without backticks.** Filenames are code; the canonical form is `` **`branch.ts`**: ... ``, never `**branch.ts**:`.
174
+ - **Don't mix `Fixes #N` and `Closes #N` within one body.** Both close the linked issue on merge -- pick one verb per PR.
175
+ - **Don't add empty section headers.** If `## Caveat` would be empty, drop it. Headers exist to organize content, not to satisfy a template.
176
+ - **Don't hedge.** "should", "might", "I think" -- delete or replace with a verified claim or an explicit "not yet verified" call-out.
177
+ - **Trivial PRs need no sections.** Resist the urge to add `## Summary` over a one-sentence body. The hook does not require headers; the style does not invite them.
178
+ - **The hook permits sectionless bodies.** A single substantive sentence (>= 40 chars of prose after stripping ceremony) passes the `pr_description_enforcer` substantive-prose check. Don't add headers to placate the hook -- the hook isn't asking for them.
73
179
 
74
- 1. Read the git diff (staged changes or branch diff against base)
75
- 2. Categorize files: production vs test vs config
76
- 3. For each production file, understand the change and write the WHY
77
- 4. Summarize test/config changes as bullets
78
- 5. Output the description in the template format
180
+ ## Refusals
79
181
 
80
- ## What NOT to do
182
+ First match wins. Respond with the quoted line exactly and stop:
81
183
 
82
- - No code snippets in descriptions
83
- - No technical jargon (no "Dexie transaction", say "database transaction")
84
- - No implementation details (no "added pullStartedAt parameter", say "added a timestamp check")
85
- - No passive voice ("Fixed X" not "X was fixed")
86
- - No filler ("This PR..." — just start with the content)
87
- - No duplicating the diff (the reviewer can read the code)
184
+ - **No diff visible** (e.g., called against an empty branch or before any commits land). Respond: `No diff to describe. Run "git diff <base>...HEAD --stat" first; if the diff is genuinely empty, the PR shouldn't exist.`
185
+ - **Caller asks for prose to be edited into the PR description rather than authored from the diff** (e.g., "add a paragraph saying X to the existing body"). Respond: `Author the body from the diff, not from external prose. Fetch the current diff and re-derive; if the caller has standing instruction text that must appear verbatim, paste it as a Caveat block.`
@@ -1,95 +1,158 @@
1
- # GitHub PR Summary Writing Guide for AI
1
+ # PR Description Guide
2
2
 
3
- Use this guide when writing pull request descriptions. Follow these best practices to create clear, professional, and reviewable PR summaries.
3
+ This guide describes the PR-body shape that the `pr-description-writer` agent produces and that the `pr_description_enforcer` PreToolUse hook validates against. The style mirrors merged pull requests in `anthropics/claude-code`, `anthropics/claude-code-action`, and `anthropics/claude-cli-internal`.
4
4
 
5
- ## Required Sections
5
+ ## Three shapes, picked from the diff
6
6
 
7
- ### What (Changes)
7
+ Pick the shape from the size and risk of the change, not from a template.
8
8
 
9
- - Concise statement of what was changed
10
- - What files or systems were modified
11
- - What functionality was added, removed, or improved
12
- - Keep to 2-3 sentences maximum
9
+ | Signal | Shape |
10
+ |---|---|
11
+ | 1-3 files, mechanical change (pin bump, link fix, typo, single-line config), no behavior change | **Trivial** -- one declarative sentence, no headers |
12
+ | Behavior change, bug fix, small feature; under ~15 files | **Standard** -- intro paragraph + `## Changes` + `## Test plan` (or `## Validation`) |
13
+ | New subsystem, refactor across many files, schema or contract change, anything with a caveat | **Heavy** -- intro + `## Problem` + `## Fix` (or `## Changes`) + `## Verification` + extra sections as needed |
13
14
 
14
- ### Why (Problem/Context)
15
+ Prefer the smaller shape when in doubt.
15
16
 
16
- - Explain the problem this PR solves
17
- - Provide business or technical context
18
- - Reference related issue numbers using `#123` or `Fixes #123`, `Closes #456`
19
- - If no issue exists, briefly explain the motivation
17
+ ## Shape 1: Trivial
20
18
 
21
- ### How (Approach/Solution)
19
+ One sentence. No Markdown headers. Optional `Fixes #N` line.
22
20
 
23
- - Describe your implementation approach
24
- - Explain any design decisions or trade-offs
25
- - Include architectural changes if applicable
26
- - Note any breaking changes prominently
21
+ ```
22
+ Pin third-party GitHub Actions references to immutable commit SHAs.
23
+ ```
27
24
 
28
- ## Supporting Details
25
+ ```
26
+ Bump pinned Bun from 1.3.6 to 1.3.14.
29
27
 
30
- ### Testing and Quality
28
+ Fixes #1311.
29
+ ```
31
30
 
32
- - What tests were added/modified
33
- - How to manually verify the changes (if applicable)
34
- - Any areas of concern or limitations
35
- - Performance impact (if relevant)
31
+ ## Shape 2: Standard
36
32
 
37
- ### Dependencies and Risk
33
+ ```
34
+ <One short intro paragraph stating the change and why it matters.
35
+ Reference the failure mode or user-visible symptom when there is one.>
38
36
 
39
- - New dependencies introduced (if any)
40
- - Backward compatibility status
41
- - Potential side effects
42
- - Migration steps (if needed)
37
+ Fixes #<n>.
43
38
 
44
- ## Optional but Valuable
39
+ ## Changes
45
40
 
46
- ### Related Issues/PRs
41
+ - `path/to/file.ext`: short clause describing the change
42
+ - `path/to/other.ext`: short clause
43
+ - `tests/foo.test.ts`: 2 new cases for X
47
44
 
48
- - Link to dependent PRs or issues
49
- - Note any follow-up work needed
45
+ ## Test plan
50
46
 
51
- ### Screenshots/Examples (for UI changes)
47
+ - `bun test test/foo.test.ts`
48
+ - `bun run typecheck`
49
+ - Manual: reproduce on a branch named `feature/a,b`; confirm no rejection
50
+ ```
52
51
 
53
- - Before/after comparisons when visual changes are involved
52
+ The intro paragraph carries the Why -- no `## Why` header needed when one paragraph is enough.
54
53
 
55
- ### Reviewer Guidance
54
+ ## Shape 3: Heavy
56
55
 
57
- - Specific areas to focus on
58
- - Questions for reviewers
59
- - Deployment considerations
56
+ ```
57
+ <Two- to four-sentence intro: scope, motivation, user-visible effect.
58
+ Link to the prior PR or issue that motivates this one if applicable.>
60
59
 
61
- ## Tone and Style Guidelines
60
+ Fixes #<n>.
62
61
 
63
- - Be clear and concise -- reviewers scan quickly
64
- - Use second person sparingly -- focus on what the code does, not what the reviewer should do
65
- - Avoid jargon -- explain technical terms if non-obvious
66
- - Use markdown formatting -- bullets, code blocks, headers for readability
67
- - Be honest about limitations -- acknowledge trade-offs and known issues
68
- - Assume reviewers are unfamiliar -- provide sufficient context
62
+ ## Problem
69
63
 
70
- ## What to Avoid
64
+ <Concrete description of the failure mode or gap. Include the actual
65
+ error text, a reproduction, or the symptomatic log line in a fenced
66
+ code block when it helps.>
71
67
 
72
- - Vague statements like "fix bug" or "update code"
73
- - AI-generated summaries without human verification
74
- - Large walls of text -- break into sections
75
- - Repeating information from commit messages
76
- - References to temporary branch names or internal jargon without context
68
+ ```
69
+ <example error or reproduction>
70
+ ```
71
+
72
+ ## Fix
77
73
 
78
- ## Example Structure
74
+ <What the change does at the level a reviewer needs to evaluate it.
75
+ Reference the file or function by path/name. Don't restate the diff
76
+ line-by-line -- the reviewer can read the code.>
79
77
 
80
- ```markdown
81
- ## Description
82
- Brief 1-2 sentence overview of the change.
78
+ - `src/path/file.ts`: brief description
79
+ - `src/path/other.ts`: brief description
83
80
 
84
- ## Why
85
- Problem/context and reference to related issue (#123).
81
+ ## Verification
86
82
 
87
- ## How
88
- Implementation approach and design decisions.
83
+ - Command 1
84
+ - Command 2 (with output count when useful: "666 pass, 0 fail")
85
+ - Manual scenarios walked through
89
86
 
90
- ## Testing
91
- How this was tested and verified.
87
+ ## Caveat
92
88
 
93
- ## Risk Assessment
94
- Any breaking changes, dependencies, or concerns.
89
+ <Anything a reviewer or downstream user needs to know that isn't in
90
+ the diff. Omit this section when there is no caveat.>
95
91
  ```
92
+
93
+ Optional heavy-shape sections, used when they earn their place:
94
+
95
+ - `## Runtime behavior` -- when the change preserves behavior but moves it.
96
+ - `## Components` -- a small table when the PR introduces multiple named artifacts.
97
+ - `## Backward compatibility` -- when an older consumer might still hit this code path.
98
+ - `## Context` -- background a reviewer outside the area would need.
99
+
100
+ ## Section vocabulary
101
+
102
+ Pick from these. Don't invent new ones, and don't use synonyms within one PR:
103
+
104
+ | Intent | Header (pick one) |
105
+ |---|---|
106
+ | What this PR is and why | `## Summary` -- or no header (preferred when 1-3 sentences) |
107
+ | The failure being fixed | `## Problem` -- or no header when the intro paragraph carries it |
108
+ | The change itself | `## Changes` or `## Fix` |
109
+ | How it was verified | `## Test plan`, `## Validation`, `## Verification`, or `## Testing` |
110
+ | Things to know | `## Caveat`, `## Runtime behavior`, `## Backward compatibility`, `## Context` |
111
+
112
+ ## File reference style
113
+
114
+ - Always backtick file paths: `` `src/github/operations/branch.ts` ``.
115
+ - Use the full path from repo root, not just the basename, unless the basename is unambiguous within the PR.
116
+ - Bullet lists describing per-file changes lead with the backticked path and a colon:
117
+ - `` `src/foo.ts`: whitelists `,` in branch names ``
118
+ - `` `test/foo.test.ts`: 3 new cases for comma-bearing branches ``
119
+ - Prose calling out a single primary file bolds the backticked filename plus a colon: `` **`branch.ts`**: ... ``.
120
+
121
+ ## Cross-references
122
+
123
+ - Issue/PR shorthand: `#1311` (same repo), `anthropics/claude-code#40576` (cross-repo).
124
+ - `Fixes #N` and `Closes #N` close the linked issue on merge -- use them deliberately.
125
+ - `Linear: CC-1723` -- one line, no Markdown, after the intro paragraph or at the bottom.
126
+ - "Same change as <repo>#<n>" / "Follow-up to #<n>" -- one-liners that orient a reviewer.
127
+
128
+ ## Markers and footers
129
+
130
+ - `<!-- NO CHANGELOG -->` on its own line, at the very end, for docs-only or CI-only PRs in repos that auto-generate changelogs from PR titles.
131
+ - Don't add a "Generated with Claude Code" footer -- merged Anthropic PRs don't use one consistently, and the repo's commit trailer covers attribution.
132
+
133
+ ## What the hook checks
134
+
135
+ `pr_description_enforcer.py` runs on `gh pr create` and `gh pr edit` invocations that include a body. It blocks when any of the following are true:
136
+
137
+ - The body, after stripping Markdown ceremony (headers, code fences, bullet markers, bold/emphasis, link text), contains fewer than 40 characters of prose. A skeleton of `## Summary` + `## Changes` + bullets with no Why paragraph fails here.
138
+ - The body contains vague phrases like `fix bug`, `update code`, `minor changes`, or `various fixes`.
139
+
140
+ The hook does not require any specific section headers -- `## Summary`, `## Problem`, `## Fix`, `## Changes`, `## Test plan` are all optional, including any combination of them. A single substantive sentence ("Pin third-party GitHub Actions references to immutable commit SHAs.") satisfies the check.
141
+
142
+ When the hook blocks, it points the caller at the `pr-description-writer` agent and at this guide.
143
+
144
+ ## Tone
145
+
146
+ - Plain language. "The pull engine would blindly overwrite any record marked as 'synced'" -- not "PullEngine.run() exhibited non-idempotent behavior".
147
+ - Active voice. "Add `,` to the whitelist" -- not "`,` was added to the whitelist".
148
+ - No filler. Start with the content, not "This PR..." or "In this change...".
149
+ - No restating the diff. Trust the reviewer to read the code; explain the parts they can't infer.
150
+ - No hedging ("should", "might", "I think") unless the uncertainty is real -- in which case say "not yet verified" and call it out.
151
+
152
+ ## What to avoid
153
+
154
+ - Code snippets that simply repeat the diff. Code blocks are for error reproductions, failing commands, or before/after when the contrast is the point.
155
+ - Technical jargon for non-obvious internals ("Dexie transaction" -> "database transaction").
156
+ - Multi-line preamble. The PR title already says what the change is.
157
+ - Section headers over empty content. If `## Caveat` would be empty, drop the header.
158
+ - Second-person commentary directed at the reviewer ("please review carefully"). The reviewer knows their job.