All skills
acedergren avatar

/bugfix

@9d099e9
by Alexander Cedergrenacedergren/agentic-tools26 stars
4

Use when given a bug report, failing test, stack trace, or CI failure that needs diagnosis and repair. Autonomously diagnoses root cause, implements minimal fix, verifies correctness, and commits. Keywords: fix bug, failing test, stack trace, CI failure, debug error, broken test. Triggers on "fix bug" or "debug failing test".

Use this Skill: https://skilld.dev/gh/acedergren/agentic-tools/bugfix

This session only. Nothing lands on disk.

SKILL.md

โ‰ˆ84 tokens always: the name and description. โ‰ˆ773 when used: this file.

Bugfix

When to Use

Load this skill when the user request matches the frontmatter description for Bugfix.

Autonomous end-to-end bug fix: diagnose from evidence, find root cause, minimal fix, verify, commit.

NEVER

  • Never ask the user for more information unless the bug description is completely ambiguous โ€” use tools to find it.
  • Never refactor unrelated code while fixing a bug โ€” scope creep breaks regression isolation.
  • Never fix other bugs you notice while fixing the target โ€” create a new task instead.
  • Never git add -A โ€” stage only the files you changed.
  • Never skip running the full workspace test suite after a fix โ€” targeted test passing doesn't mean no regression.
  • Never commit until typecheck passes on the affected workspace.

Root Cause Classification (decide before writing any code)

Type Signal Fix approach
Code bug Logic error, wrong query, bad comparison Fix implementation
Test bug Expectation contradicts documented contract Fix the test โ€” explain why it was wrong
Mock wiring mockReset: true pattern not followed, stale mock state Use correct mock pattern from CLAUDE.md
Type error TypeScript compilation failure Fix types, not tests
Import error Wrong package path, missing export Fix import resolution

If it's a mock wiring issue: read the mock patterns in CLAUDE.md before writing anything โ€” there are three distinct patterns (forwarding, object-bag, counter-based sequencing).

Evidence-First Thinking

Collect before hypothesizing:

  1. Run the failing test โ€” see the exact error output, not just the description
  2. Read the failing test โ€” understand what it expects
  3. Read the source under test
  4. git log --oneline -10 -- <file> โ€” was this recently changed?
  5. For runtime errors: check logs, route/plugin/service code

State hypothesis explicitly before writing code: "The test fails because X, caused by Y."

Abort Conditions (stop and ask user)

  • Bug is in security-sensitive area (auth, RBAC, IDOR) โ€” confirm fix approach first
  • Fix requires changing more than 5 files โ€” may be an architectural issue
  • Root cause requires changing the mock strategy for an entire test suite

Scripts

bash scripts/collect-bugfix-context.sh apps/api/src/tests/routes/auth.test.ts
bash scripts/run-targeted-test.sh apps/api/src/tests/routes/auth.test.ts
bash scripts/run-targeted-test.sh apps/api/src/tests/routes/auth.test.ts "returns 500"

Verification Sequence

  1. Run the specific failing test โ€” must pass
  2. Run the full workspace suite โ€” no new failures
  3. Run typecheck on the affected workspace (npx tsc --noEmit)
  4. git diff --name-only โ€” verify every changed file relates to the bug; revert anything that doesn't

Commit Format

fix(scope): what was broken and how it was fixed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Arguments

$ARGUMENTS: Error message, failing test path, CI log URL, or reproduction steps. If empty, ask for the error or failing test name.

Source: SKILL.md on GitHub

1 warning5mo5 checks ยท Risk SAFE
  • Gen Agent Trust Hub6mo

    This skill provides an autonomous workflow for diagnosing and fixing software bugs using tools like Vitest and Git. The primary security risk is indirect prompt injection, where malicious instructions hidden in a bug report could influence the agent's actions. The skill includes reasonable safeguards, such as stopping for manual review on security-sensitive code paths.

  • Socket6mo

    No alerts

  • Snyk6mo

    Risk: LOW ยท No issues

  • Runlayer6mo

    3/3 files flagged

  • ZeroLeaks5mo

    Score: 93/100 ยท 2 sections analyzed

Signed by skilld at 9d099e9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 4 months ago

README badge

README badge for acedergren/agentic-tools/bugfix