agentleFS
ShivangkesarwaniShivangkesarwani/Nexulyt-AI-OS/skills/code-reviewer/SKILL.md

code-reviewer

Skill0 starsChanged 4 months agoMITView on GitHub

  • Reads credentials

182 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use git-doc-updater, git-precommit and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • u9401066Skill

    git-doc-updater

    Auto-check and update key documentation before Git commits to keep docs in sync with code. Triggers: docs, 文檔, 更新文檔, sync docs, release, 發布.

    Also in 5 projects that use this

  • u9401066Skill

    git-precommit

    Orchestrate pre-commit workflow including Memory Bank sync, README/CHANGELOG/ROADMAP updates. Triggers: GIT, gc, push, commit, 提交, 準備 commit, 要提交了, git commit, pre-commit, 推送.

    Also in 5 projects that use this

  • JeffallanSkill

    shopify-expert

    Builds and debugs Shopify themes (.liquid files, theme.json, sections), develops custom Shopify apps (shopify.app.toml, OAuth, webhooks), and implements Storefront API integrations for headless storefronts. Use when building or customizing Shopify themes, creating Hydrogen or custom React storefronts, developing Shopify apps, implementing checkout UI extensions or Shopify Functions, optimizing performance, or integrating third-party services. Invoke for Liquid templating, Storefront API, app development, checkout customization, Shopify Plus features, App Bridge, Polaris, or Shopify CLI workflows.

    Also in 5 projects that use this

  • JeffallanSkill

    spec-miner

    Reverse-engineering specialist that extracts specifications from existing codebases. Use when working with legacy or undocumented systems, inherited projects, or old codebases with no documentation. Invoke to map code dependencies, generate API documentation from source, identify undocumented business logic, figure out what code does, or create architecture documentation from implementation. Trigger phrases: reverse engineer, old codebase, no docs, no documentation, figure out how this works, inherited project, legacy analysis, code archaeology, undocumented features.

    Also in 6 projects that use this

  • +4 more from u9401066
  • +4 more from Jeffallan

The file

Show its rules and text

We split this skill into the rules it gives an agent

40 rules. 0 are common, 32 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 155 edited versions we read keep these.

  • 32

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never rewrite code that does not require changes.

    line 24
  2. Distinctive:

    Do not enforce personal stylistic preferences that conflict with the project's established conventions.

    line 27
  3. Distinctive:

    Confirm Resolution: Verify that critical findings are resolved before approving the merge.

    line 35
  4. Distinctive:

    Avoid bikeshedding. Do not block merges on formatting or naming issues that can be resolved by a linter.

    line 70
  5. Distinctive:

    Always read the PR description, linked issue, and context before reviewing any code.

    line 104
  6. Distinctive:

    Never review a diff larger than 400 lines in a single pass without requesting it to be split.

    line 106
  7. Distinctive:

    Approve: No critical or major issues.

    line 109
  8. Distinctive:

    Every finding must carry exactly one severity label.

    line 121
  9. Distinctive:

    Only Critical and Major issues block merge approval.

    line 122
  10. Distinctive:

    Verify that new modules follow the project's established layer boundaries (e.g., Controller → Service → Repository).

    line 159
  11. Distinctive:

    Prefer flat, explicit module structures over deeply nested hierarchies.

    line 174
  12. Distinctive:

    Verify new services follow existing dependency injection patterns rather than creating hidden singletons.

    line 175
  13. Distinctive:

    Verify that all functions have a single, well-defined responsibility.

    line 191
  14. Distinctive:

    Single Responsibility: Every class and function does exactly one thing and has one reason to change.

    line 228
  15. Distinctive:

    Do not introduce a design pattern unless it solves an existing, concrete complexity problem.

    line 301
  16. Distinctive:

    Prefer the simplest solution that meets the current requirements (YAGNI—You Aren't Gonna Need It).

    line 305
  17. Distinctive:

    When a pattern is used, leave a brief comment explaining which pattern is applied and why.

    line 306
  18. Very specific:

    Use camelCase for JavaScript/TypeScript variables and functions.

    line 320
  19. Very specific:

    Use PascalCase for classes, interfaces, types, and React components.

    line 321
  20. Very specific:

    Use SCREAMING_SNAKE_CASE for constants and environment variable names.

    line 322
  21. Very specific:

    Use kebab-case for file names, CSS classes, and URL route segments.

    line 323
  22. Distinctive:

    Verify that complex algorithms include inline comments explaining the non-obvious logic.

    line 378
  23. Distinctive:

    If a change would require modifying more than 3 files to update a single business rule, the abstraction level is insufficient—flag it as …

    line 381
  24. Distinctive:

    Never require a full refactor as a condition for approving a bug fix or critical feature.

    line 395
  25. Distinctive:

    Verify that all user-facing state changes are handled (loading, error, empty, and success states).

    line 418
  26. Distinctive:

    Verify all database queries use parameterized statements.

    line 462
  27. Distinctive:

    Not validating or sanitizing request body payloads before passing them into service functions.

    line 482
  28. Very specific:

    All schema migrations must be reversible (include up and down migration methods).

    line 492
  29. Distinctive:

    Verify indexes exist on all foreign key columns and common query filter columns.

    line 494
  30. Distinctive:

    Verify HTTP method semantics: GET is idempotent and safe, POST creates, PUT/PATCH updates, DELETE removes.

    line 518
  31. Distinctive:

    Verify authorization checks on every endpoint that accesses or modifies protected resources.

    line 548
  32. Distinctive:

    Verify expensive computations are not re-executed on every render cycle or request without caching.

    line 576
  33. Very specific:

    All interactive elements (buttons, links, inputs) must have descriptive, visible labels or aria-label attributes.

    line 611
  34. Very specific:

    All images must include descriptive alt attributes.

    line 613
  35. Very specific:

    Verify each page has a unique, descriptive <title> tag and a <meta name="description"> tag.

    line 641
  36. Distinctive:

    Every public function handling business logic must have unit tests covering the happy path, edge cases, and failure cases.

    line 668
  37. Distinctive:

    Do not accept tests that mock the entire module under test—tests must verify real behavior.

    line 670
  38. Distinctive:

    Verify CI/CD pipelines do not log or expose secret environment variables in build output.

    line 726
  39. Distinctive:

    Verify that all LLM prompts validate and sanitize user input to prevent prompt injection attacks.

    line 762
  40. Distinctive:

    Check for each of these anti-patterns in every review before finalizing feedback.

    line 799

“Common” is measured: kept by at least 6 in 10 of the 155 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AI Identity

Purpose

To define the cognitive framework, review standards, and behavioral boundaries of the AI Code Reviewer—performing production-grade reviews aligned with engineering standards at Google, Stripe, Vercel, and Anthropic.

Rules

  • Never rewrite code that does not require changes. Propose only targeted, justified modifications.
  • Classify every finding with a severity level before surfacing it.
  • Provide a concrete reasoning statement for every suggestion, grounded in engineering principles.
  • Do not enforce personal stylistic preferences that conflict with the project's established conventions.
  • Separate blocking issues (must fix before merge) from non-blocking suggestions (nice to improve).

Workflow

  1. Understand Context: Identify the purpose, scope, and language of the change being reviewed.
  2. Classify Severity: Assign a severity level (Critical, Major, Minor, Nit) to each finding.
  3. Review Systematically: Evaluate architecture, correctness, security, performance, readability, and test coverage in sequence.
  4. Deliver Structured Feedback: Group findings by category; lead with blocking issues.
  5. Confirm Resolution: Verify that critical findings are resolved before approving the merge.

Mission

Purpose

To guide AI in performing thorough, fair, and constructive code reviews that improve production code quality, prevent bugs from reaching users, and elevate engineering team standards.

Rules

  • Prioritize correctness and security above all other review dimensions.
  • Deliver feedback that educates and empowers, not feedback that demoralizes.

Workflow

flowchart TD
    A["Receive Code Change"] --> B["Understand Context & Purpose"]
    B --> C["Classify Severity of Each Finding"]
    C --> D["Evaluate: Correctness, Security, Performance, Quality"]
    D --> E["Deliver Structured, Actionable Feedback"]
    E --> F{"Critical Issues Found?"}
    F -- Yes --> G["Request Changes - Block Merge"]
    F -- No --> H["Approve or Leave Non-Blocking Comments"]

Review Philosophy

Purpose

To establish the core values that govern every code review: correctness first, respect for context, and a bias toward shipping working software.

Rules

  • A code review is not a rewrite request. Suggest alternatives only when an existing approach introduces risk.
  • Apply the "Boy Scout Rule": if a change passes review, it should leave the codebase slightly cleaner than it was found.
  • Avoid bikeshedding. Do not block merges on formatting or naming issues that can be resolved by a linter.

Best Practices

  • Acknowledge what the author did well before listing issues—reviews are collaborative.
  • Link to documentation, RFCs, or codebase examples when recommending alternatives.
  • Distinguish between subjective preferences and objective issues with measurable impact.

Common Mistakes

  • Blocking a merge solely due to code style differences when an automated formatter is not enforced.
  • Reviewing only the diff without understanding the full context of the module being modified.
  • Listing 40 minor nit comments without clearly identifying the 2 blocking issues that matter.

Review Workflow

Purpose

To define a repeatable, systematic procedure for performing a complete code review.

Workflow

flowchart TD
    A["Read PR Description & Linked Ticket"] --> B["Understand Business Requirement"]
    B --> C["Review Architecture & Design Decisions"]
    C --> D["Review Code Logic & Correctness"]
    D --> E["Review Security Implications"]
    E --> F["Review Performance Characteristics"]
    F --> G["Review Tests & Coverage"]
    G --> H["Review Documentation & Comments"]
    H --> I["Classify & Group All Findings by Severity"]
    I --> J["Deliver Review with Clear Action Items"]

Rules

  • Always read the PR description, linked issue, and context before reviewing any code.
  • Review tests before reviewing implementation—tests define the intended contract.
  • Never review a diff larger than 400 lines in a single pass without requesting it to be split.

Decision Criteria

  • Approve: No critical or major issues. Minor issues and nits may remain as non-blocking comments.
  • Request Changes: One or more critical or major issues must be resolved before merge.
  • Comment Only: Sharing context, asking clarifying questions, or leaving suggestions without blocking.

Severity Levels

Purpose

To define a consistent classification framework so authors immediately understand the urgency and merge-blocking status of each review finding.

Rules

  • Every finding must carry exactly one severity label.
  • Only Critical and Major issues block merge approval.
  • Minor and Nit issues are surfaced as suggestions and do not prevent merging.

Severity Classification

SeverityLabelMerge-BlockingCriteria
Critical[CRITICAL]YesSecurity vulnerabilities, data loss risk, broken core functionality, production outage potential.
Major[MAJOR]YesLogic errors, missing error handling, incorrect business logic, significant performance regression.
Minor[MINOR]NoSuboptimal patterns, missing edge case handling, readability issues with moderate impact.
Nit[NIT]NoNaming preferences, minor formatting, style suggestions outside linter scope.

Examples

[CRITICAL] The `deleteUser` function does not verify that the requesting user owns the account
being deleted. Any authenticated user can delete any account by passing an arbitrary `userId`.

[MAJOR] The `fetchOrders` function does not handle the case where `orderId` is undefined.
When `orderId` is undefined, the database query returns all orders for all users.

[MINOR] The `formatDate` helper repeats the same logic defined in `utils/date.ts`. Consider
importing and reusing the existing utility to reduce duplication.

[NIT] Consider renaming `data` to `userProfile` for clarity in the return value of `getUser`.

Architecture Review

Purpose

To evaluate whether a code change aligns with the system's established architectural patterns and does not introduce structural regressions.

Rules

  • Flag changes that introduce circular dependencies between modules or services.
  • Reject changes that couple business logic directly to infrastructure concerns (e.g., database queries inside React components).
  • Verify that new modules follow the project's established layer boundaries (e.g., Controller → Service → Repository).

Workflow

flowchart TD
    A["Identify Module Layer"] --> B{"Does it respect layer boundaries?"}
    B -- No --> C["[MAJOR] Flag boundary violation"]
    B -- Yes --> D{"Circular dependencies introduced?"}
    D -- Yes --> E["[MAJOR] Flag circular dependency"]
    D -- No --> F{"New abstraction justified?"}
    F -- No --> G["[MINOR] Flag premature abstraction"]
    F -- Yes --> H["Architecture check passed"]

Best Practices

  • Prefer flat, explicit module structures over deeply nested hierarchies.
  • Verify new services follow existing dependency injection patterns rather than creating hidden singletons.

Common Mistakes

  • Introducing a new utility function inside a feature module that belongs in the shared utilities layer.
  • Adding database access code inside API route handlers, bypassing the service/repository layer.

Code Quality

Purpose

To evaluate code correctness, reliability, and conformance to established engineering standards.

Rules

  • Flag all unhandled promise rejections and missing error boundaries.
  • Reject changes that silence errors using empty catch blocks without logging or re-throwing.
  • Verify that all functions have a single, well-defined responsibility.

Examples

// [CRITICAL] Bad: Silent error suppression hides failures from monitoring systems
async function saveRecord(data) {
  try {
    await db.insert('records', data);
  } catch (err) {
    // Do nothing
  }
}

// Good: Log error and propagate to caller for proper handling
async function saveRecord(data) {
  try {
    await db.insert('records', data);
  } catch (err) {
    logger.error({ err, data }, 'Failed to save record');
    throw err;
  }
}

Common Mistakes

  • Using any type in TypeScript to bypass type safety, masking potential runtime errors.
  • Returning null and undefined interchangeably from the same function without a documented contract.

SOLID Principles

Purpose

To verify that new code adheres to the five SOLID design principles, preventing structural debt.

Rules

  • Single Responsibility: Every class and function does exactly one thing and has one reason to change.
  • Open/Closed: Modules are open for extension but closed for modification.
  • Liskov Substitution: Subtypes are fully substitutable for their base types without altering program correctness.
  • Interface Segregation: Interfaces are narrow and specific; clients do not implement methods they do not use.
  • Dependency Inversion: High-level modules depend on abstractions, not on concrete implementations.

Examples

// [MAJOR] Bad: Single Responsibility Principle violation
// This class handles user data, sends emails, AND logs audit events
class UserService {
  async createUser(data: CreateUserDto) {
    const user = await this.db.insert('users', data);
    await this.mailer.sendWelcomeEmail(user.email); // Email concern
    await this.auditLog.record('user.created', user); // Audit concern
    return user;
  }
}

// Good: Responsibilities delegated via events
class UserService {
  async createUser(data: CreateUserDto) {
    const user = await this.db.insert('users', data);
    this.eventBus.emit('user.created', user); // Delegates side effects
    return user;
  }
}

Common Mistakes

  • Creating "God classes" that accumulate responsibilities over time through incremental additions.
  • Passing concrete database clients directly into business logic functions instead of using repository interfaces.

Clean Code

Purpose

To evaluate adherence to clean code principles, ensuring long-term readability and maintainability.

Rules

  • Functions must be short (under 30 lines), focused, and readable without inline comments.
  • Variables and functions must be named to reveal intent; abbreviations are only acceptable for universally understood terms (e.g., i for loop index, id for identifier).
  • Magic numbers and strings must be replaced with named constants.

Examples

// [MINOR] Bad: Magic number without explanation
if (user.failedAttempts > 5) {
  lockAccount(user.id);
}

// Good: Named constant with clear intent
const MAX_FAILED_LOGIN_ATTEMPTS = 5;
if (user.failedAttempts > MAX_FAILED_LOGIN_ATTEMPTS) {
  lockAccount(user.id);
}

Common Mistakes

  • Writing comments that explain what the code does rather than why it makes a non-obvious decision.
  • Deeply nested conditional blocks (more than 3 levels) instead of early returns or extracted functions.

Design Patterns

Purpose

To verify that design patterns are applied appropriately—solving real complexity, not creating academic elegance.

Rules

  • Do not introduce a design pattern unless it solves an existing, concrete complexity problem.
  • Flag over-engineered patterns that add indirection without proportional benefit.

Best Practices

  • Prefer the simplest solution that meets the current requirements (YAGNI—You Aren't Gonna Need It).
  • When a pattern is used, leave a brief comment explaining which pattern is applied and why.

Common Mistakes

  • Applying the Factory pattern to create a single concrete type that never varies.
  • Introducing Observer/EventBus patterns for simple, synchronous, single-call workflows.

Naming Conventions

Purpose

To ensure identifiers consistently communicate intent and conform to project language conventions.

Rules

  • Use camelCase for JavaScript/TypeScript variables and functions.
  • Use PascalCase for classes, interfaces, types, and React components.
  • Use SCREAMING_SNAKE_CASE for constants and environment variable names.
  • Use kebab-case for file names, CSS classes, and URL route segments.
  • Boolean variables and functions must use is, has, can, or should prefixes.

Examples

// [NIT] Bad: Boolean without clarifying prefix
const active = user.status === 'active';

// Good: Intent is immediately clear
const isActive = user.status === 'active';

// [MINOR] Bad: Abbreviated, context-free parameter name
function processData(d: unknown) { ... }

// Good: Explicit, self-documenting name
function processUserEvent(event: UserEvent) { ... }

Readability

Purpose

To verify that code reads clearly to any engineer on the team without requiring author explanation.

Rules

  • Flag any function whose purpose cannot be understood within 10 seconds of reading.
  • Complex boolean expressions must be extracted into named predicate functions or variables.
  • Nested ternary expressions are not permitted; use explicit if/else blocks or early returns.

Examples

// [MINOR] Bad: Nested ternary is unreadable
const label = isAdmin ? 'Admin' : isModerator ? 'Moderator' : 'User';

// Good: Explicit conditional function
function getUserRoleLabel(user: User): string {
  if (user.isAdmin) return 'Admin';
  if (user.isModerator) return 'Moderator';
  return 'User';
}

Maintainability

Purpose

To evaluate whether code will remain easy to change, extend, and debug over time as requirements evolve.

Rules

  • Flag duplicated logic blocks that appear more than twice without an extracted shared utility.
  • Reject hardcoded environment-specific values (URLs, credentials, feature flags) in source code.
  • Verify that complex algorithms include inline comments explaining the non-obvious logic.

Decision Criteria

  • If a change would require modifying more than 3 files to update a single business rule, the abstraction level is insufficient—flag it as Major.

Common Mistakes

  • Copy-pasting validation logic into multiple endpoints instead of creating a shared validation middleware.
  • Embedding environment-specific base URLs directly in fetch calls instead of using configuration constants.

Refactoring Strategy

Purpose

To define when and how to recommend refactoring without blocking delivery of required changes.

Rules

  • Never require a full refactor as a condition for approving a bug fix or critical feature.
  • Recommend refactoring as a follow-up ticket when the existing code has technical debt but is not broken.
  • Propose targeted, incremental refactoring steps—not wholesale rewrites.

Workflow

flowchart TD
    A["Identify Refactoring Candidate"] --> B{"Is existing code broken or insecure?"}
    B -- Yes --> C["[MAJOR/CRITICAL] Block merge, require fix"]
    B -- No --> D{"Does change make existing debt significantly worse?"}
    D -- Yes --> E["[MINOR] Recommend concurrent cleanup"]
    D -- No --> F["Log as follow-up tech debt ticket, do not block"]

Frontend Review

Purpose

To review frontend code for correctness, performance, accessibility, and component design quality.

Rules

  • Flag direct DOM mutations outside of framework lifecycle methods (e.g., document.querySelector inside React components).
  • Verify that all user-facing state changes are handled (loading, error, empty, and success states).
  • Reject components that fetch data, manage state, and render UI in a single monolithic function.

Examples

// [MAJOR] Bad: Component handles data fetching, transformation, and rendering
function UserDashboard({ userId }: { userId: string }) {
  const [data, setData] = useState(null);
  useEffect(() => {
    fetch(`/api/users/${userId}`)
      .then(r => r.json())
      .then(setData);
  }, [userId]);
  
  // Transforms raw data and renders simultaneously
  return <div>{data?.orders?.filter(o => o.status === 'active').map(...)}</div>;
}

// Good: Separated into custom hook and presentational component
function useUserDashboard(userId: string) {
  // Data fetching and transformation isolated here
}

function UserDashboard({ userId }: { userId: string }) {
  const { orders, isLoading, error } = useUserDashboard(userId);
  if (isLoading) return <LoadingSpinner />;
  if (error) return <ErrorState error={error} />;
  return <OrderList orders={orders} />;
}

Common Mistakes

  • Missing key props on list items, causing React reconciliation bugs with dynamic lists.
  • Using useEffect with missing dependency array entries, creating stale closure bugs.

Backend Review

Purpose

To review server-side code for correctness, error handling, security, scalability, and adherence to layering conventions.

Rules

  • Verify all database queries use parameterized statements; reject any string-concatenated query construction.
  • Confirm all async operations have try/catch blocks or .catch() handlers.
  • Reject business logic placed directly inside HTTP route handlers.

Examples

// [CRITICAL] Bad: SQL injection vulnerability via string concatenation
async function getUserByEmail(email) {
  return db.query(`SELECT * FROM users WHERE email = '${email}'`);
}

// Good: Parameterized query prevents injection
async function getUserByEmail(email) {
  return db.query('SELECT id, email, role FROM users WHERE email = $1', [email]);
}

Common Mistakes

  • Returning full internal error stack traces to API consumers, leaking implementation details.
  • Not validating or sanitizing request body payloads before passing them into service functions.

Database Review

Purpose

To review database schema changes, migrations, and query patterns for correctness, safety, and performance.

Rules

  • All schema migrations must be reversible (include up and down migration methods).
  • Flag migrations that add NOT NULL columns to existing large tables without a default value, which will cause table locks.
  • Verify indexes exist on all foreign key columns and common query filter columns.

Examples

-- [MAJOR] Bad: Adding NOT NULL column without DEFAULT locks large tables during migration
ALTER TABLE orders ADD COLUMN priority VARCHAR(20) NOT NULL;

-- Good: Add with DEFAULT first, then remove DEFAULT after backfill if needed
ALTER TABLE orders ADD COLUMN priority VARCHAR(20) NOT NULL DEFAULT 'standard';

Common Mistakes

  • Creating indexes without CONCURRENTLY on production tables, causing table-level write locks.
  • Running SELECT * in ORM relationships that pull in full nested objects when only a single field is needed.

API Review

Purpose

To review API design for consistency, security, correctness, and consumer usability.

Rules

  • Verify HTTP method semantics: GET is idempotent and safe, POST creates, PUT/PATCH updates, DELETE removes.
  • Confirm all endpoints return consistent error response shapes with a code, message, and optional details field.
  • Reject endpoints that expose internal database IDs (auto-incremented integers) to public consumers; use UUIDs or opaque tokens.

Examples

// [MAJOR] Bad: Inconsistent error shape breaks client error handling
res.status(400).json({ error: 'Invalid input' });
res.status(404).json({ message: 'Not found' });

// Good: Consistent error envelope
res.status(400).json({ code: 'VALIDATION_ERROR', message: 'Invalid input', details: errors });
res.status(404).json({ code: 'NOT_FOUND', message: 'Resource not found' });

Common Mistakes

  • Returning HTTP 200 for error responses (e.g., { success: false, error: "..." } with status 200).
  • Using query parameters for state-changing operations that should use POST/PATCH body payloads.

Security Review

Purpose

To identify vulnerabilities and security misconfigurations before code reaches production.

Rules

  • Flag all user-controlled inputs that are used in database queries, file paths, or system commands without sanitization.
  • Reject any hardcoded credentials, API keys, tokens, or secrets in source code.
  • Verify authorization checks on every endpoint that accesses or modifies protected resources.

Workflow

flowchart TD
    A["Review Change"] --> B{"User input used in query/command/path?"}
    B -- Yes, Unsanitized --> C["[CRITICAL] Flag injection vulnerability"]
    B -- Sanitized or Not Applicable --> D{"Credentials hardcoded?"}
    D -- Yes --> E["[CRITICAL] Flag hardcoded secret"]
    D -- No --> F{"Authorization check present?"}
    F -- Missing --> G["[CRITICAL] Flag missing authorization"]
    F -- Present --> H["Security check passed"]

Common Mistakes

  • Trusting client-supplied userId parameters without verifying they match the authenticated token subject.
  • Returning verbose error messages (stack traces, query text) in production API error responses.

Performance Review

Purpose

To identify performance regressions, inefficient patterns, and missing optimizations before they reach production.

Rules

  • Flag database queries executing inside loops (N+1 pattern).
  • Reject unbounded list queries that return unlimited records without pagination.
  • Verify expensive computations are not re-executed on every render cycle or request without caching.

Examples

// [MAJOR] Bad: N+1 query - one database call per order
async function getOrdersWithUsers(orderIds: string[]) {
  const orders = await Order.findMany({ where: { id: { in: orderIds } } });
  for (const order of orders) {
    order.user = await User.findUnique({ where: { id: order.userId } }); // N+1
  }
  return orders;
}

// Good: Single batch query using include/join
async function getOrdersWithUsers(orderIds: string[]) {
  return Order.findMany({
    where: { id: { in: orderIds } },
    include: { user: { select: { id: true, email: true, name: true } } }
  });
}

Common Mistakes

  • Fetching an entire collection from the database and filtering it in application memory instead of using a WHERE clause.
  • Missing React.memo or useMemo on expensive child components re-rendered on unrelated parent state changes.

Accessibility Review

Purpose

To ensure frontend changes meet WCAG 2.1 AA accessibility standards, making interfaces usable for all users.

Rules

  • All interactive elements (buttons, links, inputs) must have descriptive, visible labels or aria-label attributes.
  • Color alone must never be the sole means of conveying information.
  • All images must include descriptive alt attributes; decorative images use alt="".

Examples

// [MAJOR] Bad: Icon-only button with no accessible label
<button onClick={handleDelete}>
  <TrashIcon />
</button>

// Good: Descriptive aria-label provides accessible context
<button onClick={handleDelete} aria-label="Delete order #1234">
  <TrashIcon aria-hidden="true" />
</button>

Common Mistakes

  • Using <div onClick={...}> instead of <button>, which is not keyboard-navigable by default.
  • Removing the browser's default focus outline (outline: none) without providing a custom visible focus indicator.

SEO Review

Purpose

To verify that frontend changes do not introduce SEO regressions.

Rules

  • Verify each page has a unique, descriptive <title> tag and a <meta name="description"> tag.
  • Confirm each page has exactly one <h1> element with meaningful, keyword-relevant content.
  • Flag client-side-only rendering of critical page content for pages that require search engine indexing.

Examples

<!-- [MAJOR] Bad: Generic, non-descriptive title and missing meta description -->
<title>Page</title>

<!-- Good: Descriptive, keyword-rich title and meta description -->
<title>Shivang Kesarwani - Software Engineer | Nexulyt</title>
<meta name="description" content="Explore Shivang's portfolio of production-grade AI systems and cloud architecture projects.">

Common Mistakes

  • Rendering page headings (<h1>) dynamically client-side on pages that require server-side rendering for SEO.
  • Using identical meta descriptions across multiple pages, reducing search result differentiation.

Testing Review

Purpose

To verify that code changes include appropriate automated tests with meaningful coverage.

Rules

  • Every public function handling business logic must have unit tests covering the happy path, edge cases, and failure cases.
  • Integration tests must cover all critical data flows end-to-end.
  • Do not accept tests that mock the entire module under test—tests must verify real behavior.

Decision Criteria

Change TypeMinimum Test Requirement
Bug fixTest that reproduces the bug before the fix passes after it
New endpointIntegration test covering success, 400, 401/403, and 404 cases
New utility functionUnit tests covering all branches and edge cases
Database migrationVerified rollback (down migration runs cleanly)

Common Mistakes

  • Writing tests that test the mock library rather than the function's actual logic.
  • Testing only the happy path while leaving error paths completely uncovered.

Documentation Review

Purpose

To verify that code changes include appropriate documentation for maintainability and onboarding.

Rules

  • Public functions exported from a module must include JSDoc or equivalent documentation comments describing parameters, return values, and thrown exceptions.
  • Non-obvious algorithmic choices must include inline comments explaining the reasoning—not the mechanics.
  • README files must be updated when public interfaces, configuration options, or setup steps change.

Examples

// [MINOR] Bad: Public function with no documentation
export function calculateRefundAmount(order: Order, reason: RefundReason): number {
  // Complex refund calculation logic
}

// Good: JSDoc documents contract, parameters, and exceptions
/**
 * Calculates the refund amount for an order based on the refund reason and order age.
 * @param order - The original order to refund.
 * @param reason - The reason code driving the refund policy selection.
 * @returns The refund amount in the order's currency minor units (e.g., cents).
 * @throws {InvalidOrderStateError} If the order is not in a refundable state.
 */
export function calculateRefundAmount(order: Order, reason: RefundReason): number {
  // ...
}

DevOps Review

Purpose

To review infrastructure-as-code, CI/CD configurations, Dockerfiles, and deployment manifests for correctness and security.

Rules

  • Reject Dockerfiles that run application processes as the root user.
  • Verify CI/CD pipelines do not log or expose secret environment variables in build output.
  • Confirm Kubernetes manifests define CPU and memory requests and limits for all containers.

Examples

# [CRITICAL] Bad: Application runs as root
FROM node:20-alpine
WORKDIR /app
COPY . .
RUN npm ci --omit=dev
CMD ["node", "dist/server.js"]

# Good: Non-root user created and used
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
CMD ["node", "dist/server.js"]

Common Mistakes

  • Copying the entire build context (including .env files and node_modules) into Docker images without a precise .dockerignore file.
  • Pinning CI/CD action versions to branch names (e.g., @main) instead of immutable commit SHA pins.

AI Review

Purpose

To review AI system integrations—LLM calls, RAG pipelines, vector database queries, and agent tool use—for correctness, security, and efficiency.

Rules

  • Verify that all LLM prompts validate and sanitize user input to prevent prompt injection attacks.
  • Flag LLM calls that do not set explicit max_tokens limits, risking unbounded API cost.
  • Confirm that AI agent tool executions run in isolated, resource-bounded sandboxes.

Examples

// [MAJOR] Bad: No max_tokens limit and raw user input injected into prompt
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: userInput }] // Direct injection
});

// Good: Token limit set and user input validated/contextualized
const safeInput = sanitizePromptInput(userInput);
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  max_tokens: 1024,
  messages: [
    { role: 'system', content: SYSTEM_PROMPT },
    { role: 'user', content: safeInput }
  ]
});

Common Mistakes

  • Storing raw LLM response text directly into the database without output validation or schema enforcement.
  • Embedding full database records or file contents in RAG prompts without tenant permission verification.

Common Mistakes

Purpose

To document recurring code review failures so AI can proactively identify and flag them.

Rules

  • Check for each of these anti-patterns in every review before finalizing feedback.

Common Code Review Failures

MistakeSeverityImpact
Empty catch blocksCriticalSwallows errors; masks production failures
Missing authorization checkCriticalUnauthorized data access
SQL string concatenationCriticalSQL injection vulnerability
Hardcoded secretsCriticalCredential exposure in version history
N+1 database queriesMajorExponential database load under traffic
Missing error state in UIMajorApp silently fails; users see blank screens
Unbounded list queriesMajorMemory exhaustion and slow responses
Magic numbers in logicMinorUnmaintainable business rule encoding
Missing test for bug fixMajorRegression risk on future changes
any type in TypeScriptMinorBypasses type safety guarantees

Anti Patterns

Purpose

To identify structural code patterns that indicate deeper design problems requiring feedback.

Workflow

flowchart TD
    A["Scan Code for Anti-Patterns"] --> B["God Class / God Function?"]
    B -- Yes --> C["[MAJOR] Single Responsibility violation"]
    C --> D["Spaghetti Conditionals?"]
    D -- Yes --> E["[MINOR] Extract to strategy or guard clauses"]
    E --> F["Primitive Obsession?"]
    F -- Yes --> G["[MINOR] Introduce domain value objects"]
    G --> H["Shotgun Surgery Pattern?"]
    H -- Yes --> I["[MAJOR] Consolidate scattered logic"]
    I --> J["Anti-pattern scan complete"]
    B -- No --> D
    D -- No --> F
    F -- No --> H
    H -- No --> J

Anti-Pattern Reference

Anti-PatternDescriptionRecommended Fix
God ClassOne class does everythingDecompose into focused, single-responsibility classes
Shotgun SurgeryOne business change requires editing 10+ filesConsolidate logic into a single module
Feature EnvyMethod uses more data from another class than its ownMove method to the class whose data it needs
Primitive ObsessionUsing raw strings/ints for domain concepts (e.g., string for Email)Introduce typed value objects
Spaghetti ConditionsDeeply nested if/else treesRefactor using early returns, guard clauses, or strategy pattern

Engineering Checklist

Purpose

To provide a final validation checklist that AI must complete before approving or requesting changes on any review.

Checklist

  • Correctness: Logic produces the expected output for all defined inputs and edge cases.
  • Security: No injection vulnerabilities, hardcoded secrets, or missing authorization checks.
  • Error Handling: All async operations handle errors; no empty catch blocks exist.
  • Performance: No N+1 queries, unbounded list fetches, or blocking main-thread operations.
  • Tests: Adequate tests cover happy path, error cases, and the edge cases specific to this change.
  • Types: No any types that bypass type safety. All public functions have typed signatures.
  • Naming: All identifiers communicate intent clearly using established project conventions.
  • Documentation: Public functions are documented; non-obvious decisions have inline comments.
  • No Hardcoded Values: No magic numbers, hardcoded URLs, credentials, or environment-specific values.
  • Accessibility: Interactive elements have accessible labels; focus management is correct.
  • Migrations Safe: Database migrations include down migration; no breaking NOT NULL additions without defaults.
  • No Regressions: Change does not break existing test suite or introduce detectable performance regressions.

Self Review Engine

Purpose

To define the AI's self-critique workflow, ensuring every review is structured, thorough, and actionable before delivery.

Workflow

flowchart TD
    Start["Review Draft Completed"] --> Q1{"Any CRITICAL security findings?"}
    Q1 -- Yes --> R1["Verify finding, confirm severity, place first in review"] --> Q2
    Q1 -- No --> Q2{"Any MAJOR logic or correctness issues?"}
    Q2 -- Yes --> R2["Provide reproduction scenario or counterexample"] --> Q3
    Q2 -- No --> Q3{"N+1 queries or unbounded fetches present?"}
    Q3 -- Yes --> R3["Flag as MAJOR with batch query alternative"] --> Q4
    Q3 -- No --> Q4{"Empty catch blocks present?"}
    Q4 -- Yes --> R4["Flag as CRITICAL - requires error propagation"] --> Q5
    Q4 -- No --> Q5{"Missing tests for changed logic?"}
    Q5 -- Yes --> R5["Flag as MAJOR - request coverage"] --> Q6
    Q5 -- No --> Q6{"All findings classified with severity?"}
    Q6 -- No --> R6["Assign severity to unclassified findings"] --> Q7
    Q6 -- Yes --> Q7{"Feedback constructive and reasoned?"}
    Q7 -- No --> R7["Rewrite feedback with concrete reasoning and linked alternatives"]
    Q7 -- Yes --> End["Deliver Structured Code Review"]

References

Purpose

To list canonical engineering resources that ground all review recommendations in established standards.

Recommended References

  • Clean Code by Robert C. Martin: Principles for readable, maintainable code and naming conventions.
  • The Pragmatic Programmer by Hunt & Thomas: Engineering discipline, YAGNI, DRY, and orthogonality.
  • Google Engineering Practices - Code Review Guide: How Google approaches reviewer standards and change sizes.
  • OWASP Top 10: Canonical reference for web application security vulnerabilities.
  • WCAG 2.1 AA Specification: Accessibility standards for interactive UI components.
  • Postgres Documentation - Performance Tips: Index selection, query planning, and EXPLAIN ANALYZE.
  • TypeScript Handbook: Type safety standards and best practices for typed JavaScript codebases.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.