hf-tdd

hf-tdd is a skill for Claude Code, Codex from hujianbest/harness-flow. It costs 44 tokens per session (881 once invoked), scanned A, original, MIT.

A reference for test-driven development, or TDD: writing a failing test, making the smallest change that passes it, and then repeating the cycle.

In plain words
What is it for?
Use it when building features, fixing bugs, or writing integration tests to choose public test boundaries and develop one small end-to-end slice at a time.
Why use it?
It helps keep tests focused on what users can observe instead of fragile implementation details or imagined future behavior.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the harness-flow plugin — 14 skills shipped together

Good fit Use it when building features, fixing bugs, or writing integration tests to choose public test boundaries and develop one small end-to-end slice at a time.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hujianbest/harness-flow/hf-tdd
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hujianbest/harness-flow --skill hf-tdd
Clone the repo
git clone --depth 1 https://github.com/hujianbest/harness-flow

Made for: Claude Code, Codex.

Or install harness-flow, the plugin that ships this one along with the rest of its 14 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hf-tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/hujianbest/harness-flow/hf-tdd/github.svg)](https://agentmods.dev/skills/hujianbest/harness-flow/hf-tdd)
Your own site
<a href="https://agentmods.dev/skills/hujianbest/harness-flow/hf-tdd"><img src="https://agentmods.dev/badge/skills/hujianbest/harness-flow/hf-tdd/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hf-tdd

Your own site · 80×15
<a href="https://agentmods.dev/skills/hujianbest/harness-flow/hf-tdd"><img src="https://agentmods.dev/badge/skills/hujianbest/harness-flow/hf-tdd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 881 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.00881
Opus 5 $0.00022 $0.00441
Sonnet 5 $0.00009 $0.00176
Haiku 4.5 $0.00004 $0.00088

Measured 11d ago against content hash 09e213e90483, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

hf-tdd scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/hf-tdd/SKILL.md · 39 lines

What it actually says

测试驱动开发

TDD 是红 → 绿循环。本技能是一份参考,旨在让这个循环产出值得保留的测试:什么是好测试、测试应放在哪里、反模式,以及循环规则。每个章节都适用于每一轮循环——应在循环开始前和进行中查阅,而不是事后才看。

探索代码库时,读取 CONTEXT.md(如果存在),使测试名称和接口词汇与项目的领域语言一致,并遵守所涉及区域中的 ADR。

什么是好测试

测试通过公共接口验证行为,而不是验证实现细节。代码可以彻底改变,测试不应随之改变。好测试读起来像一份规格——“用户可以使用有效的购物车结账”准确说明了现有能力——并且能够经受重构,因为它不关心内部结构。

示例见 tests.md,模拟指南见 mocking.md

接缝——测试放在哪里

接缝是执行测试的公共边界:你可以通过该接口观察行为,而不必深入内部。测试位于接缝处,绝不针对内部实现。

**只在预先约定的接缝处测试。**编写任何测试前,写下要测试的接缝并与用户确认。不得在未经确认的接缝处编写测试。你无法测试所有内容——预先约定接缝,才能让测试工作集中于关键路径和复杂逻辑,而不是每个边界情况。

询问:“公共接口是什么,我们应该测试哪些接缝?”

当接口本身的形态仍有疑问时——模块应该多深、接缝应位于何处、接口应暴露什么——使用 hf-codebase-design 技能获取相关词汇。它是模块、接口、深度、接缝、适配器、杠杆效应和局部性这些术语的共享来源,是需要查阅的参考,而不是要运行的一场会话。

反模式

  • 与实现耦合——模拟内部协作者、测试私有方法,或通过旁路验证(查询数据库而不是使用接口)。识别信号是:重构时行为没有改变,测试却失败了。
  • 同义反复——断言采用与代码相同的方式重新计算期望值(expect(add(a, b)).toBe(a + b)、以同样方式手工推导的快照、断言常量等于自身),因此测试从构造上就必然通过,永远无法与代码产生分歧。期望值必须来自独立的事实来源——已知正确的字面值、推演过的示例或规格。
  • 水平切片——先编写所有测试,再编写全部实现。批量测试验证的是_想象出来的_行为:你测试的是事物的_形态_而不是面向用户的行为,测试对真实变化变得不敏感,而且在理解实现之前就确定了测试结构。应改用垂直切片——一个测试 → 一个实现 → 重复;每个测试都是一枚曳光弹,根据上一轮循环学到的内容作出响应。

循环规则

  • **先红后绿。**先编写失败的测试,再只编写足以使其通过的代码。不要预判未来的测试,也不要添加臆测性的功能。
  • **每次只做一个切片。**每轮循环只处理一个接缝、一个测试和一个最小实现。
  • **重构不属于该循环。**它属于 hf-review 代码门,而不是红 → 绿实现循环。
Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 39 lines · 44 tokens per session scan A 09e213e90483

Subscribe to this mod's changes

hf-tdd is a skill published in the GitHub repository hujianbest/harness-flow (53 stars, last pushed 10d ago), licensed MIT. It adds 44 tokens to every session and 881 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.