@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.4

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 (83) hide show
  1. package/README.md +44 -6
  2. package/commands/active/xarchitecture.md +393 -0
  3. package/commands/active/xconfig.md +127 -0
  4. package/commands/active/xdebug.md +130 -0
  5. package/commands/active/xdocs.md +178 -0
  6. package/commands/active/xgit.md +149 -0
  7. package/commands/active/xpipeline.md +152 -0
  8. package/commands/active/xquality.md +96 -0
  9. package/commands/active/xrefactor.md +198 -0
  10. package/commands/active/xrelease.md +142 -0
  11. package/commands/active/xsecurity.md +92 -0
  12. package/commands/active/xspec.md +174 -0
  13. package/commands/active/xtdd.md +151 -0
  14. package/commands/active/xtest.md +89 -0
  15. package/commands/experiments/xact.md +742 -0
  16. package/commands/experiments/xanalytics.md +113 -0
  17. package/commands/experiments/xanalyze.md +70 -0
  18. package/commands/experiments/xapi.md +161 -0
  19. package/commands/experiments/xatomic.md +112 -0
  20. package/commands/experiments/xaws.md +85 -0
  21. package/commands/experiments/xcicd.md +337 -0
  22. package/commands/experiments/xcommit.md +122 -0
  23. package/commands/experiments/xcompliance.md +182 -0
  24. package/commands/experiments/xconstraints.md +89 -0
  25. package/commands/experiments/xcoverage.md +90 -0
  26. package/commands/experiments/xdb.md +102 -0
  27. package/commands/experiments/xdesign.md +121 -0
  28. package/commands/experiments/xevaluate.md +111 -0
  29. package/commands/experiments/xfootnote.md +12 -0
  30. package/commands/experiments/xgenerate.md +117 -0
  31. package/commands/experiments/xgovernance.md +149 -0
  32. package/commands/experiments/xgreen.md +66 -0
  33. package/commands/experiments/xiac.md +118 -0
  34. package/commands/experiments/xincident.md +137 -0
  35. package/commands/experiments/xinfra.md +115 -0
  36. package/commands/experiments/xknowledge.md +115 -0
  37. package/commands/experiments/xmaturity.md +120 -0
  38. package/commands/experiments/xmetrics.md +118 -0
  39. package/commands/experiments/xmonitoring.md +128 -0
  40. package/commands/experiments/xnew.md +898 -0
  41. package/commands/experiments/xobservable.md +114 -0
  42. package/commands/experiments/xoidc.md +165 -0
  43. package/commands/experiments/xoptimize.md +115 -0
  44. package/commands/experiments/xperformance.md +112 -0
  45. package/commands/experiments/xplanning.md +131 -0
  46. package/commands/experiments/xpolicy.md +115 -0
  47. package/commands/experiments/xproduct.md +98 -0
  48. package/commands/experiments/xreadiness.md +75 -0
  49. package/commands/experiments/xred.md +55 -0
  50. package/commands/experiments/xrisk.md +128 -0
  51. package/commands/experiments/xrules.md +124 -0
  52. package/commands/experiments/xsandbox.md +120 -0
  53. package/commands/experiments/xscan.md +102 -0
  54. package/commands/experiments/xsetup.md +123 -0
  55. package/commands/experiments/xtemplate.md +116 -0
  56. package/commands/experiments/xtrace.md +212 -0
  57. package/commands/experiments/xux.md +171 -0
  58. package/commands/experiments/xvalidate.md +104 -0
  59. package/commands/experiments/xworkflow.md +113 -0
  60. package/hooks/README.md +231 -0
  61. package/hooks/file-logger.sh +98 -0
  62. package/hooks/lib/argument-parser.sh +422 -0
  63. package/hooks/lib/config-constants.sh +230 -0
  64. package/hooks/lib/context-manager.sh +549 -0
  65. package/hooks/lib/error-handler.sh +412 -0
  66. package/hooks/lib/execution-engine.sh +627 -0
  67. package/hooks/lib/file-utils.sh +375 -0
  68. package/hooks/lib/subagent-discovery.sh +465 -0
  69. package/hooks/lib/subagent-validator.sh +597 -0
  70. package/hooks/on-error-debug.sh +221 -0
  71. package/hooks/pre-commit-quality.sh +204 -0
  72. package/hooks/pre-write-security.sh +107 -0
  73. package/hooks/prevent-credential-exposure.sh +265 -0
  74. package/hooks/subagent-trigger-simple.sh +193 -0
  75. package/hooks/subagent-trigger.sh +253 -0
  76. package/lib/hook-installer-core.js +2 -2
  77. package/package.json +3 -1
  78. package/templates/README.md +100 -0
  79. package/templates/basic-settings.json +30 -0
  80. package/templates/comprehensive-settings.json +206 -0
  81. package/templates/hybrid-hook-config.yaml +133 -0
  82. package/templates/security-focused-settings.json +62 -0
  83. package/templates/subagent-hooks.yaml +188 -0
@@ -0,0 +1,133 @@
1
+ # Hybrid Hook Configuration for Claude Code
2
+ #
3
+ # This configuration demonstrates the hybrid approach: lightweight trigger scripts
4
+ # that delegate complex logic to AI subagents. This approach provides the best
5
+ # balance of immediate response and intelligent analysis.
6
+ #
7
+ # Place relevant sections in your Claude Code settings.json file.
8
+
9
+ ##################################
10
+ # Claude Code Settings.json Configuration
11
+ ##################################
12
+
13
+ # Copy sections below into your ~/.claude/settings.json file:
14
+
15
+ hooks_configuration:
16
+ PreToolUse:
17
+ - matcher: "Edit|Write|MultiEdit"
18
+ hooks:
19
+ - command: "~/.claude/hooks/pre-write-security.sh"
20
+ blocking: true
21
+ description: "Security analysis via security-auditor subagent"
22
+ timeout: 10000
23
+
24
+ PostToolUse:
25
+ - matcher: "Edit|Write|MultiEdit"
26
+ hooks:
27
+ - command: "~/.claude/hooks/file-logger.sh"
28
+ blocking: false
29
+ description: "Log file modifications"
30
+
31
+ OnError:
32
+ - hooks:
33
+ - command: "~/.claude/hooks/on-error-debug.sh"
34
+ blocking: false
35
+ description: "Automatic debugging via debug-specialist subagent"
36
+
37
+ custom:
38
+ pre-commit:
39
+ command: "~/.claude/hooks/pre-commit-quality.sh"
40
+ description: "Quality checks via style-enforcer subagent"
41
+ blocking: true
42
+
43
+ manual-security:
44
+ command: "~/.claude/hooks/subagent-trigger-simple.sh security-auditor manual"
45
+ description: "Manual security audit"
46
+
47
+ ##################################
48
+ # Trigger Script to Subagent Mapping
49
+ ##################################
50
+ # Reference for which trigger scripts delegate to which subagents:
51
+
52
+ trigger_mappings:
53
+ pre-write-security.sh:
54
+ delegates_to: "security-auditor"
55
+ purpose: "Scan for security vulnerabilities before file modifications"
56
+ context_includes: ["tool", "file", "user", "timestamp"]
57
+
58
+ pre-commit-quality.sh:
59
+ delegates_to: "style-enforcer"
60
+ purpose: "Code quality validation before git commits"
61
+ context_includes: ["staged_files", "git_info", "file_types"]
62
+
63
+ on-error-debug.sh:
64
+ delegates_to: "debug-specialist"
65
+ purpose: "Automatic debugging assistance when errors occur"
66
+ context_includes: ["error_info", "system_context", "diagnostics"]
67
+
68
+ subagent-trigger-simple.sh:
69
+ delegates_to: "any (specified as argument)"
70
+ purpose: "General-purpose lightweight subagent trigger"
71
+ context_includes: ["subagent", "event", "environment", "project"]
72
+
73
+ ##################################
74
+ # Available Subagents for Delegation
75
+ ##################################
76
+ # These subagents can be invoked by the trigger scripts:
77
+
78
+ available_subagents:
79
+ security-auditor:
80
+ specialization: "Security vulnerability detection and prevention"
81
+ best_for: ["credential_exposure", "injection_attacks", "access_control"]
82
+ trigger_events: ["pre_write", "pre_commit", "manual"]
83
+
84
+ style-enforcer:
85
+ specialization: "Code quality, formatting, and style consistency"
86
+ best_for: ["formatting", "imports", "documentation", "best_practices"]
87
+ trigger_events: ["pre_commit", "post_write", "manual"]
88
+
89
+ debug-specialist:
90
+ specialization: "Error analysis and troubleshooting"
91
+ best_for: ["error_analysis", "root_cause", "performance_issues"]
92
+ trigger_events: ["on_error", "manual"]
93
+
94
+ test-writer:
95
+ specialization: "Test case generation and validation"
96
+ best_for: ["test_coverage", "test_generation", "mocking"]
97
+ trigger_events: ["post_write", "pre_test", "manual"]
98
+
99
+ ##################################
100
+ # Usage Examples
101
+ ##################################
102
+
103
+ # Manual subagent invocation:
104
+ manual_usage:
105
+ - "~/.claude/hooks/subagent-trigger-simple.sh security-auditor pre_write"
106
+ - "~/.claude/hooks/subagent-trigger-simple.sh style-enforcer pre_commit 'Check Python files'"
107
+ - "~/.claude/hooks/subagent-trigger-simple.sh debug-specialist on_error 'ImportError'"
108
+
109
+ # Event-driven automatic invocation:
110
+ automatic_usage:
111
+ - "Edit/Write operations automatically trigger security analysis"
112
+ - "Git operations can trigger quality checks"
113
+ - "Errors automatically engage debugging assistance"
114
+
115
+ ##################################
116
+ # Migration from Complex to Hybrid
117
+ ##################################
118
+
119
+ migration_benefits:
120
+ before: "253-line complex bash orchestration script"
121
+ after: "4 lightweight trigger scripts (30-100 lines each)"
122
+ improvements:
123
+ - "Simplified maintenance and debugging"
124
+ - "AI-driven complex logic instead of bash complexity"
125
+ - "Better error handling and user feedback"
126
+ - "Modular trigger scripts for specific use cases"
127
+ - "Preserved shared utilities in hooks/lib/"
128
+
129
+ # To migrate:
130
+ # 1. Replace complex hooks with appropriate trigger scripts
131
+ # 2. Update Claude Code settings.json with new hook commands
132
+ # 3. Test triggers with manual invocation
133
+ # 4. Verify subagent delegation works correctly
@@ -0,0 +1,62 @@
1
+ {
2
+ "// Security-focused Claude Code settings.json template": "Copy to ~/.claude/settings.json",
3
+ "// Includes security hooks and enhanced governance": "",
4
+
5
+ "allowedTools": [
6
+ "Edit",
7
+ "Bash",
8
+ "Read",
9
+ "Write",
10
+ "MultiEdit"
11
+ ],
12
+
13
+ "// Trust and onboarding settings": "",
14
+ "hasTrustDialogAccepted": true,
15
+ "hasCompletedProjectOnboarding": true,
16
+
17
+ "// Performance optimization": "",
18
+ "parallelTasksCount": 3,
19
+
20
+ "// Security hooks configuration": "",
21
+ "hooks": {
22
+ "PreToolUse": [
23
+ {
24
+ "matcher": "Edit|Write|MultiEdit",
25
+ "hooks": [
26
+ {
27
+ "type": "command",
28
+ "command": "~/.claude/hooks/prevent-credential-exposure.sh",
29
+ "blocking": true,
30
+ "timeout": 10000
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ },
36
+
37
+ "// Security-focused environment variables": "",
38
+ "env": {
39
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "true",
40
+ "BASH_DEFAULT_TIMEOUT_MS": "120000",
41
+ "SECURITY_WEBHOOK_URL": "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK",
42
+ "CLAUDE_SECURITY_OVERRIDE": "false"
43
+ },
44
+
45
+ "// Restrictive permissions for security": "",
46
+ "permissions": {
47
+ "allow": [
48
+ "Bash(npm run *)",
49
+ "Bash(python -m *)",
50
+ "Bash(git *)",
51
+ "Edit(*)",
52
+ "Read(*)",
53
+ "Write(*)"
54
+ ],
55
+ "deny": [
56
+ "Bash(curl *)",
57
+ "Bash(wget *)",
58
+ "Bash(ssh *)",
59
+ "Bash(sudo *)"
60
+ ]
61
+ }
62
+ }
@@ -0,0 +1,188 @@
1
+ # Claude Code Subagent-Hook Event Mapping Configuration
2
+ #
3
+ # This file defines which subagents should be automatically invoked
4
+ # during specific Claude Code events. Place this file at:
5
+ # ~/.claude/subagent-hooks.yaml
6
+ #
7
+ # Format:
8
+ # event_name:
9
+ # - subagent-name
10
+ # - another-subagent
11
+ #
12
+ # Available events:
13
+ # - pre_write: Before any file write/edit operation
14
+ # - post_write: After successful file write/edit
15
+ # - pre_commit: Before git commit operations
16
+ # - post_commit: After successful git commit
17
+ # - pre_test: Before running tests
18
+ # - post_test: After test execution
19
+ # - on_error: When an error occurs
20
+ # - security_check: Security validation events
21
+ # - code_review: Code review triggers
22
+ # - deployment: Deployment-related events
23
+
24
+ # File modification events
25
+ pre_write:
26
+ - security-auditor # Check for security issues before writing
27
+ - style-enforcer # Ensure code style compliance
28
+ - license-compliance-guardian # Verify license headers
29
+
30
+ post_write:
31
+ - documentation-curator # Update docs after code changes
32
+ - test-writer # Generate/update tests for new code
33
+
34
+ # Git workflow events
35
+ pre_commit:
36
+ - trunk-guardian # Ensure branch policies are followed
37
+ - security-auditor # Final security check before commit
38
+ - contract-tester # Verify API contracts maintained
39
+
40
+ post_commit:
41
+ - audit-trail-verifier # Log changes for audit trail
42
+ - change-scoper # Analyze change impact
43
+
44
+ # Testing events
45
+ pre_test:
46
+ - test-writer # Ensure adequate test coverage
47
+ - environment-guardian # Validate test environment
48
+
49
+ post_test:
50
+ - performance-guardian # Analyze performance results
51
+ - observability-engineer # Check monitoring coverage
52
+
53
+ on_test_failure:
54
+ - debug-specialist # Diagnose test failures
55
+ - test-writer # Suggest test fixes
56
+
57
+ # Build and deployment events
58
+ pre_build:
59
+ - dependency-steward # Check dependency versions
60
+ - sbom-provenance # Generate software bill of materials
61
+
62
+ pre_deployment:
63
+ - deployment-strategist # Plan deployment approach
64
+ - environment-guardian # Validate target environment
65
+ - rollback-first-responder # Prepare rollback plan
66
+
67
+ post_deployment:
68
+ - observability-engineer # Verify monitoring active
69
+ - performance-guardian # Check performance metrics
70
+
71
+ # Error handling events
72
+ on_error:
73
+ - debug-specialist # Analyze and diagnose errors
74
+ - rollback-first-responder # Prepare recovery plan
75
+
76
+ on_security_violation:
77
+ - security-auditor # Deep security analysis
78
+ - audit-trail-verifier # Document violation
79
+
80
+ # Code review events
81
+ code_review:
82
+ - code-review-assistant # Automated review suggestions
83
+ - requirements-reviewer # Check requirements alignment
84
+ - api-guardian # Verify API compatibility
85
+
86
+ # Continuous improvement events
87
+ daily_analysis:
88
+ - data-steward # Data quality check
89
+ - performance-guardian # Performance trending
90
+ - dependency-steward # Dependency updates
91
+
92
+ weekly_review:
93
+ - product-owner-proxy # Business alignment check
94
+ - workflow-coordinator # Process optimization
95
+
96
+ # CI/CD pipeline events
97
+ pipeline_failure:
98
+ - ci-pipeline-curator # Diagnose pipeline issues
99
+ - debug-specialist # Investigate failures
100
+
101
+ pipeline_success:
102
+ - continuous-release-orchestrator # Plan next release
103
+ - audit-trail-verifier # Document successful build
104
+
105
+ # Custom event examples (add your own)
106
+ custom_security_scan:
107
+ - security-auditor
108
+ - license-compliance-guardian
109
+ - sbom-provenance
110
+
111
+ custom_performance_check:
112
+ - performance-guardian
113
+ - observability-engineer
114
+ - debug-specialist
115
+
116
+ # Priority configurations (optional)
117
+ # Define execution order and blocking behavior
118
+ priorities:
119
+ security-auditor:
120
+ priority: 1 # Execute first
121
+ blocking: true # Block operation if issues found
122
+
123
+ style-enforcer:
124
+ priority: 2
125
+ blocking: false # Non-blocking, just warnings
126
+
127
+ test-writer:
128
+ priority: 3
129
+ blocking: false
130
+
131
+ documentation-curator:
132
+ priority: 4
133
+ blocking: false
134
+
135
+ # Subagent configuration overrides (optional)
136
+ # Override default subagent settings for specific events
137
+ overrides:
138
+ pre_deployment:
139
+ deployment-strategist:
140
+ timeout: 300 # 5 minutes for deployment planning
141
+ tools: "Read, Grep, Glob, Bash" # Restricted tools
142
+
143
+ environment-guardian:
144
+ timeout: 120
145
+ require_approval: true # Human approval needed
146
+
147
+ on_error:
148
+ debug-specialist:
149
+ timeout: 600 # 10 minutes for debugging
150
+ tools: "all" # Full tool access for debugging
151
+
152
+ # Event conditions (optional)
153
+ # Define conditions for event triggering
154
+ conditions:
155
+ pre_write:
156
+ file_patterns:
157
+ - "*.py" # Only Python files
158
+ - "*.js" # Only JavaScript files
159
+ - "*.ts" # Only TypeScript files
160
+
161
+ exclude_patterns:
162
+ - "*.test.*" # Skip test files
163
+ - "*.spec.*" # Skip spec files
164
+ - "__pycache__/*" # Skip cache directories
165
+
166
+ code_review:
167
+ branch_patterns:
168
+ - "feature/*" # Feature branches
169
+ - "hotfix/*" # Hotfix branches
170
+
171
+ exclude_branches:
172
+ - "main" # Skip main branch
173
+ - "develop" # Skip develop branch
174
+
175
+ # Notification settings (optional)
176
+ notifications:
177
+ on_blocking_event:
178
+ log_level: "error"
179
+ alert_user: true
180
+
181
+ on_security_violation:
182
+ log_level: "critical"
183
+ alert_user: true
184
+ notify_webhook: "${SECURITY_WEBHOOK_URL}"
185
+
186
+ on_success:
187
+ log_level: "info"
188
+ alert_user: false