architecture
Use when implementing anything on this repo's slice architecture including creating a slice or package, adding a concept or schema, wiring a use-case end to end, sharing code across slices, translating errors, writing tests, and writing Effect code.
来源信息
- 仓库
- baptisteArno/strict-effect-starter
- 最近来源活动
- 2026年7月20日 14:20
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 1
- 分支
- 0
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
文件资源管理器
7 个文件正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- architecture
- description
- Use when implementing anything on this repo's slice architecture including creating a slice or package, adding a concept or schema, wiring a use-case end to end, sharing code across slices, translating errors, writing tests, and writing Effect code.
# Implementing on this architecture
Normative tables (families, roles, suffixes, ceilings, exports) live in `ARCHITECTURE.md`. `tools/architecture/policy.ts` enforces them via `bun run lint` — run it after every structural step; it is fast and its diagnostics tell you the correct shape.
`packages/notes` + `apps/server` are the compiled, tested, runnable worked example of everything below — when a playbook is ambiguous, imitate the example.
## Route your task
| Task | Playbook |
| ---------------------------------------------------------------------- | ----------------------------------- |
| New slice or new package in a slice | `references/add-a-slice.md` |
| New domain concept, schema, model, domain error | `references/add-a-concept.md` |
| Command/query, port, adapter, handler, client, UI — the vertical chain | `references/wire-a-use-case.md` |
| Two slices need the same type, event, or contract | `references/share-across-slices.md` |
| Tests for any layer | `references/testing.md` |
| Writing Effect code (imports, errors, Options, Match, Layers) | `references/effect-code.md` |
## The path is the spec
Every product file matches `packages/<slice>/<role>/src/<domain-kind>/<Concept>/<Concept>.<role-suffix>.ts(x)`. Before creating a file, decode where it goes:
1. **Which slice owns the meaning?** Product behavior goes in its slice. External SDK/engine wrapper → `drivers/`. Domain-agnostic substrate → `foundation/`. Repo tooling → `tooling/`. Deliberately shared product language → `shared/` (promotion required, see `share-across-slices.md`).
2. **Which role owns the action?** Pure meaning → `domain`. Application intent and ports → `use-cases`. Adapters and live Layers → `server`. Browser state/adapters → `client`. Persistence projection → `tables`. React → `ui`. Typed config contracts → `config`.
3. **Which suffix owns the file?** Look it up in `ARCHITECTURE.md` § Concept grammar. If no canonical suffix fits, you are probably putting the code in the wrong role.
## Iron rules (never violate, in any playbook)
- Never import another slice's packages — integrate via events or a promoted `shared` contract.
- Never import deep private paths — only declared subpath exports (`/public`, `/server`, `/secrets`, `/layer`, `/test`, `/browser`); never wildcard exports.
- `domain` imports nothing but its own slice's domain, shared domain, and foundation `primitive`/`modeling`. No config, no drivers, no `Config`/`ConfigProvider`, no side effects.
- `use-cases` declares ports and contracts; it never implements adapters or exports live Layers.
- Schema-first: if data can be a `Schema`, define the schema and derive the type. Finite cases are discriminated unions, never optional-field bags.
- Errors translate at every boundary: driver errors die in the adapter, port errors die in the use-case, action errors die in the handler.
- Create only what has a current concrete responsibility: no packages for symmetry, no placeholder exports, no empty role files, no `utils`/`common`/`helpers` folders.
- Effect APIs: verify against the pinned Effect source via `opensrc` (see `CLAUDE.md`) before using a nontrivial API.
在 GitHub 查看