Bug Fix Assistant
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md to install @user_00c9b356/buddy-bug-fixer.
About this skill
What problem it addresses
In Python projects, many low-level bugs are not visible just by reading the code: date sorting without reverse=True, nested lists incorrectly using .append([...]), assignment written in an if x = y condition, missing colons, and bare except: blocks that swallow exceptions can all surface during runtime or code review. Manual search-and-replace across multiple files is easy to miss or overreach.
Bug Fix Assistant targets this class of deterministic, pattern-based Python issues and organizes scanning, fixing, and optional AI analysis into a library that agents can call directly.
How it works
It is not primarily a standalone CLI. It exposes bug_fixer.py for AI or automation workflows. Common entry points include:
analyze(code, filename="input", use_ai=True): analyzes a code snippet, applies scans and auto-fixes, and optionally returns AI analysis.scan_file(filepath, auto_fix=True): scans a single.pyfile and writes back fixes by default.scan_directory(directory="."): scans Python source files under a directory while skipping.git,__pycache__,node_modules, virtual environments, and build directories.
The built-in rules fall into two groups. The first group consists of local deterministic rules that require no external API and run in milliseconds. Examples include adding reverse=True to date-related sorted(...) calls, changing nested-list .append([...]) to .extend([...]), correcting if x = y to if x == y, inserting missing colons, and replacing bare except: with except Exception:. Mutable default arguments such as def f(x=[]) are marked NEEDS-REVIEW rather than auto-fixed, to avoid changing runtime semantics.
The second group is AI deep analysis. When SILICONFLOW_API_KEY is configured, it can call SiliconFlow (DeepSeek-V3) to inspect complex business logic, potential null pointer or type issues, security risks such as SQL injection or XSS, performance and concurrency concerns, and code readability. If the key is missing, the network call fails, or a timeout occurs, the system degrades to deterministic rule results instead of aborting.
Boundaries
This skill is well suited for quickly cleaning frequent Python syntax misuse and low-level pattern bugs, but it is not a replacement for human code review or complex algorithm review. It only scans .py files and does not handle JS/Go or other languages. Automatic write-back overwrites the original file, so version control should be committed before bulk fixes. Very large files are read into memory, so they should be split or passed as snippets. Auto-fixes improve syntactic stability but do not guarantee business correctness, especially when sorting direction or comparison semantics are involved; developers should verify the results.
Use Cases
- Before committing a local Python project, batch-scan `.py` files and auto-fix low-level errors such as `if x = y` and bare `except:` blocks.
- When an AI receives failing code, call `analyze` to produce a structured report separating auto-fixable issues from items needing manual review.
- In CI or automation workflows, periodically run directory scans to detect new syntax misuse and common anti-patterns in Python files.
- With a SiliconFlow key configured, add AI analysis for complex risks such as SQL injection, null pointers, and concurrency issues.
Best For
- Python backend maintainers who need to clean high-frequency syntax misuse and low-level exception-handling issues.
- Developers using agents for code issues who want deterministic scans and optional AI analysis in the same workflow.
- Engineers doing pre-commit code self-checks who care about pattern fixes such as `==`, `extend`, and `except Exception`.
- Engineers maintaining multi-file Python repositories who want to skip build directories and bulk-check source files.
Related Skills
A one-shot coding agent built on Claude Code CLI that runs non-interactively, supports a specified workdir, and can be monitored in the foreground or background.
Preview and confirm file sorting by extension, with recursive cleanup, ignore rules, and transactional rollback.
An engineering assistant for static HTML/CSS/JS pages, design-token extraction, IE8-compatible review, and structured delivery.
An engineering workflow for requirement analysis, scenario modeling, risk planning, quality gates, testing, and knowledge capture, with lightweight, standard, and full modes.