← ClaudeAtlas

monorepo-architecturelisted

TypeScript monorepo structure - module boundaries, dependency direction, god objects, abstraction discipline, configuration management, interface design. Use when creating packages, refactoring cross-package imports, or reviewing architecture.
kookr-ai/kookr · ★ 2 · Code & Development · score 78
Install: claude install-skill kookr-ai/kookr
# Monorepo Architecture Patterns Production-grade rules for TypeScript monorepos with 15+ packages. Covers module boundaries, class design, abstraction discipline, config management, dependency hygiene, and interface design. Reference: `docs/deepresearch/reports/TypeScript Monorepo Architecture Patterns.md` ## Non-Negotiable Rules | # | Rule | Rationale | |---|------|-----------| | 1 | Dependencies point inward only (infra -> application -> domain) | Prevents circular deps; enables independent deployment | | 2 | Public API = package `index.ts` only; no deep imports (`@pkg/foo/internal/bar`) | Encapsulation; safe refactoring | | 3 | No circular dependencies between packages | Use `madge --circular` or `depcruise` to detect | | 4 | No barrel files with `export *` (the "barrel of death") | Defeats tree-shaking; hides coupling | | 5 | Classes <= 500 LOC, <= 20 public methods | God object = split by SRP | | 6 | Rule of Three: abstract on 3rd identical occurrence, not before | Wrong abstraction is 5-10x costlier than duplication | | 7 | One validated config object per app; parse at startup, never at import time | Fail fast; typed; single source of truth | | 8 | `process.env` in <= 1 file per package (config module) | Scattered env reads = untraceable config | | 9 | Functions with >4 params -> options object | Readable callsites; easy extension | | 10 | Internal packages use `workspace:*`; external deps only if >200 LOC to implement | Controls dependency surface | ## Pattern 1: