claude-git-hooks
Version:
Git hooks with Claude CLI for code analysis and automatic commit messages
81 lines (65 loc) • 2.2 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
1. **Security First**: Check for OWASP Top 10 vulnerabilities, especially:
- SQL injection risks
- Authentication/authorization flaws
- Sensitive data exposure
- XML external entities (XXE)
- Insecure deserialization
2. **Spring Boot Best Practices**:
- Proper use of `@Transactional`
- Correct exception handling
- Appropriate use of DTOs vs Entities
- Proper dependency injection // Si intelligence -> recomendar @RequiredArgsConstructor || Si Automation -> recomendar @Autowired
- Configuration management
3. **JPA/Hibernate**:
- N+1 query problems
- Lazy loading issues
- Proper use of relationships
- Query optimization
- Transaction boundaries
4. **Code Quality**:
- SOLID principles
- DRY violations
- Proper error handling
- Logging should be like so
- debug: regular flow, operations details
- info: important business events
- warn: anomalies and manageable errors
- error: exceptions and errors
## Output Format
Respond with a valid JSON following the structured JSON format:
```json
{
"QUALITY_GATE": "PASSED|FAILED",
"approved": true|false,
"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.java",
"line": 123,
"message": "Clear description of the issue"
}
],
"securityHotspots": 0,
"blockingIssues": ["List of critical issues that must be fixed"]
}
```
## Analysis Rules
- **Block commit** if: Security vulnerabilities, critical bugs, or blocker issues found
- **Pass** if: Only minor issues, info messages, or no issues
- Be strict but fair - focus on real problems, not style preferences
- Provide actionable, specific feedback with line numbers