원클릭으로
tdd-loop
Test-driven development loop for workflows - write tests first, then implementation
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Test-driven development loop for workflows - write tests first, then implementation
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | tdd-loop |
| description | Test-driven development loop for workflows - write tests first, then implementation |
Use this skill to follow test-driven development practices for workflow implementation.
#!/usr/bin/env python3
"""Tests for workflow."""
from pathlib import Path
from workflow_name import WorkflowClass, WorkflowParams
def test_workflow_basic():
"""Test basic workflow execution."""
params = WorkflowParams()
workflow = WorkflowClass(params, workflow_dir=Path(__file__).parent)
result = workflow.run()
assert result == 0 # Success
# Add more assertions
def test_workflow_with_params():
"""Test workflow with specific parameters."""
params = WorkflowParams(param1="value")
workflow = WorkflowClass(params, workflow_dir=Path(__file__).parent)
result = workflow.run()
assert result == 0
# Verify outputs, side effects, etc.
def test_workflow_error_handling():
"""Test workflow handles errors gracefully."""
params = WorkflowParams(invalid="value")
workflow = WorkflowClass(params, workflow_dir=Path(__file__).parent)
# Should handle error, not crash
result = workflow.run()
assert result != 0 # Non-zero exit code for errors
The dry run is a form of integration testing with mocks:
#!/usr/bin/env python3
"""Dry run with mock data."""
from raw_runtime import DryRunContext
def mock_external_api(ctx: DryRunContext):
"""Mock API call that would normally fetch real data."""
return {
"data": "mock_value",
"status": "success"
}
def mock_file_write(ctx: DryRunContext):
"""Mock file writing - don't actually write."""
ctx.log("Would write to file: results/output.json")
return True
# 1. RED: Write failing test
def test_fetch_stock_data():
result = fetch_stock_data("AAPL")
assert result["symbol"] == "AAPL"
assert "price" in result
# Run: pytest test.py -k test_fetch (FAILS - function doesn't exist)
# 2. GREEN: Minimal implementation
def fetch_stock_data(symbol: str) -> dict:
return {"symbol": symbol, "price": 150.0} # Hardcoded for now
# Run: pytest test.py -k test_fetch (PASSES)
# 3. REFACTOR: Real implementation
def fetch_stock_data(symbol: str) -> dict:
from tools.yahoo_finance import get_quote
data = get_quote(symbol)
return {"symbol": data.symbol, "price": data.current_price}
# Run: pytest test.py -k test_fetch (PASSES)
Design multi-service architectures with RAW workflows as components
Writing effective dry_run.py mocks for workflow testing without external dependencies
Guide for creating structured plans with numbered steps and quality gates
Understanding and passing workflow quality gates (validate, dry, pytest, ruff, typecheck)
Creating reusable tools in tools/ directory that workflows can import and use
Create Agent Skills that comply with the agentskills.io specification. Use when the user asks to create a new skill, add agent capabilities, or build reusable instructions.