Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

test-patterns

verified

This skill provides patterns and best practices for generating and organizing tests. It covers unit testing, integration testing, test data factories, and coverage strategies across multiple languages and frameworks.

View on GitHub

Marketplace

agent-skills-marketplace

jayteealao/agent-skills

Plugin

session-workflow

development

Repository

jayteealao/agent-skills

plugins/session-workflow/skills/test-patterns/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/jayteealao/agent-skills/blob/main/plugins/session-workflow/skills/test-patterns/SKILL.md -a claude-code --skill test-patterns

Installation paths:

Claude
.claude/skills/test-patterns/
Powered by add-skill CLI

Instructions

# Test Patterns Skill

Generate and organize tests following project conventions and industry best practices.

## When to Use

- Generating unit tests for new or existing code
- Creating integration/API tests
- Setting up test data factories
- Analyzing and improving test coverage
- Establishing testing conventions in a project

## Reference Documents

- [Unit Test Patterns](./references/unit-test-patterns.md) - Patterns for unit tests including mocking, fixtures, and assertions
- [Integration Test Patterns](./references/integration-test-patterns.md) - API and integration testing patterns
- [Test Data Factories](./references/test-data-factories.md) - Factory patterns for generating test data
- [Coverage Strategies](./references/coverage-strategies.md) - Approaches to meaningful test coverage

## Core Principles

### 1. Test Behavior, Not Implementation

```
WRONG: Testing internal method calls
RIGHT: Testing observable behavior and outputs
```

Tests should verify what code does, not how it does it. This makes tests resilient to refactoring.

### 2. Arrange-Act-Assert (AAA) Pattern

Every test should have three distinct sections:

```python
# Arrange - Set up test data and conditions
user = create_user(name="Alice")
order = create_order(user=user, items=[item1, item2])

# Act - Execute the behavior being tested
result = order.calculate_total()

# Assert - Verify the expected outcome
assert result == 150.00
```

### 3. One Assertion Per Test (Logical)

Each test should verify one logical concept, though it may have multiple assertions for that concept:

```python
def test_user_creation_sets_defaults():
    user = User.create(email="test@example.com")

    # Multiple assertions for one concept: default values
    assert user.status == "pending"
    assert user.role == "member"
    assert user.created_at is not None
```

### 4. Descriptive Test Names

Test names should describe the scenario and expected outcome:

```python
# WRONG
def test_order():
def test_calculate()

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5159 chars