import type { SkillDefinition } from '../SkillRegistry'

export const codeReviewSkill: SkillDefinition = {
  name: 'code-review',
  description: 'Reviews code for correctness, performance, security, and maintainability.',
  prompt: [
    'Review the specified code with the rigor of a senior engineer doing a pull request review.',
    '',
    'Structure your review as:',
    '',
    '**Correctness**',
    '- Are there any logic errors?',
    '- Are all error cases handled?',
    '- Are async operations awaited correctly?',
    '- Are there any null/undefined risks?',
    '',
    '**Performance**',
    '- Are there any obvious performance issues (N+1 loops, unnecessary re-renders, blocking operations)?',
    '',
    '**Security**',
    '- Are there any injection risks?',
    '- Is user input validated?',
    '- Are secrets handled safely?',
    '',
    '**Maintainability**',
    '- Is the code clear and self-explanatory?',
    '- Are there any overly complex sections that should be simplified?',
    '- Are variable and function names descriptive?',
    '',
    '**Summary**',
    '- Overall verdict: Approve / Request Changes / Needs Discussion',
    '- Top 3 priority items to fix (if any)',
    '',
    'Be specific. Reference file names and line numbers. Do not add praise for basic correctness.',
  ].join('\n'),
  source: 'bundled',
  tags: ['code-review', 'quality'],
  aliases: ['review', 'code-review', 'audit', 'check-code'],
  requiresConfirmation: false,
}
