MCPInstall

unit-testing-framework

Write comprehensive unit tests with high coverage using testing frameworks like Jest, pytest, JUnit, or RSpec. Use when writing tests for functions, classes, components, or establishing testing standards.

Installs
595
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill unit-testing-framework
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads unit-testing-framework automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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);

      // Assert - Verify the outcome
      expect(result.id).toBeDefined();
      expect(result.email).toBe("john@example.com");
      expect(mockDatabase.save).toHaveBeenCalledWith(
        expect.objectContaining(userData),
      );
    });
  });
});

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Test Structure (AAA Pattern)Test Structure (AAA Pattern)
Test Cases by LanguageTest Cases by Language
Mocking & Test DoublesMocking & Test Doubles
Testing Async CodeTesting Async Code, Test Coverage
Testing Edge CasesTesting Edge Cases
Example: Complete Test Suiteimport { UserService } from "./user-service";

Best Practices

✅ DO

  • Write tests before or alongside code (TDD)
  • Test one thing per test
  • Use descriptive test names
  • Follow AAA pattern
  • Test edge cases and error conditions
  • Keep tests isolated and independent
  • Use setup/teardown appropriately
  • Mock external dependencies
  • Aim for high coverage on critical paths
  • Make tests fast (< 10ms each)
  • Use parameterized tests for similar cases
  • Test public interfaces, not implementation

❌ DON'T

  • Test implementation details
  • Write tests that depend on each other
  • Ignore failing tests
  • Test third-party library code
  • Use real databases/APIs in unit tests
  • Make tests too complex
  • Skip edge cases
  • Forget to clean up resources
  • Test everything (focus on business logic)
  • Write flaky tests

FAQ

What does the unit-testing-framework skill do?

Write comprehensive unit tests with high coverage using testing frameworks like Jest, pytest, JUnit, or RSpec. Use when writing tests for functions, classes, components, or establishing testing standards.

How do I install unit-testing-framework?

Run npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill unit-testing-framework in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/unit-testing-framework/ (personal) or .claude/skills/unit-testing-framework/ (project).

Which AI agents can use unit-testing-framework?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is unit-testing-framework safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains unit-testing-framework?

It is published by aj-geddes in aj-geddes/useful-ai-prompts. It has 595 recorded installs.

More from aj-geddes/useful-ai-prompts

View all →

nodejs-express-server

aj-geddes/useful-ai-prompts

Build production-ready Express.js servers with middleware, authentication, routing, and database integration. Use when creating REST APIs, managing requests/responses, implementing middleware chains, and handling server logic.

Backend & APIs3.3K installs

code-review-analysis

aj-geddes/useful-ai-prompts

Perform comprehensive code reviews with best practices, security checks, and constructive feedback. Use when reviewing pull requests, analyzing code quality, checking for security vulnerabilities, or providing code improvement suggestions.

rest-api-design

aj-geddes/useful-ai-prompts

Design RESTful APIs following best practices for resource modeling, HTTP methods, status codes, versioning, and documentation. Use when creating new APIs, designing endpoints, or improving existing API architecture.

Backend & APIs2.1K installs

jenkins-pipeline

aj-geddes/useful-ai-prompts

Build Jenkins declarative and scripted pipelines with stages, agents, parameters, and plugins. Implement multi-branch pipelines and deployment automation.

AI & Agents2K installs

architecture-diagrams

aj-geddes/useful-ai-prompts

Create system architecture diagrams using Mermaid, PlantUML, C4 model, flowcharts, and sequence diagrams. Use when documenting architecture, system design, data flows, or technical workflows.

ansible-automation

aj-geddes/useful-ai-prompts

Infrastructure automation and configuration management using Ansible playbooks, roles, and inventory. Use for deploying applications, patching, and managing servers.

Popular testing & qa skills

View category →

tdd

mattpocock/skills

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Testing & QA1.2M installs

grilling

mattpocock/skills

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

Testing & QA996.2K installs

migrate-to-shoehorn

mattpocock/skills

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Testing & QA484.1K installs

run-train

lllllllama/rigorpilot-skills

Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.

Testing & QA337.8K installs

test-driven-development

obra/superpowers

Use when implementing any feature or bugfix, before writing implementation code

Testing & QA261.8K installs

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

Testing & QA216.8K installs