Skip to main content

PRD-STD-002: Code Review Standards

Standard ID: PRD-STD-002 Version: 1.0 Status: Active Compliance Level: Level 1 (Foundation) Effective Date: 2025-01-15 Last Reviewed: 2026-01-15

1. Purpose

This standard defines the mandatory code review process for AI-generated code. Code review is the single most critical control against the quality and security risks associated with AI-assisted development. With AI co-authored code exhibiting 1.7x more issues and 2.74x higher vulnerability rates, human review is an essential safeguard that MUST NOT be bypassed or abbreviated.

AI coding assistants generate code that is often syntactically correct and superficially plausible but may contain subtle logic errors, security vulnerabilities, performance anti-patterns, or architectural misalignments that require trained human judgment to detect. This standard ensures that every line of AI-generated code receives adequate scrutiny before reaching production.

2. Scope

This standard applies to:

  • All code that is generated, modified, refactored, or substantially influenced by AI coding assistants
  • All pull requests, merge requests, and code submissions that contain AI-assisted code
  • All engineers acting as reviewers for AI-assisted code
  • All repositories and projects where AI tools are authorized for use

This standard applies regardless of the AI tool used, the programming language, or the perceived simplicity of the change.

3. Definitions

TermDefinition
AI-Generated CodeCode that was produced, in whole or in part, by an AI coding assistant, including completions, generations, and refactorings
Qualified ReviewerAn engineer who meets the reviewer qualification requirements defined in Section 4.1
AI-Specific ReviewReview activities that specifically target known AI code generation failure modes
Approval ThresholdThe number and seniority of reviewer approvals required before code can be merged
EscalationThe process of raising a review to a higher-authority reviewer when specific criteria are triggered

4. Requirements

4.1 Reviewer Qualifications

MANDATORY

REQ-002-01: Reviewers of AI-generated code MUST have at least 12 months of professional experience in the relevant programming language and framework.

REQ-002-02: Reviewers MUST have completed AEEF AI code review training, or equivalent training approved by the organization, covering common AI code generation failure modes.

REQ-002-03: The code author MUST NOT be the sole reviewer of their own AI-assisted code.

RECOMMENDED

REQ-002-04: Organizations SHOULD maintain a roster of qualified reviewers per technology stack and domain area.

REQ-002-05: Reviewers SHOULD rotate periodically to prevent review fatigue and distribute knowledge.

4.2 Review Process

MANDATORY

REQ-002-06: All AI-generated code MUST undergo human code review before merging into any shared branch (main, develop, release).

REQ-002-07: Pull requests containing AI-generated code MUST be explicitly tagged or labeled to indicate AI involvement (e.g., ai-assisted label).

REQ-002-08: Reviewers MUST use the AI-Specific Review Checklist (Section 5) for all AI-assisted pull requests.

REQ-002-09: Review comments MUST be documented in the version control system and preserved as part of the project record.

RECOMMENDED

REQ-002-10: AI-assisted pull requests SHOULD be limited to 400 lines of changed code to ensure thorough review. Larger changes SHOULD be split into smaller, reviewable units.

REQ-002-11: Reviewers SHOULD spend a minimum of 5 minutes per 100 lines of AI-generated code. Speed reviews are ineffective against subtle AI-introduced defects.

4.3 Approval Thresholds

MANDATORY

REQ-002-12: AI-assisted code changes MUST receive approval from at least one qualified reviewer before merging.

REQ-002-13: Changes to security-sensitive code (authentication, authorization, cryptography, PII handling) that involve AI generation MUST receive approval from at least two qualified reviewers, one of whom MUST have security domain expertise.

REQ-002-14: Changes to critical infrastructure code (database schemas, deployment configurations, CI/CD pipelines) that involve AI generation MUST receive approval from at least two qualified reviewers.

4.4 Escalation Criteria

MANDATORY

REQ-002-15: A review MUST be escalated to a senior engineer or architect when any of the following conditions are detected:

  • AI-generated code modifies authentication, authorization, or cryptographic functions
  • AI-generated code introduces a new external dependency
  • AI-generated code modifies data persistence logic or database schemas
  • AI-generated code contains patterns that the reviewer does not fully understand
  • AI-generated code modifies regulatory or compliance-sensitive functionality
  • The reviewer identifies potential security vulnerabilities

REQ-002-16: Escalated reviews MUST be resolved before the code is merged. Escalation MUST NOT be bypassed by any team member, including managers and leads.

5. Implementation Guidance

AI-Specific Review Checklist

The following checklist MUST be used for all AI-assisted code reviews. Each item MUST be explicitly verified by the reviewer.

#CategoryReview ItemPriority
1CorrectnessLogic matches the intended specification, not just the promptCritical
2CorrectnessEdge cases are handled (null, empty, boundary values, overflow)Critical
3CorrectnessError handling is complete and follows project conventionsCritical
4CorrectnessNo hallucinated APIs, methods, or library functions (verify they exist)Critical
5SecurityNo hardcoded credentials, secrets, or API keysCritical
6SecurityInput validation is present and sufficient for all external inputsCritical
7SecurityNo SQL injection, XSS, path traversal, or command injection vectorsCritical
8SecurityAuthentication and authorization checks are correct and completeCritical
9SecurityCryptographic functions use approved algorithms and librariesCritical
10PerformanceNo unnecessary allocations, copies, or O(n^2+) operations on large datasetsHigh
11PerformanceDatabase queries are efficient (no N+1 queries, proper indexing assumed)High
12ArchitectureCode follows project architecture patterns and conventionsHigh
13ArchitectureNo unnecessary coupling or dependency introductionHigh
14ArchitectureCode is placed in the correct module/package/directoryMedium
15MaintainabilityCode is readable and understandable without AI contextHigh
16MaintainabilityNo duplicated logic that should be extracted to shared functionsMedium
17MaintainabilityNaming conventions are consistent with the projectMedium
18TestingAdequate test coverage for AI-generated code pathsHigh
19TestingTests validate behavior, not just implementation detailsMedium
20DependenciesNo new dependencies introduced without justificationMedium
21DependenciesImported libraries are compatible with project licenseMedium

Common AI Code Generation Failure Modes

Reviewers should be especially vigilant for these known failure modes:

  1. Hallucinated APIs -- AI generates calls to functions or methods that do not exist in the specified library version
  2. Outdated patterns -- AI uses deprecated APIs or insecure patterns from older training data
  3. Subtle logic errors -- Code that appears correct but fails on edge cases the AI was not explicitly told about
  4. Cargo-cult patterns -- AI reproduces patterns from training data that are inappropriate for the current context
  5. Missing error handling -- AI often generates the "happy path" and omits comprehensive error handling
  6. Over-engineering -- AI may generate unnecessarily complex solutions for simple problems
  7. License-contaminated code -- AI may reproduce code from open-source projects with incompatible licenses

Review Documentation Template

## AI Code Review Summary
- **PR:** #[number]
- **Reviewer:** [name]
- **AI Tool Used:** [tool name]
- **Checklist Completed:** Yes/No
- **Escalation Required:** Yes/No
- **Items Found:** [count]
- **Verdict:** Approved / Changes Requested / Escalated

6. Exceptions & Waiver Process

There are NO exceptions to the requirement for human code review of AI-generated production code (REQ-002-06). This is an absolute requirement.

Limited exceptions MAY be granted for:

  • Approval threshold requirements (REQ-002-12 through REQ-002-14) in emergency hotfix scenarios, provided a post-merge review is completed within 24 hours
  • Labeling requirements (REQ-002-07) during a 90-day transition period for newly adopted AI tools

Emergency exceptions MUST be documented and reported to the engineering standards committee within 48 hours.

8. Revision History

VersionDateAuthorChanges
1.02025-01-15AEEF Standards CommitteeInitial release
1.0.12026-01-15AEEF Standards CommitteeExpanded review checklist from 15 to 21 items; added failure modes section