Systematic Debugging (Superpowers)
Forces finding the root cause before touching the code: reproduce, isolate, test, fix once.
By Jesse Vincent (obra) (opens in a new tab) · community
When to use it
- When facing a bug, a failing test or odd behavior.
- When the agent chains random attempts without understanding the failure.
When to avoid it
- In a throwaway prototype where the cause doesn’t matter.
Recommendations
- Describe the symptom with data: what you expected and what you got.
- Ask for the failing test before the fix.
Risks and permissions
- Includes find-polluter.sh, which runs the tests in a loop.
- The full Superpowers plugin adds a hook at the start of every session: it changes how the agent works on everything.
Install it
With BibliotecaPrompts Recommended
-
Connect bp, just once. In Claude Code:
Terminal claude mcp add --transport http --scope user bp https://bibliotecaprompts.com/mcpAnother harness? How to connect it in yours.
-
Ask your agent for it:
Ask like this Instala con bp la skill systematic-debugging
- Downloads the version we tested (
22f0b46), 7 files. - Checks each one against its SHA-256 fingerprint: if anything changed, it installs nothing.
- Only the skill and its license: no hooks or extra servers.
- Puts it in your harness’s folder, the project’s or your own.
Other ways, from the source
Claude Code
Installs all of Superpowers from the official marketplace.
/plugin install superpowers@claude-plugins-official
Codex CLI Cursor Gemini CLI OpenCode
With the npx skills installer, which asks you which agent to install it in.
npx skills add obra/superpowers --skill systematic-debugging
Before installing, read its SKILL.md. Another harness? Where skills go in each one.
Our test
The task: Three $3.33 notebooks with a 10% discount should cost $8.99 and the cart says $8.97. Find the cause and fix it (npm test runs the tests).
Passes if: It reproduces the bug before touching code, names the root cause (it truncates each unit’s price), writes a failing test first, applies a single fix and leaves the tests green.
-
Claude Opus 5.5Passes with caveats
Found the cause (the discount was truncated per unit), wrote tests it saw fail and left npm test green. But it made two fixes instead of one: it also changed trunc to round.
- 46 s
- 219.3K tokens
- $0.28
- Nov 24, 2026
What changed in
carrito.js--- carrito.js (antes)+++ carrito.js (después)@@ -1,5 +1,7 @@ import { aplicarDescuento } from "./precios.js"; export function totalCarrito(items, porcentaje = 0) {- return items.reduce((suma, item) => suma + aplicarDescuento(item.precio, porcentaje) * item.cantidad, 0);+ // El descuento se aplica al subtotal de cada línea, no a cada unidad:+ // redondear por unidad y luego multiplicar acumula el error de centavos.+ return items.reduce((suma, item) => suma + aplicarDescuento(item.precio * item.cantidad, porcentaje), 0); }What changed in
carrito.test.js--- carrito.test.js (antes)+++ carrito.test.js (después)@@ -5,3 +5,13 @@ test("sin descuento suma precio por cantidad", () => { assert.equal(totalCarrito([{ precio: 2, cantidad: 3 }]), 6); });++test("tres cuadernos de 3,33 con 10 % cuestan 8,99", () => {+ // 3 × 3,33 = 9,99; 9,99 × 0,9 = 8,991 → 8,99+ assert.equal(totalCarrito([{ precio: 3.33, cantidad: 3 }], 10), 8.99);+});++test("sin descuento no pierde centavos por error de coma flotante", () => {+ // 0.29 * 100 da 28.999999999999996 en coma flotante+ assert.equal(totalCarrito([{ precio: 0.29, cantidad: 1 }]), 0.29);+});What changed in
precios.js--- precios.js (antes)+++ precios.js (después)@@ -1,4 +1,5 @@ // Precio con descuento, en pesos con centavos. export function aplicarDescuento(precio, porcentaje) {- return Math.trunc(precio * (100 - porcentaje)) / 100;+ // Redondear (no truncar): con coma flotante, 0.29 * 100 da 28.999999999999996.+ return Math.round(precio * (100 - porcentaje)) / 100; }What the agent answered
Ya está arreglado: el carrito da $8,99 y pasan las 3 pruebas de `npm test`. **Causa:** el descuento se calculaba por cada cuaderno y se truncaba en lugar de redondear. Cada uno quedaba en 3,33 × 0,9 = 2,997, que se cortaba a $2,99, y × 3 daba $8,97. El precio correcto es 9,99 × 0,9 = 8,991, es decir, $8,99. Había dos problemas, y hacía falta corregir los dos: - **Descuento por unidad.** Aunque se redondeara cada cuaderno, saldría $3,00 × 3 = $9,00, que también está mal. Hay que aplicar el descuento al subtotal de la línea (precio × cantidad). - **Truncar en vez de redondear.** Con decimales en coma flotante se pierden centavos incluso sin descuento: un producto de $0,29 aparecía como $0,28. **Archivos que cambié:** - `carrito.js`: el descuento se aplica a `precio * cantidad` y no a cada unidad. - `precios.js`: `Math.trunc` pasa a ser `Math.round`. - `carrito.test.js`: agregué dos pruebas, el caso de los cuadernos y el de $0,29. Comprobé que fallaban antes del arreglo (daban 8,97 y 0,28). No dejé archivos extra. Queda un riesgo: el total sigue sumando las líneas en coma flotante, así que con varias líneas podrían colarse residuos tipo 0,30000000000000004. La solución robusta es trabajar en centavos enteros. No lo cambié porque no hacía falta para este error. -
Claude Sonnet 5.5Passes with caveats
Named the cause, wrote the test for the 3 notebooks, saw it fail at 8.97 and fixed it; npm test passes. But it also slipped in an untested change (trunc to round).
- 18 s
- 147.1K tokens
- $0.11
- Nov 24, 2026
What changed in
carrito.js--- carrito.js (antes)+++ carrito.js (después)@@ -1,5 +1,5 @@ import { aplicarDescuento } from "./precios.js"; export function totalCarrito(items, porcentaje = 0) {- return items.reduce((suma, item) => suma + aplicarDescuento(item.precio, porcentaje) * item.cantidad, 0);+ return items.reduce((suma, item) => suma + aplicarDescuento(item.precio * item.cantidad, porcentaje), 0); }What changed in
carrito.test.js--- carrito.test.js (antes)+++ carrito.test.js (después)@@ -5,3 +5,7 @@ test("sin descuento suma precio por cantidad", () => { assert.equal(totalCarrito([{ precio: 2, cantidad: 3 }]), 6); });++test("3 cuadernos de 3,33 con 10% de descuento cuestan 8,99", () => {+ assert.equal(totalCarrito([{ precio: 3.33, cantidad: 3 }], 10), 8.99);+});What changed in
precios.js--- precios.js (antes)+++ precios.js (después)@@ -1,4 +1,6 @@-// Precio con descuento, en pesos con centavos.-export function aplicarDescuento(precio, porcentaje) {- return Math.trunc(precio * (100 - porcentaje)) / 100;+// Importe con descuento, en pesos con centavos.+// Redondea una sola vez, sobre el importe de la línea (precio * cantidad),+// no por unidad: truncar cada unidad pierde centavos que se multiplican.+export function aplicarDescuento(importe, porcentaje) {+ return Math.round(importe * (100 - porcentaje)) / 100; }What the agent answered
Ahora el carrito da $8,99 y las 2 pruebas pasan. **Causa:** `aplicarDescuento` truncaba a centavos cada unidad. 3,33 con 10 % es 2,997, que se truncaba a 2,99, y al multiplicar por 3 daba 8,97. **Arreglo:** - `precios.js`: `aplicarDescuento` ahora recibe el importe de la línea y redondea una sola vez con `Math.round`. Antes usaba `Math.trunc`. - `carrito.js`: aplica el descuento sobre `precio * cantidad`, no sobre el precio unitario. - `carrito.test.js`: agregué la prueba de los 3 cuadernos. La vi fallar con 8,97 antes del arreglo. Cambié `trunc` por `round` a propósito, porque truncar puede perder un centavo por error de coma flotante. Ese cambio de redondeo no afecta este caso (899,1 da 899 con cualquiera de los dos). Si prefieres seguir truncando, es una línea. **Archivos:** `carrito.js`, `precios.js` y `carrito.test.js`, los tres modificados. No creé archivos nuevos.
Each run: Claude Code with the skill installed, no network and in a sandbox, at version 22f0b46 of the repository. The verdict comes from a review that opens the files it left, not just its answer.