AgentSkillsCN

code-reviewing

在完成实现、升级到人工审查之前,或达到人工检查点时使用——执行AI辅助代码审查,涵盖安全、AI特定问题、逻辑错误和架构,确保人类看到全新的分析

SKILL.md
--- frontmatter
name: code-reviewing
description: Use when completing implementation, before escalating to human review, or when human checkpoint is reached - performs AI-assisted code review covering security, AI-specific issues, logic errors, and architecture to ensure humans see fresh analysis

Code Reviewing

Perform AI-assisted code review immediately before escalating to human review. Ensures humans always see fresh, relevant code analysis when making decisions.

When to Use

  • After completing implementation work (executing stage)
  • Before any human checkpoint/escalation
  • When /AI-review is invoked
  • Before creating PRs or requesting human review

Quick Reference

StageFocus Areas
conceptClarity, scope, testable criteria
planningDesign quality, pattern adherence
executingSecurity, logic, architecture, tests
testingIntegration, coverage, regressions
releasingAll findings addressed, docs complete

Review Process

Phase 1: Gather Context

  1. Identify changed files - git diff or compare to last review
  2. Load task context - Read task description, acceptance criteria
  3. Check stage - Adjust review focus based on current stage

Phase 2: Run Automated Checks

bash
# Python projects
python -m flake8 src/ || echo "No flake8"
python -m mypy src/ || echo "No mypy"

# JavaScript/TypeScript projects
npm run lint || echo "No linter"
npm run typecheck || echo "No type checker"

Phase 3: AI Analysis

See references/review-checklist.md for complete checklist.

Key areas:

CategoryCritical Checks
SecurityInput validation, no hardcoded secrets, parameterized queries
AI-specificNo hallucinated APIs, follows project patterns, appropriate abstraction
LogicEdge cases (null, empty, boundary), error handling, no infinite loops
ArchitectureFollows conventions, correct dependency flow, no circular deps

Phase 4: Generate Report

markdown
## AI Code Review Report

**Task:** [ID] - [Title]
**Stage:** [current_stage]
**Files reviewed:** [count]
**Review date:** [timestamp]

### Summary
[1-2 sentence overall assessment]

### Findings

#### Critical (must fix)
- [ ] [Finding with file:line reference]

#### Warnings (should fix)
- [ ] [Finding with file:line reference]

#### Suggestions (consider)
- [ ] [Finding with file:line reference]

### Automated Check Results
- Linting: [pass/fail/skipped]
- Type check: [pass/fail/skipped]

### Recommended Actions
1. [Specific action item]

Phase 5: Save Review

  1. Update task notes - Append review summary
  2. Create artifact - Save to .claude/data/reviews/{task_id}_{timestamp}.md

Stage-Specific Focus

Concept Stage

  • Concept clearly defined?
  • Scope bounded and reasonable?
  • Acceptance criteria verifiable?

Planning Stage

  • Design follows established patterns?
  • Avoids known anti-patterns?
  • Plan is implementable?

Executing Stage (Full Review)

  • All security checks
  • All AI-specific checks
  • All logic checks
  • All architecture checks
  • Tests adequate for changes?
  • Code matches the plan?

Testing Stage

  • Integration interfaces properly defined?
  • Test coverage adequate?
  • Regression test coverage exists?

Releasing Stage

  • All previous findings addressed?
  • Documentation complete?
  • Release checklist items documented?

Common AI Code Mistakes

See references/common-ai-mistakes.md for complete patterns.

IssueDetection
Hallucinated APIsVerify imports/methods exist
Outdated patternsCheck for deprecation warnings
Missing edge casesTest null, empty, boundaries
Security blind spotsCheck input validation, query building
Over-abstractionIs complexity justified?
Silent failuresLook for bare except: pass

Reference Files

FilePurpose
references/best-practices-research.mdIndustry research on AI code review
references/tool-capabilities.mdWhat CodeRabbit, Copilot, Semgrep, SonarQube check
references/review-checklist.mdComplete checklist by category
references/common-ai-mistakes.mdPatterns specific to AI-generated code

Invocation

code
/AI-review --task-id=[ID] --stage=[current_stage]

Or simply /AI-review when context is clear from current work.