Aller au contenu
Skillpedia
Tests15k · #10999

tdd

Ce qu’il fait

La compétence guide une correction de bogue qui commence par un test de non-régression ciblé. Elle s'adresse aux développeurs qui veulent une preuve que le bogue est corrigé et ne reviendra pas.

Quand l’utiliser

  • ✓Quand vous demandez le développement piloté par les tests ou un test de non-régression.
  • ✓Quand un bogue dispose d'un test simple et peu coûteux qui peut montrer le comportement défaillant.
  • ✓Quand vous voulez une correction qu'un test prouve ne pas pouvoir revenir.

Lien du skill

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Corrige le bogue de connexion, mais écris d'abord un test qui échoue pour que nous sachions qu'il est vraiment corrigé.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent décrit le bogue, écrit un petit test qui doit échouer, l'exécute pour confirmer l'échec, puis applique la plus petite modification de code qui le fait passer. Si un test peu coûteux n'est pas pratique, il utilise un autre contrôle.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

TDD Bug Fix

When fixing a bug with a clear, cheap test path, make the broken behavior executable before changing production code. The goal is a focused regression test that fails before the fix and passes after it.

Do not force a test when it would be impractical. If the available test would require broad harness setup, brittle mocks, slow end-to-end infrastructure, production-only state, vague reproduction steps, or large unrelated fixture churn, skip adding a new test and use the closest useful verification instead.

Workflow

  1. Understand the bug. Identify the intended behavior, current behavior, affected path, and smallest observable reproduction.
  2. Choose the narrowest executable check. Prefer the closest unit, component, integration, or regression test already used for that codepath. If no practical test path is obvious, do not create one from scratch just to satisfy the workflow.
  3. Write the failing test first. Add the smallest focused test that would have caught the bug. The test should encode intended behavior, not mirror the current implementation.
  4. Run the new test before fixing. Confirm it fails for the intended reason. If it passes or fails for an unrelated reason, correct the test or reproduction before editing the implementation.
  5. Fix the bug. Make the smallest production change that satisfies the intended behavior while preserving nearby contracts.
  6. Rerun the regression test. Confirm the test now passes.

If a Failing Test Is Impractical

Use the closest executable regression check instead: a targeted script, manual reproduction command, browser automation, snapshot comparison, log assertion, or focused integration check.

Prefer no new test over a bad test. A bad test is one that mostly tests mocks, encodes current implementation details, depends on timing or unrelated global state, needs expensive infrastructure for a small fix, or would be deleted immediately after proving the fix.

Guardrails

  • Do not change tests merely to match a wrong implementation.
  • Do not weaken existing assertions unless the expected behavior has genuinely changed and the reason is clear.
  • Keep the regression test focused on the bug. Avoid broad fixture churn or unrelated coverage expansion.
  • If the bug is flaky, make the test deterministic where possible and document the signal being locked down.
  • If the bug exposes a broader class of failures, first land the focused regression path, then consider additional sibling coverage.

Final Response

Report the evidence, not just the outcome:

  • Name the failing-before test or executable check and the failure it produced.
  • Name the passing-after test run and any nearby validation performed.
  • If failing-before evidence could not be demonstrated, state why and describe the closest regression check used instead.
Questions fréquentes

Et si aucun test n'est pratique ?

La compétence n'en impose pas un. Elle utilise le contrôle utile le plus proche.

Le test doit-il échouer d'abord ?

Oui. Le nouveau test est exécuté avant la correction pour confirmer qu'il échoue pour la bonne raison.

Pourquoi écrire le test avant la correction ?

Cela montre d'abord que le bogue existe, puis, plus tard, que le bogue est corrigé.

Détails

Description originale de l’auteur

Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.

repo: cursor/plugins

Popularité

Étoiles GitHub
15k
Position au classement
#10999
Licence
—
Mis à jour
31/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires