Skip to content
Back to skills

Tdd Assistant

ASecurity

[UDS] 引導測試驅動開發(TDD)流程:紅-綠-重構

  • 86 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 4, 2026
developmentbashcode-review

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add AsiaOstrich/universal-dev-standards --skill tdd-assistant --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tdd Assistant?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tdd Assistant
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/asiaostrich-tdd-assistant-9341dbe7/badge)](https://www.skillsdirectory.com/skills/asiaostrich-tdd-assistant-9341dbe7)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
source: ../../../../skills/tdd-assistant/SKILL.md
source_version: 1.0.0
translation_version: 1.0.0
last_synced: 2026-02-10
status: current
description: "[UDS] 引導測試驅動開發(TDD)流程:紅-綠-重構"
name: tdd
allowed-tools: Read, Write, Grep, Glob, Bash(npm test:*), Bash(npx vitest:*)
scope: partial
argument-hint: "[feature or file | 功能或檔案]"
---

# TDD 助手

> **語言**: [English](../../../../skills/tdd-assistant/SKILL.md) | 繁體中文

引導測試驅動開發(TDD)流程:紅-綠-重構。

## TDD 循環

```
    ┌─────┐       ┌───────┐       ┌──────────┐
    │ RED │ ────► │ GREEN │ ────► │ REFACTOR │
    └─────┘       └───────┘       └──────────┘
       ▲                                │
       └────────────────────────────────┘
```

## 工作流程

### 階段 1:RED - 撰寫失敗測試
- 撰寫描述期望行為的測試
- 執行測試 - 確認它因**正確的原因失敗**
- 使用 AAA 模式(Arrange-Act-Assert)

### 階段 2:GREEN - 讓測試通過
- 撰寫**最少的**程式碼使測試通過
- 此階段可以接受硬編碼
- 執行測試 - 確認它**通過**

### 階段 3:REFACTOR - 改善程式碼
- 消除重複(DRY)
- 改善命名和結構
- **每次**修改後都執行測試
- 不新增功能

## FIRST 原則

| 原則 | 說明 | Description |
|------|------|-------------|
| **F**ast | 測試快速執行(< 100ms/單元) | Tests run quickly |
| **I**ndependent | 測試間無共享狀態 | No shared state between tests |
| **R**epeatable | 每次結果相同 | Same result every time |
| **S**elf-validating | 明確的通過/失敗結果 | Clear pass/fail result |
| **T**imely | 在產品程式碼之前撰寫 | Written before production code |

## 使用方式

- `/tdd` - 開始互動式 TDD 工作階段
- `/tdd calculateTotal` - 對特定函式進行 TDD
- `/tdd "user can login"` - 對使用者故事進行 TDD

## 下一步引導

`/tdd` 完成後,AI 助手應建議:

> **TDD 循環完成。建議下一步:**
> - 執行 `/checkin` 通過品質關卡
> - 執行 `/coverage` 確認測試覆蓋率
> - 執行 `/code-review` 自我審查程式碼

## 參考

- 詳細指南:[guide.md](./guide.md)
- 核心規範:[test-driven-development.md](../../../../core/test-driven-development.md)

Files in this skill

  • SKILL.md2.5 KB
  • guide.md10.1 KB
  • language-examples.md12.5 KB
  • tdd-workflow.md20.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.