Systematic code review skill checking documentation quality and promoting code reuse
Performs systematic code review checking documentation quality, code reuse, and advanced code standards before merging.
npx claudepluginhub synthesys-lab/agentizeThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Comprehensive code review skill ensuring quality, consistency, and adherence to project documentation and code reuse standards before merging to main branch.
document-guideline skill requirementsEvery review assesses:
document-guideline standardsReviews provide recommendations - final merge decisions remain with maintainers.
When /code-review is invoked:
Validates compliance with document-guideline standards.
Documentation & Comment Content Principle: All documentation and code comments should focus on current design rationale, not historical changes or comparisons. Explain why the current approach exists and how it works, not how it improved from previous versions.
Common violations:
Standard: Documentation and comments must focus on current rationale, not historical comparisons.
Check: Review documentation files and code comments for historical references or improvement claims.
Example findings:
❌ Historical comparison in documentation
README.md:18 - "This implementation reduced LOC by 40% compared to v1.0"
Recommendation: Rewrite to focus on current design:
"This implementation uses a unified interface to simplify module interactions"
❌ Historical reference in code comment
src/parser.py:45 - "# Changed from regex to AST parsing for better performance"
Recommendation: Explain current rationale:
"# Use AST parsing to handle nested structures and provide detailed error locations"
Standard: Every folder (except hidden) must have README.md.
Check: For each directory with changes, verify README.md exists and reflects new files.
Common issues:
README.mdREADME.md not updated for new filesExample finding:
❌ Missing folder documentation
.claude/skills/new-skill/ - No README.md found
Recommendation: Create README.md documenting folder purpose, key files, integration points
Standard: Every source file (.py, .c, .cpp, .cxx, .cc) must have companion .md file.
Check: Verify .md file exists and documents:
Common issues:
.md file.md exists but incomplete (missing public functions)Example finding:
❌ Missing interface documentation
src/utils/validator.py - No validator.md found
Recommendation: Create validator.md with External Interface and Internal Helpers sections
❌ Incomplete interface documentation
src/api/handler.md - Missing handle_request() function
Recommendation: Add handle_request() signature, parameters, return value, error conditions
Standard: Test files need documentation explaining what they test.
Acceptable formats:
# Test 1: Description.md file (for complex suites)Check: Test files have inline comments or .md companion documenting test purpose and expected outcomes.
Example finding:
❌ Missing test documentation
tests/test_validation.sh - No inline comments or companion .md
Recommendation: Add inline comments:
# Test 1: Validator accepts valid input (expect: exit 0)
# Test 2: Validator rejects malformed input (expect: exit 1, error message)
Standard: Architectural changes should have design docs in docs/.
When expected: New subsystems, major features, architectural changes, significant refactoring
Check: Look for design doc references in commits; check docs/ for relevant updates.
Note: Design docs require human judgment, not enforced by linting.
Example finding:
⚠️ Consider adding design documentation
Changes introduce new authentication subsystem across 5 files
Recommendation: Consider docs/authentication.md documenting architecture, flow, integration, security
Tool: scripts/lint-documentation.sh
Validates structural requirements (folder READMEs, source .md companions, test docs).
Check: Run linter or verify it would pass. On milestone branches, --no-verify bypass acceptable if documentation complete.
Example finding:
❌ Documentation linter would fail
Missing: src/utils/parser.md, .claude/commands/README.md
Recommendation: Add missing documentation before final merge
Assesses code quality and identifies reuse opportunities.
Objective: Find duplicate or similar code within changes.
Look for: Similar function names/logic, repeated code blocks, duplicate validation/error handling.
Example finding:
❌ Code duplication detected
src/new_feature.py:42 - parse_date() duplicates existing logic
Existing: src/utils/date_parser.py:parse_date()
Recommendation: Import and use existing parse_date() instead of reimplementing
Objective: Find existing project utilities that could replace new code.
Common categories: Validation, parsing, formatting, file operations, git operations.
Check: Search src/utils/, scripts/ for existing utilities matching new code patterns.
Example finding:
❌ Reinventing the wheel - local utility exists
src/api/handler.py:67 - Manual JSON validation
Existing: src/utils/validators.py:validate_json()
Recommendation: Replace with: from src.utils.validators import validate_json
Objective: Find standard libraries or packages that could replace custom code.
Common reinvented wheels:
argparse)requests)dateutil)configparser, yaml)Example finding:
❌ Reinventing the wheel - standard library exists
src/cli.py:23-45 - Custom argument parsing
Recommendation: Use argparse for automatic --help, type conversion, error handling
Objective: Check for redundant or conflicting dependencies.
Look for: Multiple libraries for same purpose, unused imports, non-standard when standard exists.
Example finding:
⚠️ Dependency consideration
src/fetcher.py:5 - Added httpx when requests already used project-wide
Recommendation: Use consistent HTTP library unless httpx provides required feature
Objective: Ensure code follows existing patterns and architecture.
Check: Error handling approach, naming conventions, module organization, configuration management, logging patterns.
Example finding:
⚠️ Inconsistent with project patterns
src/new_module.py - Uses camelCase function names
Project convention: snake_case (see src/utils/, src/api/)
Recommendation: Rename to match project style (parseInput → parse_input)
Objective: Ensure only appropriate files are committed and debug code is removed.
Check for inappropriate files:
.tmp, *.swp, *.bak, *~, .DS_Store*.pyc, __pycache__/, build/, dist/, *.o, *.so.vscode/, .idea/, *.sublime-*.env, *.local.*, settings.local.json*.log, debug.txt.gitignore?Check for debug code:
console.log(), print("debug"), printf("DEBUG")import pdb; pdb.set_trace()Example findings:
❌ Temporary file committed
.tmp/debug-output.txt - Temporary file should not be committed
Recommendation: Remove from staging and add pattern to .gitignore
❌ Debug code left in commit
src/api/handler.py:23 - console.log("DEBUG: request received")
Recommendation: Remove debug logging before commit
⚠️ Local configuration file
config/settings.local.json - Local config file committed
Recommendation: Move to settings.example.json or add to .gitignore
Users should copy example to .local version
❌ Debug breakpoint left in code
src/utils/parser.py:45 - import pdb; pdb.set_trace()
Recommendation: Remove debugger statement
Deep analysis of code structure, type safety, and architectural boundaries.
Objective: Identify unnecessary wrappers and abstractions.
Look for:
Example finding:
❌ Unnecessary indirection
src/utils/request_wrapper.py:12 - RequestWrapper only delegates to requests.get()
Recommendation: Remove wrapper and use requests.get() directly
OR document added value (retries, logging, auth) and implement meaningfully
Objective: Identify patterns suggesting need for unified interface.
Look for: Multiple similar functions with variations, repeated patterns, copy-pasted logic.
Balance: Generalize when pattern appears 3+ times with clear abstraction. Flag premature abstraction adding complexity.
Example finding:
⚠️ Code repetition pattern detected
src/validators.py - Three similar functions: validate_email(), validate_phone(), validate_url()
All follow same pattern: regex match, return True/False, optional error message
Recommendation: Consider unified interface validate_format(value, pattern, error_msg)
Only proceed if this simplifies codebase. Keep separate if unique logic beyond pattern matching.
Objective: Ensure modules maintain single responsibility, don't repurpose code paths.
Look for:
Differentiate: Module-specific helpers (keep private) vs. reusable utilities (move to shared utils/).
Example finding:
❌ Module focus violation
src/api/user_handler.py:67 - Added CSV parsing logic unrelated to API handling
Recommendation: Extract to appropriate location:
- If CSV parsing reusable → src/utils/csv_parser.py
- If specific to user data → src/models/user_csv.py
Objective: Verify clear separation of declaration, usage, and error handling.
Prefer: @dataclass for structured data (pre-declares attributes, type safety, auto-generated methods).
Check for:
a.b access instead of getattr(a, 'b')Example finding:
❌ Dynamic attribute access reduces clarity
src/models/config.py:23 - getattr(config, 'timeout', 30)
Unclear if 'timeout' is mandatory or optional
Recommendation: Use @dataclass with explicit declaration:
@dataclass
class Config:
timeout: int = 30 # Optional with default
host: str # Mandatory
Then directly use: `config.timeout`
Benefits: Clear contract, type safety, IDE autocomplete
⚠️ None-handling at usage site
src/api/handler.py:45 - if user.email is not None: send_email(user.email)
Recommendation: Handle at accessor level:
- If mandatory: Validate email never None at creation
- If optional: Provide has_email() method or email property with default
Objective: Enforce type annotations and eliminate unnamed literal constants.
Type annotation requirements:
typing.TYPE_CHECKING for circular dependenciesMagic number detection: Flag literal constants (86400, 3600, 1024). Suggest named constants or enums. Allow well-known literals (0, 1, 2, -1).
Example finding:
❌ Magic number detected
src/cache.py:34 - cache.set(key, value, 86400)
Recommendation: Extract to named constant:
class DayConstants:
SECONDS_PER_DAY = 86400 # or: CACHE_TTL = 24 * 60 * 60
❌ Missing type annotations
src/utils/parser.py:15 - def parse_input(data): return json.loads(data)
Recommendation: def parse_input(data: str) -> Dict[str, Any]: return json.loads(data)
Objective: Validate changes appropriately scoped; justify cross-module impact.
Check: Changes limited to target module vs. widespread; cross-module impact with justification; refactoring scope appropriate.
Scope expectations:
Example finding:
⚠️ Broad change impact
Changes affect 8 modules across 3 subsystems
PR title: "Add email validation to User model" but spans multiple subsystems
Question: Is scope appropriate?
- If refactoring email validation project-wide: ✅ Document in PR
- If just adding User.email field: ⚠️ Scope too broad
Recommendation: Clarify intent and justify cross-module changes
❌ Uncontrolled change scope
src/config.py:23 - Changed MAX_RETRIES = 3 to 5
Impact: Affects all modules using MAX_RETRIES
Recommendation: Document reason, update related tests, consider migration notes if breaking
Use /code-review:
document-guideline defines standards; review-standard enforces them.
Milestone commits (in-progress):
--no-verifyDelivery commits (final):
/code-review command:
git diff --name-only main...HEADgit diff main...HEADEvery review produces structured report with actionable feedback.
To enable users to quickly locate the specific standard being referenced, every finding MUST include an explicit "Standard" line that references the phase and check from this skill document.
Required format:
❌ Missing interface documentation
Location: src/utils/validator.py:1
Standard: Phase 1, Check 3 — Source Code Interface Documentation
Recommendation: Create validator.md with External Interface section
Key requirements:
Standard: Phase {X}, Check {Y} — {Check Name}This approach provides clear traceability without introducing separate registry files or cryptic ID codes.
# Code Review Report
**Branch**: issue-42-feature-name
**Changed files**: 8 files (+450, -120 lines)
**Review date**: 2025-01-15
---
## Phase 1: Documentation Quality
### ✅ Passed
- All folders have README.md files
- Test files have inline documentation
### ❌ Issues Found
#### Missing source interface documentation
- Location: `src/utils/parser.py`
Standard: Phase 1, Check 3 — Source Code Interface Documentation
**Recommendation**: Create parser.md with External Interface and Internal Helpers
### ⚠️ Warnings
#### Consider design documentation
- Location: Multiple files (authentication subsystem)
Standard: Phase 1, Check 5 — Design Documentation
**Recommendation**: Consider docs/authentication.md for architectural changes spanning 5 files
---
## Phase 2: Code Quality & Reuse
[Similar structure]
---
## Phase 3: Advanced Code Quality
[Similar structure]
---
## Overall Assessment
**Status**: ⚠️ NEEDS CHANGES
**Summary**: 3 critical issues, 3 warnings
**Recommended actions before merge**:
1. Create parser.md documenting interfaces
2. Replace manual JSON validation with existing utility
3. Extract magic number to named constant
4. Add type annotations
5. Consider design doc
6. Evaluate dependency consistency
**Merge readiness**: Not ready - address critical issues first
✅ APPROVED: All documentation complete, no code quality issues, reuse opportunities addressed, no unnecessary indirection or magic numbers, type annotations present, change scope appropriate. Ready for merge.
⚠️ NEEDS CHANGES: Minor documentation gaps, code reuse opportunities exist, non-critical improvements recommended, missing some type annotations, minor magic numbers or scope considerations. Can merge after addressing issues.
❌ CRITICAL ISSUES: Missing required documentation, significant code quality problems, major reuse opportunities ignored, unnecessary wrappers hiding design flaws, module responsibility violations, uncontrolled change scope, security or correctness concerns. Must address before merge.
Every issue must include:
The review-standard skill provides systematic code review:
document-guideline complianceReviews are recommendations to maintain quality - final merge decisions remain with maintainers.
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.