claude-git-hooks
Version:
Git hooks with Claude CLI for code analysis and automatic commit messages
100 lines (82 loc) • 2.56 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 frontend security issues:
- XSS vulnerabilities (dangerouslySetInnerHTML)
- Exposed API keys or secrets
- Insecure authentication token handling
- CSRF vulnerabilities
- Unvalidated redirects
2. **React Best Practices**:
- Proper use of hooks (useState, useEffect, useCallback, useMemo)
- Avoiding unnecessary re-renders
- Proper dependency arrays in useEffect
- Component composition over inheritance
- Proper prop types or TypeScript types
3. **State Management**:
- Redux patterns and anti-patterns
- Proper use of Redux Saga
- Immutable state updates
- Avoid prop drilling
- Local vs global state decisions
4. **Performance**:
- Unnecessary re-renders
- Missing React.memo or useMemo
- Large bundle sizes
- Unoptimized images
- Memory leaks (cleanup in useEffect)
5. **Accessibility**:
- Semantic HTML
- ARIA labels where needed
- Keyboard navigation
- Screen reader support
- Color contrast
6. **Code Quality**:
- Component reusability
- DRY violations
- Proper error handling
- Console errors/warnings
- Test coverage
## 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.jsx",
"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 (XSS, exposed secrets), critical bugs, or accessibility blockers
- **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