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.
- package/_shared/CLAUDE.md +13 -0
- package/_shared/pr-loop/CLAUDE.md +24 -0
- package/_shared/pr-loop/scripts/CLAUDE.md +30 -0
- package/_shared/pr-loop/scripts/pr_loop_shared_constants/CLAUDE.md +21 -0
- package/_shared/pr-loop/scripts/tests/CLAUDE.md +32 -0
- package/agents/CLAUDE.md +29 -0
- package/audit-rubrics/CLAUDE.md +41 -0
- package/audit-rubrics/category_rubrics/CLAUDE.md +36 -0
- package/audit-rubrics/prompts/CLAUDE.md +36 -0
- package/bin/CLAUDE.md +28 -0
- package/commands/CLAUDE.md +25 -0
- package/docs/CLAUDE.md +28 -0
- package/docs/references/CLAUDE.md +13 -0
- package/hooks/CLAUDE.md +31 -0
- package/hooks/advisory/CLAUDE.md +16 -0
- package/hooks/blocking/CLAUDE.md +107 -0
- package/hooks/blocking/code_rules_constants_config.py +7 -4
- package/hooks/blocking/code_rules_dead_config_field.py +284 -50
- package/hooks/blocking/code_rules_docstrings.py +97 -0
- package/hooks/blocking/code_rules_enforcer.py +4 -0
- package/hooks/blocking/config/CLAUDE.md +22 -0
- package/hooks/blocking/test_code_rules_enforcer_class_docstring_methods.py +262 -0
- package/hooks/blocking/test_code_rules_enforcer_dead_config_field.py +336 -3
- package/hooks/blocking/test_code_rules_enforcer_dead_module_constant.py +36 -0
- package/hooks/blocking/test_code_rules_enforcer_file_global_constants.py +9 -0
- package/hooks/diagnostic/CLAUDE.md +43 -0
- package/hooks/diagnostic/migrations/CLAUDE.md +16 -0
- package/hooks/diagnostic/queries/CLAUDE.md +19 -0
- package/hooks/git-hooks/CLAUDE.md +28 -0
- package/hooks/git-hooks/git_hooks_constants/CLAUDE.md +21 -0
- package/hooks/hooks_constants/CLAUDE.md +60 -0
- package/hooks/hooks_constants/blocking_check_limits.py +2 -0
- package/hooks/lifecycle/CLAUDE.md +18 -0
- package/hooks/observability/CLAUDE.md +16 -0
- package/hooks/session/CLAUDE.md +21 -0
- package/hooks/validation/CLAUDE.md +19 -0
- package/hooks/validators/CLAUDE.md +49 -0
- package/hooks/workflow/CLAUDE.md +22 -0
- package/package.json +1 -1
- package/rules/CLAUDE.md +46 -0
- package/rules/docstring-prose-matches-implementation.md +1 -1
- package/scripts/CLAUDE.md +34 -0
- package/scripts/dev_env_scripts_constants/CLAUDE.md +14 -0
- package/scripts/sync_to_cursor/CLAUDE.md +23 -0
- package/scripts/tests/CLAUDE.md +18 -0
- package/skills/CLAUDE.md +66 -0
- package/skills/_shared/CLAUDE.md +11 -0
- package/skills/_shared/pr-loop/CLAUDE.md +27 -0
- package/skills/_shared/pr-loop/prompts/CLAUDE.md +9 -0
- package/skills/_shared/pr-loop/scripts/CLAUDE.md +23 -0
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/CLAUDE.md +19 -0
- package/skills/anthropic-plan/CLAUDE.md +34 -0
- package/skills/anthropic-plan/SKILL.md +1 -1
- package/skills/anthropic-plan/scripts/CLAUDE.md +11 -0
- package/skills/anthropic-plan/scripts/anthropic_plan_scripts_constants/CLAUDE.md +16 -0
- package/skills/anthropic-plan/templates/CLAUDE.md +13 -0
- package/skills/anthropic-plan/workflow/CLAUDE.md +14 -0
- package/skills/auditing-claude-config/CLAUDE.md +20 -0
- package/skills/autoconverge/CLAUDE.md +30 -0
- package/skills/autoconverge/reference/CLAUDE.md +12 -0
- package/skills/autoconverge/workflow/CLAUDE.md +23 -0
- package/skills/autoconverge/workflow/autoconverge_report_constants/CLAUDE.md +16 -0
- package/skills/bdd-protocol/CLAUDE.md +26 -0
- package/skills/bdd-protocol/references/CLAUDE.md +10 -0
- package/skills/bg-agent/CLAUDE.md +17 -0
- package/skills/bugteam/CLAUDE.md +30 -0
- package/skills/bugteam/reference/CLAUDE.md +22 -0
- package/skills/bugteam/reference/obstacles/CLAUDE.md +24 -0
- package/skills/bugteam/scripts/CLAUDE.md +36 -0
- package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +20 -0
- package/skills/caveman/CLAUDE.md +15 -0
- package/skills/code/CLAUDE.md +17 -0
- package/skills/copilot-review/CLAUDE.md +17 -0
- package/skills/deep-research/CLAUDE.md +17 -0
- package/skills/doc-gist/CLAUDE.md +25 -0
- package/skills/doc-gist/references/CLAUDE.md +9 -0
- package/skills/doc-gist/references/examples/CLAUDE.md +25 -0
- package/skills/doc-gist/scripts/CLAUDE.md +27 -0
- package/skills/doc-gist/scripts/doc_gist_scripts_constants/CLAUDE.md +10 -0
- package/skills/everything-search/CLAUDE.md +17 -0
- package/skills/findbugs/CLAUDE.md +20 -0
- package/skills/fixbugs/CLAUDE.md +19 -0
- package/skills/fresh-branch/CLAUDE.md +15 -0
- package/skills/gh-paginate/CLAUDE.md +18 -0
- package/skills/gotcha/CLAUDE.md +33 -0
- package/skills/implement/CLAUDE.md +27 -0
- package/skills/implement/scripts/CLAUDE.md +22 -0
- package/skills/implement/scripts/implement_scripts_constants/CLAUDE.md +22 -0
- package/skills/logifix/CLAUDE.md +36 -0
- package/skills/logifix/scripts/CLAUDE.md +16 -0
- package/skills/monitor-open-prs/CLAUDE.md +34 -0
- package/skills/monitor-open-prs/scripts/CLAUDE.md +17 -0
- package/skills/pr-consistency-audit/CLAUDE.md +34 -0
- package/skills/pr-consistency-audit/reference/CLAUDE.md +16 -0
- package/skills/pr-converge/CLAUDE.md +29 -0
- package/skills/pr-converge/pr_converge_skill_constants/CLAUDE.md +26 -0
- package/skills/pr-converge/reference/CLAUDE.md +27 -0
- package/skills/pr-converge/reference/obstacles/CLAUDE.md +23 -0
- package/skills/pr-converge/scripts/CLAUDE.md +36 -0
- package/skills/pr-converge/scripts/pr_converge_scripts_constants/CLAUDE.md +17 -0
- package/skills/pr-converge/workflows/CLAUDE.md +16 -0
- package/skills/pr-review-responder/CLAUDE.md +35 -0
- package/skills/pre-compact/CLAUDE.md +24 -0
- package/skills/qbug/CLAUDE.md +40 -0
- package/skills/rebase/CLAUDE.md +32 -0
- package/skills/recall/CLAUDE.md +30 -0
- package/skills/refine/CLAUDE.md +44 -0
- package/skills/refine/templates/CLAUDE.md +17 -0
- package/skills/remember/CLAUDE.md +31 -0
- package/skills/research-mode/CLAUDE.md +35 -0
- package/skills/session-log/CLAUDE.md +31 -0
- package/skills/session-tidy/CLAUDE.md +36 -0
- package/skills/skill-builder/CLAUDE.md +45 -0
- package/skills/skill-builder/references/CLAUDE.md +19 -0
- package/skills/skill-builder/templates/CLAUDE.md +14 -0
- package/skills/skill-builder/workflows/CLAUDE.md +17 -0
- package/skills/structure-prompt/CLAUDE.md +42 -0
- package/skills/structure-prompt/reference/CLAUDE.md +28 -0
- package/skills/task-build/CLAUDE.md +28 -0
- package/skills/update/CLAUDE.md +38 -0
- package/skills/verified-build/CLAUDE.md +33 -0
- package/system-prompts/CLAUDE.md +17 -0
|
@@ -32,6 +32,7 @@ TYPESCRIPT_FILE_PATH = "packages/claude-dev-env/hooks/blocking/example.ts"
|
|
|
32
32
|
TOP_LEVEL_CONFIG_FILE_PATH = "config/timing.py"
|
|
33
33
|
NESTED_CONFIG_FILE_PATH = "packages/claude-dev-env/hooks/config/example_constants.py"
|
|
34
34
|
BACKSLASH_CONFIG_FILE_PATH = "packages\\claude-dev-env\\hooks\\config\\example_constants.py"
|
|
35
|
+
WORKFLOW_REGISTRY_FILE_PATH = "packages/claude-dev-env/hooks/blocking/workflow/app_info/states.py"
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
def test_should_flag_constant_used_by_only_one_function() -> None:
|
|
@@ -114,6 +115,14 @@ def test_should_exempt_test_files() -> None:
|
|
|
114
115
|
assert issues == [], f"Expected test file exemption, got: {issues}"
|
|
115
116
|
|
|
116
117
|
|
|
118
|
+
def test_should_exempt_workflow_registry_files() -> None:
|
|
119
|
+
source = "UPPER = 1\n\ndef lonely_caller():\n return UPPER\n"
|
|
120
|
+
issues = code_rules_enforcer.check_file_global_constants_use_count(
|
|
121
|
+
source, WORKFLOW_REGISTRY_FILE_PATH
|
|
122
|
+
)
|
|
123
|
+
assert issues == [], f"Expected workflow-registry file exemption, got: {issues}"
|
|
124
|
+
|
|
125
|
+
|
|
117
126
|
def test_should_flag_constant_used_only_in_decorator_of_one_function() -> None:
|
|
118
127
|
source = (
|
|
119
128
|
"TIMEOUT = 5.0\n"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# hooks/diagnostic
|
|
2
|
+
|
|
3
|
+
Hooks and scripts that collect, store, and query hook-firing records. The pipeline reads session JSONL transcripts, extracts hook attachment records, and writes them as rows into a Neon (Postgres) `hook_events` table.
|
|
4
|
+
|
|
5
|
+
## Subdirectories
|
|
6
|
+
|
|
7
|
+
| Directory | Role |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `migrations/` | SQL migration files for the `hook_events` schema |
|
|
10
|
+
| `queries/` | Parameterized SQL queries for inspecting blocked commands |
|
|
11
|
+
|
|
12
|
+
## Key files
|
|
13
|
+
|
|
14
|
+
| File | What it does |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `hook_log_init.py` | One-time setup: creates the Neon schema (runs `schema.sql`), then verifies read-write parity with a sentinel round-trip |
|
|
17
|
+
| `hook_log_extractor.py` | Stop hook — reads per-session JSONL transcripts and ingests new `hook_*` attachment records into the `hook_events` table; idempotent via a UNIQUE constraint on `(source_jsonl_path, source_line_number)` |
|
|
18
|
+
| `hook_log_stop_wrapper.py` | Thin wrapper that invokes `hook_log_extractor.py` from the Stop lifecycle event |
|
|
19
|
+
| `schema.sql` | DDL for the `hook_events` table, `blocked_commands` view, and supporting indexes |
|
|
20
|
+
| `requirements-hook-logs.txt` | Runtime dependencies (`psycopg`) for the extractor |
|
|
21
|
+
| `requirements-hook-logs-dev.txt` | Dev/test dependencies |
|
|
22
|
+
| `test_hook_log_extractor.py` | Tests for the extractor |
|
|
23
|
+
| `test_hook_log_init.py` | Tests for the schema-init script |
|
|
24
|
+
| `test_hook_log_stop_wrapper.py` | Tests for the Stop wrapper |
|
|
25
|
+
|
|
26
|
+
## Schema overview (`schema.sql`)
|
|
27
|
+
|
|
28
|
+
The `hook_events` table captures one row per hook firing:
|
|
29
|
+
|
|
30
|
+
- `hook_event`, `hook_name`, `hook_category` — what fired
|
|
31
|
+
- `outcome` — `allowed`, `blocked`, or `ask`
|
|
32
|
+
- `tool_name`, `command_excerpt` — what tool was called
|
|
33
|
+
- `session_id`, `git_branch`, `cwd` — context
|
|
34
|
+
- `duration_ms`, `exit_code` — timing and result
|
|
35
|
+
- `source_jsonl_path`, `source_line_number` — idempotency key
|
|
36
|
+
|
|
37
|
+
The `blocked_commands` view filters to `outcome = 'blocked'`.
|
|
38
|
+
|
|
39
|
+
## Conventions
|
|
40
|
+
|
|
41
|
+
- The extractor exits 0 even when Neon is unreachable (offline-graceful); it logs to `OFFLINE_WARNING_LOG` and does not block session end.
|
|
42
|
+
- Constants for the extractor (table name, offset state file, timeout) live in `hooks_constants/hook_log_extractor_constants.py`.
|
|
43
|
+
- Tests run with `python -m pytest diagnostic/test_hook_log_*.py`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# hooks/diagnostic/migrations
|
|
2
|
+
|
|
3
|
+
SQL migration files for the `hook_events` Neon schema. Each file applies a schema change to the `hook_events` table or its indexes.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | What it does |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `2026-04-25-drop-themes-hook-events.sql` | Drops the `themes` hook-events table variant |
|
|
10
|
+
| `README.md` | Notes on the migration approach |
|
|
11
|
+
|
|
12
|
+
## Conventions
|
|
13
|
+
|
|
14
|
+
- Run migrations manually against the Neon database using `psql` or the Neon console.
|
|
15
|
+
- The baseline schema lives in `diagnostic/schema.sql`.
|
|
16
|
+
- File names follow `YYYY-MM-DD-<description>.sql` for chronological ordering.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# hooks/diagnostic/queries
|
|
2
|
+
|
|
3
|
+
Parameterized SQL queries for inspecting the `hook_events` Neon table. Run these directly against the Neon database to analyze hook-firing patterns.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | What it returns |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `block_details_for_hook.sql` | Full details for all blocked events matching a given hook name |
|
|
10
|
+
| `blocks_by_category.sql` | Count of blocks grouped by hook category |
|
|
11
|
+
| `blocks_by_tool.sql` | Count of blocks grouped by tool name |
|
|
12
|
+
| `blocks_last_7_days.sql` | All blocked events from the last 7 days |
|
|
13
|
+
| `top_blockers_last_24_hours.sql` | Hook names with the most blocks in the last 24 hours |
|
|
14
|
+
| `top_blockers_overall.sql` | Hook names with the most blocks across all time |
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
- Queries target the `hook_events` table and `blocked_commands` view defined in `diagnostic/schema.sql`.
|
|
19
|
+
- Run with `psql $DATABASE_URL -f <query>.sql` or paste into the Neon console.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# hooks/git-hooks
|
|
2
|
+
|
|
3
|
+
Native git hooks that run outside the Claude Code lifecycle — invoked directly by git at commit and push time. The installer copies these scripts into the user's shared git-hooks directory (`core.hooksPath`).
|
|
4
|
+
|
|
5
|
+
## Key files
|
|
6
|
+
|
|
7
|
+
| File | Git hook | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `pre_commit.py` | `pre-commit` | Runs the CODE_RULES gate (`precommit_code_rules_gate.py`) over staged changes; exits 1 when any staged file has a blocking violation |
|
|
10
|
+
| `pre_push.py` | `pre-push` | Runs the verified-commit gate check before a push reaches the remote |
|
|
11
|
+
| `post_commit.py` | `post-commit` | Runs after a commit lands; performs any post-commit bookkeeping |
|
|
12
|
+
| `gate_utils.py` | — | Shared helpers: resolves the gate script path, checks that the path is a safe regular file |
|
|
13
|
+
| `test_config.py` | — | Test configuration helpers |
|
|
14
|
+
| `test_gate_utils.py` | — | Tests for `gate_utils.py` |
|
|
15
|
+
| `test_pre_commit.py` | — | Tests for `pre_commit.py` |
|
|
16
|
+
| `test_pre_push.py` | — | Tests for `pre_push.py` |
|
|
17
|
+
|
|
18
|
+
## Subdirectory
|
|
19
|
+
|
|
20
|
+
| Directory | Role |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `git_hooks_constants/` | Shared constants imported by the git-hook scripts |
|
|
23
|
+
|
|
24
|
+
## Conventions
|
|
25
|
+
|
|
26
|
+
- The installer strips the `_` and `.py` suffix when copying into the live git-hooks path (e.g. `pre_commit.py` becomes `pre-commit`).
|
|
27
|
+
- Constants (exit codes, argument names, error messages) live in `git_hooks_constants/` and are imported at the top of each script.
|
|
28
|
+
- Run tests with `python -m pytest git-hooks/test_<name>.py`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# hooks/git-hooks/git_hooks_constants
|
|
2
|
+
|
|
3
|
+
Shared constants imported by the git-hook scripts in `git-hooks/`. Centralizes exit codes, argument names, and error messages so every tunable lives in one place.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | Contents |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `__init__.py` | Exports all constants; marks this as a package so `from git_hooks_constants import ...` resolves |
|
|
10
|
+
|
|
11
|
+
## Key constants (defined in `__init__.py`)
|
|
12
|
+
|
|
13
|
+
- `GATE_INFRASTRUCTURE_FAILURE_EXIT_CODE` — exit code when the gate script cannot be found or launched
|
|
14
|
+
- `GATE_SCRIPT_NOT_FOUND_MESSAGE` — error message when the gate script path does not exist
|
|
15
|
+
- `INVOKE_GATE_FAILURE_MESSAGE` — error message when the gate subprocess fails to start
|
|
16
|
+
- `STAGED_SCOPE_ARGUMENT` — CLI argument passed to the gate script to scope it to staged changes
|
|
17
|
+
|
|
18
|
+
## Conventions
|
|
19
|
+
|
|
20
|
+
- Import with `from git_hooks_constants import <CONSTANT>` from within the `git-hooks/` directory.
|
|
21
|
+
- Add new constants here rather than inline in the hook scripts.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# hooks/hooks_constants
|
|
2
|
+
|
|
3
|
+
Shared constant modules imported by hooks throughout the `hooks/` tree. Each file holds the tunables for one hook or one cross-cutting concern, keeping magic values out of the hook scripts themselves.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | What it holds |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `__init__.py` | Package marker (`# pragma: no-tdd-gate`) |
|
|
10
|
+
| `any_type_config.py` | Config for the `Any`-type escape-hatch check |
|
|
11
|
+
| `banned_identifiers_constants.py` | The set of banned short identifiers and banned function-name prefixes |
|
|
12
|
+
| `blocking_check_limits.py` | Max issue counts and preview lengths for blocking hooks |
|
|
13
|
+
| `bot_mention_comment_blocker_constants.py` | Patterns for detecting bot @-mentions in PR comments |
|
|
14
|
+
| `code_rules_enforcer_constants.py` | File-extension sets, test-path patterns, advisory line thresholds, boolean-name prefixes |
|
|
15
|
+
| `code_rules_path_utils_constants.py` | Path-matching helpers used by the code-rules check modules |
|
|
16
|
+
| `convergence_branch_constants.py` | Branch and worktree naming patterns for the convergence gate |
|
|
17
|
+
| `dead_argparse_argument_constants.py` | Patterns for detecting unused argparse arguments |
|
|
18
|
+
| `dead_config_field_constants.py` | Patterns for detecting unused dataclass config fields |
|
|
19
|
+
| `dead_dataclass_field_constants.py` | Patterns for detecting unused dataclass fields |
|
|
20
|
+
| `dead_module_constant_constants.py` | Patterns for detecting unexported `UPPER_SNAKE` constants in `*_constants.py` modules |
|
|
21
|
+
| `destructive_command_segment_constants.py` | The list of destructive shell command patterns the blocker matches |
|
|
22
|
+
| `doc_gist_auto_publish_constants.py` | Sentinel marker and URL patterns for the doc-gist auto-publish hook |
|
|
23
|
+
| `duplicate_function_body_constants.py` | Hashing and comparison config for the duplicate-body check |
|
|
24
|
+
| `dynamic_stderr_handler.py` | `DynamicStderrHandler` — a logging handler that resolves `sys.stderr` at emit time (for testability) |
|
|
25
|
+
| `gh_pr_author_swap_constants.py` | Constants for the PR-author swap enforcement hooks |
|
|
26
|
+
| `hardcoded_user_path_constants.py` | Patterns for detecting hardcoded home-directory paths |
|
|
27
|
+
| `hook_log_extractor_constants.py` | Neon table name, offset state file path, timeouts, and outcome-type mapping for the hook-log extractor |
|
|
28
|
+
| `hook_prose_detector_consistency_constants.py` | Trigger patterns and corrective messages for the hook-prose consistency checker |
|
|
29
|
+
| `html_companion_constants.py` | Blocked URL schemes and other config for the `.md`-to-`.html` companion hook |
|
|
30
|
+
| `inline_tuple_string_magic_constants.py` | Patterns for detecting magic strings in inline tuple literals |
|
|
31
|
+
| `md_to_html_blocker_constants.py` | Path exemptions and trigger patterns for the markdown-to-html blocker |
|
|
32
|
+
| `messages.py` | Short user-facing notice strings shown when a Stop hook redirects agent behavior |
|
|
33
|
+
| `open_questions_in_plans_blocker_constants.py` | Patterns for detecting unresolved open questions in plan documents |
|
|
34
|
+
| `orphan_css_class_constants.py` | Scan radius and selector patterns for the orphan-CSS-class check |
|
|
35
|
+
| `path_rewriter_constants.py` | Path rewriting patterns for the Everything-search path rewriter |
|
|
36
|
+
| `plain_language_blocker_constants.py` | The list of heavy words and their everyday replacements |
|
|
37
|
+
| `pr_converge_bugteam_enforcer_constants.py` | State keys and timing config for the bugteam-parallel enforcer |
|
|
38
|
+
| `pr_converge_bugteam_enforcer_state.py` | State-file helpers for the bugteam enforcer |
|
|
39
|
+
| `pr_description_enforcer_constants.py` | PR-description shape rules and command patterns |
|
|
40
|
+
| `pre_tool_use_stdin.py` | `read_hook_input_dictionary_from_stdin()` — shared stdin parser for PreToolUse hooks |
|
|
41
|
+
| `precommit_code_rules_gate_constants.py` | Scope argument and exit-code constants for the precommit gate |
|
|
42
|
+
| `project_paths_reader.py` | Loads `~/.claude/project-paths.json` — the per-user project-path registry |
|
|
43
|
+
| `session_env_cleanup_constants.py` | Stale-age threshold and directory names for the session-env cleanup hook |
|
|
44
|
+
| `session_handoff_blocker_constants.py` | Trigger phrases for the session-handoff blocker |
|
|
45
|
+
| `setup_project_paths_constants.py` | Encoding policy, BOM marker, and registry meta-key used across multiple hooks |
|
|
46
|
+
| `state_description_blocker_constants.py` | The set of historical/comparative phrases the state-description blocker rejects |
|
|
47
|
+
| `stuttering_check_config.py` | Config for the stuttering (repeated-phrase) check |
|
|
48
|
+
| `stuttering_import_binding_constants.py` | Import-binding patterns for the stuttering check |
|
|
49
|
+
| `subprocess_budget_completeness_constants.py` | Required argument names for the subprocess-budget completeness check |
|
|
50
|
+
| `sys_path_insert_constants.py` | Patterns for detecting unguarded `sys.path.insert` calls |
|
|
51
|
+
| `unused_module_import_constants.py` | Patterns for detecting unused module-level imports |
|
|
52
|
+
| `windows_rmtree_blocker_constants.py` | The unsafe `shutil.rmtree` pattern and the safe replacement pattern |
|
|
53
|
+
| `workflow_substitution_slot_blocker_constants.py` | Per-iteration token patterns for the workflow-slot blocker |
|
|
54
|
+
|
|
55
|
+
## Conventions
|
|
56
|
+
|
|
57
|
+
- Every file in this package is a pure constants module — no side effects, no I/O.
|
|
58
|
+
- Hooks import from this package with `from hooks_constants.<module> import <CONSTANT>`.
|
|
59
|
+
- Tests for these modules live beside them as `test_<module>.py`. Run with `python -m pytest hooks_constants/test_<name>.py`.
|
|
60
|
+
- `dynamic_stderr_handler.py` and `pre_tool_use_stdin.py` are utility modules (not pure constants) but live here because they are shared across many hooks.
|
|
@@ -17,6 +17,8 @@ MAX_BOUNDARY_TYPE_ISSUES: int = 5
|
|
|
17
17
|
ALL_BANNED_PREFIX_NAMES: tuple[str, ...] = ("handle_", "process_", "manage_", "do_")
|
|
18
18
|
MAX_DOCSTRING_FORMAT_ISSUES: int = 5
|
|
19
19
|
MAX_DOCSTRING_ARGS_SIGNATURE_ISSUES: int = 5
|
|
20
|
+
MAX_CLASS_DOCSTRING_PUBLIC_METHOD_ISSUES: int = 5
|
|
21
|
+
MINIMUM_PUBLIC_METHODS_FOR_CLASS_DOCSTRING_BREADTH: int = 2
|
|
20
22
|
MAX_IGNORED_MUST_CHECK_RETURN_ISSUES: int = 5
|
|
21
23
|
MAX_TYPE_ESCAPE_HATCH_ISSUES: int = 5
|
|
22
24
|
MAX_THIN_WRAPPER_ISSUES: int = 1
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# hooks/lifecycle
|
|
2
|
+
|
|
3
|
+
Hooks that run at session or config-change boundaries rather than on individual tool calls.
|
|
4
|
+
|
|
5
|
+
## Key files
|
|
6
|
+
|
|
7
|
+
| File | Event | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `config_change_guard.py` | PostToolUse (Write/Edit on `settings.json`) | Counts hooks in the edited `settings.json` and logs any change to `~/.claude/cache/config-change-audit.log`; alerts when the hook count drops below the last known value |
|
|
10
|
+
| `pr_converge_bugteam_skill_tracker.py` | PostToolUse | Tracks which bugteam skill runs have completed within a pr-converge loop, so the enforcer can verify parallel execution |
|
|
11
|
+
| `session_end_cleanup.py` | SessionEnd | Purges stale cache entries from `~/.claude/cache/` (entries older than the configured threshold) and old backup files |
|
|
12
|
+
| `test_config_change_guard.py` | — | Tests for `config_change_guard.py` |
|
|
13
|
+
| `test_pr_converge_bugteam_skill_tracker.py` | — | Tests for `pr_converge_bugteam_skill_tracker.py` |
|
|
14
|
+
|
|
15
|
+
## Conventions
|
|
16
|
+
|
|
17
|
+
- Constants for these hooks (stale-age threshold, cache directory, known-hook-count file) live in `hooks_constants/session_env_cleanup_constants.py` and `hooks_constants/pr_converge_bugteam_enforcer_constants.py`.
|
|
18
|
+
- Tests run with `python -m pytest lifecycle/test_<name>.py`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# hooks/observability
|
|
2
|
+
|
|
3
|
+
PostToolUse hooks that record agent behavior for later review. These hooks do not block tool calls; they log or annotate them.
|
|
4
|
+
|
|
5
|
+
## Key files
|
|
6
|
+
|
|
7
|
+
| File | Event | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `instructions_loaded_logger.py` | PostToolUse (file load events) | Appends a JSONL record to `~/.claude/logs/instructions_loaded.jsonl` each time Claude Code loads a context file (CLAUDE.md, rules, skills), capturing the file path, load reason, memory type, and session ID |
|
|
10
|
+
| `test_instructions_loaded_logger.py` | — | Tests for `instructions_loaded_logger.py` |
|
|
11
|
+
|
|
12
|
+
## Conventions
|
|
13
|
+
|
|
14
|
+
- The log file is append-only; the hook creates the parent directory if needed.
|
|
15
|
+
- Errors during logging are caught and written as error records rather than propagated — the hook never blocks the tool call.
|
|
16
|
+
- Tests run with `python -m pytest observability/test_instructions_loaded_logger.py`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# hooks/session
|
|
2
|
+
|
|
3
|
+
SessionStart and SessionEnd hooks that manage per-session resources: cleaning up stale directories at startup and pruning plugin data at shutdown.
|
|
4
|
+
|
|
5
|
+
## Key files
|
|
6
|
+
|
|
7
|
+
| File | Event | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `session_env_cleanup.py` | SessionStart | Removes the current session's pre-existing `~/.claude/session-env/<session_id>/` directory and prunes sibling entries older than the stale-age threshold. Prevents `EEXIST` errors from non-recursive `mkdir` calls in the Bash tool on Windows. |
|
|
10
|
+
| `gh_pr_author_session_cleanup.py` | SessionEnd | Clears any PR-author swap state left over from the current session |
|
|
11
|
+
| `plugin_data_dir_cleanup.py` | SessionEnd | Prunes stale plugin data directories |
|
|
12
|
+
| `untracked_repo_detector.py` | SessionStart | Detects when the session cwd is inside a git repository that is not registered in `~/.claude/project-paths.json` and logs a warning |
|
|
13
|
+
| `test_gh_pr_author_session_cleanup.py` | — | Tests for `gh_pr_author_session_cleanup.py` |
|
|
14
|
+
| `test_session_env_cleanup.py` | — | Tests for `session_env_cleanup.py` |
|
|
15
|
+
| `test_untracked_repo_detector.py` | — | Tests for `untracked_repo_detector.py` |
|
|
16
|
+
|
|
17
|
+
## Conventions
|
|
18
|
+
|
|
19
|
+
- `session_env_cleanup.py` is Windows-specific in effect but safe to run on all platforms; it exits 0 when the target directory does not exist.
|
|
20
|
+
- Constants (stale-age threshold, directory names) live in `hooks_constants/session_env_cleanup_constants.py`.
|
|
21
|
+
- Tests run with `python -m pytest session/test_<name>.py`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# hooks/validation
|
|
2
|
+
|
|
3
|
+
PostToolUse hooks that validate code quality after Claude writes or edits a file. Unlike the blocking hooks (which fire PreToolUse and can deny the write), these hooks run after the write and report errors that need a follow-up fix.
|
|
4
|
+
|
|
5
|
+
## Key files
|
|
6
|
+
|
|
7
|
+
| File | Event | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `mypy_validator.py` | PostToolUse (Write/Edit on `.py` files) | Runs mypy on the written file and blocks (via PostToolUse block decision) when type errors are found — catches missing attributes, wrong signatures, type mismatches, and import errors |
|
|
10
|
+
| `hook_format_validator.py` | PostToolUse | Validates that a hook script's output JSON matches the expected Claude Code hook-output schema |
|
|
11
|
+
| `test_mypy_validator.py` | — | Tests for `mypy_validator.py` |
|
|
12
|
+
|
|
13
|
+
## Conventions
|
|
14
|
+
|
|
15
|
+
- `mypy_validator.py` resolves the project root via `CLAUDE_PROJECT_ROOT` or `git rev-parse --show-toplevel`.
|
|
16
|
+
- It works on both WSL and Windows.
|
|
17
|
+
- Constants (timeouts, max displayed errors) are inline in `mypy_validator.py`; longer tunables go in `hooks_constants/`.
|
|
18
|
+
- The `eval_*.txt` files in this directory are evaluation exports used during development — not runtime artifacts.
|
|
19
|
+
- Tests run with `python -m pytest validation/test_<name>.py`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# hooks/validators
|
|
2
|
+
|
|
3
|
+
A library of check modules used by the validation hooks. Each module focuses on one concern; `run_all_validators.py` runs them all and collects results. These modules do not hook into Claude Code directly — they are imported by the validation hooks.
|
|
4
|
+
|
|
5
|
+
## Core infrastructure
|
|
6
|
+
|
|
7
|
+
| File | Role |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `validator_base.py` | Defines the `Violation` dataclass (`file`, `line`, `message`) used by every check module |
|
|
10
|
+
| `validator_defaults.py` | Default configuration values shared across check modules |
|
|
11
|
+
| `exempt_paths.py` | Path exemption logic — paths that checks skip (e.g. vendored code) |
|
|
12
|
+
| `output_formatter.py` | Formats `Violation` lists into human-readable output |
|
|
13
|
+
| `run_all_validators.py` | Entry point — runs every check module and aggregates results |
|
|
14
|
+
| `health_check.py` | Verifies that all validator dependencies (ruff, mypy) are reachable |
|
|
15
|
+
|
|
16
|
+
## Check modules
|
|
17
|
+
|
|
18
|
+
| Module | What it checks |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `abbreviation_checks.py` | Abbreviated names in Python code |
|
|
21
|
+
| `code_quality_checks.py` | General code quality concerns (dead code, stub bodies, etc.) |
|
|
22
|
+
| `comment_checks.py` | Inline comment presence and content |
|
|
23
|
+
| `file_structure_checks.py` | File-level structural rules (line count, module layout) |
|
|
24
|
+
| `git_checks.py` | Git-state checks (untracked files, merge conflicts) |
|
|
25
|
+
| `magic_value_checks.py` | Magic numbers and strings |
|
|
26
|
+
| `mypy_integration.py` | Runs mypy and converts its output to `Violation` objects |
|
|
27
|
+
| `pr_reference_checks.py` | PR references in commit messages and changelogs |
|
|
28
|
+
| `python_antipattern_checks.py` | Python-specific anti-patterns (bare `except`, `Any`, etc.) |
|
|
29
|
+
| `python_style_checks.py` | Python style rules (naming, imports, type hints) |
|
|
30
|
+
| `react_checks.py` | React/TSX-specific checks (class component patterns, PureComponent usage) |
|
|
31
|
+
| `ruff_integration.py` | Runs ruff and converts its output to `Violation` objects |
|
|
32
|
+
| `security_checks.py` | Security anti-patterns (hardcoded secrets, unsafe calls) |
|
|
33
|
+
| `todo_checks.py` | TODO/FIXME markers without an associated issue reference |
|
|
34
|
+
| `type_safety_checks.py` | Type-safety rules (no `Any`, no `cast`, no `# type: ignore`) |
|
|
35
|
+
| `useless_test_checks.py` | Tests that check only existence or constant values |
|
|
36
|
+
| `verify_paths.py` | Validates that file paths referenced in code actually exist |
|
|
37
|
+
|
|
38
|
+
## Subdirectory
|
|
39
|
+
|
|
40
|
+
| Directory | Role |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `test_files/` | Fixture files used by the validator tests — not checked-in test code |
|
|
43
|
+
|
|
44
|
+
## Conventions
|
|
45
|
+
|
|
46
|
+
- Every check module exposes one or more functions that take file content or an AST and return a list of `Violation` objects.
|
|
47
|
+
- Test files live beside the modules they test: `test_<module>.py`. Run with `python -m pytest validators/test_<name>.py`.
|
|
48
|
+
- `conftest.py` provides shared test fixtures (sample files, fixture paths).
|
|
49
|
+
- `README.md` in this directory documents the validator design and how to add a new check.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# hooks/workflow
|
|
2
|
+
|
|
3
|
+
PostToolUse hooks that trigger side-effects after Claude writes a file. They do not block writes; they produce companion artifacts or publish content automatically.
|
|
4
|
+
|
|
5
|
+
## Key files
|
|
6
|
+
|
|
7
|
+
| File | Event | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `auto_formatter.py` | PostToolUse (Write/Edit) | Runs the project's auto-formatter (ruff, prettier, etc.) on the written file and sends a desktop notification when formatting changes are applied |
|
|
10
|
+
| `doc_gist_auto_publish.py` | PostToolUse (Write on `.html` files) | When an `.html` file has the `<!-- @publish-as-gist -->` marker, uploads it as a secret GitHub Gist and prints the htmlpreview URL into the harness output |
|
|
11
|
+
| `md_to_html_companion.py` | PostToolUse (Write/Edit on `.md` files) | Generates a styled `.html` companion file from the `.md` source with dark-mode styling |
|
|
12
|
+
| `investigation_tracker_reset.py` | PostToolUse | Resets the investigation tracker state after a tool call |
|
|
13
|
+
| `test_auto_formatter.py` | — | Tests for `auto_formatter.py` |
|
|
14
|
+
| `test_doc_gist_auto_publish.py` | — | Tests for `doc_gist_auto_publish.py` |
|
|
15
|
+
| `test_md_to_html_companion.py` | — | Tests for `md_to_html_companion.py` |
|
|
16
|
+
|
|
17
|
+
## Conventions
|
|
18
|
+
|
|
19
|
+
- All three main hooks exit 0 even on failure — they log warnings to stderr but do not break Claude's flow.
|
|
20
|
+
- `doc_gist_auto_publish.py` checks for the `<!-- @publish-as-gist -->` marker before doing any work; HTML files without it are ignored.
|
|
21
|
+
- Constants (marker text, blocked URL schemes, gist upload script path) live in `hooks_constants/doc_gist_auto_publish_constants.py` and `hooks_constants/html_companion_constants.py`.
|
|
22
|
+
- Tests run with `python -m pytest workflow/test_<name>.py`.
|
package/package.json
CHANGED
package/rules/CLAUDE.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# rules
|
|
2
|
+
|
|
3
|
+
Rule files installed into `~/.claude/rules/` by `bin/install.mjs`. Claude Code loads these as always-on behavioral constraints for every session. Each `.md` file covers one named rule; hook-enforced rules are also backed by a Python hook in `hooks/`.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | Rule |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `agent-spawn-protocol.md` | Protocol for spawning subagents: context sufficiency check, prompt generation via `/prompt-generator`, then spawn |
|
|
10
|
+
| `ask-user-question-required.md` | Every user-directed question goes through the `AskUserQuestion` tool — no plain-text questions |
|
|
11
|
+
| `bdd.md` | BDD discovery-driven development workflow and Example Mapping reference |
|
|
12
|
+
| `cleanup-temp-files.md` | Remove temporary files created during a task when the task is complete |
|
|
13
|
+
| `code-reviews.md` | Mandatory protocol for responding to GitHub PR review feedback |
|
|
14
|
+
| `code-standards.md` | Pointer to `CODE_RULES.md` as the single source of truth |
|
|
15
|
+
| `confirm-implementation-forks.md` | Stop and ask when two or more workable implementation paths change the deliverable |
|
|
16
|
+
| `conservative-action.md` | Research and recommend when intent is ambiguous; act only on explicit request |
|
|
17
|
+
| `context7.md` | Use Context7 MCP to fetch current library docs; always prefer live docs over built-in knowledge |
|
|
18
|
+
| `docstring-prose-matches-implementation.md` | Prose enumerations in docstrings cover every behavior the body applies |
|
|
19
|
+
| `explore-thoroughly.md` | Read relevant files and map existing patterns before proposing a change |
|
|
20
|
+
| `file-global-constants.md` | File-global constants need at least two same-file references; otherwise move value to `config/` |
|
|
21
|
+
| `gh-body-file.md` | Use `--body-file` with a temp file for all `gh` commands carrying markdown body content |
|
|
22
|
+
| `gh-paginate.md` | Use `--paginate --slurp` piped to external `jq` for paginated GitHub API list endpoints |
|
|
23
|
+
| `git-workflow.md` | PR workflow: always create as draft, one commit per review stage, never commit working docs or images |
|
|
24
|
+
| `hook-prose-matches-detector.md` | Hook prose descriptions match what the hook actually detects |
|
|
25
|
+
| `long-horizon-autonomy.md` | Autonomous-run behaviors: act on what you have, do not end on a promise, delegate and keep working |
|
|
26
|
+
| `no-cross-skill-duplicate-helpers.md` | No duplicating shared helpers across skills; use `_shared/` |
|
|
27
|
+
| `no-historical-clutter.md` | Documentation describes current state only; no historical or transitional language |
|
|
28
|
+
| `no-inline-destructive-literals.md` | No destructive-command literals in Bash tool command strings, even as data |
|
|
29
|
+
| `orphan-css-class.md` | Every `class="..."` attribute in Python-generated markup has a matching selector in the `<style>` block |
|
|
30
|
+
| `parallel-tools.md` | Make all independent tool calls in a single response |
|
|
31
|
+
| `plain-language.md` | Everyday words, short active sentences, lead with the answer |
|
|
32
|
+
| `prompt-workflow-context-controls.md` | Keep prompt-workflow instruction layers small and stable; load heavy skills on demand |
|
|
33
|
+
| `research-mode.md` | Three anti-hallucination constraints: say "I don't know", verify with citations, quote for factual grounding |
|
|
34
|
+
| `right-sized-engineering.md` | Simple over clever; functions over classes; concrete over abstract |
|
|
35
|
+
| `self-contained-docs.md` | Every document is fully self-contained; no references to the conversation that produced it |
|
|
36
|
+
| `shell-invocation-policy.md` | All Windows shell commands use `pwsh`; `powershell.exe`, `cmd /c`, and `bash -c` are blocked |
|
|
37
|
+
| `tdd.md` | Test-driven development: red → green → refactor, no production code before a failing test |
|
|
38
|
+
| `testing.md` | Test quality and infrastructure standards |
|
|
39
|
+
| `vault-context.md` | Search Obsidian vault for prior sessions and decisions before substantive project work |
|
|
40
|
+
| `verify-before-asking.md` | Answer questions by inspecting files or running tools before asking the user |
|
|
41
|
+
| `windows-filesystem-safe.md` | Use safe `rmtree` patterns on Windows; `mkdirSync` with `recursive: true` on possibly-existing paths |
|
|
42
|
+
| `workflow-substitution-slots.md` | Per-iteration values in `.workflow.js` templates use angle-bracket slots |
|
|
43
|
+
|
|
44
|
+
## Hook enforcement
|
|
45
|
+
|
|
46
|
+
Rules marked with ⚡ in `packages/claude-dev-env/docs/CODE_RULES.md` are backed by a blocking hook in `hooks/blocking/`. Rules without a hook are judgment-based and enforced via audit rubrics (`audit-rubrics/`).
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
When a docstring enumerates the behaviors a body applies, the enumeration covers every behavior the body applies. A reader trusts the list to be complete: an item the code applies but the prose omits is a silent gap that misleads every future reader and reviewer.
|
|
8
8
|
|
|
9
|
-
The gate validator `check_docstring_args_match_signature` covers the `Args:` section parameter names.
|
|
9
|
+
The gate validator `check_docstring_args_match_signature` covers the `Args:` section parameter names. Two more gate validators each cover one deterministic slice of the free-form prose. `check_docstring_fallback_branch_coverage` covers a summary that scopes a fallback to a single condition (`only when`, `falls back to ... when`) while the body routes to that same fallback call from two or more distinct early-return guards. `check_class_docstring_names_public_methods` covers a class whose docstring is a single summary line while the class exposes two or more public methods whose names the summary never spells out — the drift where a one-line class summary keeps naming its first feature after the class grows a second public entry point. The remaining free-form prose — `"a field counts as read when ..."`, `"resolves to shared temp only"`, `"strip ceremony, then drop blockquotes"`, and module-level responsibility paragraphs — has no signature, method roster, or single structural shape to compare against, so the gate cannot catch its drift. This rule is the judgment standard for that prose; the audit lane below is the enforcement for everything outside the three gated slices.
|
|
10
10
|
|
|
11
11
|
## What to check before you write the docstring
|
|
12
12
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# scripts
|
|
2
|
+
|
|
3
|
+
Utility scripts installed into `~/.claude/scripts/` by `bin/install.mjs`. Each script is a standalone tool a user or hook can invoke directly.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
| File | Purpose |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `setup_project_paths.py` | One-time bootstrap: discovers git repos via `es.exe` (Everything) and writes `~/.claude/project-paths.json`; never hardcodes scan roots |
|
|
10
|
+
| `sweep_empty_dirs.py` | Deletes empty directories older than a configurable age under a given root; runs once (`--once`) or in continuous-watch mode |
|
|
11
|
+
| `sync_to_cursor.py` | Entry point for syncing Claude rules to Cursor `.mdc` files; delegates to the `sync_to_cursor/` package |
|
|
12
|
+
|
|
13
|
+
## PowerShell scripts
|
|
14
|
+
|
|
15
|
+
| File | Purpose |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `Audit-ShellPolicy.ps1` | Audits Bash tool calls in session transcripts against the `pwsh`-only shell policy |
|
|
18
|
+
| `Migrate-ShellPolicy.ps1` | Applies automated fixes for common shell-policy violations found by the audit script |
|
|
19
|
+
| `Install-SweepEmptyDirs.ps1` | Registers `sweep_empty_dirs.py` as a scheduled task on Windows |
|
|
20
|
+
| `check.ps1` | Runs the full code-quality check suite |
|
|
21
|
+
|
|
22
|
+
## Subdirectories
|
|
23
|
+
|
|
24
|
+
| Entry | Description |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `dev_env_scripts_constants/` | Named constants (`timing.py`) for scripts in this directory |
|
|
27
|
+
| `sync_to_cursor/` | Package that builds Cursor `.mdc` files from Claude rules and docs |
|
|
28
|
+
| `tests/` | pytest suite for the Python scripts in this directory |
|
|
29
|
+
|
|
30
|
+
## Running tests
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
python -m pytest packages/claude-dev-env/scripts/tests/
|
|
34
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# dev_env_scripts_constants
|
|
2
|
+
|
|
3
|
+
Named constants for scripts in `scripts/`. Follows the project convention that timeouts, delays, and retries live in `timing.py`.
|
|
4
|
+
|
|
5
|
+
## Modules
|
|
6
|
+
|
|
7
|
+
| File | Constants for |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `timing.py` | `sweep_empty_dirs.py` — `DEFAULT_AGE_SECONDS` (smallest age before an empty directory is eligible for removal) and `DEFAULT_POLL_INTERVAL` (seconds between sweep passes in continuous-watch mode) |
|
|
10
|
+
| `__init__.py` | Empty package marker |
|
|
11
|
+
|
|
12
|
+
## Convention
|
|
13
|
+
|
|
14
|
+
Every constant is `UPPER_SNAKE_CASE` with an explicit type annotation and a docstring. Scripts import from here rather than embedding literal values in their bodies.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# sync_to_cursor
|
|
2
|
+
|
|
3
|
+
Python package that syncs Claude rules and docs to Cursor `.mdc` files. Entry point is `packages/claude-dev-env/scripts/sync_to_cursor.py`; this package holds the implementation modules.
|
|
4
|
+
|
|
5
|
+
## Modules
|
|
6
|
+
|
|
7
|
+
| File | Purpose |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `engine.py` | Main sync logic: loads the manifest, builds rule mappings, hashes sources, writes `.mdc` files, and updates the manifest |
|
|
10
|
+
| `rules.py` | Builds `RuleMapping` objects from Claude rule markdown files; applies transforms to fit Cursor's `.mdc` format |
|
|
11
|
+
| `canonical_docs.py` | Checks and syncs canonical documentation files (`CODE_RULES.md`, `TEST_QUALITY.md`) to the Cursor rules directory |
|
|
12
|
+
| `paths.py` | Resolves the Claude and Cursor layout paths; respects the `LLM_SETTINGS_ROOT` env var for non-home layouts |
|
|
13
|
+
| `hashing.py` | SHA-256 helpers that detect whether source files changed since the last sync run |
|
|
14
|
+
| `config.py` | Package-level constants: `GENERATOR_VERSION`, `CANONICAL_DOC_FILES`, `MAX_RULE_BODY_LINES` |
|
|
15
|
+
| `__init__.py` | Empty package marker |
|
|
16
|
+
|
|
17
|
+
## Layout resolution
|
|
18
|
+
|
|
19
|
+
`paths.py` reads `LLM_SETTINGS_ROOT` from the environment. When set, it uses that path as the base for both `.claude/` and `.cursor/`. When unset, it falls back to `Path.home()`.
|
|
20
|
+
|
|
21
|
+
## Tests
|
|
22
|
+
|
|
23
|
+
Tests live in `packages/claude-dev-env/scripts/tests/test_sync_to_cursor.py`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# scripts/tests
|
|
2
|
+
|
|
3
|
+
pytest suite for the Python scripts in `scripts/`.
|
|
4
|
+
|
|
5
|
+
## Test files
|
|
6
|
+
|
|
7
|
+
| File | Covers |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `test_setup_project_paths.py` | `setup_project_paths.py` — discovery, filtering, and `project-paths.json` writing |
|
|
10
|
+
| `test_setup_project_paths_config.py` | Configuration constants used by `setup_project_paths.py` |
|
|
11
|
+
| `test_sweep_empty_dirs.py` | `sweep_empty_dirs.py` — age check, one-shot mode, and continuous-watch behavior |
|
|
12
|
+
| `test_sync_to_cursor.py` | `sync_to_cursor/` package — mapping, hashing, manifest, and path resolution |
|
|
13
|
+
|
|
14
|
+
## Running
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python -m pytest packages/claude-dev-env/scripts/tests/
|
|
18
|
+
```
|
package/skills/CLAUDE.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Skills Directory
|
|
2
|
+
|
|
3
|
+
Each skill is a self-contained folder Claude Code loads on demand. At startup, only the skill's `name` and `description` metadata load. The full `SKILL.md` body and any support files load only when a skill becomes relevant to the conversation.
|
|
4
|
+
|
|
5
|
+
## Skill folder convention
|
|
6
|
+
|
|
7
|
+
| Item | Role |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `SKILL.md` | Required entry point. YAML frontmatter with `name` and `description` (the trigger). Body holds the skill's full instructions. |
|
|
10
|
+
| `scripts/` | Python helper scripts the skill invokes at runtime. |
|
|
11
|
+
| `workflow/` | `.mjs` workflow scripts run via the `Workflow` tool. |
|
|
12
|
+
| `templates/` | Template files the skill or workflow renders at build time. |
|
|
13
|
+
| `reference/` | Reference docs the skill cites or the workflow reads. |
|
|
14
|
+
| `*_constants/` | Python package of named constants imported by `scripts/`. |
|
|
15
|
+
|
|
16
|
+
Skills install to `~/.claude/skills/<skill-name>/` via `packages/claude-dev-env/bin/install.mjs`. See `docs/references/skill-install-system.md` for the install pipeline.
|
|
17
|
+
|
|
18
|
+
## Shared support code
|
|
19
|
+
|
|
20
|
+
`_shared/` — support code used by more than one skill. It holds `pr-loop/`, which provides prompt templates and Python helper scripts shared between `bugteam` and `pr-converge`.
|
|
21
|
+
|
|
22
|
+
## Skill groups
|
|
23
|
+
|
|
24
|
+
**Planning and implementation**
|
|
25
|
+
- `anthropic-plan` — creates a source-grounded plan packet before any code changes
|
|
26
|
+
- `implement` — structured implementation from an existing plan packet
|
|
27
|
+
- `bdd-protocol` — BDD depth: Example Mapping, scenario quality, outside-in layout
|
|
28
|
+
- `verified-build` — build + test loop that gates on a verifier verdict
|
|
29
|
+
|
|
30
|
+
**PR review and convergence**
|
|
31
|
+
- `autoconverge` — autonomous single-run workflow that drives a PR to ready
|
|
32
|
+
- `pr-converge` — paced convergence loop across `ScheduleWakeup` ticks
|
|
33
|
+
- `bugteam` — open-loop audit-fix until convergence
|
|
34
|
+
- `pr-review-responder` — fetches all reviewer comments and replies systematically
|
|
35
|
+
- `pr-consistency-audit` — cross-file consistency check on a PR diff
|
|
36
|
+
- `copilot-review` — requests and polls a GitHub Copilot review
|
|
37
|
+
- `findbugs` / `fixbugs` — find bugs then fix them in separate passes
|
|
38
|
+
- `code` — strict-mode code generation session
|
|
39
|
+
|
|
40
|
+
**Research and discovery**
|
|
41
|
+
- `deep-research` — multi-source research with citation
|
|
42
|
+
- `research-mode` — activates anti-hallucination discipline for a session
|
|
43
|
+
- `recall` — retrieves facts from memory files
|
|
44
|
+
- `remember` — saves a decision, gotcha, or architectural choice to the Obsidian vault
|
|
45
|
+
- `everything-search` — file-system search via the Everything MCP tool
|
|
46
|
+
- `caveman` — trims noise from a draft artifact
|
|
47
|
+
|
|
48
|
+
**Session and workflow management**
|
|
49
|
+
- `session-log` — logs a session report to the Obsidian vault
|
|
50
|
+
- `session-tidy` — tidies the session folder
|
|
51
|
+
- `bg-agent` — launches a background agent
|
|
52
|
+
- `task-build` — gathers open tasks
|
|
53
|
+
- `update` — updates the dev-env package
|
|
54
|
+
- `gh-paginate` — safe `gh api` pagination patterns
|
|
55
|
+
- `fresh-branch` — creates a clean branch off main
|
|
56
|
+
- `rebase` — rebases onto main
|
|
57
|
+
- `gotcha` — records a hard-won lesson to memory
|
|
58
|
+
- `logifix` — restores the Logitech Gaming Software (LCore) tray icon when it disappears on Windows
|
|
59
|
+
- `refine` — refinement pass on an artifact
|
|
60
|
+
- `structure-prompt` — structures a freeform prompt
|
|
61
|
+
- `monitor-open-prs` — polls open PRs for status
|
|
62
|
+
- `pre-compact` — compact-safe session handoff
|
|
63
|
+
- `qbug` — required baseline PR audit; one clean-coder subagent loops audit → fix → commit → push until clean or stuck
|
|
64
|
+
- `skill-builder` — complete skill-building lifecycle
|
|
65
|
+
- `doc-gist` — uploads an HTML file as a secret gist
|
|
66
|
+
- `auditing-claude-config` — audits a Claude Code setup for context-budget waste and produces a migration table with savings
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# _shared
|
|
2
|
+
|
|
3
|
+
Support code shared across multiple skills. Each subdirectory targets a specific cross-skill concern.
|
|
4
|
+
|
|
5
|
+
## Subdirectories
|
|
6
|
+
|
|
7
|
+
| Directory | Role |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `pr-loop/` | Prompt templates and Python helper scripts used by both `bugteam` and `pr-converge` for their audit-fix loop. |
|
|
10
|
+
|
|
11
|
+
Files here are not skills themselves and have no `SKILL.md`. They install alongside each consuming skill via the install pipeline in `packages/claude-dev-env/bin/install.mjs`.
|