prmpt.onl

Un sito per i prompt AI

Code Review Automation: Quality Sistemica

Fonte: Capitolo 6 - Settore Developer & Tech
Categoria: Domini Specialistici
Livello: Avanzato
URL: prmpt.onl/202

Quando usarlo

Per code review sistematici che garantiscono quality standards, security compliance e knowledge transfer. Trasforma review process da bottleneck a learning e quality amplification opportunity.

Ideale per:

💡 PERCHÉ QUESTO TEMPLATE È IN INGLESE I code review seguono convenzioni internazionali standardizzate. Error messages, coding standards e best practices sono documentati in inglese. Mantenere la lingua tecnica originale facilita la collaborazione con team globali e l’accesso a risorse di documentazione.

Template

SENIOR CODE REVIEWER

Code context: [language, framework, project type]
Review scope: [new feature/bug fix/refactoring/performance]
Team context: [junior/mixed/senior developers]
Standards: [company coding standards, security requirements]

REVIEW FRAMEWORK:

## 1. FUNCTIONALITY ASSESSMENT
- Does the code solve the intended problem correctly?
- Are all requirements and acceptance criteria met?
- Are edge cases and error scenarios handled appropriately?
- Is the business logic clear and correctly implemented?

## 2. CODE QUALITY EVALUATION
- Readability: Clear variable names, logical structure, appropriate comments
- Maintainability: DRY principle, SOLID principles, modular design
- Performance: Algorithm efficiency, memory usage, database queries
- Security: Input validation, authentication, authorization, data protection

## 3. TECHNICAL STANDARDS COMPLIANCE
- Coding style and conventions consistency
- Architecture pattern adherence (MVC, microservices, etc.)
- Testing coverage and quality (unit, integration, e2e)
- Documentation completeness (README, API docs, inline comments)

## 4. CONSTRUCTIVE FEEDBACK DELIVERY
- Highlight positive aspects and good practices
- Provide specific, actionable improvement suggestions
- Include code examples for recommended changes
- Prioritize feedback: critical/important/nice-to-have
- Offer learning resources for skill development

## 5. COLLABORATION & MENTORING
- Ask clarifying questions about design decisions
- Suggest alternative approaches with trade-off analysis
- Share relevant experience and best practices
- Encourage discussion and knowledge sharing

REVIEW OUTPUT:
- Approval status: Approve/Request Changes/Reject
- Categorized feedback with priority levels
- Suggested improvements with code examples
- Learning opportunities and resources
- Follow-up discussion points

Focus on being thorough but constructive, educational but efficient.

Varianti

Per Security-Critical Code

Aggiungi: “Include OWASP Top 10 security check, vulnerability assessment, authentication/authorization validation, e data encryption verification.”

Per Performance-Critical Systems

Aggiungi: “Focus su algorithmic complexity analysis, memory profiling, database query optimization, e load testing considerations.”

Per Junior Developer Mentoring

Aggiungi: “Provide educational explanations for feedback, include learning resources, celebrate good practices, e offer pairing session opportunities.”

Esempio di risultato

Input: “Review React component for user authentication form with validation”

Output AI (estratto):

CODE REVIEW: User Authentication Component

## FUNCTIONALITY ASSESSMENT ✅ APPROVED

**POSITIVE ASPECTS:**
- Form validation logic correctly implemented
- Error states properly handled and displayed to user
- Loading states prevent double submission
- Success/failure flows work as expected

**REQUIREMENTS COVERAGE:** ✅ Complete
- Username/password fields with validation
- "Remember me" functionality implemented  
- Forgot password link integration
- Responsive design for mobile compatibility

## CODE QUALITY EVALUATION ⚠️ IMPROVEMENTS NEEDED

### HIGH PRIORITY ISSUES:

**1. Security Vulnerability - Password Handling**
```javascript
// CURRENT (ISSUE):
const handleSubmit = (values) => {
  console.log('Password:', values.password); // Logs password in plain text
  
// RECOMMENDED:
const handleSubmit = (values) => {
  // Never log sensitive data
  const { password, ...logSafeValues } = values;
  console.log('Login attempt:', logSafeValues);

2. Performance Issue - Unnecessary Re-renders

// CURRENT (ISSUE):
const AuthForm = () => {
  const [errors, setErrors] = useState({});
  
  // This creates new object every render
  const validationRules = {
    username: { required: true, minLength: 3 },
    password: { required: true, minLength: 8 }
  };

// RECOMMENDED:
const validationRules = {
  username: { required: true, minLength: 3 },
  password: { required: true, minLength: 8 }
}; // Move outside component or use useMemo

MEDIUM PRIORITY SUGGESTIONS:

3. Code Organization - Extract Custom Hook

// RECOMMENDED: Extract authentication logic
const useAuthForm = () => {
  const [isLoading, setIsLoading] = useState(false);
  const [errors, setErrors] = useState({});
  
  const handleLogin = async (credentials) => {
    // Authentication logic here
  };
  
  return { isLoading, errors, handleLogin };
};

TECHNICAL STANDARDS COMPLIANCE ✅ GOOD

STRENGTHS:

MINOR IMPROVEMENTS:

CONSTRUCTIVE FEEDBACK & LEARNING

EXCELLENT PRACTICES OBSERVED:

LEARNING OPPORTUNITIES:

  1. Security Best Practices: Never log sensitive data in production
    • Resource: OWASP JavaScript Security Guide
  2. React Performance: Understanding re-render triggers
    • Resource: React.dev Performance Guide
  3. Testing Strategy: Component testing with React Testing Library
    • Suggested: Unit tests for validation logic

DISCUSSION POINTS:

VERDICT: REQUEST CHANGES ⚠️

REQUIRED BEFORE MERGE:

  1. Fix password logging security issue (HIGH)
  2. Optimize validation rules performance (HIGH)

RECOMMENDED FOR NEXT ITERATION:

  1. Extract authentication hook for reusability
  2. Add comprehensive test coverage
  3. Implement error boundary pattern

ESTIMATED EFFORT: 2-3 hours for required changes

Great work on the overall structure and user experience! The security and performance fixes are important but straightforward. Happy to review again once updated. ```

Tips per risultati migliori

  1. Context specificity: Fornisci info su project type, team skill level, e business requirements per relevant feedback
  2. Code examples: Include sempre suggested improvements con actual code, non solo description
  3. Priority levels: Categorizza feedback per urgency/importance per efficient resolution
  4. Learning focus: Balance critic feedback con educational opportunities per team growth

Template correlati


📖 Da “Prompt Engineering: Il Nuovo Skill” di Marco Milani
🔗 Tutti i template: prmpt.onl/index
📱 Accesso rapido: [QR Code]

Ultimo aggiornamento: 24 Gennaio 2025