Master Test-Driven Development with deterministic red-green-refactor workflows, test-first feature delivery, bug reproduction through failing tests, behavior-focused assertions, and refactoring safety; use when implementing new functions, changing APIs, fixing regressions, or restructuring code under test.
Does it follow best practices?
Evaluation — 86%
↑ 1.05xAgent success when using this tile
Validation for skill structure
Create factory functions that generate test objects with sensible defaults. Override only the properties relevant to each test, keeping setup minimal and focused.
Incorrect (verbose inline object creation):
test('calculates order total with discount', () => {
const order = {
id: '123',
userId: 'user-456',
items: [
{ id: 'item-1', name: 'Widget', price: 100, quantity: 2 },
{ id: 'item-2', name: 'Gadget', price: 50, quantity: 1 }
],
discount: 0.1,
status: 'pending',
createdAt: new Date('2024-01-01'),
updatedAt: new Date('2024-01-01'),
shippingAddress: {
street: '123 Main St',
city: 'Springfield',
zipCode: '12345',
country: 'USA'
}
}
// 20 lines of setup for a test about discount calculation
expect(calculateTotal(order)).toBe(225) // (200 + 50) * 0.9
})Correct (factory with relevant overrides):
// factories/order.ts
function createOrder(overrides: Partial<Order> = {}): Order {
return {
id: `order-${Math.random().toString(36).slice(2)}`,
userId: 'default-user',
items: [],
discount: 0,
status: 'pending',
createdAt: new Date(),
updatedAt: new Date(),
shippingAddress: createAddress(),
...overrides
}
}
function createOrderItem(overrides: Partial<OrderItem> = {}): OrderItem {
return {
id: `item-${Math.random().toString(36).slice(2)}`,
name: 'Test Product',
price: 10,
quantity: 1,
...overrides
}
}
// Test focuses only on relevant data
test('calculates order total with discount', () => {
const order = createOrder({
items: [
createOrderItem({ price: 100, quantity: 2 }),
createOrderItem({ price: 50, quantity: 1 })
],
discount: 0.1
})
expect(calculateTotal(order)).toBe(225)
})Benefits:
Reference: Test Factories - Radan Skoric
Install with Tessl CLI
npx tessl i pantheon-ai/test-driven-developmentevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
references