moai-ref-testing-pyramid

Provides test pyramid ratios, coverage targets, and test patterns for testing agents.

2|Updated May 27, 2026
One-click install
npx skills add https://github.com/yekinya/moai-novel --skill moai-ref-testing-pyramid-yekinya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-ref-testing-pyramid
Source: https://github.com/yekinya/moai-novel/tree/main/moai-novel/.claude/skills/moai-ref-testing-pyramid
Command: npx skills add https://github.com/yekinya/moai-novel --skill moai-ref-testing-pyramid-yekinya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams often struggle to balance unit, integration, and E2E tests, set realistic coverage targets, and decide what to test versus what to skip, leading to slow, flaky, or poorly distributed test suites. ## Core Features & Use Cases - Test Pyramid Guidance: Defines the 70/20/10 distribution of unit, integration, and E2E tests with speed, reliability, and maintenance trade-offs per level. - Coverage Targets & Quality Metrics: Supplies context-specific coverage goals (95%+ for critical logic, 60%+ for glue code) plus metrics like branch coverage, mutation score, and flaky test rate. - Test Patterns & TDD Reference: Documents AAA structure, table-driven tests, mocks, testcontainers, property-based testing, and RED-GREEN-REFACTOR rules. - Use Case: An expert-testing agent creating tests for a Go service consults this reference to apply table-driven unit tests, testcontainers for integration, and verify the suite follows the pyramid distribution. ## Quick Start Ask the testing agent to review your test suite against the test pyramid and recommend coverage targets for each layer.

Frequently Asked Questions about moai-ref-testing-pyramid

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the ideal test pyramid ratio for unit, integration, and E2E tests?

The recommended distribution is 70% unit tests, 20% integration tests, and 10% E2E tests. Unit tests run fast and cover pure logic, integration tests verify API and database boundaries, and E2E tests cover only critical user journeys.

How do I structure tests using the AAA pattern?

The AAA pattern divides each test into Arrange, Act, and Assert phases. Arrange sets up test data and preconditions, Act executes the function under test, and Assert verifies the expected outcome.

What code coverage target should I aim for?

Coverage targets depend on context: 95%+ for critical business logic, 90%+ for API endpoints, 85%+ for utilities, 80%+ for UI components, and 60%+ for configuration code. Generated code requires no coverage.

Should I use mocks or real dependencies in unit tests?

Unit tests should mock external dependencies like databases and APIs at boundaries to stay fast and deterministic. Reserve real dependencies for integration tests using tools like testcontainers or in-memory databases.

Why is 100% code coverage not a good quality goal?

Coverage measures execution, not correctness. A test that executes code without meaningful assertions provides zero value, so pair coverage targets with mutation scores and behavior-focused assertions.

What should I do about flaky tests in my suite?

Flaky tests erode trust in the entire suite and should stay below a 1% rate. Fix the flakiness immediately or quarantine the test with a tracking issue, and verify stability by running the suite three times.