用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/diegosouzapw/awesome-omni-skill --skill bug-fixing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Token-efficient tracking for AI orchestration. CLI-first for status updates (~50 tokens), agent fallback for complex ops (~1KB). Use when: updating task status, querying blockers, creating progress files, validating phases.
AshAi extension guidelines for integrating AI capabilities with Ash Framework. Use when implementing vectorization/embeddings, exposing Ash actions as LLM tools, creating prompt-backed actions, or setting up MCP servers. Covers semantic search, LangChain integration, and structured outputs.
This skill should be used when solving hard questions, complex architectural problems, or debugging issues that benefit from GPT-5 Pro or GPT-5.1 thinking models with large file context. Use when standard Claude analysis needs deeper reasoning or extended context windows.
基于 SOC 职业分类
正在显示 SKILL.md
| name | bug-fixing |
| category | workflow |
| version | 2.0.0 |
| description | Systematic debugging and bug fixing with Australian user-friendly messages |
| author | Unite Group |
| priority | 3 |
| triggers | ["bug","fix bug","debug","error","issue"] |
| requires | ["verification/verification-first.skill.md","verification/error-handling.skill.md"] |
Guide agents through systematic bug fixing: reproduction, root cause analysis, fix, and regression prevention.
Objective: Confirm bug exists and understand conditions
1. Gather Information
- Error message/stack trace
- Steps to reproduce
- Expected vs actual behavior
- Environment details (browser, OS, Australian locale)
2. Reproduce Locally
- Follow reproduction steps
- Observe behavior
- Capture error details
- Document conditions
3. Create Failing Test
- Write test that triggers bug
- Test should fail initially
- Commit failing test
Outputs:
If Cannot Reproduce:
Objective: Find where the bug originates
1. Analyze Stack Trace
- Find entry point
- Follow execution path
- Identify failing line
2. Add Logging/Debugging
- Log inputs at key points
- Check intermediate values
- Verify assumptions
3. Narrow Down
- Binary search approach
- Isolate problematic code
- Identify exact cause
Debugging Techniques:
Python:
import logging
logger = logging.getLogger(__name__)
def process_data(data):
logger.debug(f"Input: {data}") # Check input
result = transform(data)
logger.debug(f"Transformed: {result}") # Check intermediate
return result
TypeScript:
function processData(data: Data): Result {
console.log('Input:', data) // Temporary debug
const result = transform(data)
console.log('Result:', result) // Temporary debug
return result
}
Remember: Remove debug logging after fixing!
Objective: Understand WHY it's broken
1. Ask Five Whys
- Why did it fail?
- Why was that condition true?
- Why wasn't it handled?
- Why did we assume that?
- Why is the design that way?
2. Identify Category
- Logic error
- Edge case not handled
- Race condition
- Incorrect assumption
- Missing validation
- Performance issue
- Australian context issue (date/currency formatting)
3. Check for Similar Issues
- Query memory for similar bugs
- Search codebase for pattern
- Are other places affected?
Root Cause Categories:
| Category | Example | Fix Strategy |
|---|---|---|
| Logic Error | Wrong condition | Fix logic |
| Edge Case | Null not handled | Add validation |
| Race Condition | Async timing | Add synchronization |
| Assumption | Assumed non-null | Validate assumptions |
| Validation | No input check | Add validation |
| Performance | Slow query | Optimize |
| Locale | US date format | Apply Australian formatting |
Objective: Fix the bug properly
1. Design Fix
- Address root cause (not symptom)
- Consider edge cases
- Avoid breaking changes
- Check performance impact
- Ensure Australian context preserved
2. Implement Fix
- Minimal code change
- Follow project patterns
- Handle errors properly (en-AU messages)
- Add comments explaining fix
3. Verify Locally
- Failing test now passes
- No new test failures
- Manual test works
- No regressions
- Australian context still correct
Fix Patterns:
Add Validation:
# Before (buggy)
def divide(a, b):
return a / b # Crashes if b=0
# After (fixed)
def divide(a, b):
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
Handle Null/None:
// Before (buggy)
function getName(user: User): string {
return user.name.toUpperCase() // Crashes if name is null
}
// After (fixed with Australian-friendly default)
function getName(user: User): string {
return user.name?.toUpperCase() ?? 'Unknown'
}
Fix Australian Date Formatting:
// Before (buggy - US format)
function formatDate(date: Date): string {
return date.toLocaleDateString('en-US') // MM/DD/YYYY
}
// After (fixed - Australian format)
function formatDate(date: Date): string {
return date.toLocaleDateString('en-AU') // DD/MM/YYYY
}
Add Async Safety:
# Before (buggy)
async def fetch_data():
data = requests.get(url) # Blocks event loop
# After (fixed)
async def fetch_data():
async with httpx.AsyncClient() as client:
response = await client.get(url)
Objective: Ensure bug doesn't come back
1. Create Regression Test
- Test the specific bug scenario
- Include edge cases found
- Test should pass now
- Descriptive test name
2. Test Coverage
- Cover the fix
- Cover related edge cases
- Update existing tests if needed
3. Verify No Regressions
- All existing tests pass
- No new failures introduced
- Performance not degraded
Regression Test Pattern:
def test_regression_issue_123_divide_by_zero():
"""Regression test for issue #123: Division by zero crash.
Previously, calling divide(10, 0) would crash with ZeroDivisionError.
Now it should raise a descriptive ValueError.
"""
with pytest.raises(ValueError, match="Cannot divide by zero"):
divide(10, 0)
Objective: Capture learnings
1. Update Code
- Add comment explaining fix
- Update docstring if behavior changed
- Note any caveats
2. Update Documentation
- README if user-facing bug
- API docs if behavior changed
- Migration guide if breaking
3. Store to Memory
- Record failure pattern
- Store fix approach
- Document root cause
- Prevent similar bugs
Objective: Get fix reviewed and merged
1. Create Bug Fix Branch
- Branch name: `fix/agent-{issue-number}`
2. Commit Changes
- Clear commit message
- Reference issue number
- Include test
3. PR Description
- Link to issue
- Describe bug
- Explain fix
- Show test evidence
4. Request Review
- Await human approval
Bug Report: "Dates showing in wrong format (MM/DD/YYYY instead of DD/MM/YYYY)"
Reproduction:
1. Create invoice
2. View invoice details
3. Date displays as 01/15/2025 (should be 15/01/2025)
Created failing test:
test_invoice_date_format_australian() - FAIL
Stack trace points to:
invoice_formatter.ts:23 - formatDate()
Found issue:
Using toLocaleDateString('en-US') instead of 'en-AU'
Root Cause: Hardcoded US locale instead of Australian
Why?
1. Default locale was 'en-US'
2. No Australian context enforcement
3. No validation of date format output
Category: Locale/Internationalization error
// Before (buggy)
function formatDate(date: Date): string {
return date.toLocaleDateString('en-US')
}
// After (fixed)
function formatDate(date: Date, locale: string = 'en-AU'): string {
// Always default to Australian format unless explicitly overridden
return date.toLocaleDateString(locale)
}
describe('Date formatting', () => {
it('should format dates in Australian DD/MM/YYYY format by default', () => {
const date = new Date('2025-01-15')
const formatted = formatDate(date)
expect(formatted).toBe('15/01/2025')
})
it('regression: dates should not use US format', () => {
const date = new Date('2025-01-15')
const formatted = formatDate(date)
expect(formatted).not.toBe('01/15/2025') // Not US format
})
})
Updated:
- Added docstring noting default Australian format
- Updated README with date formatting guidelines
Stored to memory:
- Failure pattern: Hardcoded locales
- Fix approach: Default to en-AU
- Root cause: Missing Australian context enforcement
Created: PR #234 - "fix(invoices): Use Australian date format (DD/MM/YYYY)"
Status: Awaiting review
Tests: All passing ✅
❌ Fixing without reproducing ✅ Reproduce reliably first
❌ Treating symptom not cause ✅ Identify and fix root cause
❌ No regression test ✅ Add test to prevent recurrence
❌ Introducing new bugs ✅ Run full test suite before committing
❌ Over-engineering the fix ✅ Minimal, targeted fix
❌ Forgetting Australian context ✅ Verify en-AU, DD/MM/YYYY, AUD throughout
async def fix_bug(agent, bug_report):
# Check for similar past bugs
similar = await agent.memory.find_similar(
query=bug_report.description,
domain=MemoryDomain.TESTING,
category="failure_patterns"
)
if similar:
# Learn from past fixes
past_fix = similar[0]
logger.info(f"Similar bug fixed before: {past_fix}")
# Proceed with fix
fix_result = await agent.execute_fix(bug_report)
# Store for future
await agent.memory.store_failure(
failure_type=fix_result.bug_category,
context={
"bug": bug_report.description,
"root_cause": fix_result.root_cause,
"fix_approach": fix_result.approach,
"lessons": fix_result.lessons,
"australian_context": fix_result.au_context_impact
}
)
Goal: Fix bugs systematically with tests, prevent regressions, and maintain Australian context.