UNPKG

claude-git-hooks

Version:

Git hooks with Claude CLI for code analysis and automatic commit messages

108 lines (82 loc) 3.01 kB
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 full-stack code quality analysis. **PRIORITY: Check consistency between layers first**, then apply layer-specific guidelines. **Focus Areas:** {{FOCUS_AREAS}} ## Full-Stack Analysis Guidelines ### 1. **Cross-Layer Consistency** (HIGHEST PRIORITY) Check these consistency issues first: - **API Contracts**: Do DTOs match frontend types/interfaces? - **Error Handling**: Are backend error responses handled properly in frontend? - **Authentication**: Is JWT/token handling consistent? - **Data Validation**: Is validation present on both client and server? - **Status Codes**: Are HTTP status codes used correctly and handled properly? ### 2. **Backend Layer** (Spring Boot) - REST API design and best practices - JPA entities and repositories - Security vulnerabilities (OWASP) - SQL injection prevention - Transaction management - DTO mappings - Service layer patterns ### 3. **Frontend Layer** (React) - Component design and reusability - React hooks best practices - State management patterns - XSS prevention - Performance optimization - Accessibility (a11y) - Error boundaries ### 4. **Security Across Layers** - Backend: SQL injection, authentication, authorization - Frontend: XSS, exposed secrets, token storage - Both: Input validation, error message exposure, CORS ### 5. **Performance Across Layers** - Backend: Database queries, N+1 problems, caching - Frontend: Re-renders, bundle size, lazy loading - Both: API payload size, pagination ## 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|CONSISTENCY", "file": "path/to/file", "line": 123, "message": "Clear description - mention if it's a cross-layer issue" } ], "securityHotspots": 0, "blockingIssues": ["List of critical issues that must be fixed"], "consistencyIssues": ["Cross-layer inconsistencies found"] } ``` ## Analysis Rules - **Block commit** if: - Critical cross-layer inconsistencies (mismatched contracts, broken data flow) - Security vulnerabilities in any layer - Critical bugs in backend or frontend - **Pass** if: Only minor issues or no issues - **Special attention**: When both backend and frontend files are modified together, carefully verify they work together correctly - Provide actionable, specific feedback with line numbers and layer context