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
Unit tests should never make real network requests. Network calls are slow, unreliable, and create dependencies on external systems.
Incorrect (real network calls):
test('fetches user profile', async () => {
// Real HTTP request - slow, flaky, requires running server
const response = await fetch('http://localhost:3000/api/users/123')
const user = await response.json()
expect(user.name).toBe('Alice')
})
test('sends notification', async () => {
// Real external API call - costs money, slow, can fail
const result = await notificationService.send({
to: 'test@example.com',
message: 'Hello'
})
expect(result.delivered).toBe(true)
})Correct (mocked network):
test('fetches user profile', async () => {
// Mock the fetch function
const mockUser = { id: '123', name: 'Alice', email: 'alice@test.com' }
global.fetch = jest.fn().mockResolvedValue({
ok: true,
json: async () => mockUser
})
const user = await userService.getProfile('123')
expect(user.name).toBe('Alice')
expect(fetch).toHaveBeenCalledWith(
expect.stringContaining('/api/users/123')
)
})
test('sends notification', async () => {
const mockNotificationApi = {
send: jest.fn().mockResolvedValue({ delivered: true, messageId: 'm1' })
}
const service = new NotificationService(mockNotificationApi)
const result = await service.send({
to: 'test@example.com',
message: 'Hello'
})
expect(result.delivered).toBe(true)
expect(mockNotificationApi.send).toHaveBeenCalledWith({
to: 'test@example.com',
message: 'Hello'
})
})Mocking strategies:
jest.fn(), jest.spyOn()Reference: MSW - Mock Service Worker
Install with Tessl CLI
npx tessl i pantheon-ai/test-driven-development@0.2.4evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
references