/cf-fix

High>2.5K tokens injected into prompt

Quick bug fix workflow with problem verification.

Context footprint: ⚡⚡⚡ (high) — what does this mean?

The /cf-fix skill streamlines bug fixing by verifying the problem exists, exploring the codebase for context, confirming your approach, implementing a fix with tests, and verifying the solution works.

Usage

/cf-fix [bug description]

Workflow

  1. Understand the Bug — Read the error or bug description. If vague, asks clarifying questions: what did you expect? what happened instead?
  2. Verify Problem — Run the failing test or command to reproduce the bug. If no test exists, writes one that demonstrates the failure
  3. Recall Past Bugs + Explore Code — Searches docs/memory/bugs/ for related past bugs via frontmatter grep, then launches the cf-explorer agent to trace the code path
  4. Locate Root Cause — Traces backward from where the error appears to where it originates. States a hypothesis before fixing
  5. Confirm Approach — Explains the root cause and proposed fix. Asks for your input if uncertain
  6. Implement Fix — Dispatches the cf-implementer agent with strict TDD discipline: write a failing regression test first, then fix the root cause
  7. Verify Results + Retry — Parses the implementer's result signal. On success, confirms the fix addresses the root cause. On failure, retries once with error context. If both attempts fail, escalates to user
  8. Save Bug Knowledge — If the fix required more than 1 attempt, documents the bug (symptom, root cause, fix, prevention) to docs/memory/bugs/ via cf-writer agent with frontmatter for future recall
  9. Auto-Review — Automatically runs /cf-review after the fix is verified

Example

/cf-fix Login fails with 401 error when auth token expires

The skill will:

  • Reproduce the 401 error with an expired token
  • Launch cf-explorer to trace the auth code path
  • Identify the root cause (e.g., missing token refresh logic)
  • Confirm the fix approach with you
  • Dispatch cf-implementer to write a regression test and implement the fix
  • Run full test suite to verify no regressions

Quick Checks

Before diving deep, the skill tries these common causes first:

  • Typo in variable/function name? Check spelling
  • Wrong import path? Check relative vs absolute
  • Stale cache/build? Clean and rebuild
  • Missing dependency? Check package.json/requirements
  • Environment mismatch? Check env vars, node version, etc.

Key Features

  • Bug Memory Recall — Searches past bug docs before investigating, leveraging previously solved issues
  • TDD Integration — Enforces test-first approach for bug fixes
  • Regression Prevention — Runs existing tests to catch side effects
  • Knowledge Capture — Non-trivial bugs (multiple attempts) are documented for future reference
  • Learn Prompt — After 2 failed attempts, suggests /cf-learn to capture debugging insights before continuing
  • Minimal Changes — Focuses on surgical fixes, not rewrites
  • Custom Guides — Extend behavior via .coding-friend/skills/cf-fix-custom/SKILL.md

Escalation

If the bug persists after 2 fix attempts, the skill suggests running /cf-learn to capture debugging insights before the 3rd attempt — so the knowledge gained from investigation isn't lost.

If the bug persists after 3 fix attempts, the skill stops and escalates to the full cf-sys-debug 5-phase diagnostic process — the bug is likely deeper than expected.

When to Use

  • Production bugs affecting users
  • Flaky tests that fail intermittently
  • Unexpected behavior in existing features
  • Performance regressions

Output

Fixes include:

  • Regression test demonstrating the bug
  • Source code changes with comments explaining why
  • Test report showing no regressions

After the fix is verified, /cf-review runs automatically:

/cf-fix → (auto) /cf-review/cf-commit