/tdd
Comprehensive test-driven development orchestrator with language-aware test generation and Red-Green-Refactor workflow automation
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/tdd
Context preview
What this command does when you run it.
Comprehensive test-driven development orchestrator with language-aware test generation and Red-Green-Refactor workflow automation
Command definition
tdd.mdallowed-tools: Task, Read, Write, Edit, MultiEdit, Bash(fd:*), Bash(rg:*), Bash(eza:*), Bash(bat:*), Bash(jq:*), Bash(gdate:*), Bash(mvn:*), Bash(gradle:*), Bash(cargo:*), Bash(go:*), Bash(deno:*)
name: "Tdd"
description: "Comprehensive test-driven development orchestrator with language-aware test generation and Red-Green-Refactor workflow automation"
author: "wcygan"
tags: ["test","run"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"
Context
- Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
- TDD target: $ARGUMENTS
- Current directory: !`pwd`
- Project structure: !`eza -la --tree --level=2 2>/dev/null | head -10 || fd . -t d -d 2 | head -8`
- Build files detected: !`fd "(package\.json|Cargo\.toml|go\.mod|pom\.xml|build\.gradle|deno\.json)" . -d 3 | head -5 || echo "No build files detected"`
- Existing test files: !`fd "(test|spec)" . -t f | head -5 || echo "No test files found"`
- Language tools status: !`echo "deno: $(which deno >/dev/null && echo ✓ || echo ✗) | cargo: $(which cargo >/dev/null && echo ✓ || echo ✗) | go: $(which go >/dev/null && echo ✓ || echo ✗) | mvn: $(which mvn >/dev/null && echo ✓ || echo ✗)"`
- Git status: !`git status --porcelain 2>/dev/null | head -3 || echo "Not a git repository"`
Your Task
STEP 1: Initialize TDD session and analyze project architecture
- CREATE session state file: `/tmp/tdd-session-$SESSION_ID.json`
- ANALYZE project structure and technology stack from Context section
- DETECT primary language and testing framework
- IDENTIFY existing test patterns and conventions
# Initialize TDD session state
echo '{
"sessionId": "'$SESSION_ID'",
"tddTarget": "'$ARGUMENTS'",
"detectedLanguage": "auto-detect",
"testingFramework": "auto-detect",
"tddPhase": "red",
"testFilePath": "",
"implementationPath": ""
}' > /tmp/tdd-session-$SESSION_ID.jsonSTEP 2: Language-aware project analysis with intelligent framework detection
TRY:
CASE detected_language: WHEN "rust":
- VALIDATE Cargo.toml exists and analyze dependencies
- DETECT testing strategy: unit tests (`#[cfg(test)]`) vs integration tests (`tests/`)
- IDENTIFY existing test modules and patterns
- SET testing framework: "cargo_test" with potential criterion for benchmarks
WHEN "go":
- VALIDATE go.mod exists and analyze module structure
- DETECT testing strategy: standard library vs testify framework
- IDENTIFY table-driven test patterns in existing code
- SET testing framework: "go_test" with build tags and coverage support
WHEN "java":
- DETECT build system: Maven (pom.xml) vs Gradle (build.gradle)
- IDENTIFY testing framework: JUnit 5, TestNG, or legacy JUnit 4
- ANALYZE test directory structure and naming conventions
- SET testing framework based on dependencies and existing patterns
WHEN "typescript" OR "javascript":
- DETECT runtime: Deno vs Node.js vs browser environment
- IF Deno project: USE Deno.test() with built-in test runner
- IF Node.js: IDENTIFY framework (Jest, Vitest, Mocha, etc.)
- ANALYZE existing test structure and mocking patterns
WHEN "unknown":
- LAUNCH sub-agent for comprehensive language detection
- ANALYZE file extensions, import patterns, and build configurations
- PROVIDE language-agnostic TDD guidance
STEP 3: Intelligent test file creation with language-specific patterns
FOR target_component IN $ARGUMENTS:
CASE language: WHEN "rust":
**Rust TDD Implementation:**
// FOR library crates: src/lib.rs or src/component.rs
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_${target_component}_${expected_behavior}() {
// Arrange
// Act
// Assert
assert_eq!(actual, expected);
}
#[test]
fn test_${target_component}_edge_cases() {
// Test boundary conditions and error cases
}
}// FOR integration tests: tests/${target_component}_test.rs
use project_name::*;
#[test]
fn integration_test_${target_component}() {
// Integration test implementation
}WHEN "go":
**Go TDD Implementation:**
// ${target_component}_test.go
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test${TargetComponent}_${ExpectedBehavior}(t *testing.T) {
// Table-driven tests
tests := []struct {
name string
input InputType
expected ExpectedType
wantErr bool
}{
{
name: "valid input",
input: validInput,
expected: expectedOutput,
wantErr: false,
},
{
name: "invalid input",
input: invalidInput,
expected: zeroValue,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := ${target_component}(tt.input)
if tt.wantErr {
assert.Error(t, err)
return
}
assert.NoError(t, err)
assert.Equal(t, tt.expected, result)
})
}
}WHEN "java":
**Java TDD Implementation (JUnit 5):**
// src/test/java/.../ComponentNameTest.java
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.*;
class ${TargetComponent}Test {
private ${TargetComponent} ${targetComponent};
@BeforeEach
void setUp() {
${targetComponent} = new ${TargetComponent}();
}
@Test
@DisplayName("Should ${expected_behavior} when ${condition}")
void should${ExpectedBehavior}When${Condition}() {
// Arrange
var inputRead more
allowed-tools: Task, Read, Write, Edit, MultiEdit, Bash(fd:*), Bash(rg:*), Bash(eza:*), Bash(bat:*), Bash(jq:*), Bash(gdate:*), Bash(mvn:*), Bash(gradle:*), Bash(cargo:*), Bash(go:*), Bash(deno:*) name: "Tdd" description: "Comprehensive test-driven development orchestrator with language-aware test generation and Red-Green-Refactor workflow automation" author: "wcygan" tags: ["test","run"] version: "1.0.0" created_at: "2025-07-14T00:00:00Z" updated_at: "2025-07-14T00:00:00Z"
Context
- Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
- TDD target: $ARGUMENTS
- Current directory: !`pwd`
- Project structure: !`eza -la --tree --level=2 2>/dev/null | head -10 || fd . -t d -d 2 | head -8`
- Build files detected: !`fd "(package\.json|Cargo\.toml|go\.mod|pom\.xml|build\.gradle|deno\.json)" . -d 3 | head -5 || echo "No build files detected"`
- Existing test files: !`fd "(test|spec)" . -t f | head -5 || echo "No test files found"`
- Language tools status: !`echo "deno: $(which deno >/dev/null && echo ✓ || echo ✗) | cargo: $(which cargo >/dev/null && echo ✓ || echo ✗) | go: $(which go >/dev/null && echo ✓ || echo ✗) | mvn: $(which mvn >/dev/null && echo ✓ || echo ✗)"`
- Git status: !`git status --porcelain 2>/dev/null | head -3 || echo "Not a git repository"`
Your Task
STEP 1: Initialize TDD session and analyze project architecture
- CREATE session state file: `/tmp/tdd-session-$SESSION_ID.json`
- ANALYZE project structure and technology stack from Context section
- DETECT primary language and testing framework
- IDENTIFY existing test patterns and conventions
# Initialize TDD session state
echo '{
"sessionId": "'$SESSION_ID'",
"tddTarget": "'$ARGUMENTS'",
"detectedLanguage": "auto-detect",
"testingFramework": "auto-detect",
"tddPhase": "red",
"testFilePath": "",
"implementationPath": ""
}' > /tmp/tdd-session-$SESSION_ID.jsonSTEP 2: Language-aware project analysis with intelligent framework detection
TRY:
CASE detected_language: WHEN "rust":
- VALIDATE Cargo.toml exists and analyze dependencies
- DETECT testing strategy: unit tests (`#[cfg(test)]`) vs integration tests (`tests/`)
- IDENTIFY existing test modules and patterns
- SET testing framework: "cargo_test" with potential criterion for benchmarks
WHEN "go":
- VALIDATE go.mod exists and analyze module structure
- DETECT testing strategy: standard library vs testify framework
- IDENTIFY table-driven test patterns in existing code
- SET testing framework: "go_test" with build tags and coverage support
WHEN "java":
- DETECT build system: Maven (pom.xml) vs Gradle (build.gradle)
- IDENTIFY testing framework: JUnit 5, TestNG, or legacy JUnit 4
- ANALYZE test directory structure and naming conventions
- SET testing framework based on dependencies and existing patterns
WHEN "typescript" OR "javascript":
- DETECT runtime: Deno vs Node.js vs browser environment
- IF Deno project: USE Deno.test() with built-in test runner
- IF Node.js: IDENTIFY framework (Jest, Vitest, Mocha, etc.)
- ANALYZE existing test structure and mocking patterns
WHEN "unknown":
- LAUNCH sub-agent for comprehensive language detection
- ANALYZE file extensions, import patterns, and build configurations
- PROVIDE language-agnostic TDD guidance
STEP 3: Intelligent test file creation with language-specific patterns
FOR target_component IN $ARGUMENTS:
CASE language: WHEN "rust":
**Rust TDD Implementation:**
// FOR library crates: src/lib.rs or src/component.rs
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_${target_component}_${expected_behavior}() {
// Arrange
// Act
// Assert
assert_eq!(actual, expected);
}
#[test]
fn test_${target_component}_edge_cases() {
// Test boundary conditions and error cases
}
}// FOR integration tests: tests/${target_component}_test.rs
use project_name::*;
#[test]
fn integration_test_${target_component}() {
// Integration test implementation
}WHEN "go":
**Go TDD Implementation:**
// ${target_component}_test.go
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test${TargetComponent}_${ExpectedBehavior}(t *testing.T) {
// Table-driven tests
tests := []struct {
name string
input InputType
expected ExpectedType
wantErr bool
}{
{
name: "valid input",
input: validInput,
expected: expectedOutput,
wantErr: false,
},
{
name: "invalid input",
input: invalidInput,
expected: zeroValue,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := ${target_component}(tt.input)
if tt.wantErr {
assert.Error(t, err)
return
}
assert.NoError(t, err)
assert.Equal(t, tt.expected, result)
})
}
}WHEN "java":
**Java TDD Implementation (JUnit 5):**
// src/test/java/.../ComponentNameTest.java
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.*;
class ${TargetComponent}Test {
private ${TargetComponent} ${targetComponent};
@BeforeEach
void setUp() {
${targetComponent} = new ${TargetComponent}();
}
@Test
@DisplayName("Should ${expected_behavior} when ${condition}")
void should${ExpectedBehavior}When${Condition}() {
// Arrange
var inputA lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.
Repo: kiliczsh/claude-cmd
Other commands on claude-cmd.
- /agent-browser-automation
Automate browser interactions for development testing using Puppeteer MCP
Open command - /agent-prep-merge
Prepare branches for merging across multiple worktrees and coordinate integration
Open command - /agent-persona-accessibility-expert
Transform into accessibility expert for WCAG compliance and inclusive design
Open command - /agent-persona-api-designer
Transform into an API design specialist who creates well-structured, developer-friendly APIs
Open command - /agent-persona-backend-specialist
Transform into backend specialist for scalable API and system design
Open command - /agent-persona-cloud-architect
Cloud architect persona for designing scalable, secure cloud infrastructure using modern cloud-native technologies
Open command

