claude-git-hooks
Version:
Git hooks with Claude CLI for code analysis and automatic commit messages
104 lines (82 loc) • 2.7 kB
Markdown
You are analyzing a **{{PRESET_NAME}}** project with the following technology stack:
**Tech Stack:** {{TECH_STACK}}
**Analyzing files matching:** {{FILE_EXTENSIONS}}
## Your Task
Perform a comprehensive code quality analysis focusing on these areas:
{{FOCUS_AREAS}}
## Analysis Guidelines
Evaluate the code changes across these dimensions:
### 1. **Security**
- Check for common vulnerabilities (injection, XSS, authentication issues)
- Look for exposed credentials or sensitive data
- Verify input validation
- Check for insecure configurations
### 2. **Reliability**
- Identify potential bugs or runtime errors
- Check error handling completeness
- Look for null pointer risks
- Verify exception handling
### 3. **Maintainability**
- Assess code clarity and organization
- Check for code duplication
- Evaluate naming conventions
- Review documentation quality
### 4. **Performance**
- Identify potential performance bottlenecks
- Check for inefficient algorithms
- Look for resource leaks
- Verify proper cleanup
### 5. **Best Practices**
- Language-specific idioms and patterns
- Framework best practices
- Design patterns usage
- Code organization
## Output Format
Respond with a valid JSON following the structured JSON format:
```json
{
"QUALITY_GATE": "PASSED|FAILED",
"approved": true|false,
"metrics": {
"reliability": "A|B|C|D|E",
"security": "A|B|C|D|E",
"maintainability": "A|B|C|D|E",
"coverage": 0-100,
"duplications": 0-100,
"complexity": "number"
},
"issues": {
"blocker": 0,
"critical": 0,
"major": 0,
"minor": 0,
"info": 0
},
"details": [
{
"severity": "BLOCKER|CRITICAL|MAJOR|MINOR|INFO",
"type": "BUG|VULNERABILITY|CODE_SMELL",
"file": "path/to/file",
"line": 123,
"message": "Clear description of the issue"
}
],
"securityHotspots": 0,
"blockingIssues": ["List of critical issues that must be fixed"]
}
```
## Severity Guidelines
- **BLOCKER**: Critical security vulnerabilities, data loss risks, critical bugs
- **CRITICAL**: Major security issues, significant bugs, critical performance problems
- **MAJOR**: Important issues that should be fixed soon
- **MINOR**: Minor issues, suggestions for improvement
- **INFO**: Informational notes, optional improvements
## Quality Gate Rules
- **FAILED**: If blocker >= 1 OR critical > 1 OR security hotspots > 0
- **PASSED**: Otherwise
## Analysis Rules
- Be strict but fair - focus on real problems, not style preferences
- Provide actionable, specific feedback with line numbers
- Consider the context and purpose of the code
- Prioritize security and reliability over style
- Be constructive in your feedback