claude-git-hooks 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,14 @@
3
3
  ## Claude API Best Practices
4
4
 
5
5
  ### Model Selection
6
+
6
7
  ✅ **Haiku**: Simple tasks, fast responses, cost-effective
7
8
  ✅ **Sonnet**: Balanced performance, most use cases
8
9
  ✅ **Opus**: Complex reasoning, highest quality
9
10
  ❌ Don't use Opus when Haiku would suffice
10
11
 
11
12
  ### API Usage
13
+
12
14
  ✅ Implement proper timeout handling
13
15
  ✅ Handle rate limiting gracefully
14
16
  ✅ Retry with exponential backoff on failures
@@ -17,6 +19,7 @@
17
19
  ✅ Calculate and monitor token usage
18
20
 
19
21
  ### Error Handling
22
+
20
23
  ```javascript
21
24
  // ✅ Good
22
25
  try {
@@ -39,6 +42,7 @@ try {
39
42
  ## Prompt Engineering
40
43
 
41
44
  ### Structure
45
+
42
46
  ✅ Clear role/context at the beginning
43
47
  ✅ Specific task instructions
44
48
  ✅ Well-defined output format (usually JSON)
@@ -46,6 +50,7 @@ try {
46
50
  ✅ Appropriate length (token-efficient)
47
51
 
48
52
  ### Quality Checklist
53
+
49
54
  ✅ Instructions are unambiguous
50
55
  ✅ Output format is machine-parseable
51
56
  ✅ Context is sufficient but not excessive
@@ -53,6 +58,7 @@ try {
53
58
  ✅ Placeholders are replaced correctly
54
59
 
55
60
  ### Common Prompt Issues
61
+
56
62
  ❌ Vague instructions
57
63
  ❌ No output format specification
58
64
  ❌ Too much unnecessary context
@@ -62,6 +68,7 @@ try {
62
68
  ## CLI User Experience
63
69
 
64
70
  ### Error Messages
71
+
65
72
  ✅ Clear, actionable error messages
66
73
  ✅ Suggest solutions when possible
67
74
  ✅ Use appropriate log levels
@@ -69,6 +76,7 @@ try {
69
76
  ✅ Include context (what was being attempted)
70
77
 
71
78
  ### User Feedback
79
+
72
80
  ✅ Show progress for long operations
73
81
  ✅ Confirm destructive operations
74
82
  ✅ Provide helpful usage information
@@ -78,6 +86,7 @@ try {
78
86
  ## Git Operations Safety
79
87
 
80
88
  ### Safe Practices
89
+
81
90
  ✅ Validate repository state before operations
82
91
  ✅ Use `--cached` for staged changes
83
92
  ✅ Handle special characters in filenames
@@ -85,6 +94,7 @@ try {
85
94
  ✅ Graceful handling of git errors
86
95
 
87
96
  ### Dangerous Operations
97
+
88
98
  ❌ Never run git commands that modify history without explicit user confirmation
89
99
  ❌ Avoid hard resets
90
100
  ❌ Be careful with force pushes
@@ -93,6 +103,7 @@ try {
93
103
  ## Security
94
104
 
95
105
  ### API Keys
106
+
96
107
  ✅ Load from environment variables
97
108
  ✅ Never log or display API keys
98
109
  ✅ Never commit API keys to repository
@@ -100,6 +111,7 @@ try {
100
111
  ✅ Clear keys from memory when done
101
112
 
102
113
  ### Command Injection
114
+
103
115
  ✅ Validate all user input
104
116
  ✅ Use parameterized commands when possible
105
117
  ✅ Escape special characters
@@ -107,14 +119,15 @@ try {
107
119
  ✅ Sanitize file paths
108
120
 
109
121
  ### Sensitive Data
122
+
110
123
  ✅ Don't send secrets to Claude API
111
124
  ✅ Filter sensitive data from diffs
112
125
  ✅ Be careful with error messages (don't expose internals)
113
- ✅ Implement SKIP_ANALYSIS for sensitive code
114
126
 
115
127
  ## Code Organization
116
128
 
117
129
  ### File Structure
130
+
118
131
  ```
119
132
  lib/
120
133
  hooks/ # Git hook implementations
@@ -129,6 +142,7 @@ bin/ # CLI entry points
129
142
  ```
130
143
 
131
144
  ### Module Design
145
+
132
146
  ✅ Single responsibility principle
133
147
  ✅ Clear, descriptive function names
134
148
  ✅ Comprehensive error handling
@@ -138,12 +152,14 @@ bin/ # CLI entry points
138
152
  ## Common Issues to Avoid
139
153
 
140
154
  ### Critical Issues
155
+
141
156
  ❌ Exposed API keys or secrets
142
157
  ❌ Command injection vulnerabilities
143
158
  ❌ Destructive git operations without confirmation
144
159
  ❌ Unhandled promise rejections
145
160
 
146
161
  ### Major Issues
162
+
147
163
  ❌ Missing error handling
148
164
  ❌ Poor user experience (unclear errors)
149
165
  ❌ Cross-platform incompatibility
@@ -151,6 +167,7 @@ bin/ # CLI entry points
151
167
  ❌ Missing input validation
152
168
 
153
169
  ### Minor Issues
170
+
154
171
  ❌ Insufficient logging
155
172
  ❌ Unclear variable names
156
173
  ❌ Missing documentation
@@ -1,37 +1,37 @@
1
- {
2
- "name": "ai",
3
- "displayName": "AI/CLI (Node.js + Claude)",
4
- "description": "Node.js CLI tools with Claude API integration",
5
- "version": "1.0.0",
6
-
7
- "techStack": [
8
- "Node.js",
9
- "ES Modules",
10
- "Claude API",
11
- "CLI tools",
12
- "Git hooks",
13
- "Bash scripting",
14
- "Markdown templates"
15
- ],
16
-
17
- "fileExtensions": [".js", ".json", ".md", ".sh"],
18
-
19
- "focusAreas": [
20
- "Claude API usage and best practices",
21
- "Prompt engineering quality",
22
- "CLI user experience",
23
- "Error handling and logging",
24
- "Git operations safety",
25
- "Cross-platform compatibility",
26
- "Token usage optimization",
27
- "Security (API keys, secrets)"
28
- ],
29
-
30
- "templates": {
31
- "analysis": "ANALYSIS_PROMPT.md",
32
- "guidelines": "PRE_COMMIT_GUIDELINES.md",
33
- "commitMessage": "../shared/COMMIT_MESSAGE.md",
34
- "analyzeDiff": "../shared/ANALYZE_DIFF.md",
35
- "resolution": "../shared/RESOLUTION_PROMPT.md"
36
- }
37
- }
1
+ {
2
+ "name": "ai",
3
+ "displayName": "AI/CLI (Node.js + Claude)",
4
+ "description": "Node.js CLI tools with Claude API integration",
5
+ "version": "1.0.0",
6
+
7
+ "techStack": [
8
+ "Node.js",
9
+ "ES Modules",
10
+ "Claude API",
11
+ "CLI tools",
12
+ "Git hooks",
13
+ "Bash scripting",
14
+ "Markdown templates"
15
+ ],
16
+
17
+ "fileExtensions": [".js", ".json", ".md", ".sh"],
18
+
19
+ "focusAreas": [
20
+ "Claude API usage and best practices",
21
+ "Prompt engineering quality",
22
+ "CLI user experience",
23
+ "Error handling and logging",
24
+ "Git operations safety",
25
+ "Cross-platform compatibility",
26
+ "Token usage optimization",
27
+ "Security (API keys, secrets)"
28
+ ],
29
+
30
+ "templates": {
31
+ "analysis": "ANALYSIS_PROMPT.md",
32
+ "guidelines": "PRE_COMMIT_GUIDELINES.md",
33
+ "commitMessage": "../shared/COMMIT_MESSAGE.md",
34
+ "analyzeDiff": "../shared/ANALYZE_DIFF.md",
35
+ "resolution": "../shared/RESOLUTION_PROMPT.md"
36
+ }
37
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_comment": "This file stores local settings that should NOT be committed. Copy to .claude/settings.local.json",
3
+ "githubToken": "ghp_your_token_here"
4
+ }