- Home
- Skills
- Testing & Debugging
- ai bug fixer
ai bug fixer
Analyze stack traces and source files to generate root-cause explanations, unified diffs, and regression tests.
Free
Works with the AI Agents you already use
ai bug fixer
Example session with this skill installed
python scripts/fixer.py --file auth.py --error "TypeError: Cannot read properties of undefined (reading 'user_id') at auth.py:42"
- Read your context and instructions
- Compiled the ai bug fixer
I have analyzed the stack trace and the source file provided. The error is caused by accessing a property on a null object during the authentication handshake.
Bug Fix Report
| Field | Details |
|---|---|
| Root Cause | Attempting to access user_id on an undefined session object. |
| Confidence | 🟢 HIGH |
| Explanation | The getUserSession function returns undefined when a token is expired, but the subsequent logic assumes the object exists before accessing its properties. |
| Prevention | Use optional chaining or an explicit null check before accessing session properties. |
Proposed Fix (Unified Diff)
--- auth.py
+++ auth.py
@@ -39,7 +39,7 @@
def get_auth_context(token):
session = get_user_session(token)
- return session.user_id
+ return session.user_id if session else None
Regression Test
def test_expired_token_returns_none():
# Setup: mock an expired session
token = "expired_token"
# Action: call the buggy function
result = get_auth_context(token)
# Assert: should handle null gracefully
assert result is None
Next steps
- Review the diff and apply it to
auth.py. - Run the provided regression test to verify the fix.
- Check if other areas of the codebase lack null checks on
get_user_session.
Connects securely to your tools. The creator never sees your data.
About this skill
Debugging eats hours of development time when stack traces are cryptic or logs are buried. This skill bridges the gap between a crash and a resolution by analyzing errors against your source code to provide a verified fix.
What it does
- Root-cause analysis identifies the exact problem in one sentence based on your logs or stack traces.
- Unified diffs generate the precise code replacement needed to resolve the issue.
- Regression testing provides a minimal unit test to ensure the bug does not return.
- Prevention tips offer specific advice on how to avoid similar coding patterns in the future.
- Multi-language support handles Python, JavaScript, TypeScript, Go, Rust, and several other major languages.
How it works
- Input error data by pasting a stack trace, pointing to a file, or piping program output directly into the tool.
- Review the report to understand the explanation and the logic behind the crash.
- Verify the fix by reviewing the generated unified diff.
- Export results to a text file or JSON for further processing by your CI/CD or agent workflows.
Frameworks & tools
Built for Python 3.8+ environments. It supports a wide array of languages including Python, JS/TS, Go, Java, Ruby, Rust, C/C++, PHP, Swift, and SQL.
Why this beats prompting it yourself
Generic prompts often lack the context to generate a working diff or a relevant unit test. This skill follows a structured debugging protocol that combines source files with error context to hit a higher confidence level than raw chat prompts.
Use cases
- Fixing failing tests by piping pytest or vitest output directly to the fixer.
- Debugging production crashes by feeding in raw logs or stack traces from monitoring tools.
- Refactoring legacy code that throws frequent runtime errors.
Known limitations
Source files are capped at 8,000 characters and error messages at 4,000 characters. It is designed for single-file context and may struggle with complex architectural bugs spanning many files.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.
Source files capped at 8,000 chars. Error messages capped at 4,000 chars. Requires Python 3.8+. Optimized for single-file context.
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 1 day ago
- Free with an Agensi account
- Accounts
Anthropic
- Software
Python
Permissions
Allowed Hosts