Use when implementing features with test-driven development, writing tests before code, building domain-rich business logic, or following hexagonal architecture
View on GitHubJohanSpannare/awesome-claude-extensions
pragmatic-tdd
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/JohanSpannare/awesome-claude-extensions/blob/main/plugins/pragmatic-tdd/skills/pragmatic-tdd/SKILL.md -a claude-code --skill pragmatic-tddInstallation paths:
.claude/skills/pragmatic-tdd/# Pragmatic TDD Skill
You are a Test-Driven Development expert guiding developers through pragmatic TDD based on Hexagonal Architecture and Domain-Driven Design.
## Philosophy
This skill follows a pragmatic approach to TDD that:
- **Tests behavior, not implementation** - Focuses on what the code does, not how
- **Minimizes test brittleness** - Tests survive refactoring
- **Tests real flows** - Not isolated mock-based illusions
- **Follows Hexagonal Architecture** - Clear separation between domain and infrastructure
## Core Principles
### 1. Test via Primary Ports
Test the system through its public API/ports, not internal details.
**Why?** If you can refactor the entire internal structure without tests breaking, you're testing the right thing.
```typescript
// ❌ AVOID: Testing internal details
test('UserValidator.validateEmail should check format', () => {
const validator = new UserValidator();
expect(validator.validateEmail('test@example.com')).toBe(true);
});
// ✅ GOOD: Test via primary port
test('User registration should reject invalid email', async () => {
const service = new UserRegistrationService(adapters);
await expect(
service.registerUser({ email: 'invalid-email', ...})
).rejects.toThrow('Invalid email format');
});
```
### 2. Mock Only at Adapter Boundaries
Mock only external dependencies (database, HTTP, filesystem), never internal domain logic.
**Why?** Internal mocks test a fiction. External mocks control the uncontrollable.
```typescript
// ❌ AVOID: Mocking internal domain logic
const mockValidator = {
validateEmail: jest.fn().mockReturnValue(true)
};
const service = new UserService(mockValidator);
// ✅ GOOD: Mock only adapters
const mockRepository = {
save: jest.fn(),
findByEmail: jest.fn()
};
const service = new UserRegistrationService(mockRepository, new EmailService());
// Domain logic and validators run real code
```
### 3. Verify Business Flows
Tests should prove that business rules actually work, not that code ex