agentleFS
PANYUXIN6PANYUXIN6/pyx-skills/tdd/SKILL.md

tdd

Skill8 starsChanged 4 months agoMITView on GitHub

通过连贯的红—绿—重构切片执行测试驱动开发。用户明确要求 TDD、先写测试、红—绿—重构,或在修复缺陷前先补回归测试时使用。新增或修改测试时,始终与 testing-guidelines 搭配;普通测试请求只使用 testing-guidelines,不使用本技能。

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use make-bot-ui, Poteto Mode and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • eryzerzSkill

    make-bot-ui

    Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.

    Also in 8 projects that use this

  • jtarorehSkill

    Poteto Mode

    poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work. Use for poteto, /poteto-mode, or requests to work in this style.

    Also in 5 projects that use this

  • risadamsSkill

    which-skill

    Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.

    Also in 7 projects that use this

  • TheOnlyFusionCubeSkill

    principle-attack-the-premise

    Inventory who actually owns or exhibits the imbalance, then challenge the shared premise before writing another patch. Use when two or more fixes that share one premise have failed the same gate.

    Also in 11 projects that use this

  • TheOnlyFusionCubeSkill

    principle-test-behavior-not-implementation

    Call the system the way its consumer does and assert meaningful observable output; avoid mocks or assertions that only mirror internal calls. Use when when writing or evaluating tests.

    Also in 11 projects that use this

  • shreyT19Skill

    principle-laziness-protocol

    Apply when refactoring, evaluating diff size, or tempted to add abstractions, layers, or signal threading. Bias toward deletion and the smallest change that solves the problem.

    Also in 22 projects that use this

The file

Files
SKILL.md

让测试先行地实现功能

负责已确认行为、失败证据、实现和局部重构之间的顺序。使用 testing-guidelines 选择并验证测试证据;本技能只负责测试优先的开发循环。

在 RED 前确定行为

从需求、契约、验收标准、不变量或已确认的回归问题开始。进入循环前,先解决会实质改变公开行为或用户可见行为的歧义。不要让测试凭空创造新需求。

每个连贯切片按以下顺序推进:

需求 -> 验收标准 -> 测试用例 -> RED -> GREEN -> REFACTOR

保持 TDD 关卡

  • 观察到有意义的 RED。 在实现前运行所选证据;只有目标行为确实缺失或已损坏时,才接受该失败。构建、夹具、导入和环境失败都属于准备失败。
  • 实现合理的 GREEN。 仅添加当前切片需要的生产行为,同时保持现有架构和契约。不要为了最快通过而牺牲可维护性或正确性。
  • 局部重构。 只改进当前实现已有理由支持的部分,保持所有相关证据为绿,并避免无关清理或大范围重设计。

使用连贯的纵向切片

对每个尚未完成的行为:

  1. 用 testing-guidelines 为该行为选择最小且可信的证据。
  2. 添加证据并观察到有效的失败。
  3. 只实现该切片所需的内容。
  4. 运行聚焦证据并保持通过。
  5. 只有能改进当前切片时才重构,然后再次验证通过。

一个切片是一项连贯的行为或契约,不一定只对应一个测试函数。完成一个切片后再开始独立行为,确保每次失败和通过都有清晰原因。

无法产生真实 RED 的情况

对于特征测试或保持行为不变的重构,目标行为可能已经存在,因此真实失败既不安全也不可行。说明替代证据,保留当前行为,不要为了模仿 TDD 顺序而制造没有意义的失败。

只有未解决的权限、公开行为,或为了可测试性而进行的重大架构调整会实质改变实现时,才询问用户。普通的执行顺序、接缝和局部重构无需额外审批。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.