Design comprehensive failing tests for a feature or behavior in the RED phase of TDD.
Creates comprehensive failing tests for features using RED phase TDD methodology.
/plugin marketplace add DoubleslashSE/claude-marketplace/plugin install node-tdd@doubleslash-pluginsDesign comprehensive failing tests for a feature or behavior in the RED phase of TDD.
/red <behavior-description>
behavior-description: Description of the behavior to testUses the test-designer agent with tdd-workflow skill.
Analyze Behavior
Design Test Cases
Create Test Suite
Execute and Verify
npm test or vitest runimport { describe, it, expect, beforeEach } from 'vitest';
describe('FeatureName', () => {
describe('methodName', () => {
// Happy path
it('should return expected result when given valid input', () => {
// Arrange
const sut = createSystemUnderTest();
// Act
const result = sut.methodName(validInput);
// Assert
expect(result).toEqual(expectedOutput);
});
// Edge case
it('should handle empty input gracefully', () => {
const sut = createSystemUnderTest();
const result = sut.methodName([]);
expect(result).toEqual([]);
});
// Error case
it('should return failure result when validation fails', () => {
const sut = createSystemUnderTest();
const result = sut.methodName(invalidInput);
expect(result.isFailure).toBe(true);
expect(result.error.code).toBe('VALIDATION_ERROR');
});
});
});
Format: should {expectedBehavior} when {scenario}
Examples:
should return user when id existsshould return empty array when no matches foundshould throw ValidationError when email is invalid| Category | Purpose | Example |
|---|---|---|
| Unit | Pure logic | Validators, transformers |
| Integration | I/O boundaries | API calls, DB access |
| Contract | Type safety | API responses |
The command produces:
/red User email validation should accept valid formats and reject invalid ones
Output:
describe('validateEmail', () => {
it('should return success for valid email format', () => {...});
it('should return failure for email without @ symbol', () => {...});
it('should return failure for email without domain', () => {...});
it('should return failure for empty string', () => {...});
});
/tdd - Complete TDD cycle/green - Implement to pass tests