Hai Tdd logo

Hai Tdd

Community
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.

Overview

Publisherhylarucoder
Repositoryhai-stack
Skill namehai-tdd
Stars
284
Forks
15
Bundled files
3
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by hylarucoder on GitHub. Read the source before you install it.

Installation

Install the Hai Tdd AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hai Tdd in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hai Tdd on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hai Tdd is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Hai Tdd AI skill do?

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.

Why use Hai Tdd on TypingMind?

Because you install it once and use it with any model. Hai Tdd is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hai Tdd in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/hylarucoder/hai-stack/tree/main/skills/hai-tdd. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Hai Tdd?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hai Tdd?

As many as you like. As long as a model supports skills, you can use Hai Tdd with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hai Tdd AI skill free?

It is published on GitHub by hylarucoder. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇