Logo di Superpowers Test Driven Development

Superpowers Test Driven Development

Community
christopherarter
superpowers-test-driven-development

Writing or fixing any code? Load first — write the failing test before the code.

Panoramica

Pubblicato dachristopherarter
Repositorysuperpowers-reasonix
Nome della skillsuperpowers-test-driven-development
Stelle
101
Fork
7
File inclusi
1
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 1

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da christopherarter su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Superpowers Test Driven Development in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/christopherarter/superpowers-reasonix/tree/main/skills/superpowers-test-driven-development
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/christopherarter/superpowers-reasonix.git /tmp/superpowers-reasonix
mkdir -p .claude/skills
cp -r /tmp/superpowers-reasonix/skills/superpowers-test-driven-development .claude/skills/superpowers-test-driven-development
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Superpowers Test Driven Development in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Superpowers Test Driven Development non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Superpowers Test Driven Development non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Test-Driven Development (TDD)

Overview

Test first. Watch it fail. Write minimal code to pass.

Core principle: Didn't watch the test fail? You don't know it tests the right thing.

Break the letter of the rules = break the spirit.

When to Use

Always: new features, bug fixes, refactors, behavior changes.

Exceptions (ask your human partner): throwaway prototypes, generated code, config files.

"Skip TDD just this once"? Stop. That's rationalization.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Code before the test? Delete it. Start over. Don't keep it as "reference", don't "adapt" it, don't look at it. Delete means delete. Implement fresh from tests.

Red-Green-Refactor

dot
digraph tdd_cycle {
    rankdir=LR;
    red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
    verify_red [label="Verify fails\ncorrectly", shape=diamond];
    green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
    verify_green [label="Verify passes\nAll green", shape=diamond];
    refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
    next [label="Next", shape=ellipse];

    red -> verify_red;
    verify_red -> green [label="yes"];
    verify_red -> red [label="wrong\nfailure"];
    green -> verify_green;
    verify_green -> refactor [label="yes"];
    verify_green -> green [label="no"];
    refactor -> verify_green [label="stay\ngreen"];
    verify_green -> next;
    next -> red;
}

RED — write failing test

One minimal test. Shows what should happen.

const result = await retryOperation(operation);

expect(result).toBe('success'); expect(attempts).toBe(3); });

Clear name, real behavior, one thing
</Good>

<Bad>
```typescript
test('retry works', async () => {
  const mock = jest.fn()
    .mockRejectedValueOnce(new Error())
    .mockRejectedValueOnce(new Error())
    .mockResolvedValueOnce('success');
  await retryOperation(mock);
  expect(mock).toHaveBeenCalledTimes(3);
});

Vague name, tests mock not code

One behavior. Clear name. Real code (no mocks unless unavoidable).

Verify RED — watch it fail

MANDATORY. Never skip. Run via bash:

bash
npm test path/to/test.test.ts

Confirm: fails (not errors), failure message is the expected one, fails because feature missing (not a typo).

Passes? Testing existing behavior — fix the test. Errors? Fix, rerun till it fails right.

GREEN — minimal code

Simplest code that passes.

Don't add features, refactor other code, or "improve" past the test.

Verify GREEN — watch it pass

MANDATORY.

bash
npm test path/to/test.test.ts

Confirm: passes, other tests still pass, output pristine (no errors/warnings).

Fails? Fix code, not test. Other tests fail? Fix now.

"Other tests" means the project's full suite. A passing focused test does not establish that the change is done. Before reporting completion, run the repository's test command (npm test, pytest, cargo test, or its equivalent) even when the task names one file. Report every failure by name, including a failure you did not cause; a scoped deliverable does not narrow verification.

REFACTOR — clean up

After green only: kill duplication, improve names, extract helpers. Stay green. Don't add behavior.

Repeat

Next failing test, next feature.

Good Tests

QualityGoodBad
MinimalOne thing. "and" in name? Split it.test('validates email and domain and whitespace')
ClearName describes behaviortest('test1')
Shows intentDemonstrates desired APIObscures what code should do

Common Rationalizations

ExcuseReality
"Too simple to test"Simple code breaks. Test takes 30 seconds.
"I'll test after"Tests passing immediately prove nothing.
"Tests after achieve same goals"Tests-after = "what does this do?" Tests-first = "what should this do?"
"Already manually tested"Ad-hoc ≠ systematic. No record, can't re-run.
"Deleting X hours is wasteful"Sunk cost. Keeping unverified code is tech debt.
"Keep as reference, write tests first"You'll adapt it. That's testing after. Delete means delete.
"Need to explore first"Fine. Throw away exploration, start with TDD.
"Test hard = design unclear"Listen to the test. Hard to test = hard to use.
"TDD will slow me down"TDD faster than debugging. Pragmatic = test-first.
"Manual test faster"Manual doesn't prove edge cases. You'll re-test every change.
"Existing code has no tests"You're improving it. Add tests for it.

Red Flags — STOP and Start Over

  • Code before test
  • Test passes immediately, or you can't explain why it failed
  • "I'll test after" / "tests after achieve the same purpose"
  • "Keep as reference" / "adapt existing code"
  • "Already spent X hours, deleting is wasteful"
  • "TDD is dogmatic, I'm being pragmatic" / "this is different because…"

All mean: delete code, start over with TDD.

Example: Bug Fix

Bug: empty email accepted.

RED

typescript
test('rejects empty email', async () => {
  const result = await submitForm({ email: '' });
  expect(result.error).toBe('Email required');
});

Verify RED

bash
$ npm test
FAIL: expected 'Email required', got undefined

GREEN

typescript
function submitForm(data: FormData) {
  if (!data.email?.trim()) {
    return { error: 'Email required' };
  }
  // ...
}

Verify GREEN

bash
$ npm test
PASS

REFACTOR — extract validation for more fields if needed.

Verification Checklist

  • Every new function/method has a test
  • Watched each test fail before implementing
  • Each test failed for the expected reason (feature missing, not a typo)
  • Wrote minimal code to pass
  • All tests pass, output pristine
  • Tests use real code (mocks only if unavoidable)
  • Edge cases and errors covered

Can't check all? You skipped TDD. Start over.

When Stuck

ProblemSolution
Don't know how to testWrite the wished-for API. Assertion first. Ask your human partner.
Test too complicatedDesign too complicated. Simplify the interface.
Must mock everythingCode too coupled. Use dependency injection.
Test setup hugeExtract helpers. Still complex? Simplify design.

Debugging Integration

Bug? Write a failing test reproducing it. Follow the cycle — the test proves the fix and blocks regression. Never fix bugs without a test. (See superpowers-systematic-debugging.)

Testing Anti-Patterns

Adding mocks/test utils? Consult the Testing Anti-Patterns reference (auto-included below): testing mock not real behavior; test-only methods in prod classes; mocking without understanding deps.

Final Rule

Production code → test exists and failed first
Otherwise → not TDD

No exceptions without your human partner's permission.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Superpowers Test Driven Development?

Writing or fixing any code? Load first — write the failing test before the code.

Perché usare Superpowers Test Driven Development su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Superpowers Test Driven Development è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Superpowers Test Driven Development in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/christopherarter/superpowers-reasonix/tree/main/skills/superpowers-test-driven-development. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Superpowers Test Driven Development?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Superpowers Test Driven Development?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Superpowers Test Driven Development: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Superpowers Test Driven Development è gratuita?

Sì. È pubblicata su GitHub da christopherarter con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇