S

Self-Review Command

Performs a comprehensive self-review of all uncommitted changes before creating a pull request. Checks for code quality, security issues, test coverage, documentation, and style consistency. Catches issues before reviewers see them.

CommandCommunitycode reviewv1.0.0MIT
0 views0 copies

Command

/self-review

Description

Runs a thorough self-review of all uncommitted changes (staged and unstaged) as if you were a senior reviewer seeing the code for the first time. Checks for bugs, security issues, missing tests, documentation gaps, and style inconsistencies. Produces an actionable report with specific file/line references.

Behavior

Steps

  1. Gather all changes:

    git diff --cached --name-only # Staged files git diff --name-only # Unstaged changes git diff HEAD --stat # Overall change summary
  2. Review each changed file against this checklist:

    Code Quality

    • Functions are focused and under 50 lines
    • Variable names are descriptive and consistent
    • No commented-out code or debug statements
    • No TODO/FIXME/HACK comments without ticket references
    • Error messages are helpful and actionable

    Security

    • No hardcoded secrets, keys, or passwords
    • User input is validated and sanitized
    • SQL queries use parameterized statements
    • Sensitive data is not logged
    • Authentication/authorization checks are present where needed

    Testing

    • New functions have corresponding unit tests
    • Edge cases are covered (null, empty, boundary values)
    • Test names describe the expected behavior
    • Mocks are minimal and realistic

    Consistency

    • Follows existing project patterns and conventions
    • Imports are organized consistently
    • Error handling follows project patterns
    • Type annotations are present (if using typed language)
  3. Check for common mistakes:

    • Console.log / print statements left in
    • Async functions without await
    • Missing return statements
    • Unused imports or variables
    • Accidental file inclusion (.env, node_modules, etc.)
  4. Generate the review report.

Output Format

## Self-Review Report **Files changed**: 8 | **Lines added**: 245 | **Lines removed**: 67 ### Issues Found #### Critical (0) None found. #### Warnings (2) 1. `src/api/users.ts:42` -- Missing input validation on `userId` parameter 2. `src/services/email.ts:15` -- API key appears to be hardcoded #### Suggestions (3) 1. `src/utils/format.ts:28` -- Could use `Intl.NumberFormat` instead of manual formatting 2. `tests/api.test.ts` -- Missing test for error case when user not found 3. `src/types.ts:12` -- Consider making `status` a union type instead of string ### PR Readiness: ALMOST READY Fix the 2 warnings above, then this is ready for review.

Examples

# Review all uncommitted changes /self-review # Review only staged changes /self-review --staged-only
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates