CtrlK
BlogDocsLog inGet started
Tessl Logo

pantheon-ai/test-driven-development

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?

Evaluation86%

1.05x

Agent success when using this tile

Validation for skill structure

Overview
Skills
Evals
Files

isolate-no-shared-state.mdreferences/

title:
Avoid Shared Mutable State Between Tests
impact:
HIGH
impactDescription:
eliminates 74% of test order dependency bugs
tags:
isolate, shared-state, independence, determinism

Avoid Shared Mutable State Between Tests

Each test must run in isolation without depending on or affecting other tests. Shared state causes tests to pass or fail based on execution order.

Incorrect (shared mutable state):

// Shared across all tests in file
let userCount = 0
let database: User[] = []

test('creates first user', () => {
  const user = createUser({ name: 'Alice' })
  database.push(user)
  userCount++

  expect(database).toHaveLength(1)
  expect(userCount).toBe(1)
})

test('creates second user', () => {
  const user = createUser({ name: 'Bob' })
  database.push(user)
  userCount++

  // Fails if tests run in different order or parallel
  expect(database).toHaveLength(2)
  expect(userCount).toBe(2)
})

Correct (isolated state per test):

describe('createUser', () => {
  let database: User[]

  beforeEach(() => {
    // Fresh state for each test
    database = []
  })

  test('creates first user', () => {
    const user = createUser({ name: 'Alice' })
    database.push(user)

    expect(database).toHaveLength(1)
  })

  test('creates second user', () => {
    const user = createUser({ name: 'Bob' })
    database.push(user)

    // Always passes regardless of test order
    expect(database).toHaveLength(1)
  })
})

Isolation techniques:

  • Reset state in beforeEach
  • Use unique identifiers per test (e.g., UUID)
  • Wrap tests in database transactions that rollback
  • Create fresh instances instead of reusing singletons

Reference: Software Testing Anti-patterns - Codepipes

Install with Tessl CLI

npx tessl i pantheon-ai/test-driven-development@0.2.4

SKILL.md

tile.json