tdd-typescript
How to Install
Claude Code:
git clone --depth 1 https://github.com/lekman/cdn.git && cp cdn/.claude/skills/tdd-typescript ~/.claude/skills/tdd-typescript -r---
name: tdd-typescript
description: Test-driven development with Bun test framework. Use when writing new tests, creating test files, setting up mocks, writing assertions, configuring test coverage, or following the RED-GREEN-REFACTOR cycle in TypeScript.
user-invocable: false
---
# Test-Driven Development in TypeScript
When writing tests or following TDD workflow, read and follow the policy guide:
**Policy**: `docs/policies/tdd-typescript.md`
## When This Applies
- Writing new test files for `src/` modules
- Following the RED -> GREEN -> REFACTOR cycle
- Creating mock implementations in `tests/mocks/`
- Writing assertions with `bun:test` (`expect`, `describe`, `test`)
- Setting up test factories or shared test utilities
- Configuring coverage thresholds in `bunfig.toml`
- Testing async functions, file system operations, or platform-specific code
- Debugging flaky or failing tests
## Project-Specific Rules (from CLAUDE.md)
- Test files mirror source path: `src/functions/delete/handler.ts` -> `tests/unit/functions/delete/handler.test.ts`
- Use `test()` (not `it()`) for individual test cases
- Import from `bun:test`: `describe`, `expect`, `test`, `beforeEach`, `mock`
- Tests MUST NOT make network calls
- Coverage thresholds: 80% line, 80% statement, 60% function
## Key Patterns
- Arrange / Act / Assert structure
- `realpathSync` for macOS temp directory symlink resolution
- `.skipIf()` for platform-specific tests
- `describe.serial` for tests using `process.chdir()`
- Mock restore in `afterEach` to prevent leaks
Read the full guide for assertion reference, mocking patterns, and examples.
Details
| Category | Coding → testing |
| Source | lekman/cdn |
| SKILL.md | View on GitHub → |
| Repo Stars | N/A |
| Est. per Skill | N/A (shared across 13 skills from this repo) |
| Difficulty | Intermediate |
| Risk Level | Safe |
Related Skills
busybox-on-windows
BusyBox is a single binary that implements many common Unix tools. Use this skill only on Windows. I
technical-change-tracker
Technical Change Tracker Overview Track every code change with structured JSON records and accessibl
elixir-pro
Use this skill when Working on elixir pro tasks or workflows Needing guidance, best practices, or ch
google-drive-automation
Google Drive Lightweight Google Drive integration with standalone OAuth authentication. No MCP serve
Works Well With
Skills from the same repository — often designed to work together
skill
--- name: skill description: Guidelines for creating Claude Code skill files. Use when creating new
refine
--- name: refine description: Refine early requirements into a validated PRD document. Use when you
planner
--- name: planner description: Unified planning workflow that detects context and guides you through