growing-outside-in-systems
Drive feature development using Outside-In TDD with Hexagonal Architecture. Design emerges through inline code, in-memory fakes, interface extraction, and deferred I/O. Use when building features, writing tests, or structuring backend services. Triggers on: TDD, outside-in, hexagonal, ports and adapters, emergent design, acceptance test, component test, walking skeleton, in-memory fakes, component, contract test, adapter, fast tests, sub-second feedback. Language-agnostic (Go, Rust, Python, TypeScript, Java, C#).
What this skill does
STARTER_CHARACTER = ๐ด๐ข # Outside-In TDD with Hexagonal Architecture Build features by driving design from the outside in. Every feature starts with a failing acceptance test. Design emerges through disciplined Red-Green-Refactor cycles. Infrastructure is deferred until the domain API is proven. Unlike inside-out TDD with mocks, this approach tests behavior at the boundary โ not implementation details โ making the suite refactor-friendly by design. See [methodology.md](references/methodology.md#why-outside-in-over-regular-tdd). For canonical terms used throughout, see [references/glossary.md](references/glossary.md). --- ## The Two Loops **Outer loop (Acceptance test):** Write a failing test scoped at the service/system boundary. This test exercises integration across Bounded Contexts using in-memory adapters. It defines "done." **Inner loop (Red-Green-Refactor):** Cycles inside a Bounded Context to make the outer test pass. Drop into this loop only to implement what the acceptance test demands. Every feature starts from the outside in. The acceptance test drives the process. --- ## Test Priorities Acceptance and component tests are the primary instruments. Unit tests are the exception. - **Acceptance tests** โ service/system boundary, in-process, in-memory adapters; read as specifications - **Component tests** โ single Bounded Context; drives internal module design via in-memory adapters - **Unit tests** โ exception only: well isolated ,genuinely complex, algorithmic, or combinatorial logic See [testing-strategy.md](references/testing-strategy.md) for full definitions, the testing matrix, and contract test patterns. --- ## The Testing Matrix | | Fast | Slow | |---|---|---| | **Large Scope** | Acceptance & Component โ daily driver | E2E โ minimize | | **Small Scope** | Unit โ use sparingly | Contract โ CI only | **Sub-second feedback is non-negotiable.** If tests take seconds, the team stops refactoring and the system decays. --- ## Emergent Design Workflow Follow this sequence strictly within each Bounded Context: 1. **Inline** โ implement logic naively inside business code; use local variables, lists, maps; no abstractions 2. **In-Memory adapter** โ once behavior is verified, extract logic into a dedicated in-memory adapter implementation 3. **Interface** โ extract the adapter interface from what actually emerged (not theoretical guesses) - *Checkpoint:* all types in the interface must live inside the hexagon - *I/O Checkpoint:* if no I/O and not out-of-process โ keep inside hexagon; do not create a port 4. **Deferred I/O** โ implement the real adapter (database, network, file system) only after the API is mature 5. **Refactor the inline code inside the hexagon** **The sequence is non-negotiable.** Each step collects evidence about what the adapter actually needs. See [methodology.md](references/methodology.md) for detailed rationale and the walking skeleton. --- ## Hexagonal Architecture The Domain Layer is the center. All I/O lives behind adapter interfaces at the boundary. **Dependency Rule:** `Infrastructure(adapters) โ Application(ports) โ Domain` (outer depends on inner, never reverse) **I/O Classification Rule:** if it does not do I/O and does not run out-of-process โ belongs inside the hexagon; otherwise โ adapter. **Port-referenced types must live inside the hexagon.** If a port signature references a type in the adapter layer, the hexagon depends outward โ a violation. **Naming:** - Ports: `For[Something]` (e.g., `ForCalculatingTaxes`, `ForGettingTaxRates`) - Adapters: `[Something]Adapter` (e.g., `WebUIAdapter`, `SQLDatabaseAdapter`) See [folder-structure.md](references/folder-structure.md) for full folder structure, private/public hexagon split, cross-hexagon dependency rule, adapter design patterns, and test seams. --- ## In-Memory Fakes, Not Mocks Use in-memory fakes for all adapter boundaries. Never mocks or stubs for domain-level testing. Fakes are real implementations backed by simple data structures (maps, lists). They have actual behavior. Mocks only verify call sequences โ they couple tests to implementation details and break on every refactor. Contract tests verify the real adapter matches the fake's behavior. See [testing-strategy.md](references/testing-strategy.md). --- ## Walking Skeleton For new projects or major new components: build a minimal end-to-end implementation first to pay integration cost upfront. Once upright, pivot to the emergent design workflow. See [methodology.md](references/methodology.md). --- ## Composition Root (Configurator) Wires all adapter interfaces at startup. Used in two contexts: - **Production:** real adapter implementations (database, network, file system) - **Tests:** in-memory adapter implementations โ fast, deterministic test harness The same business logic runs in both contexts โ only the adapters differ. --- ## Feature Implementation Order 1. **Write a failing acceptance test** โ defines "done" 2. **Drop into the inner loop** โ Red-Green-Refactor 3. **Follow the emergent design sequence** โ Inline โ In-Memory โ Interface โ Deferred I/O 4. **Add component tests if needed** โ when a Bounded Context grows complex 5. **Add unit tests only when justified** โ complex algorithms, combinatorial logic 6. **Implement real adapters last** โ verify with contract tests against in-memory fakes --- ## Listen to the Tests Difficulty writing a test is a design signal, not a skill problem: - **Hard to set up** โ too many dependencies; split or rethink adapter boundaries - **Hard to assert on** โ API is hiding or tangling information callers need - **Fragile, breaks on refactor** โ testing implementation details; step up to component/acceptance test - **Slow** โ hitting real I/O; find the missing adapter boundary Do not fight the tests. Reshape the code until the test is easy to write. --- ## Reference Documentation - [glossary.md](references/glossary.md) โ canonical terms - [folder-structure.md](references/folder-structure.md) โ folder structure, private/public hexagon, cross-hexagon rules, adapter patterns, test seams - [testing-strategy.md](references/testing-strategy.md) โ full testing matrix, acceptance/component test rules, contract test pattern - [methodology.md](references/methodology.md) โ why outside-in over regular TDD, walking skeleton, emergent design deep-dive, listen to the tests, anti-patterns ## Sources - [Growing Object-Oriented Software, Guided by Tests](http://www.growing-object-oriented-software.com/) โ Steve Freeman & Nat Pryce (2009) - [Big Design Up-Front or Emergent Design? Hexagonal Architecture Gives Us Both](https://www.shaiyallin.com/post/big-design-up-front-or-emergent-design-hexagonal-architecture-gives-us-both) โ Shai Yallin (2020) - [Hexagonal Architecture](https://alistair.cockburn.us/hexagonal-architecture/) โ Alistair Cockburn (2005) - [Contract Test](https://martinfowler.com/bliki/ContractTest.html) โ Martin Fowler - [Component Test](https://martinfowler.com/bliki/ComponentTest.html) โ Martin Fowler - [Bounded Context](https://martinfowler.com/bliki/BoundedContext.html) โ Martin Fowler
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context โ no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes โ information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development โ guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.