Awesome-omni-skill fix-bug
Implement bug fixes for Rust code. Use when improvements, issues, GitHub Issue links, or error messages are provided. Triggers on keywords like "fix", "bug", "issue", "error", "broken".
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/development/fix-bug" ~/.claude/skills/diegosouzapw-awesome-omni-skill-fix-bug && rm -rf "$T"
manifest:
skills/development/fix-bug/SKILL.mdsource content
Bug Fix Workflow
A systematic workflow for implementing bug fixes.
Phase 1: Understand the Bug
Issue/Error Analysis
-
GitHub Issue: Fetch details from issue number
- Check reproduction steps, expected vs actual behavior
- Review labels, milestones, linked PRs
-
Error Message: Parse the stack trace
- Identify error type (panic, Result::Err, compile error)
- Locate occurrence point (file:line)
-
Description Only: Gather additional information
- Confirm reproduction steps
- Check environment (OS, Rust version, DB type)
Phase 2: Explore the Code
Find Related Code
Exploration order: 1. File where error occurs 2. Callers (upstream) 3. Related test files 4. Related code in the same module
Project Structure
: CLI command handlingsrc/cli/
: Domain models (schema, migration)src/core/
: Database adapters, SQL generationsrc/db/
Phase 3: Diagnose Root Cause
Root Cause Analysis
- Form hypothesis: "This bug might be caused by X"
- Verify hypothesis: Read code, confirm with tests
- Identify cause: Create minimal reproduction case
Debugging Techniques
# Run with stack trace RUST_BACKTRACE=1 cargo run -- <command> # Run specific test cargo test <test_name> -- --nocapture # Inspect variable values (temporary) dbg!(variable);
Phase 4: Create Fix Branch
Branch Creation (Before Making Changes)
# Create and switch to fix branch git checkout -b fix/<issue-number>-<short-description> # Example git checkout -b fix/10-sqlite-nested-transaction
Branch Naming Convention
- For issue-based fixesfix/<issue-number>-<short-description>
- For fixes without issue numberfix/<short-description>
Phase 5: Implement the Fix
Coding Conventions
- Error handling: No
/unwrap()
, propagate withexpect()? - Ownership: Prefer borrowing over unnecessary
.clone() - Naming: snake_case (functions), PascalCase (types)
Fix Scope
- Minimal changes to solve the problem
- Avoid unrelated refactoring
- Consider API breaking changes carefully
Fix Patterns
Panic Fix:
// Before: Potential panic let value = map.get(key).unwrap(); // After: Proper error handling let value = map.get(key) .ok_or_else(|| anyhow::anyhow!("Key not found: {}", key))?;
Logic Error Fix:
// Before: Missing boundary condition if items.len() > 0 { ... } // After: Handle empty case if !items.is_empty() { ... }
Phase 6: Write Tests
Add Regression Tests
- Write a test that reproduces the bug first (Red)
- Confirm the test fails
- Implement the fix (Green)
- Confirm the test passes
Test Location
- Unit tests:
module in the same file#[cfg(test)] - Integration tests:
directorysrc/cli/tests/
Test Naming Convention
#[test] fn test_<feature>_<condition>_<expected_result>() { // e.g., test_parse_array_type_with_mixed_case_preserves_casing }
Phase 7: Verify
Local Verification
# Format cargo fmt # Lint cargo clippy -- -D warnings # Run all tests cargo test # Run specific test file cargo test --test <test_file_name>
Pre-Commit Checklist
- Bug is fixed and verified
- Regression test is added
- All existing tests pass
- No errors from
/cargo fmtcargo clippy - Commit message is appropriate
Commit Message Format
fix(<scope>): <summary> <body - optional> Fixes #<issue-number> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Scope examples: cli, core, db, schema, migration, sql, test
Phase 8: Create Pull Request
Push Branch and Create PR via MCP
After verification passes, create a pull request using GitHub MCP tools:
-
Push the fix branch
git push -u origin <branch-name> -
Create PR using MCP (
)mcp__github__create_pull_request
PR Content
Read the PR template from
.github/pull_request_template.md and fill in the sections accordingly:
- Summary: Brief description of the fix
- Related Issue:
Fixes #<issue-number> - Type of Change: Check "Bug fix"
- Test Plan: Check items based on what was tested
- Checklist: Check completed items
MCP Tool Parameters
owner: Lazialize repo: stratum title: fix(<scope>): <summary> head: <fix-branch-name> base: main body: <PR content from template>
GitHub Issue Integration
When issue number is provided:
- Fetch issue details with
gh issue view <number> - Include
in commit message after fixFixes #<number> - Link to issue when creating PR
Escape Hatches
Stop and confirm with user in these cases:
- Breaking API changes required
- Multiple fix approaches possible
- Cannot identify root cause
- Security-related issues