hns-lsel-applier
Local Self-Evolution Loop (LSEL) APPLY engine — the playback-only consumer of approved decision.json records that drives `.moai/hooks/lsel-apply.sh` for the…
Test pyramid strategy, coverage targets, test patterns, and quality metrics reference. Agent-extending skill that amplifies manager-develop test-creation and quality-validation work with production-grade testing patterns. NOT for: production code implementation, architecture
$ npx -y skills add modu-ai/moai-adk --skill moai-ref-testing-pyramid --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/moai-ref-testing-pyramidContext preview
The summary Claude sees to decide when to auto-load this skill.
Test pyramid strategy, coverage targets, test patterns, and quality metrics reference. Agent-extending skill that amplifies manager-develop test-creation and quality-validation work with production-grade testing patterns. NOT for: production code implementation, architecture
name: moai-ref-testing-pyramid description: > Test pyramid strategy, coverage targets, test patterns, and quality metrics reference. Agent-extending skill that amplifies manager-develop test-creation and quality-validation work with production-grade testing patterns. NOT for: production code implementation, architecture design, DevOps, security audits. when_to_use: > Use for test-pyramid strategy reference: coverage targets, unit/integration/e2e test patterns, and quality metrics. Amplifies manager-develop test-creation and quality-validation work with production-grade testing patterns. user-invocable: false metadata: version: "1.0.0" category: "domain" status: "active" updated: "2026-03-30" tags: "testing, pyramid, coverage, tdd, patterns, reference" # MoAI Extension: Progressive Disclosure progressive_disclosure: enabled: true level1_tokens: 100 level2_tokens: 3000
/ E2E \ 10% — Critical user journeys only
/----------\
/ Integration \ 20% — API endpoints, DB queries, service boundaries
/----------------\
/ Unit Tests \ 70% — Functions, hooks, utilities, pure logic
/--------------------\| Level | Speed | Reliability | Maintenance | Coverage Target | |-------|-------|-------------|-------------|-----------------| | Unit | Fast (<100ms) | High | Low | 70% of tests | | Integration | Medium (1-5s) | Medium | Medium | 20% of tests | | E2E | Slow (10-60s) | Lower | High | 10% of tests |
| Context | Target | Rationale | |---------|--------|-----------| | Critical business logic | 95%+ | Revenue/security impact | | API endpoints | 90%+ | Contract compliance | | Utility functions | 85%+ | Reuse reliability | | UI components | 80%+ | Rendering correctness | | Configuration/glue code | 60%+ | Low complexity | | Generated code | 0% | Don't test generated code |
// Arrange: Set up test data and preconditions
input := CreateTestUser("test@example.com")
// Act: Execute the function under test
result, err := service.CreateUser(ctx, input)
// Assert: Verify the outcome
assert.NoError(t, err)
assert.Equal(t, "test@example.com", result.Email)| Pattern | When | Example | |---------|------|---------| | Table-Driven | Multiple input/output combinations | Go: `tests := []struct{...}` | | Mock/Stub | External dependencies (DB, API) | Interface injection, mock frameworks | | Snapshot | Complex output comparison | Jest snapshots, golden files | | Property-Based | Mathematical properties | quickcheck, hypothesis | | Boundary Value | Edge cases | 0, -1, MAX_INT, empty string, nil |
| Pattern | When | Example | |---------|------|---------| | Testcontainers | Real DB needed | Docker-based PostgreSQL for tests | | HTTP Test Server | API endpoint testing | httptest.NewServer (Go), supertest (Node) | | In-Memory DB | Fast DB tests | SQLite for development | | Fixture Loading | Consistent test data | Factory functions, seed files |
| Metric | Target | Tool | |--------|--------|------| | Line Coverage | 85%+ | go test -cover, istanbul, coverage.py | | Branch Coverage | 75%+ | go test -covermode=count | | Mutation Score | 70%+ | go-mutesting, Stryker | | Test Execution Time | <2 min (unit), <10 min (all) | CI timer | | Flaky Test Rate | <1% | CI history analysis |
| Language | Test File | Location | |----------|-----------|----------| | Go | `*_test.go` | Same package | | TypeScript | `*.test.ts` / `*.spec.ts` | `__tests__/` or co-located | | Python | `test_*.py` | `tests/` directory | | Java | `*Test.java` | `src/test/` mirror | | Rust | `#[cfg(test)] mod tests` | Same file or `tests/` |
RED: Write a failing test that defines expected behavior GREEN: Write minimal code to make the test pass REFACTOR: Clean up while keeping tests green
Rules:
<!-- moai:evolvable-start id="rationalizations" -->
| Rationalization | Reality | |---|---| | "E2E tests cover everything, unit tests are redundant" | E2E tests are slow and flaky. Unit tests provide fast, precise feedback. The pyramid exists because each level serves a different purpose. | | "Integration tests are more realistic than unit tests" | Realism comes at the cost of speed and isolation. A balanced pyramid gives both fast feedback and realistic validation. | | "100% code coverage means the code is well tested" | Coverage measures execution, not correctness. A test that executes code without meaningful assertions provides zero value. | | "Mocking is bad, I prefer real dependencies" | Real dependencies make tests slow and non-deterministic. Mock at boundaries, test business logic in isolation. | | "This test is flaky, but it catches real bugs sometimes" | Flaky tests erode trust in the entire suit
Agentic development harness for Claude Code — SPEC-driven plan/run/sync, TRUST 5 quality gates, model+effort routing, and Claude×GLM multi-LLM cost control. Single Go binary, 16 languages, zero deps.
Repo: modu-ai/moai-adk
Local Self-Evolution Loop (LSEL) APPLY engine — the playback-only consumer of approved decision.json records that drives `.moai/hooks/lsel-apply.sh` for the…
Local Self-Evolution Loop (LSEL) curator — the CLUSTER + drain engine for the GOOS-local PROPOSE→APPLY seam closure (SPEC-LSEL-LOCAL-EVOLUTION-001).…
moai-adk-go best-practices reference for the 4 harness specialists (cli-template-specialist, quality-specialist, workflow-specialist, hook-ci-specialist).…
moai-adk-go local dev reference — version management/release process (sec 5), shell-script hook development (sec 7), build & dev commands (sec 10). Load only…
moai-adk-go domain-patterns reference for the 4 harness specialists (cli-template-specialist, quality-specialist, workflow-specialist, hook-ci-specialist).…
HARD i18n rules digest for the oss-docs harness specialists working on moai-adk-go README 4-locale set and the docs-site (adk.mo.ai.kr). Covers the…