# Code Review

> Use this skill when the user wants a production-grade review of Python code, a Python pull request, or a Python-focused diff. Check architecture, security, code quality, tests, documentation, deployment risk, and code-documentation consistency. Trigger on requests like "review this Python PR", "audit this diff", "check code quality", or "give me a fix plan". Do NOT use it for non-Python code review, writing new features, dependency-only changes, pytest-suite-specific audits where `pytest-suite-review` is a better fit, or iterative review-fix-rerun loops where `code-review-loop` is a better fit.

- Skill: `argythana/code-review` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add argythana/code-review`
- Raw SKILL.md: https://api.skillmd.com/api/skills/argythana/code-review/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: argythana (https://skillmd.com/u/argythana)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/argythana/code-review

---


# Python Code Review

Systematic code review with actionable feedback organized by severity.

## Process

1. **Gather context**
   ```bash
   git diff --name-only main
   git diff main
   git log main..HEAD --oneline
   ```

2. **Run automated checks**
   ```bash
   ruff check --output-format=json <files>
   vulture --min-confidence=80 <files>
   mypy <files>
   ```

3. **Apply review checklists** - see references below

4. **Generate report** with issues and fix plan

## Severity Levels

| Level | Definition | Action |
|-------|------------|--------|
| Critical | Security flaws, data loss, breaking changes | Blocks merge |
| High | Resource leaks, wrong layer, N+1 queries | Fix before merge |
| Moderate | Missing tests, complexity >10, swallowed exceptions | Should address |
| Low | Style beyond linter, minor refactoring | Optional |

## Review Categories

Apply these checklists to changed files:

1. **Architecture** - Layer violations, dependency direction, god classes
   - See [references/architecture.md](references/architecture.md)

2. **Security** - Injection, secrets, path traversal, deserialization
   - See [references/security.md](references/security.md)

3. **Quality** - Complexity, error handling, performance
   - See [references/quality.md](references/quality.md)

4. **Testing** - Coverage, assertions, isolation, fixtures
   - See [references/testing.md](references/testing.md)

5. **Documentation** - Docstrings, README accuracy
   - See [references/documentation.md](references/documentation.md)

6. **Deployment** - Dockerfile, Helm, migrations
   - See [references/deployment.md](references/deployment.md)

7. **Consistency** - Code-docs sync, signature matches
   - See [references/consistency.md](references/consistency.md)

## Output Format

```markdown
# Code Review Report

**Status**: PASS | NEEDS_WORK | BLOCKED

## Issues
| Severity | Count |
|----------|-------|
| Critical | N |

### [Category]
- [severity] file:line - description
  - Fix: specific suggestion

## Fix Plan
1. [Issue] - [Action]
```

## Principles

- Be specific: "Add try/except at line 42" not "improve error handling"
- Verify first: Check functions exist before suggesting them
- Focus on changes: Don't refactor untouched code
- Provide working examples

