tdd-workflow
Skill0 starsChanged 13 months agoMITView on GitHub
Test-Driven Development workflow with red-green-refactor pattern and best practices
- Installs packages
78 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- mnzralee/claude-multi-agent-architecturetheir own version, first seen Oct 3, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- kapadias/nonnatheir own version, first seen Oct 1, 2026
- imMamdouhaboammar/tiktok-growth-automation-meshtheir own version, first seen Oct 1, 2026
- smitshivalkar-spectims4567/hsj-agent-skillstheir own version, first seen Sep 29, 2026
Used with
Projects with it also use kotlin-testing, ralphinho-rfc-pipeline and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tpavanipradeepSkillkotlin-testing
Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.
Also in 6 projects that use this
InfopibeSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 10 projects that use this
mryeastcodeSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 5 projects that use this
saxon-ySkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 12 projects that use this
InfopibeSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 12 projects that use this
WorldFlowAISkillproject-guidelines-example
Also in 19 projects that use this
- +2 more from Infopibe
Other versions78 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- talayash/agentrium★ 4216% same
Wrote their own version · 77
- WorldFlowAI/everything-claude-code★ 4ksame name
- xu-xiang/everything-claude-code-zh★ 2ksame name
- zhukunpenglinyutong/ai-max★ 335same name
- loulanyue/awesome-claude-notes★ 272same name
- ab604/claude-code-r-skills★ 205same name
- cloudnative-co/claude-code-starter-kit★ 151same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- hellangleZ/burn-in-cceverywhere-ralph★ 112same name
- cohen-liel/hivemind★ 110same name
67 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- aws-cost-analyzerSkill
- code-reviewerSkill
- dast-scannerSkill
- database-optimizerSkill
- dependency-checkerSkill
- git-workflowSkill
- java-profilerSkill
- jira-integrationSkill
- memory-analyzerSkill
- penetration-testerSkill
- performance-monitorSkill
- python-profilerSkill
- refactoring-assistantSkill
- sast-analyzerSkill
- security-scannerSkill
- skill-validatorSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 72 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Test-Driven Development (TDD) skill implementing the red-green-refactor cycle, test-first development, and comprehensive testing strategies …
- Distinctive: line 14
Red: Write failing test first
- Distinctive: line 15
Green: Write minimal code to pass
- Distinctive: line 24
Test doubles (mocks, stubs, spies)
- Distinctive: line 406
100%: Not always necessary or practical
“Common” is measured: kept by at least 6 in 10 of the 72 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TDD Workflow Skill
Overview
Test-Driven Development (TDD) skill implementing the red-green-refactor cycle, test-first development, and comprehensive testing strategies across multiple languages and frameworks.
Capabilities
1. TDD Cycle Implementation
- Red: Write failing test first
- Green: Write minimal code to pass
- Refactor: Improve code while keeping tests green
- Test coverage tracking
- Continuous test execution
2. Testing Strategies
- Unit testing
- Integration testing
- End-to-end testing
- Test doubles (mocks, stubs, spies)
- Parameterized testing
3. Multi-Language Support
- Python: pytest, unittest
- JavaScript: Jest, Mocha, Vitest
- Java: JUnit, TestNG, Mockito
- Go: testing package
- Ruby: RSpec
- .NET: xUnit, NUnit
TDD Principles
The Three Laws of TDD
- Don't write production code until you have a failing test
- Don't write more of a test than is sufficient to fail
- Don't write more production code than is sufficient to pass the test
Red-Green-Refactor Cycle
1. RED: Write a failing test
↓
2. GREEN: Make it pass (simplest way)
↓
3. REFACTOR: Improve the code
↓
RepeatPython TDD with pytest
Setup
pip install pytest pytest-cov pytest-watchExample Workflow
Step 1: RED - Write failing test
# test_calculator.py
import pytest
from calculator import Calculator
def test_add_two_numbers():
calc = Calculator()
result = calc.add(2, 3)
assert result == 5 # This will fail - Calculator doesn't exist yet!Run test:
pytest test_calculator.py
# ❌ FAIL: ModuleNotFoundError: No module named 'calculator'Step 2: GREEN - Make it pass
# calculator.py
class Calculator:
def add(self, a, b):
return a + bRun test:
pytest test_calculator.py
# ✅ PASS: 1 passedStep 3: REFACTOR - Improve code
# calculator.py
class Calculator:
def add(self, a: int, b: int) -> int:
"""Add two numbers and return the result."""
return a + bRun test again:
pytest test_calculator.py
# ✅ PASS: 1 passed (still works!)Advanced Testing
Parameterized Tests
import pytest
@pytest.mark.parametrize("a,b,expected", [
(2, 3, 5),
(0, 0, 0),
(-1, 1, 0),
(100, 200, 300)
])
def test_add_multiple_cases(a, b, expected):
calc = Calculator()
assert calc.add(a, b) == expectedTest Fixtures
@pytest.fixture
def calculator():
return Calculator()
def test_add(calculator):
assert calculator.add(2, 3) == 5
def test_subtract(calculator):
assert calculator.subtract(5, 3) == 2Mocking
from unittest.mock import Mock, patch
def test_api_call():
with patch('requests.get') as mock_get:
mock_get.return_value.status_code = 200
mock_get.return_value.json.return_value = {'data': 'test'}
result = fetch_data('http://api.example.com')
assert result == {'data': 'test'}JavaScript TDD with Jest
Setup
npm install --save-dev jest @types/jestExample Workflow
Step 1: RED
// calculator.test.js
const Calculator = require('./calculator');
describe('Calculator', () => {
test('adds two numbers', () => {
const calc = new Calculator();
expect(calc.add(2, 3)).toBe(5); // FAIL: Calculator not defined
});
});Step 2: GREEN
// calculator.js
class Calculator {
add(a, b) {
return a + b;
}
}
module.exports = Calculator;Step 3: REFACTOR
// calculator.js
class Calculator {
/**
* Adds two numbers
* @param {number} a - First number
* @param {number} b - Second number
* @returns {number} Sum of a and b
*/
add(a, b) {
if (typeof a !== 'number' || typeof b !== 'number') {
throw new TypeError('Both arguments must be numbers');
}
return a + b;
}
}
module.exports = Calculator;Jest Features
Test Coverage
jest --coverageWatch Mode
jest --watchMocking
// Mock API call
jest.mock('./api');
const api = require('./api');
test('fetches data', async () => {
api.fetchData.mockResolvedValue({ data: 'test' });
const result = await getData();
expect(result.data).toBe('test');
});Java TDD with JUnit 5
Setup (Maven)
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>Example Workflow
Step 1: RED
// CalculatorTest.java
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class CalculatorTest {
@Test
void testAdd() {
Calculator calc = new Calculator();
assertEquals(5, calc.add(2, 3)); // FAIL: Calculator not found
}
}Step 2: GREEN
// Calculator.java
public class Calculator {
public int add(int a, int b) {
return a + b;
}
}Step 3: REFACTOR
// Calculator.java
public class Calculator {
/**
* Adds two integers
* @param a first integer
* @param b second integer
* @return sum of a and b
*/
public int add(int a, int b) {
return Math.addExact(a, b); // Throws on overflow
}
}JUnit 5 Features
Parameterized Tests
@ParameterizedTest
@CsvSource({
"2, 3, 5",
"0, 0, 0",
"-1, 1, 0"
})
void testAddMultipleCases(int a, int b, int expected) {
Calculator calc = new Calculator();
assertEquals(expected, calc.add(a, b));
}Test Lifecycle
@BeforeEach
void setUp() {
calc = new Calculator();
}
@AfterEach
void tearDown() {
calc = null;
}Mockito Integration
@ExtendWith(MockitoExtension.class)
class ServiceTest {
@Mock
private Repository repository;
@InjectMocks
private Service service;
@Test
void testServiceMethod() {
when(repository.findById(1)).thenReturn(Optional.of(entity));
Result result = service.process(1);
assertEquals("expected", result.getValue());
}
}TDD Best Practices
1. Write Tests First
❌ BAD: Write code, then test
✅ GOOD: Write test, then code2. Small Steps
# Don't try to implement everything at once
def test_calculator():
calc = Calculator()
assert calc.add(2, 3) == 5 # Start simple
# Later add more tests:
# - multiply
# - divide
# - error handling3. One Test at a Time
✅ Write one test
✅ Make it pass
✅ Refactor
❌ Don't write multiple failing tests4. Test Behavior, Not Implementation
# ❌ BAD: Testing implementation details
def test_uses_dictionary():
cache = Cache()
assert isinstance(cache._storage, dict)
# ✅ GOOD: Testing behavior
def test_stores_and_retrieves_value():
cache = Cache()
cache.set('key', 'value')
assert cache.get('key') == 'value'5. Fast Tests
# ✅ Fast: In-memory operations
def test_calculation():
result = calculate(2, 3)
assert result == 5
# ❌ Slow: Database/network operations (use mocks)
def test_database():
# Use test database or mock instead
passTest Coverage
Aim for High Coverage
# Python
pytest --cov=src --cov-report=html
# JavaScript
jest --coverage
# Java
mvn test jacoco:reportCoverage Guidelines
- 80-90%: Good target for most projects
- 100%: Not always necessary or practical
- Focus: Critical business logic > boilerplate
Coverage Report Example
Name Stmts Miss Cover
---------------------------------------
calculator.py 10 0 100%
database.py 50 5 90%
utils.py 20 8 60%
---------------------------------------
TOTAL 80 13 84%Continuous Testing
pytest-watch
# Auto-run tests on file changes
pytest-watchJest watch mode
# Interactive test runner
jest --watchGradle continuous testing
# Java continuous testing
gradle test --continuousIntegration Scripts
tdd_helper.sh
TDD workflow automation:
#!/bin/bash
# TDD workflow helper
ACTION=$1
case $ACTION in
"red")
echo "🔴 RED: Writing failing test..."
echo "1. Write a test that fails"
echo "2. Run: npm test / pytest / mvn test"
;;
"green")
echo "🟢 GREEN: Making test pass..."
echo "1. Write minimal code to pass"
echo "2. Run tests again"
;;
"refactor")
echo "🔵 REFACTOR: Improving code..."
echo "1. Improve code quality"
echo "2. Keep tests green"
echo "3. Run tests continuously"
;;
"watch")
echo "👀 Starting watch mode..."
if [ -f "package.json" ]; then
jest --watch
elif [ -f "pytest.ini" ] || [ -f "setup.py" ]; then
pytest-watch
else
echo "No test framework detected"
fi
;;
*)
echo "Usage: $0 {red|green|refactor|watch}"
;;
esactest_coverage_checker.py
Enforce coverage standards:
#!/usr/bin/env python3
import json
import sys
def check_coverage(coverage_json, threshold=80):
"""Check if test coverage meets threshold"""
with open(coverage_json) as f:
data = json.load(f)
total_coverage = data['totals']['percent_covered']
print(f"Test Coverage: {total_coverage:.1f}%")
if total_coverage < threshold:
print(f"❌ FAIL: Coverage below {threshold}%")
sys.exit(1)
else:
print(f"✅ PASS: Coverage meets {threshold}% threshold")
sys.exit(0)
if __name__ == '__main__':
check_coverage('coverage.json', threshold=80)Common TDD Patterns
1. Arrange-Act-Assert (AAA)
def test_user_creation():
# Arrange
username = "testuser"
email = "test@example.com"
# Act
user = User.create(username, email)
# Assert
assert user.username == username
assert user.email == email2. Given-When-Then (BDD style)
describe('User Login', () => {
it('should authenticate valid credentials', () => {
// Given
const user = createUser('john', 'password123');
// When
const result = authenticate('john', 'password123');
// Then
expect(result.success).toBe(true);
});
});3. Test Doubles
# Dummy: Passed but never used
def test_with_dummy():
dummy = DummyLogger()
service = Service(dummy)
# Stub: Returns canned responses
def test_with_stub():
stub = StubDatabase()
stub.set_return_value([User('test')])
# Mock: Verifies interactions
def test_with_mock():
mock = Mock()
service.notify(mock)
mock.send.assert_called_once()Requirements
# Python
pip install pytest pytest-cov pytest-watch pytest-mock
# JavaScript
npm install --save-dev jest @testing-library/react
# Java
# Add JUnit 5 + Mockito to Maven/Gradle
# Coverage tools
# Python: coverage.py (included with pytest-cov)
# JavaScript: built into Jest
# Java: JaCoCoMetrics to Track
- Test coverage: > 80%
- Test execution time: < 1 minute for unit tests
- Test count: Growing with features
- Failure rate: Quick to identify and fix
- Refactoring safety: Tests enable confident refactoring
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

