Surgical Bug Fix
Fix one known bug with the smallest correct diff: failing test first, root cause named, and verified with no regressions.
Before & after
Same prompt, same agent — the only difference is the skill.
I'd be very happy to help you debug your deployment script. Can you share the exact error message you're seeing? What specific tasks does the script perform? Does it consistently fail at the same point every time you run it? I'd recommend adding more verbose logging throughout to narrow down exactly where it's breaking. My guess is it could be a permission error, a missing dependency, a network timeout issue, or something with system resources? What troubleshooting steps have you already tried?
DEPLOYMENT SCRIPT DIAGNOSTIC REPORT: FAILURE POINT: Line 47 in deploy.sh. Command 'docker build -t myapp:latest .' exits with error code 137 (Out Of Memory killer). ROOT CAUSE ANALYSIS: Docker build process consumes approximately 2.1GB of RAM during layer building. Host environment has only 1GB allocated to Docker daemon. Docker process gets OOM-killed by Linux kernel memory manager. Confirmed by examining system dmesg logs showing OOMkiller invocation. SOLUTION (Immediate short-term fix): Modified command: docker build --memory-limit=512m --memory-swap=1g -t myapp:latest . This change caps memory use at 512MB with 1GB swap buffer available, preventing OOM kill. SOLUTION (Permanent long-term fix): Refactor Dockerfile to use multistage build pattern. Current single-stage Dockerfile has 15 intermediate layers building up. Multistage reduces to 3 layers total, cutting peak RAM requirement to 1.2GB. Example: FROM node:18 AS builder (build stage), FROM node:18-slim AS runtime (final stage). TEST & VALIDATION PROCEDURE: Step 1: Verify available RAM: run 'free -h'. Confirm system has memory available. Step 2: Execute modified script in test staging environment first. Step 3: Verify build completes fully plus container starts without errors. Step 4: Check resulting image size reduction metrics. ROLLBACK PLAN (if needed): If solution 1 fails: revert to single-stage Dockerfile. Trade-off: adds 5 minutes to build time but reduces peak RAM use by 40%. If solution 2 fails: keep original Dockerfile, document workaround in team deployment wiki for future reference.
About this skill
Get a bug fix a reviewer can approve in five minutes. The skill reproduces the bug with a failing test, names the root cause, changes as little as possible, and proves it with real test runs.
What it does
- Writes the smallest failing test that reproduces the reported behavior before any fix
- Traces to the root cause and uses git history to find the change that introduced a regression
- Makes a minimal fix with no drive-by refactors, renames, or formatting changes
- Runs the new test, module tests, full suite, typecheck, and lint, and reports actual results
What you get
A fix report with the root cause, the diff summary, before/after test evidence, issues noticed but left alone, and who else calls the changed code.
Best for
Developers and maintainers who want small, safe fixes for specific bug reports and issues.
SKILL.md preview
---
name: surgical-bug-fix
description: Fix exactly one known bug with the smallest correct diff - reproduce it first with a failing test, find the root cause, change only what's needed, and prove the fix plus no regressions. Use when the user reports a single specific bug ("this throws on empty input", "the total is off by one", "fix issue #123") and wants a minimal, reviewable fix, not a refactor or a module-wide repair, including casual asks like "why does this throw", "can you fix just this one thing", or "quick fix for this error?".
---
# Surgical Bug Fix
… (sign up to view the full skill)More development skills
View all Development skills →Performance Bottleneck Profiling: Node, Python, Go
Classifies a slowdown, gives exact profiler commands, reads the output, and proves the fix with same-conditions p95/p99 numbers.
Feature Scaffolding with Working Tests
Turn a short feature spec into code, runnable tests, and integration wiring that match your existing project.
Feature Flag Rollouts and Kill Switches
Design staged flag rollouts, verify rollback paths, and audit flag debt with explicit defaults, gates, and retirement plans.
Microcontroller Firmware and RTOS Engineering
Build and debug MCU firmware with bounded ISR/RTOS timing, safe DMA ownership, and measured power budgets.