بنقرة واحدة
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 ويثبّتها لك.
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.
استنادا إلى تصنيف 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)