Codifies a single source of truth for use-case input/output contracts:
- Every use case exports xInputSchema/XInput and xOutputSchema/XOutput
from its own file; controllers and tRPC procedures import the same
schema. Use case body runtime-validates output via .parse before
returning.
- Controllers gain a co-located top-level `function presenter`
(Lazar-style) that reshapes entity output to view DTO; controller
return type = ReturnType<typeof presenter>.
- Domain error → TRPCError mapping moves to per-feature
integrations/api/procedures.ts via a defineErrorMiddleware factory
in core-shared/trpc/. core-shared never enumerates feature errors.
- Per-feature public-API surface cleaned: feature root = contracts
only (types, errors, schemas, IUseCase aliases, router type); new
./ui subpath holds query builders / components.
30 numbered rules using RFC-2119 MUST/SHOULD language so every
enforceable decision is citable from CLAUDE.md and per-feature AGENTS.md
during the post-Plan-9 doc-update pass. Includes file-shape templates,
migration order (~9 commits), doc-update mapping per rule, and an
ADR-013 mandate.
Spec: docs/superpowers/specs/2026-05-06-input-output-unification-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>