claude-dev-env 1.68.0 → 1.69.1

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 (122) hide show
  1. package/_shared/CLAUDE.md +13 -0
  2. package/_shared/pr-loop/CLAUDE.md +24 -0
  3. package/_shared/pr-loop/scripts/CLAUDE.md +30 -0
  4. package/_shared/pr-loop/scripts/pr_loop_shared_constants/CLAUDE.md +21 -0
  5. package/_shared/pr-loop/scripts/tests/CLAUDE.md +32 -0
  6. package/agents/CLAUDE.md +29 -0
  7. package/audit-rubrics/CLAUDE.md +41 -0
  8. package/audit-rubrics/category_rubrics/CLAUDE.md +36 -0
  9. package/audit-rubrics/prompts/CLAUDE.md +36 -0
  10. package/bin/CLAUDE.md +28 -0
  11. package/commands/CLAUDE.md +25 -0
  12. package/docs/CLAUDE.md +28 -0
  13. package/docs/references/CLAUDE.md +13 -0
  14. package/hooks/CLAUDE.md +31 -0
  15. package/hooks/advisory/CLAUDE.md +16 -0
  16. package/hooks/blocking/CLAUDE.md +107 -0
  17. package/hooks/blocking/code_rules_constants_config.py +7 -4
  18. package/hooks/blocking/code_rules_dead_config_field.py +284 -50
  19. package/hooks/blocking/code_rules_docstrings.py +97 -0
  20. package/hooks/blocking/code_rules_enforcer.py +4 -0
  21. package/hooks/blocking/config/CLAUDE.md +22 -0
  22. package/hooks/blocking/test_code_rules_enforcer_class_docstring_methods.py +262 -0
  23. package/hooks/blocking/test_code_rules_enforcer_dead_config_field.py +336 -3
  24. package/hooks/blocking/test_code_rules_enforcer_dead_module_constant.py +36 -0
  25. package/hooks/blocking/test_code_rules_enforcer_file_global_constants.py +9 -0
  26. package/hooks/diagnostic/CLAUDE.md +43 -0
  27. package/hooks/diagnostic/migrations/CLAUDE.md +16 -0
  28. package/hooks/diagnostic/queries/CLAUDE.md +19 -0
  29. package/hooks/git-hooks/CLAUDE.md +28 -0
  30. package/hooks/git-hooks/git_hooks_constants/CLAUDE.md +21 -0
  31. package/hooks/hooks_constants/CLAUDE.md +60 -0
  32. package/hooks/hooks_constants/blocking_check_limits.py +2 -0
  33. package/hooks/lifecycle/CLAUDE.md +18 -0
  34. package/hooks/observability/CLAUDE.md +16 -0
  35. package/hooks/session/CLAUDE.md +21 -0
  36. package/hooks/validation/CLAUDE.md +19 -0
  37. package/hooks/validators/CLAUDE.md +49 -0
  38. package/hooks/workflow/CLAUDE.md +22 -0
  39. package/package.json +1 -1
  40. package/rules/CLAUDE.md +46 -0
  41. package/rules/docstring-prose-matches-implementation.md +1 -1
  42. package/scripts/CLAUDE.md +34 -0
  43. package/scripts/dev_env_scripts_constants/CLAUDE.md +14 -0
  44. package/scripts/sync_to_cursor/CLAUDE.md +23 -0
  45. package/scripts/tests/CLAUDE.md +18 -0
  46. package/skills/CLAUDE.md +66 -0
  47. package/skills/_shared/CLAUDE.md +11 -0
  48. package/skills/_shared/pr-loop/CLAUDE.md +27 -0
  49. package/skills/_shared/pr-loop/prompts/CLAUDE.md +9 -0
  50. package/skills/_shared/pr-loop/scripts/CLAUDE.md +23 -0
  51. package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/CLAUDE.md +19 -0
  52. package/skills/anthropic-plan/CLAUDE.md +34 -0
  53. package/skills/anthropic-plan/SKILL.md +1 -1
  54. package/skills/anthropic-plan/scripts/CLAUDE.md +11 -0
  55. package/skills/anthropic-plan/scripts/anthropic_plan_scripts_constants/CLAUDE.md +16 -0
  56. package/skills/anthropic-plan/templates/CLAUDE.md +13 -0
  57. package/skills/anthropic-plan/workflow/CLAUDE.md +14 -0
  58. package/skills/auditing-claude-config/CLAUDE.md +20 -0
  59. package/skills/autoconverge/CLAUDE.md +30 -0
  60. package/skills/autoconverge/reference/CLAUDE.md +12 -0
  61. package/skills/autoconverge/workflow/CLAUDE.md +23 -0
  62. package/skills/autoconverge/workflow/autoconverge_report_constants/CLAUDE.md +16 -0
  63. package/skills/bdd-protocol/CLAUDE.md +26 -0
  64. package/skills/bdd-protocol/references/CLAUDE.md +10 -0
  65. package/skills/bg-agent/CLAUDE.md +17 -0
  66. package/skills/bugteam/CLAUDE.md +30 -0
  67. package/skills/bugteam/reference/CLAUDE.md +22 -0
  68. package/skills/bugteam/reference/obstacles/CLAUDE.md +24 -0
  69. package/skills/bugteam/scripts/CLAUDE.md +36 -0
  70. package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +20 -0
  71. package/skills/caveman/CLAUDE.md +15 -0
  72. package/skills/code/CLAUDE.md +17 -0
  73. package/skills/copilot-review/CLAUDE.md +17 -0
  74. package/skills/deep-research/CLAUDE.md +17 -0
  75. package/skills/doc-gist/CLAUDE.md +25 -0
  76. package/skills/doc-gist/references/CLAUDE.md +9 -0
  77. package/skills/doc-gist/references/examples/CLAUDE.md +25 -0
  78. package/skills/doc-gist/scripts/CLAUDE.md +27 -0
  79. package/skills/doc-gist/scripts/doc_gist_scripts_constants/CLAUDE.md +10 -0
  80. package/skills/everything-search/CLAUDE.md +17 -0
  81. package/skills/findbugs/CLAUDE.md +20 -0
  82. package/skills/fixbugs/CLAUDE.md +19 -0
  83. package/skills/fresh-branch/CLAUDE.md +15 -0
  84. package/skills/gh-paginate/CLAUDE.md +18 -0
  85. package/skills/gotcha/CLAUDE.md +33 -0
  86. package/skills/implement/CLAUDE.md +27 -0
  87. package/skills/implement/scripts/CLAUDE.md +22 -0
  88. package/skills/implement/scripts/implement_scripts_constants/CLAUDE.md +22 -0
  89. package/skills/logifix/CLAUDE.md +36 -0
  90. package/skills/logifix/scripts/CLAUDE.md +16 -0
  91. package/skills/monitor-open-prs/CLAUDE.md +34 -0
  92. package/skills/monitor-open-prs/scripts/CLAUDE.md +17 -0
  93. package/skills/pr-consistency-audit/CLAUDE.md +34 -0
  94. package/skills/pr-consistency-audit/reference/CLAUDE.md +16 -0
  95. package/skills/pr-converge/CLAUDE.md +29 -0
  96. package/skills/pr-converge/pr_converge_skill_constants/CLAUDE.md +26 -0
  97. package/skills/pr-converge/reference/CLAUDE.md +27 -0
  98. package/skills/pr-converge/reference/obstacles/CLAUDE.md +23 -0
  99. package/skills/pr-converge/scripts/CLAUDE.md +36 -0
  100. package/skills/pr-converge/scripts/pr_converge_scripts_constants/CLAUDE.md +17 -0
  101. package/skills/pr-converge/workflows/CLAUDE.md +16 -0
  102. package/skills/pr-review-responder/CLAUDE.md +35 -0
  103. package/skills/pre-compact/CLAUDE.md +24 -0
  104. package/skills/qbug/CLAUDE.md +40 -0
  105. package/skills/rebase/CLAUDE.md +32 -0
  106. package/skills/recall/CLAUDE.md +30 -0
  107. package/skills/refine/CLAUDE.md +44 -0
  108. package/skills/refine/templates/CLAUDE.md +17 -0
  109. package/skills/remember/CLAUDE.md +31 -0
  110. package/skills/research-mode/CLAUDE.md +35 -0
  111. package/skills/session-log/CLAUDE.md +31 -0
  112. package/skills/session-tidy/CLAUDE.md +36 -0
  113. package/skills/skill-builder/CLAUDE.md +45 -0
  114. package/skills/skill-builder/references/CLAUDE.md +19 -0
  115. package/skills/skill-builder/templates/CLAUDE.md +14 -0
  116. package/skills/skill-builder/workflows/CLAUDE.md +17 -0
  117. package/skills/structure-prompt/CLAUDE.md +42 -0
  118. package/skills/structure-prompt/reference/CLAUDE.md +28 -0
  119. package/skills/task-build/CLAUDE.md +28 -0
  120. package/skills/update/CLAUDE.md +38 -0
  121. package/skills/verified-build/CLAUDE.md +33 -0
  122. package/system-prompts/CLAUDE.md +17 -0
@@ -0,0 +1,13 @@
1
+ # _shared
2
+
3
+ Cross-cutting runtime assets shared by multiple PR-loop skills (`bugteam`, `pr-converge`, `findbugs`, `fixbugs`). Files here are installed into `~/.claude/_shared/` by `bin/install.mjs` alongside the skill directories that import them.
4
+
5
+ ## Contents
6
+
7
+ | Entry | Description |
8
+ |---|---|
9
+ | `pr-loop/` | Docs, scripts, and constants for the PR-loop workflow suite |
10
+
11
+ ## Install path
12
+
13
+ `bin/install.mjs` copies this entire directory tree verbatim to `~/.claude/_shared/`. Skills reference files here by relative path from their own skill root (e.g. `../../_shared/pr-loop/audit-contract.md`).
@@ -0,0 +1,24 @@
1
+ # _shared/pr-loop
2
+
3
+ Runtime documents and scripts shared by every PR-loop skill. Changes here affect `bugteam`, `pr-converge`, `findbugs`, `fixbugs`, and `qbug` simultaneously — treat this as a breaking-change surface.
4
+
5
+ ## Key documents
6
+
7
+ | File | Purpose |
8
+ |---|---|
9
+ | `audit-contract.md` | Canonical finding schema (Shape A / Shape B) and loop contract; defines the JSON shapes every audit skill must emit |
10
+ | `audit-reply-template.md` | Canonical reply skeleton Claude posts to each unresolved review thread; single source of truth for reply structure |
11
+ | `fix-protocol.md` | Ordered sequence a fix lens follows: read, capture SHA, TDD, apply, validate, self-audit, commit, push, reply + resolve |
12
+ | `gh-payloads.md` | How to build GitHub review and reply payloads via MCP tools; describes the one-review-per-loop pattern |
13
+ | `state-schema.md` | Fields each PR-loop workflow tracks across iterations; documents common fields and per-skill extensions |
14
+ | `code-rules-gate.md` | Reference for the CODE_RULES pre-commit gate check; describes what the gate blocks and when it runs |
15
+
16
+ ## Subdirectory
17
+
18
+ | Entry | Description |
19
+ |---|---|
20
+ | `scripts/` | Python scripts and constants consumed at runtime by the PR-loop skills |
21
+
22
+ ## Breaking-change rule
23
+
24
+ Any shape change in `audit-contract.md` or `audit-reply-template.md` requires updating every consuming skill in the same commit.
@@ -0,0 +1,30 @@
1
+ # _shared/pr-loop/scripts
2
+
3
+ Python scripts invoked at runtime by the PR-loop skills. Each script is a standalone CLI entry point; `pr_loop_shared_constants/` holds the named constants they import.
4
+
5
+ ## Key scripts
6
+
7
+ | File | Purpose |
8
+ |---|---|
9
+ | `preflight.py` | Pre-flight check run before each audit loop tick: verifies hooks path, finds test files, runs pytest, checks for `BUGTEAM_PREFLIGHT_SKIP` opt-out |
10
+ | `preflight_self_heal.py` | Clears stale `core.hooksPath` overrides that Git seeds into fresh worktree local config; called from `preflight.py` |
11
+ | `post_audit_thread.py` | Posts an audit review (APPROVE / REQUEST_CHANGES) to a draft PR via the GitHub reviews API; reads the body skeleton from `audit-reply-template.md` at runtime |
12
+ | `grant_project_claude_permissions.py` | Writes idempotent allow-rules and `additionalDirectories` entries into `~/.claude/settings.json` so subagents can edit the project's `.claude/` tree without prompting |
13
+ | `revoke_project_claude_permissions.py` | Removes the allow-rules and entries that `grant_project_claude_permissions.py` wrote; safe to run when no prior grant exists |
14
+ | `code_rules_gate.py` | Pre-commit gate that runs `code_rules_enforcer` checks on staged Python files before a fix commit lands |
15
+ | `reviews_disabled.py` | Shared helper for the `CLAUDE_REVIEWS_DISABLED` opt-out gate; parses the env-var token to find which reviewer types are suppressed |
16
+ | `fix_hookspath.py` | Repairs a malformed `core.hooksPath` global git config entry |
17
+ | `_claude_permissions_common.py` | Internal helpers shared by the grant/revoke scripts: atomic settings.json writes, list mutation, path helpers |
18
+
19
+ ## Subdirectories
20
+
21
+ | Entry | Description |
22
+ |---|---|
23
+ | `pr_loop_shared_constants/` | Named constants used by the scripts above |
24
+ | `tests/` | pytest suite for all scripts in this directory |
25
+
26
+ ## Running tests
27
+
28
+ ```bash
29
+ python -m pytest packages/claude-dev-env/_shared/pr-loop/scripts/tests/
30
+ ```
@@ -0,0 +1,21 @@
1
+ # pr_loop_shared_constants
2
+
3
+ Named constants for every script in `_shared/pr-loop/scripts/`. Each module owns the constants for one script; the module name mirrors the script name with a `_constants` suffix.
4
+
5
+ ## Modules
6
+
7
+ | File | Constants for |
8
+ |---|---|
9
+ | `claude_permissions_constants.py` | `grant_project_claude_permissions.py` and `revoke_project_claude_permissions.py` — permission rule strings and settings.json keys |
10
+ | `claude_settings_keys_constants.py` | Top-level `~/.claude/settings.json` key names used across the permission helpers |
11
+ | `code_rules_gate_constants.py` | `code_rules_gate.py` — file extensions, git diff subcommands, test filename patterns |
12
+ | `fix_hookspath_constants.py` | `fix_hookspath.py` — verification suffix and related strings |
13
+ | `post_audit_thread_constants.py` | `post_audit_thread.py` — HTTP status codes, retry counts, GitHub API paths |
14
+ | `preflight_constants.py` | `preflight.py` — env-var names, git subcommands, pytest exit codes, test discovery patterns |
15
+ | `preflight_self_heal_constants.py` | `preflight_self_heal.py` — git config keys and local-scope detection strings |
16
+ | `reviews_disabled_constants.py` | `reviews_disabled.py` — `CLAUDE_REVIEWS_DISABLED` token taxonomy |
17
+ | `__init__.py` | Empty package marker |
18
+
19
+ ## Convention
20
+
21
+ Every constant is `UPPER_SNAKE_CASE` with an explicit type annotation. No magic literals appear in the consuming scripts — all values live here. Test coverage for each module lives in `tests/test_<module_name>.py`.
@@ -0,0 +1,32 @@
1
+ # _shared/pr-loop/scripts/tests
2
+
3
+ pytest suite for the scripts and constants in `_shared/pr-loop/scripts/`. Each test file covers one script or one constants module.
4
+
5
+ ## Test files
6
+
7
+ | File | Covers |
8
+ |---|---|
9
+ | `test__claude_permissions_common.py` | Internal helpers in `_claude_permissions_common.py` (legacy underscore prefix) |
10
+ | `test_claude_permissions_common.py` | Public API of `_claude_permissions_common.py` |
11
+ | `test_claude_permissions_constants.py` | `pr_loop_shared_constants/claude_permissions_constants.py` |
12
+ | `test_claude_settings_keys_constants.py` | `pr_loop_shared_constants/claude_settings_keys_constants.py` |
13
+ | `test_code_rules_gate.py` | `code_rules_gate.py` gate logic |
14
+ | `test_code_rules_gate_constants.py` | `pr_loop_shared_constants/code_rules_gate_constants.py` |
15
+ | `test_fix_hookspath.py` | `fix_hookspath.py` repair logic |
16
+ | `test_fix_hookspath_constants.py` | `pr_loop_shared_constants/fix_hookspath_constants.py` |
17
+ | `test_grant_project_claude_permissions.py` | `grant_project_claude_permissions.py` end-to-end |
18
+ | `test_post_audit_thread.py` | `post_audit_thread.py` review-posting flow |
19
+ | `test_post_audit_thread_constants.py` | `pr_loop_shared_constants/post_audit_thread_constants.py` |
20
+ | `test_preflight.py` | `preflight.py` pre-flight checks |
21
+ | `test_preflight_constants.py` | `pr_loop_shared_constants/preflight_constants.py` |
22
+ | `test_preflight_self_heal.py` | `preflight_self_heal.py` hooks-path repair |
23
+ | `test_reviews_disabled.py` | `reviews_disabled.py` opt-out gate parsing |
24
+ | `test_revoke_project_claude_permissions.py` | `revoke_project_claude_permissions.py` end-to-end |
25
+ | `test_agent_config_carveout.py` | Agent-config deny-rule carve-out logic |
26
+ | `conftest.py` | Shared pytest fixtures |
27
+
28
+ ## Running
29
+
30
+ ```bash
31
+ python -m pytest packages/claude-dev-env/_shared/pr-loop/scripts/tests/
32
+ ```
@@ -0,0 +1,29 @@
1
+ # agents
2
+
3
+ Agent definition files installed into `~/.claude/agents/` by `bin/install.mjs`. Each `.md` file defines a named subagent: its description (shown in the Claude Code UI), allowed tools, and behavioral instructions.
4
+
5
+ ## Agent files
6
+
7
+ | File | Agent name | Role |
8
+ |---|---|---|
9
+ | `caveman.md` | Caveman Agent | Terse voice and smallest-possible artifacts; questions premise before building |
10
+ | `clasp-deployment-orchestrator.md` | Clasp Deployment Orchestrator | Creates and deploys Google Apps Script projects with multiple files |
11
+ | `clean-coder.md` | Clean Coder | Primary code-writing agent; internalizes CODE_RULES.md and targets zero `/check` findings |
12
+ | `code-advisor.md` | Code Advisor | Mid-run advisor for executor agents; returns plans or stop signals — no tools, no edits |
13
+ | `code-quality-agent.md` | Code Quality Agent | Multi-file code quality review across an entire diff or set of files |
14
+ | `code-verifier.md` | Code Verifier | Post-hoc verification after coder agents finish; read-only, fresh context, ends with a fenced verdict |
15
+ | `deep-research.md` | Deep Research | Citation-grounded research with web search |
16
+ | `docs-agent.md` | Docs Agent | Documentation authoring and maintenance |
17
+ | `git-commit-crafter.md` | Git Commit Crafter | Stages changes, writes conventional commit messages, creates commits |
18
+ | `plan-packet-validator.md` | Plan Packet Validator | Fresh-context validator for workflow-generated plan packets under `docs/plans/` |
19
+ | `pr-description-writer.md` | PR Description Writer | Authors PR descriptions in Anthropic-style shapes; required by the `pr_description_enforcer` hook |
20
+
21
+ ## Format
22
+
23
+ Each file uses YAML frontmatter (`name`, `description`, `tools`, optional `color`) followed by a Markdown body with the agent's behavioral instructions. The `description` field appears in the Claude Code agent picker.
24
+
25
+ ## Adding an agent
26
+
27
+ 1. Create a new `.md` file in this directory with valid frontmatter.
28
+ 2. Run `bin/install.mjs` to copy it to `~/.claude/agents/`.
29
+ 3. Restart Claude Code to pick up the new agent.
@@ -0,0 +1,41 @@
1
+ # audit-rubrics
2
+
3
+ Audit rubrics for the PR-loop code-review suite. The rubrics define the 16 bug categories (A–P), their sub-bucket decompositions, and the prompt templates agents use during an audit pass. Installed into `~/.claude/audit-rubrics/` by `bin/install.mjs`.
4
+
5
+ ## Key file
6
+
7
+ | File | Purpose |
8
+ |---|---|
9
+ | `source-material-section-types.md` | Lookup table for how to chunk an artifact into sections for an audit prompt; covers code PRs, docs, SQL schemas, config files, and more |
10
+
11
+ ## Subdirectories
12
+
13
+ | Entry | Description |
14
+ |---|---|
15
+ | `category_rubrics/` | One `.md` per category (A–P): defines what the category audits, example findings, and a sub-bucket decomposition table |
16
+ | `prompts/` | One `.md` per category: the ready-to-use audit prompt template an agent inlines the artifact into |
17
+
18
+ ## Categories
19
+
20
+ | ID | Name |
21
+ |---|---|
22
+ | A | API contract verification |
23
+ | B | Selector engine compatibility |
24
+ | C | Resource cleanup |
25
+ | D | Scoping and ordering |
26
+ | E | Dead code |
27
+ | F | Silent failures |
28
+ | G | Bounds and overflow |
29
+ | H | Security boundaries |
30
+ | I | Concurrency |
31
+ | J | Code-rules compliance |
32
+ | K | Codebase conflicts |
33
+ | L | Behavior equivalence |
34
+ | M | Producer-consumer cardinality |
35
+ | N | Test name / scenario verifier |
36
+ | O | Docstring vs implementation drift |
37
+ | P | Name vs behavior contract |
38
+
39
+ ## Breaking-change rule
40
+
41
+ Adding a sub-bucket to a category rubric requires updating the matching prompt template in `prompts/` in the same commit. Skills that reference category IDs (`bugteam`, `findbugs`) rely on stable sub-bucket IDs (A1, A2, … P-n).
@@ -0,0 +1,36 @@
1
+ # audit-rubrics/category_rubrics
2
+
3
+ One rubric file per audit category (A–P). Each file defines what the category covers, gives concrete examples of findings, and provides the sub-bucket decomposition an audit agent uses to structure its pass.
4
+
5
+ ## Files
6
+
7
+ | File | Category |
8
+ |---|---|
9
+ | `category-a-api-contracts.md` | A — API contract verification |
10
+ | `category-b-selector-engine-compat.md` | B — Selector engine compatibility |
11
+ | `category-c-resource-cleanup.md` | C — Resource cleanup |
12
+ | `category-d-scoping-and-ordering.md` | D — Scoping and ordering |
13
+ | `category-e-dead-code.md` | E — Dead code |
14
+ | `category-f-silent-failures.md` | F — Silent failures |
15
+ | `category-g-bounds-and-overflow.md` | G — Bounds and overflow |
16
+ | `category-h-security-boundaries.md` | H — Security boundaries |
17
+ | `category-i-concurrency.md` | I — Concurrency |
18
+ | `category-j-code-rules-compliance.md` | J — Code-rules compliance |
19
+ | `category-k-codebase-conflicts.md` | K — Codebase conflicts |
20
+ | `category-l-behavior-equivalence.md` | L — Behavior equivalence |
21
+ | `category-m-producer-consumer-cardinality.md` | M — Producer-consumer cardinality |
22
+ | `category-n-test-name-scenario-verifier.md` | N — Test name / scenario verifier |
23
+ | `category-o-docstring-vs-impl-drift.md` | O — Docstring vs implementation drift |
24
+ | `category-p-name-vs-behavior-contract.md` | P — Name vs behavior contract |
25
+
26
+ ## Rubric structure
27
+
28
+ Each file has:
29
+ - A plain-language description of what the category audits
30
+ - Concrete finding examples
31
+ - A companion-reference pointer to `../source-material-section-types.md`
32
+ - A sub-bucket decomposition table with stable IDs (A1, A2, …) and the concrete checks each bucket requires
33
+
34
+ ## Relationship to prompts/
35
+
36
+ `category_rubrics/` is the human-readable reference. `prompts/` holds the agent-ready prompt templates that inline the same sub-bucket list in a structured prompt format. Keep both in sync when sub-buckets change.
@@ -0,0 +1,36 @@
1
+ # audit-rubrics/prompts
2
+
3
+ Agent-ready audit prompt templates, one per category (A–P). An agent inlines the artifact under review into the `[INLINE THE FULL ARTIFACT HERE]` placeholder and runs the prompt as-is.
4
+
5
+ ## Files
6
+
7
+ | File | Category |
8
+ |---|---|
9
+ | `category-a-api-contracts.md` | A — API contract verification |
10
+ | `category-b-selector-engine-compat.md` | B — Selector engine compatibility |
11
+ | `category-c-resource-cleanup.md` | C — Resource cleanup |
12
+ | `category-d-scoping-and-ordering.md` | D — Scoping and ordering |
13
+ | `category-e-dead-code.md` | E — Dead code |
14
+ | `category-f-silent-failures.md` | F — Silent failures |
15
+ | `category-g-bounds-and-overflow.md` | G — Bounds and overflow |
16
+ | `category-h-security-boundaries.md` | H — Security boundaries |
17
+ | `category-i-concurrency.md` | I — Concurrency |
18
+ | `category-j-code-rules-compliance.md` | J — Code-rules compliance |
19
+ | `category-k-codebase-conflicts.md` | K — Codebase conflicts |
20
+ | `category-l-behavior-equivalence.md` | L — Behavior equivalence |
21
+ | `category-m-producer-consumer-cardinality.md` | M — Producer-consumer cardinality |
22
+ | `category-n-test-name-scenario-verifier.md` | N — Test name / scenario verifier |
23
+ | `category-o-docstring-vs-impl-drift.md` | O — Docstring vs implementation drift |
24
+ | `category-p-name-vs-behavior-contract.md` | P — Name vs behavior contract |
25
+
26
+ ## Prompt structure
27
+
28
+ Each template:
29
+ - Scopes the audit to one category only (skip the others)
30
+ - Lists all sub-buckets from the matching `category_rubrics/` file
31
+ - Requires each sub-bucket to produce at least one Shape A finding OR one Shape B proof-of-absence with three or more adversarial probes
32
+ - Uses `find` as the finding ID prefix (single-pass audits) rather than `loop<N>-<K>`
33
+
34
+ ## Relationship to category_rubrics/
35
+
36
+ `prompts/` is the executable form; `category_rubrics/` is the reference form. When a sub-bucket decomposition changes in a rubric, update the matching prompt in the same commit.
package/bin/CLAUDE.md ADDED
@@ -0,0 +1,28 @@
1
+ # bin
2
+
3
+ The installer and its companion modules. Running `npx claude-dev-env` (or `node bin/install.mjs`) copies package files into `~/.claude/`, merges hook entries into `~/.claude/settings.json`, installs Git hooks, and writes `~/.mypy.ini`.
4
+
5
+ ## Files
6
+
7
+ | File | Purpose |
8
+ |---|---|
9
+ | `install.mjs` | Main installer: discovers install groups, copies content directories (`rules`, `docs`, `commands`, `agents`, `system-prompts`, `scripts`, `_shared`, `audit-rubrics`), merges hooks into `settings.json`, installs skills, runs `git_hooks_installer.mjs` and `install_mypy_ini.mjs` |
10
+ | `git_hooks_installer.mjs` | Installs or updates the `pre-commit`, `pre-push`, and `post-commit` Git hooks in the user's git config; writes hook scripts that delegate to the installed Python hooks |
11
+ | `install_mypy_ini.mjs` | Writes `~/.mypy.ini` with settings that make mypy find the hooks package and enforce strict type checking |
12
+ | `install.test.mjs` | Tests for `install.mjs` — covers conflict detection, interpreter detection, settings merging |
13
+ | `git_hooks_installer.test.mjs` | Tests for `git_hooks_installer.mjs` |
14
+ | `install_mypy_ini.test.mjs` | Tests for `install_mypy_ini.mjs` |
15
+
16
+ ## Key exports from install.mjs
17
+
18
+ | Export | Description |
19
+ |---|---|
20
+ | `CONTENT_DIRECTORIES` | Array of package subdirectory names copied verbatim to `~/.claude/` |
21
+ | `pythonCandidatesForPlatform(platform)` | Returns ordered Python interpreter candidates to probe; `py -3` first on Windows to avoid Microsoft Store alias issues |
22
+ | `isWindowsStorePythonStub(path)` | Returns true when the path resolves to the non-spawnable WindowsApps stub |
23
+ | `interpreterCommandFromPath(path)` | Formats an absolute interpreter path as a settings.json hook command prefix |
24
+ | `collectPackageSourceConflicts(dir)` | Returns any unmerged git conflicts in the package source; installer aborts when any exist |
25
+
26
+ ## Install groups
27
+
28
+ `install.mjs` defines install groups (`core`, `journal`, `research`) plus any dependency groups discovered from `package.json` `dependencies`. The `core` group installs skills, all hooks, and the content directories. `journal` and `research` install only their skill sets.
@@ -0,0 +1,25 @@
1
+ # commands
2
+
3
+ Slash-command definitions installed into `~/.claude/commands/` by `bin/install.mjs`. Each `.md` file registers a `/command-name` the user can type in Claude Code. The file name (without `.md`) becomes the command name.
4
+
5
+ ## Command files
6
+
7
+ | File | Command | What it does |
8
+ |---|---|---|
9
+ | `commit.md` | `/commit` | Commits and pushes changes to GitHub |
10
+ | `doc-gist.md` | `/doc-gist` | Uploads an HTML file as a secret gist and opens the htmlpreview URL |
11
+ | `docupdate.md` | `/docupdate` | Updates documentation to match current code state |
12
+ | `hook-log-extract.md` | `/hook-log-extract` | Extracts and formats hook log entries for a session |
13
+ | `hook-log-init.md` | `/hook-log-init` | Initializes the Neon Postgres schema that backs the hook-log extractor (one-time per machine) |
14
+ | `implement.md` | `/implement` | Provides full implementation context to a right-sized engineer in XML format |
15
+ | `initialize.md` | `/initialize` | Bootstraps a new project with standard Claude Code config |
16
+ | `plan.md` | `/plan` | Plans a feature through the `anthropic-plan` skill and workflow |
17
+ | `pr-comments.md` | `/pr-comments` | Fetches and formats PR review comments for response |
18
+ | `review-plan.md` | `/review-plan` | Reviews the current plan packet against code standards |
19
+ | `right-size.md` | `/right-size` | Checks an implementation against the Right-Sized Engineering rules |
20
+ | `stubcheck.md` | `/stubcheck` | Finds stub bodies (`pass`/`...`/`raise NotImplementedError`) in the diff |
21
+ | `sum.md` | `/sum` | Generates a formatted session summary for quick pickup in a new session |
22
+
23
+ ## Format
24
+
25
+ Each file is plain Markdown. The first paragraph is the command's help text shown in the Claude Code UI. The body is the full instruction set Claude follows when the command runs.
package/docs/CLAUDE.md ADDED
@@ -0,0 +1,28 @@
1
+ # docs
2
+
3
+ Reference documentation installed into `~/.claude/docs/` by `bin/install.mjs`. These files are loaded on demand by rules, skills, and agents — they are not always-on context.
4
+
5
+ ## Files
6
+
7
+ | File | Purpose |
8
+ |---|---|
9
+ | `CODE_RULES.md` | Compact agent reference for all code rules; ⚡ marks hook-enforced rules; canonical source agents load before writing code |
10
+ | `TEST_QUALITY.md` | Test writing standards: what to test, what to remove, React testing patterns, anti-patterns |
11
+ | `BDD_DISCOVERY_PROTOCOL.md` | Example Mapping algorithm for discovery before implementation; based on Smart & Molak *BDD in Action* §6.4 |
12
+ | `BDD_SCENARIO_QUALITY.md` | Seven scenario quality patterns (§7.6-style catalog) |
13
+ | `BDD_TEST_LAYOUT.md` | `describe/when/should` test layout and soap-opera personas |
14
+ | `PR_DESCRIPTION_GUIDE.md` | Authoritative reference for the `pr-description-writer` agent; PR body shapes derived from a 120-PR Anthropic corpus |
15
+ | `DJANGO_PATTERNS.md` | Django-specific coding patterns |
16
+ | `REACT_PATTERNS.md` | React-specific coding patterns |
17
+ | `emotion-informed-prompt-design.md` | Guidance for emotionally-aware prompt authoring |
18
+ | `agents-md-alignment-plan.md` | Alignment between `AGENTS.md` review-tool rules and the local hook enforcement layer |
19
+
20
+ ## Subdirectory
21
+
22
+ | Entry | Description |
23
+ |---|---|
24
+ | `references/` | Pointer documents to external sources and standard terminology; loaded on demand |
25
+
26
+ ## Load pattern
27
+
28
+ Rules reference these docs with `@~/.claude/docs/<file>.md` to pull them into context only when needed, rather than loading every doc on every session start.
@@ -0,0 +1,13 @@
1
+ # docs/references
2
+
3
+ Pointer documents to external sources and standard terminology. Files here are loaded on demand by rules that cite external resources.
4
+
5
+ ## Files
6
+
7
+ | File | Purpose |
8
+ |---|---|
9
+ | `dead-code-elimination.md` | External sources and standard terms behind CODE_RULES §9.8 (remove code you orphan): DCE, tree shaking, reachability analysis, and the Lava Flow anti-pattern |
10
+
11
+ ## Role
12
+
13
+ Each file names an external concept, gives a one-line definition, and links a direct source. They back the rule text in `rules/` and `packages/claude-dev-env/docs/CODE_RULES.md` without embedding full third-party content inline.
@@ -0,0 +1,31 @@
1
+ # hooks
2
+
3
+ Python hook scripts wired into Claude Code's lifecycle via `settings.json`. Each hook answers one or more lifecycle events (`PreToolUse`, `PostToolUse`, `Stop`, `SubagentStop`, `SessionStart`, `SessionEnd`) and either blocks a tool call, annotates it, or performs a side-effect.
4
+
5
+ ## Subdirectories
6
+
7
+ | Directory | Role |
8
+ |---|---|
9
+ | `advisory/` | Hooks that warn but do not block (`permissionDecision: "ask"`) |
10
+ | `blocking/` | Hooks that deny tool calls when a rule is violated |
11
+ | `blocking/config/` | Shared constants for the verified-commit gate family |
12
+ | `diagnostic/` | Hooks that record and extract hook-firing records into Neon |
13
+ | `diagnostic/migrations/` | SQL migrations for the `hook_events` Neon schema |
14
+ | `diagnostic/queries/` | Parameterized SQL queries for inspecting blocked commands |
15
+ | `git-hooks/` | Native git hooks (`pre-commit`, `pre-push`, `post-commit`) installed via the git-hooks path |
16
+ | `git-hooks/git_hooks_constants/` | Shared constants for the git-hook scripts |
17
+ | `hooks_constants/` | Shared constant modules imported by multiple hooks across this tree |
18
+ | `lifecycle/` | Hooks that run at session or config-change boundaries |
19
+ | `observability/` | PostToolUse hooks that record agent behavior for diagnostics |
20
+ | `session/` | SessionStart and SessionEnd hooks for per-session cleanup |
21
+ | `validation/` | PostToolUse hooks that validate code quality after a write (mypy, auto-format) |
22
+ | `validators/` | Library modules used by the validation hooks — checks split by concern |
23
+ | `workflow/` | PostToolUse hooks that trigger doc publishing and companion-file generation |
24
+
25
+ ## Conventions
26
+
27
+ - **Event mapping:** Every hook reads JSON from stdin and exits 0 (allow) or prints a `hookSpecificOutput` block (block/ask). Blocking hooks set `permissionDecision: "block"`.
28
+ - **Constants companion:** Each hook with more than a handful of tunable strings keeps them in a `hooks_constants/<hook_name>_constants.py` sibling. Import from there; do not repeat literals.
29
+ - **Tests:** Each hook has one or more `test_<hookname>*.py` files beside it. Run with `python -m pytest <test_file>`.
30
+ - **Registration:** Hooks are declared in `settings.json` under the right lifecycle event. The installer (`packages/claude-dev-env/bin/install.mjs`) merges the hook entries during `npx claude-dev-env`.
31
+ - **Top-level utilities:** `_gh_pr_author_swap_utils.py` and `rewrite_plugin_paths.py` are shared helpers imported by multiple blocking hooks. `hooks.json` records the canonical hook-to-event mapping for auditing.
@@ -0,0 +1,16 @@
1
+ # hooks/advisory
2
+
3
+ Hooks that produce a warning prompt (`permissionDecision: "ask"`) rather than an outright block. The user sees the warning and can continue or cancel.
4
+
5
+ ## Key files
6
+
7
+ | File | Event | What it guards |
8
+ |---|---|---|
9
+ | `migration_safety_advisor.py` | PreToolUse (Write/Edit) | Django migration files containing `RemoveField`, `RenameField`, `DeleteModel`, or `RenameModel` — warns that these operations must be backwards-compatible during deployment |
10
+ | `refactor_guard.py` | PreToolUse (Edit) | Edits that rename or restructure existing code not present in the current git diff — warns that the change may be out of scope |
11
+
12
+ ## Conventions
13
+
14
+ - Both hooks exit 0 (silent) when their trigger condition is not met.
15
+ - `refactor_guard.py` respects a bypass token at `~/.claude/.refactor-bypass-token`; when that file exists the hook stays silent.
16
+ - Tests live beside each hook following the `test_<name>.py` pattern used in `blocking/`. Run with `python -m pytest <test_file>`.
@@ -0,0 +1,107 @@
1
+ # hooks/blocking
2
+
3
+ PreToolUse hooks that deny (block) tool calls when a rule is violated. The main enforcer is `code_rules_enforcer.py`, which routes each Write/Edit through a suite of focused check modules. Every other file in this directory is either a standalone blocker, a check module, or a test.
4
+
5
+ ## Subdirectory
6
+
7
+ | Directory | Role |
8
+ |---|---|
9
+ | `config/` | Shared constants for the verified-commit gate family (`verified_commit_constants.py`) |
10
+
11
+ ## Core enforcer
12
+
13
+ | File | What it does |
14
+ |---|---|
15
+ | `code_rules_enforcer.py` | Entry point — reads PreToolUse stdin, reconstructs post-edit content, dispatches all check modules, and returns a block with a per-issue list when any check fails |
16
+
17
+ The check modules it calls are the `code_rules_<concern>.py` files below.
18
+
19
+ ## Check modules (imported by `code_rules_enforcer.py`)
20
+
21
+ | Module | Concern |
22
+ |---|---|
23
+ | `code_rules_annotations_length.py` | Parameter/return annotations, function length, pytest fixture annotation requirements |
24
+ | `code_rules_banned_identifiers.py` | Banned short names (`ctx`, `cfg`, `msg`, etc.), banned prefixes (`handle_`, `process_`, etc.) |
25
+ | `code_rules_boolean_mustcheck.py` | Boolean naming (`is_`/`has_`/… prefixes) and must-check return values |
26
+ | `code_rules_comments.py` | No new inline comments; no deletion of existing ones |
27
+ | `code_rules_constants_config.py` | Constants must live in `config/`; file-global constant use-count |
28
+ | `code_rules_dead_argparse_argument.py` | Argparse arguments with no references in the same file |
29
+ | `code_rules_dead_config_field.py` | Dataclass config fields with no live references |
30
+ | `code_rules_dead_dataclass_field.py` | Dataclass fields with no consuming references |
31
+ | `code_rules_dead_module_constant.py` | `UPPER_SNAKE` constants in `*_constants.py` modules with no importers |
32
+ | `code_rules_docstrings.py` | Google-style docstrings; `Args:` section matches signature; fallback-branch coverage |
33
+ | `code_rules_duplicate_body.py` | Functions whose bodies match another function's body in the same file |
34
+ | `code_rules_imports_logging.py` | Imports at top of file; logging format-arg style |
35
+ | `code_rules_magic_values.py` | No magic numbers or strings in production code bodies |
36
+ | `code_rules_mock_completeness.py` | Mock calls that skip required arguments |
37
+ | `code_rules_naming_collection.py` | Collection names must use `all_*` prefix |
38
+ | `code_rules_optional_params.py` | No optional parameters where a required one would do |
39
+ | `code_rules_orphan_css_class.py` | CSS class attributes in Python markup with no matching `.<class>` selector |
40
+ | `code_rules_path_utils.py` | Path utility helpers shared across check modules |
41
+ | `code_rules_paths_syspath.py` | `sys.path.insert` must be guarded |
42
+ | `code_rules_probe_chains.py` | Probe-chain detection logic |
43
+ | `code_rules_probe_detection.py` | Probe pattern detection helpers |
44
+ | `code_rules_probe_recording.py` | Probe recording utilities |
45
+ | `code_rules_scope_binding.py` | Scope/binding analysis utilities |
46
+ | `code_rules_shared.py` | Shared dataclasses and helpers used by multiple check modules |
47
+ | `code_rules_string_magic.py` | Magic string detection with masking and f-string support |
48
+ | `code_rules_test_assertions.py` | Test assertion style rules |
49
+ | `code_rules_test_branching_except.py` | No bare or broad `except` in test branches |
50
+ | `code_rules_test_isolation.py` | Tests must not rely on home-dir or temp-dir side effects |
51
+ | `code_rules_type_escape.py` | No `Any` imports, `cast()`, or `# type: ignore` outside boundary files |
52
+ | `code_rules_typeddict_stub.py` | TypedDict pairs (`_encode_*`/`_decode_*`) must both exist in the same module |
53
+ | `code_rules_unused_imports.py` | Unused module-level imports |
54
+
55
+ ## Other standalone blockers
56
+
57
+ | File | Event | What it blocks |
58
+ |---|---|---|
59
+ | `block_main_commit.py` | PreToolUse (Bash) | `git commit`/`git push` directly to `main` |
60
+ | `bot_mention_comment_blocker.py` | PreToolUse (Write/Edit) | PR review comments that @-mention a bot |
61
+ | `convergence_gate_blocker.py` | PreToolUse (Bash) | Convergence workflow actions on a conflicting PR |
62
+ | `destructive_command_blocker.py` | PreToolUse (Bash/PowerShell) | Shell commands with destructive literals (`rm -rf`, `git reset --hard`, etc.) |
63
+ | `es_exe_path_rewriter.py` | PreToolUse | Rewrites paths referencing `.exe` under the Everything search path |
64
+ | `gh_body_arg_blocker.py` | PreToolUse (Bash) | `gh` commands passing `--body`/`-b` directly (requires `--body-file` instead) |
65
+ | `gh_pr_author_enforcer.py` | PreToolUse | Enforces PR author identity rules |
66
+ | `gh_pr_author_restore.py` | PostToolUse | Restores PR author after a tool call |
67
+ | `hedging_language_blocker.py` | Stop | Responses with hedging words (`likely`, `probably`, `appears to`) |
68
+ | `hook_prose_detector_consistency.py` | PreToolUse (Write/Edit) | Hook docstrings/messages that claim a trigger the detector cannot fire on |
69
+ | `intent_only_ending_blocker.py` | Stop | Responses that end on a plan or intent without doing the work |
70
+ | `md_to_html_blocker.py` | PreToolUse (Write/Edit) | Writing `.md` files when an `.html` companion is required |
71
+ | `open_questions_in_plans_blocker.py` | PreToolUse (Write/Edit) | Plan documents with unresolved open questions |
72
+ | `plain_language_blocker.py` | PreToolUse (Write/Edit/AskUserQuestion) | Heavy or jargon words in user-facing prose |
73
+ | `pr_converge_bugteam_enforcer.py` | PreToolUse | Enforces that bugteam runs in parallel with bugbot in pr-converge loops |
74
+ | `pr_description_enforcer.py` | PreToolUse (Bash) | `gh pr create`/`edit` without a PR-description-writer-authored body |
75
+ | `precommit_code_rules_gate.py` | PreToolUse (Bash) | Staged changes that fail the CODE_RULES gate at commit time |
76
+ | `question_to_user_enforcer.py` | Stop | User-directed questions not routed through `AskUserQuestion` |
77
+ | `sensitive_file_protector.py` | PreToolUse (Write/Edit) | Writes to sensitive credential or config files |
78
+ | `session_handoff_blocker.py` | Stop | Responses suggesting a new session mid-task |
79
+ | `state_description_blocker.py` | PreToolUse (Write/Edit) | Historical/comparative language in documentation |
80
+ | `subprocess_budget_completeness.py` | PreToolUse | Subprocess calls missing required budget arguments |
81
+ | `tdd_enforcer.py` | PreToolUse (Write/Edit) | Production code written without a matching failing test |
82
+ | `verdict_directory_write_blocker.py` | PreToolUse (Bash/PowerShell) | Shell writes into `~/.claude/verification/` |
83
+ | `verified_commit_gate.py` | PreToolUse (Bash/PowerShell) | `git commit`/`git push` without a passing verifier verdict |
84
+ | `verified_commit_message_accuracy_blocker.py` | PreToolUse | Commit messages that misstate what the diff has |
85
+ | `verifier_verdict_minter.py` | SubagentStop | Mints a passing verdict file when a `code-verifier` agent finishes cleanly |
86
+ | `windows_rmtree_blocker.py` | PreToolUse (Write/Edit) | `shutil.rmtree` with `ignore_errors=True` on Windows |
87
+ | `workflow_substitution_slot_blocker.py` | PreToolUse (Write/Edit) | Workflow templates with bare per-iteration tokens missing angle-bracket slots |
88
+ | `write_existing_file_blocker.py` | PreToolUse (Write) | Write to a path where a file already exists |
89
+
90
+ ## Supporting modules
91
+
92
+ | File | Role |
93
+ |---|---|
94
+ | `_gh_body_arg_utils.py` | Parsing helpers for `gh_body_arg_blocker.py` |
95
+ | `_md_to_html_blocker_test_support.py` | Test fixtures shared across `md_to_html_blocker` tests |
96
+ | `md_path_exemptions.py` | Path exemption logic for `md_to_html_blocker.py` |
97
+ | `pr_description_body_audit.py` | Body audit logic for `pr_description_enforcer.py` |
98
+ | `pr_description_command_parser.py` | `gh` command parsing for `pr_description_enforcer.py` |
99
+ | `pr_description_pr_number.py` | PR number extraction logic |
100
+ | `pr_description_readability.py` | Readability checks on PR description bodies |
101
+ | `verification_verdict_store.py` | Reads and writes verdict files under `~/.claude/verification/` |
102
+
103
+ ## Conventions
104
+
105
+ - Tests live beside each hook as `test_<hookname>.py` or `test_<hookname>_<suffix>.py`. Run with `python -m pytest <test_file>`.
106
+ - Tunable constants live in `hooks_constants/<hook_name>_constants.py`; the verified-commit family uses `blocking/config/verified_commit_constants.py`.
107
+ - `conftest.py` gives shared pytest fixtures for the blocking test suite.
@@ -203,15 +203,18 @@ def check_file_global_constants_use_count(content: str, file_path: str) -> list[
203
203
  """Flag module-level UPPER_SNAKE constants referenced by only one function/method.
204
204
 
205
205
  Enforces the file-global-constants use-count rule: a constant used by just
206
- one caller belongs in that caller's scope. Test files, config files, and
207
- non-Python files are exempt. Constants with zero references are out of
208
- scope. The enforcer entry module (``hooks/blocking/code_rules_enforcer.py``)
209
- is exempt to avoid self-blocking.
206
+ one caller belongs in that caller's scope. Test files, config files,
207
+ workflow-registry files, and non-Python files are exempt. Constants with
208
+ zero references are out of scope. The enforcer entry module
209
+ (``hooks/blocking/code_rules_enforcer.py``) is exempt to avoid
210
+ self-blocking.
210
211
  """
211
212
  if is_test_file(file_path):
212
213
  return []
213
214
  if is_config_file(file_path):
214
215
  return []
216
+ if is_workflow_registry_file(file_path):
217
+ return []
215
218
  if get_file_extension(file_path) not in ALL_PYTHON_EXTENSIONS:
216
219
  return []
217
220
  if file_path.replace("\\", "/").endswith("hooks/blocking/code_rules_enforcer.py"):