/harness-claude:test-tdd-workflowfrom harness-claude
Guides test-driven development with red-green-refactor cycle: write a failing test, implement minimal code to pass, then refactor. Includes examples in TypeScript with vitest.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:test-tdd-workflow still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Drive design through tests using red-green-refactor cycle and test-first discipline
describe('PasswordValidator', () => {
it('rejects passwords shorter than 8 characters', () => {
const result = validatePassword('short');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must be at least 8 characters');
});
});
Run the test — it should fail (function does not exist or returns wrong value).
function validatePassword(password: string): ValidationResult {
const errors: string[] = [];
if (password.length < 8) {
errors.push('Password must be at least 8 characters');
}
return { valid: errors.length === 0, errors };
}
Run the test — it should pass.
// Extract rules into a composable structure
const rules: PasswordRule[] = [
{ test: (p) => p.length >= 8, message: 'Password must be at least 8 characters' },
{ test: (p) => /[A-Z]/.test(p), message: 'Password must contain an uppercase letter' },
];
function validatePassword(password: string): ValidationResult {
const errors = rules.filter((r) => !r.test(password)).map((r) => r.message);
return { valid: errors.length === 0, errors };
}
Run all tests — everything should still pass.
it('rejects passwords without uppercase letters', () => {
const result = validatePassword('lowercase123');
expect(result.valid).toBe(false);
expect(result.errors).toContain('Password must contain an uppercase letter');
});
it('accepts valid passwords', () => {
const result = validatePassword('ValidPass123!');
expect(result.valid).toBe(true);
expect(result.errors).toHaveLength(0);
});
vitest --watch
Tests re-run on every file save, showing red/green status immediately.
// First: test the public function
it('creates an order with total', async () => {
const order = await createOrder({ items: [{ sku: 'A', qty: 2, price: 10 }] });
expect(order.total).toBe(20);
});
// Then: test edge cases
it('applies bulk discount for qty > 10', async () => {
/* ... */
});
it('throws for empty items array', async () => {
/* ... */
});
// Tests serve as living documentation
describe('ShippingCalculator', () => {
it('charges flat $5 for orders under $50', () => {
/* ... */
});
it('provides free shipping for orders over $50', () => {
/* ... */
});
it('uses express rate when expedited shipping is selected', () => {
/* ... */
});
it('throws for negative order totals', () => {
/* ... */
});
});
TDD is a design technique that uses tests to drive the shape of the code. The core discipline is: never write production code without a failing test that demands it.
The three rules of TDD:
Benefits of TDD:
When TDD works best:
When TDD is harder:
Common TDD mistakes:
Trade-offs:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job