跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code. Enforces red-green-refactor cycle with strict rules.

peintune · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add peintune/runjam --skill test-driven-development

技能说明


name: test-driven-development description: "Use when implementing any feature or bugfix, before writing implementation code. Enforces red-green-refactor cycle with strict rules."

Test-Driven Development (TDD)

Rule

Write the test first. Watch it fail. Write minimal code to pass.

Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.

When to Use

Always for:

  • New features
  • Bug fixes
  • Refactoring with behavior changes

Skip only for:

  • Config file changes
  • Documentation updates
  • Non-functional changes (formatting, comments)

Process

  1. Red: Write a failing test
  2. Green: Write minimal code to pass
  3. Refactor: Clean up while keeping tests green

Anti-Patterns

  • Writing implementation before the test
  • Skipping the "watch it fail" step
  • Writing tests that are too coupled to implementation
  • Testing framework behavior instead of your code