Agent Skills
› NeverSight/learn-skills.dev
› ac-tdd-runner
ac-tdd-runner
GitHub自动化测试驱动开发(TDD)流程,强制执行红-绿-重构循环。通过先写失败测试、最小化实现直至通过、最后优化代码结构,确保功能以测试优先方式高质量交付,提升代码可维护性。
Trigger Scenarios
使用测试驱动开发实施新功能
自动化TDD工作流程
执行红-绿-重构周期
确保测试优先的开发实践
Install
npx skills add NeverSight/learn-skills.dev --skill ac-tdd-runner -g -y
SKILL.md
Frontmatter
{
"name": "ac-tdd-runner",
"description": "Run TDD cycle for feature implementation. Use when implementing features with RED-GREEN-REFACTOR, running test-driven development, automating TDD workflow, or ensuring test-first development."
}
AC TDD Runner
Automate the Test-Driven Development cycle for feature implementation.
Purpose
Enforces the RED-GREEN-REFACTOR cycle, ensuring all features are implemented with test-first methodology for quality and maintainability.
Quick Start
from scripts.tdd_runner import TDDRunner
runner = TDDRunner(project_dir)
result = await runner.run_cycle(feature)
TDD Cycle
RED Phase
Write failing tests first:
red_result = await runner.red_phase(feature)
# Creates test file with failing tests
# Verifies tests actually fail
GREEN Phase
Implement minimum code to pass:
green_result = await runner.green_phase(feature)
# Implements code
# Runs tests until all pass
# Minimum necessary implementation
REFACTOR Phase
Clean up while tests pass:
refactor_result = await runner.refactor_phase(feature)
# Improve code structure
# Ensure tests still pass
# Apply coding standards
Cycle Result
{
"feature_id": "auth-001",
"cycle_complete": true,
"phases": {
"red": {
"success": true,
"tests_created": 5,
"all_tests_fail": true
},
"green": {
"success": true,
"iterations": 3,
"all_tests_pass": true
},
"refactor": {
"success": true,
"changes_made": ["extracted_helper", "renamed_variable"],
"tests_still_pass": true
}
},
"coverage": 92.5,
"duration_ms": 120000
}
RED Phase Details
- Generate test file from feature test_cases
- Write test functions with proper structure
- Run tests to verify they fail
- If tests pass unexpectedly, add more specific assertions
GREEN Phase Details
- Analyze failing tests
- Write minimum implementation
- Run tests
- If tests fail, iterate on implementation
- Stop when all tests pass
REFACTOR Phase Details
- Identify code smells
- Apply refactoring patterns
- Run tests after each change
- Revert if tests fail
- Continue until code is clean
Configuration
{
"max_green_iterations": 10,
"coverage_threshold": 80,
"refactoring_patterns": [
"extract_method",
"rename_for_clarity",
"remove_duplication"
],
"test_framework": "pytest"
}
Integration
- Uses:
ac-test-generatorfor RED phase - Uses:
ac-criteria-validatorfor GREEN verification - Reports to:
ac-task-executor
API Reference
See scripts/tdd_runner.py for full implementation.
Version History
- e0220ca Current 2026-07-05 23:06


