---
title: "Test Writing Prompt"
description: "Prompt for generating comprehensive tests with Claude Code"
type: "prompt"
category: "atomic"
tags: ["claude-code", "prompt", "testing"]
url: "https://theglitch.ai/academy/prompts/test-writing-prompt"
---

# Test Writing Prompt

Prompt for generating comprehensive tests with Claude Code

## The Prompt

```
Write tests for [file/function/component].

Cover:
- Happy path (normal usage)
- Edge cases: [specific cases]
- Error handling
- Boundary conditions

Use [testing framework].
Follow test patterns in [reference test file].
Put tests in [location].
```


# Test Writing Prompt

```
Write tests for [file/function/component].

Cover:
- Happy path (normal usage)
- Edge cases: [specific cases]
- Error handling
- Boundary conditions

Use [testing framework].
Follow test patterns in [reference test file].
Put tests in [location].
```

---

**Example:**

```
Write tests for /src/services/user.ts.

Cover:
- Happy path (create, read, update, delete)
- Edge cases:
  - Empty email
  - Duplicate email
  - Invalid password (too short)
  - Non-existent user ID
- Error handling (database failures)
- Boundary conditions (max name length)

Use Jest with testing-library.
Follow test patterns in /tests/services/auth.test.ts.
Put tests in /tests/services/user.test.ts.
```

---

**Output:** Complete test file matching your project patterns.

