aj-geddes avatar

Unit Testing Framework

This walks Claude through writing proper unit tests with the AAA pattern across Jest, pytest, JUnit, and RSpec. You get concrete examples for each language, guidance on mocking and test doubles, and patterns for async code and edge cases. The best practices section is solid on fundamentals like testing one thing per test and keeping tests fast. Most useful when you're setting up testing standards for a project or need Claude to generate comprehensive test suites rather than quick validation code. The reference guides cover the specifics you'd actually need to implement TDD properly instead of just checking if something doesn't crash.

skills.sh installs
622
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill unit-testing-framework --agent claude-code

Installs into .claude/skills of the current project.

Files

Unit Testing Framework

Table of Contents

Overview

Write effective unit tests that are fast, isolated, readable, and maintainable following industry best practices and AAA (Arrange-Act-Assert) pattern.

When to Use

  • Writing tests for new code
  • Improving test coverage
  • Establishing testing standards
  • Refactoring with test safety
  • Implementing TDD (Test-Driven Development)
  • Creating test utilities and mocks

Quick Start

Minimal working example:

// Jest/JavaScript example
describe("UserService", () => {
  describe("createUser", () => {
    it("should create user with valid data", async () => {
      // Arrange - Set up test data and dependencies
      const userData = {
        email: "john@example.com",
        firstName: "John",
        lastName: "Doe",
      };
      const mockDatabase = createMockDatabase();
      const service = new UserService(mockDatabase);

      // Act - Execute the function being tested
      const result = await service.createUser(userData);

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Testing & QA, Documentation, AI & Agent Building, Python
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1wshaddix avatardotnet-testing-strategywshaddix/dotnet-skillsDeciding how to test .NET code. Unit vs integration vs E2E decision tree, test doubles.619skills.sh installs
2lambdatest avatarplaywright-skilllambdatest/agent-skillsGenerates production-grade Playwright automation scripts and E2E tests in TypeScript, JavaScript, Python, Java, or C#. Supports local execution and TestMu AI cl554skills.sh installs
3davila7 avatarplaywright-skilldavila7/claude-code-templatesComplete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check respon525skills.sh installs
4aj-geddes avatarfrontend-testingaj-geddes/useful-ai-promptsImplement comprehensive frontend testing using Jest, Vitest, React Testing Library, and Cypress. Use when building robust test suites for UI and integration tes514skills.sh installs
5bmad-labs avatartypescript-unit-testingbmad-labs/skillsUnit testing for TypeScript/NestJS projects using Jest, @golevelup/ts-jest (DeepMocked/createMock), and in-memory databases, with AAA structure. Use whenever th511skills.sh installs
6parcadei avatartestparcadei/continuous-claude-v3Comprehensive testing workflow - unit tests ∥ integration tests → E2E tests503skills.sh installs