Logo de Hai Tdd

Hai Tdd

Communauté
hylarucoder
hai-tdd

Drives a real behavior change through red-green-refactor and records the failing RED evidence, minimal GREEN implementation, refactor decision, and verification commands. Use when the user explicitly asks for TDD/tests first, adds or fixes testable behavior, or needs regression protection(先写测试、红绿重构、补回归测试). Do not force TDD onto documentation, configuration, styling, renames, package moves, or other purely structural changes; report honest non-TDD verification instead.

Présentation

Éditeurhylarucoder
Dépôthai-stack
Nom de la compétencehai-tdd
Étoiles
284
Forks
15
Fichiers inclus
3
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont en simple Markdown, et non en code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • 3 fichiers inclus

    Des scripts, des modèles de documents et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par hylarucoder sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Hai Tdd dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Collez l’URL du dossier de la compétence indiquée ci-dessous, puis confirmez.
    https://github.com/hylarucoder/hai-stack/tree/main/skills/hai-tdd
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter → Via URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hylarucoder/hai-stack.git /tmp/hai-stack
mkdir -p .claude/skills
cp -r /tmp/hai-stack/skills/hai-tdd .claude/skills/hai-tdd
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Hai Tdd dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Hai Tdd dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, Hai Tdd n’est pas lié au modèle pour lequel cette compétence a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

Hai TDD

For Chinese readers, see SKILL.zh_CN.md. The English SKILL.md is the execution source of truth.

Overview

Drive development with tests: write a failing test first, confirm it fails for the right reason, write the smallest implementation that passes, then refactor while keeping tests green. This is not "add tests at the end" — TDD defines behavior before implementation.

Core Principle

Red, then green, then refactor.

Do not write production code before a failing test. A test that never failed first has not proven it constrains the target behavior — so the RED failure is the evidence, not a formality. If implementation already exists without a test, do not call the process TDD; either label it as tests-after or return to a test-first path.

Do not invent a test merely to satisfy the ritual. TDD is for behavior and stable contracts, not for creating ad hoc structural tripwires around a one-off cleanup.

When TDD does not fit

Select honest non-TDD verification without pausing for permission when:

  • The work is a throwaway prototype or a spike, or the user asked for code reading before implementation.
  • The change is pure configuration, copy, or styling.
  • The behavior cannot reasonably be verified automatically yet.
  • The change is purely structural and has no meaningful behavior-level RED, such as deleting a field, narrowing an interface, moving a type, renaming a symbol, removing an exported helper, or changing package ownership.

In these cases, say TDD does not fit this slice. Use compile failures, existing tests, static checks, or tests-after verification instead of manufacturing a RED test. Ask the user only when the choice would materially change the requested behavior or scope.

No Fake RED

Never add tests whose only purpose is to make a structural refactor look like TDD. Do not add:

  • AST/regex/reflection scans for a one-time shape cleanup.
  • White-box guards that inspect source rather than a durable behavior or policy boundary.
  • Tests that duplicate compiler checks unless the repository already maintains that policy class.
  • One-off guards for renames, package moves, aliases, or visibility changes.

Architecture/static boundary tests are allowed only when all of the following are true:

  • The boundary is a durable policy the project intends to keep checking over time.
  • The test failure would catch a likely future regression, not just document today's edit.
  • The user explicitly wants that kind of guard, or the repository already has an established policy-test pattern.

When no legitimate RED exists, prefer this sentence over a fake test: "No TDD for this slice: this is a structural refactor. I will validate it with compiler errors, existing tests, and focused runtime checks."

Workflow

  1. Define the target behavior.

    • Pick one minimal behavior slice.
    • State input, output, side effect, boundary, and failure condition.
    • If the slice is only structural, stop here and report "not TDD" instead of forcing RED.
    • If the work is too broad, use hai-goal to split it into verifiable phases.
  2. RED: write the failing test first.

    • The test name should describe behavior, not say "works".
    • Test one behavior at a time.
    • Prefer public APIs, user-observable behavior, or stable boundaries — they keep the test stable when you refactor internals.
    • Avoid mocks unless external systems, time, network, randomness, or permissions force them; mocks tie the test to implementation and hide real behavior.
  3. Verify RED.

    • Run the smallest relevant test command and confirm the test fails.
    • Confirm it fails because the target behavior is missing, not because of syntax, imports, bad test code, or environment setup — that distinction is what makes the RED a real constraint rather than a broken test.
    • If the test passes immediately, do not damage it merely to manufacture RED. Determine whether the behavior already exists, the reproduction is wrong, or this is regression/tests-after work, then label the evidence honestly.
  4. GREEN: write the minimal implementation.

    • Write only enough code to pass the current test. Extra code is unverified by any failing test, so it falls outside TDD's safety net.
    • Do not add future features and do not mix in unrelated refactors.
    • Do not skip the minimal implementation step for a larger "complete" design.
  5. Verify GREEN.

    • Rerun the relevant tests.
    • Confirm the new test passes.
    • Based on risk, run broader tests for the directory, module, or full suite.
  6. REFACTOR.

    • Refactor only after green.
    • Improve duplication, naming, structure, or boundaries.
    • Rerun tests after refactoring.
  7. Continue with the next behavior.

    • Every new behavior returns to RED.
    • Do not put multiple behaviors into one large test.

Test Quality Bar

Good TDD tests:

  • Test behavior rather than implementation details.
  • Have names that communicate business or system meaning.
  • Fail with a message that points to the missing behavior.
  • Are stable under refactoring.
  • Are small, but not brittle white-box tests.
  • Serve as behavior documentation for future maintainers.

Common Mistakes

Traps not already caught by the workflow steps above:

  • Forcing TDD onto structural cleanup by writing AST/grep/reflection guard tests that do not protect user-visible behavior or a stable contract.
  • Distorting the production API just to make tests convenient — the test should adapt to a good design, not the design to the test.
  • Testing only whether a mock was called, not the real behavior, so the test passes even when the behavior is wrong.

Use a different skill when

  • The work is too broad to slice into one verifiable behavior, or the goal/phasing is unclear — use hai-goal to turn it into verifiable phases first, then return here to drive each phase.
  • The question is module boundaries, abstraction depth, or dependency direction rather than behavior under test — use hai-architecture.
  • You are deciding whether the feature is worth building at all — use hai-idea.
  • You are choosing the name of the unit, function, or concept under test — use hai-naming.

Output

Report using references/output-template.md — fill every RED / GREEN / REFACTOR field with real evidence when TDD applies; do not collapse it to "tested, passing". If no legitimate RED exists, use the template's "No Legitimate RED" path instead of pretending. Read the template before finalizing.

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Hai Tdd ?

Drives a real behavior change through red-green-refactor and records the failing RED evidence, minimal GREEN implementation, refactor decision, and verification commands. Use when the user explicitly asks for TDD/tests first, adds or fixes testable behavior, or needs regression protection(先写测试、红绿重构、补回归测试). Do not force TDD onto documentation, configuration, styling, renames, package moves, or other purely structural changes; report honest non-TDD verification instead.

Pourquoi utiliser Hai Tdd sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Hai Tdd se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Hai Tdd dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/hylarucoder/hai-stack/tree/main/skills/hai-tdd. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Hai Tdd ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Hai Tdd ?

Autant que vous le souhaitez. Tant qu’un modèle prend en charge les compétences, vous pouvez utiliser Hai Tdd avec lui : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Hai Tdd est-elle gratuite ?

Cette compétence est publiée sur GitHub par hylarucoder. Consultez le dépôt pour connaître les conditions de licence. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, modèles de documents ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇