- Home
- Skills
- Code Quality & Review
- Senior Python Code Reviewer & Debugger
Senior Python Code Reviewer & Debugger
by Qasim Khan
Reviews, debugs, and refactors Python code like a senior engineer: root-cause diagnosis, the smallest safe fix, tests, security checks, and a clear handoff.
Free
What it does
- Diagnoses the root cause of a bug, not just the symptom
- Proposes the smallest safe fix instead of a full rewrite
- Adds typing, tests, and error handling only where they actually help
- Reviews code for security issues (injection, unsafe deserialization, secrets in logs)
- Writes a regression test for every bug it fixes
- Delivers a severity-ranked review or a clean patch, your choice
Who it's for
Developers stuck on a bug
Get the root cause and a minimal fix with a regression test.
Try asking: “Here's a traceback — find the bug and fix it.”
Teams doing code review
Get a severity-ranked review, not a nitpick list.
Try asking: “Review this pull request for correctness and security.”
Engineers refactoring legacy code
Get the smallest safe change, not a rewrite.
Try asking: “Refactor this function for readability without changing behavior.”
Senior Python Code Reviewer & Debugger
Example session with this skill installed
Here's a function that reads a JSON file and returns data["users"]: ```python def get_users(path): with open(path) as f: data = json.load(f) return data["users"] ``` It crashed in production. Review it and fix it.
- Read your context and instructions
- Compiled the senior python code
**Code Review:** get_users Root cause: almost certainly a KeyError on data["users"] (if the JSON lacks that key) or a FileNotFoundError/JSONDecodeError upstream — none of these are handled, so any of them propagates as an unhandled exception. **Findings** - High: no handling for missing file. Catch FileNotFoundError, raise a domain-specific UserDataError with the path - High: no handling for malformed JSON. Catch json.JSONDecodeError, same pattern - Medium: data["users"] assumes key always exists. Use .get("users"), raise clearly with the actual keys found if None - Low: no encoding specified. Open with encoding="utf-8" explicitly **Fix** ```python import json from pathlib import Path class UserDataError(Exception): pass def get_users(path: str | Path) -> list[dict]: path = Path(path) try: with path.open(encoding="utf-8") as f: data = json.load(f) except FileNotFoundError as e: raise UserDataError(f"User data file not found: {path}") from e except json.JSONDecodeError as e: raise UserDataError(f"Invalid JSON in {path}: {e}") from e users = data.get("users") if users is None: raise UserDataError(f"'users' key missing in {path}. Keys found: {list(data.keys())}") return users ``` Regression tests added: valid JSON with users key, missing file, malformed JSON, JSON missing the users key — all four now raise UserDataError with an actionable message instead of crashing. **Not changed:** the function's public signature and return type are unchanged — this is a minimal, behavior-preserving fix, not a rewrite.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem it solves Generic code help tends to either rewrite far more than asked or miss the actual root cause behind a bug. This skill operates as a pragmatic senior engineer: understand the contract first, diagnose from evidence, then make the smallest safe change — preserving intended behavior unless a change is explicitly requested. How it works Understands the contract (inputs, outputs, Python version, constraints), inspects existing code and tests before changing anything, diagnoses from evidence (distinguishing confirmed cause from hypothesis), proposes the smallest safe fix, adds typing and error handling where they clarify the contract, writes tests for the actual behavior/bug, assesses security, measures performance by benchmarking, and delivers a handoff summary with risks and follow-ups. Frameworks & tools pytest-first for testing; standard-library solutions preferred over frameworks when sufficient; idiomatic practices include pathlib, context managers, no mutable default arguments, parameterized SQL, no hardcoded credentials. Why this beats prompting it yourself Has five distinct output modes (Explain / Patch / Review / Design / Debug), each with its own deliverable shape — code reviews are severity-ranked with location, impact, fix, and a regression test per finding, and it never claims to have run code or tests unless it actually did. Use cases - Debugging a traceback down to the root cause - Code review before merging a pull request - Refactoring legacy code without changing behavior - Security review of code handling user input, subprocess calls, or SQL Known limitations Can't execute code itself unless the host agent provides a code-execution tool — without one, it gives you commands to run rather than claiming results it didn't verify.
Pure SKILL.md package (no dependencies itself). Ships references/review-checklist.md, references/project-layouts.md, templates/code-review.md and templates/bug-report.md (required deliverables), examples/example-review.md, and tests/quality-tests.md. Works on any supplied Python code — no required runtime. If a terminal/code-execution tool is connected, runs pytest and linters directly and reports real results; otherwise supplies exact commands to run. Supports Python 3.8+ idioms by default.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed today
- Free with an Agensi account
- Software
Python
- Optional
- Code execution / sandbox tool (to run pytest and linters)
Without a code-execution tool, it won't claim to have run tests — it gives you the exact commands to run yourself.
Permissions
File Scopes
Reads and edits Python source/test files in the project; runs pytest/linters when available to verify fixes. Never commits or pushes — local changes only.
What's inside
Frequently Asked Questions
New in Code Quality & Review
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.