hexagonal-architecture
Hexagonal Architecture
The Core Decision Rule
To decide if something belongs inside or outside the hexagon, ask:
"Does it do I/O or run out-of-process?"
- No → Inside the hexagon (domain or application layer)
- Yes → Outside (adapter)
Critical: Consider ALL dependencies. A component's dependencies disqualify it even if the component itself doesn't do I/O. If it depends on Spring, a database driver, or any framework—it's outside.
Layer Responsibilities
Common misconception: The hexagon is NOT just the domain. The hexagon contains both domain AND application layers. Adapters sit outside.
┌─────────────────────────────────────────┐
More from lexler/skill-factory
using-uv
Python package and project management with UV. Use when creating Python scripts, initializing projects, or managing dependencies.
5approval-tests
Writes approval tests (snapshot/golden master testing) for Python, JavaScript/TypeScript, or Java. Use when verifying complex output, characterization testing legacy code, testing combinations, or working with .approved/.received files.
5refactoring
Refactoring process. Invoke immediately when user or document mentions refactoring, or proactively when code gets too complex or messy.
5git-worktrees
Creates git worktrees for parallel development. Use when creating a git worktree, setting up multiple working directories, or working on features in parallel.
5nullables
Writes tests without mocks using Nullables. Use when writing tests, especially testing code with external I/O (HTTP, files, databases, clocks, random numbers), designing infrastructure wrappers or replacing mocking libraries.
5refinement-loop
Iterative refinement through multiple passes. Use when the user asks to 'meditate on', 'distill', 'refine', or 'iterate on' something, or proactively when a problem benefits from multiple passes rather than a single attempt.
5