Claude Code architecture for interfaces and contract tests
Keep domain services independent of a storage implementation through focused interfaces, clear error semantics, and reusable contract tests.
中文Install in Claude Code
Open the code in Claude Code. Identify the callers, interchangeable implementations, and tests you can reuse as contracts.
- Review `.claude/skills/architecture/SKILL.md` and its requirements at the pinned GitHub commit.
- Create `.claude/skills/architecture/` in your project and save the reviewed file as `.claude/skills/architecture/SKILL.md`.
- Start Claude Code from that project's root, then select `/architecture` in the slash menu.
Example task
In rent-31, a catalog service reads a book’s availability. The existing in-memory implementation contains {item: 'atlas', available: 4}. A replacement should return it too, and return an empty result for a missing book.What to check
The catalog service depends on the lookup interface. The same test suite expects {item: 'atlas', available: 4} from both implementations and null for a missing record.
Original SKILL.md on GitHub · Updated
Frequently asked question
When can I keep a concrete implementation?
Start concrete for a pure function or an unclear boundary. Extract an interface when a replacement or testability need appears.