nWave/skills/nw-hexagonal-testing/SKILL.md
5-layer agent output validation, I/O contract specification, vertical slice development, and test doubles policy with per-layer examples
npx skillsauth add nwave-ai/nwave nw-hexagonal-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Validates agent OUTPUTS, not TDD testing methodology.
Validate individual software-crafter outputs.
structural_checks:
- required_elements_present: true
- format_compliance: true
- quality_standards_met: true
quality_checks:
- completeness: "All required components present"
- clarity: "Unambiguous and understandable"
- testability: "Can be validated"
test_data_quality:
real_data: "Use real API responses as golden masters"
edge_cases: "Test null, empty, malformed, boundary conditions"
assertions: "Assert expected counts, not just 'any results'"
Validate handoffs to next agent. Next agent must consume outputs without clarification.
Challenge output quality through adversarial scrutiny of generated code:
Pass criteria: all critical challenges addressed, edge cases documented and handled.
For peer review and escalation protocols, load the review-dimensions skill.
Complete business capability per slice: UI -> Application -> Domain -> Infrastructure for a specific feature. Slices developed and deployed independently. Focus on business capability over technical layer.
For test doubles policy and violation examples, load the tdd-methodology skill.
| Layer | Test Strategy | Adapter Selection | Rationale | |-------|--------------|------------------|-----------| | Domain | Pure unit test, zero I/O | N/A (no adapters) | Domain is pure functions — test with pure inputs | | Application | InMemory ports for focused scenarios | InMemory doubles | Application orchestrates — test logic, not I/O | | Adapter | REAL I/O ALWAYS* | Real system (tmp_path, subprocess, DB) | Adapter IS the I/O boundary — testing with InMemory defeats the purpose |
*Exception: costly subprocesses (claude -p, LLM) and paid external APIs use contract smoke tests tagged @requires_external instead of real I/O. See nw-tdd-methodology Mandate 6 for the full adapter type → test type table.
| WS/E2E | Per declared strategy (A/B/C/D) | Real for local, fake for costly | WS proves wiring — InMemory proves nothing about wiring |
A pure function stub at a driven port boundary models the port's CONTRACT, not the external system's BEHAVIOR. For every driven port stub, verify that an adapter integration test with real I/O covers the behavioral gap.
If the system's primary job is coordinating external processes (orchestrators, ETL, deployment scripts), invest MORE in WS and adapter integration tests than unit tests. If the system's primary job is domain computation (pricing, validation, parsing), the traditional pyramid applies.
# conftest.py
import os
import pytest
@pytest.fixture
def subprocess_runner():
"""Returns real or fake subprocess runner based on E2E mode."""
if os.getenv("NWAVE_E2E_REAL_SUBPROCESS") == "1":
from myapp.adapters.real_subprocess_runner import RealSubprocessRunner
return RealSubprocessRunner()
from tests.doubles.fake_subprocess_runner import FakeSubprocessRunner
return FakeSubprocessRunner(exit_code=0, stdout="OK")
Naming convention for multi-port Strategy D: NWAVE_E2E_REAL_{PORT_NAME} per driven port (e.g., NWAVE_E2E_REAL_SUBPROCESS, NWAVE_E2E_REAL_DATABASE). Use NWAVE_E2E_MODE=real as composite flag to enable ALL real adapters at once for full E2E.
testing
Acceptance test creation methodology for the DISTILL wave. Domain knowledge for the acceptance designer agent: port-to-port principle, prior wave reading, wave-decision reconciliation, graceful degradation, and document back-propagation.
testing
Methodology for minimizing test count while maximizing behavioral coverage - behavior definition, anti-pattern catalog, consolidation patterns, stopping criterion, coverage-preserving validation
testing
Methodology for minimizing test count while maximizing behavioral coverage - behavior definition, anti-pattern catalog, consolidation patterns, stopping criterion, coverage-preserving validation
development
Design mandates for acceptance tests - hexagonal boundary, business language abstraction, user journey completeness, pure function extraction, 3 Pillars (domain language / chained narrative / production composition), and the layered ATD discipline (Universe-bound assertion, layer-dependent PBT mode, two-tier acceptance, example-based sad paths)