[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M799WSEE3QKJPSHAANKYBJEB":3,"skill-same:01M799WSEE3QKJPSHAANKYBJEB":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M799WSEE3QKJPSHAANKYBJEB","onion-architecture",null,"Enforces Onion Architecture (dependencies point inward) on a TypeScript backend (a Fastify + Drizzle + Zod server\u002F package and a pure domain core, reviewer-core in the reference layout). Use this skill whenever you add or change a backend route, service, repository, adapter, DB query, contract, or DI wiring — and whenever deciding WHERE a piece of logic, an external-tool call (LLM\u002FOpenAI\u002FAnthropic\u002FOpenRouter, GitHub\u002Foctokit, git, ripgrep\u002Fast-grep, Postgres), a type, or a validation belongs across layers. Also use when reviewing layering, an import that crosses package\u002Flayer boundaries, a leaked Drizzle query, a directly-instantiated SDK client, or business logic creeping into a route. Trigger terms: onion architecture, layer, dependency direction\u002Frule, ports and adapters, repository, service, adapter, composition root, container, dependency inversion, where should this live, layering violation.","SyukPublic\u002Fdev-digest-ai-marketplace","SyukPublic","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211482903?v=4","01M799WENGJRH924NQACAF41WB","Roman","01M799WEP642M9AWFZ4NWSWNT8",0,"MIT","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Fonion-architecture\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: onion-architecture\ndescription: \"Enforces Onion Architecture (dependencies point inward) on a TypeScript backend (a Fastify + Drizzle + Zod server\u002F package and a pure domain core, reviewer-core in the reference layout). Use this skill whenever you add or change a backend route, service, repository, adapter, DB query, contract, or DI wiring — and whenever deciding WHERE a piece of logic, an external-tool call (LLM\u002FOpenAI\u002FAnthropic\u002FOpenRouter, GitHub\u002Foctokit, git, ripgrep\u002Fast-grep, Postgres), a type, or a validation belongs across layers. Also use when reviewing layering, an import that crosses package\u002Flayer boundaries, a leaked Drizzle query, a directly-instantiated SDK client, or business logic creeping into a route. Trigger terms: onion architecture, layer, dependency direction\u002Frule, ports and adapters, repository, service, adapter, composition root, container, dependency inversion, where should this live, layering violation.\"\n---\n\n# Onion Architecture (TypeScript backend)\n\nKeeps the backend's dependencies pointing **inward**: the pure domain core\n(`reviewer-core`) knows nothing about the database, GitHub, git, or any SDK;\nthose are replaceable outer details reached only through interfaces. This skill is\nabout **layers, dependency direction, and where each kind of code lives** — not\nhow to write a Fastify route, a Drizzle query, or a Zod schema (those have their\nown skills).\n\nFor a good\u002Fbad code example per rule see [examples.md](examples.md); for sources\nand the canonical definition see [references.md](references.md).\n\nSibling skills (do not duplicate — defer to them for mechanics):\n- `engineering-paved-path:fastify-best-practices` → route\u002Fplugin\u002Fhook mechanics, JSON-schema validation, error handling.\n- ORM mechanics (how to write queries, relations, transactions, migrations) and schema-authoring\n  mechanics (Zod schemas, `safeParse`, `z.infer`, refinements) → dedicated ORM\u002Fvalidation skills, when the host project provides them.\n- `engineering-paved-path:react-frontend-architecture` → the same \"where does it live\" question for the **frontend**.\n\n## Severity Levels\n\n- **CRITICAL** — Breaks the dependency rule or leaks infrastructure into the core. Destroys testability and the ability to swap implementations; the core stops being pure.\n- **HIGH** — Erodes a boundary (DB\u002FSDK escapes its layer, logic in the wrong place). Compiles and runs, but couples layers and makes tests need real I\u002FO.\n- **MEDIUM** — Hurts navigability or invites future erosion.\n\n## The layers (outer → inner) and where they live (reference layout)\n\nDependencies may point **only inward** (toward the core). Nothing inner may import\nanything outer.\n\n| Layer | Where | Tool |\n|---|---|---|\n| Presentation \u002F edge | `server\u002Fsrc\u002Fmodules\u002F\u003Cf>\u002Froutes.ts` | Fastify 5 |\n| Application services | `server\u002Fsrc\u002Fmodules\u002F\u003Cf>\u002Fservice.ts` (+ `run-executor.ts`, `helpers.ts`) | — |\n| Ports (interfaces) | `server\u002Fsrc\u002Fvendor\u002Fshared\u002Fadapters.ts` + Zod contracts in `vendor\u002Fshared\u002Fcontracts\u002F` | Zod 3 |\n| Infrastructure adapters | `server\u002Fsrc\u002Fadapters\u002F**` (llm, github, git, astgrep, codeindex, embedder, depgraph, tokenizer, secrets, auth, skill-import) | vendor SDKs |\n| Data access (repositories) | `server\u002Fsrc\u002Fmodules\u002F\u003Cf>\u002Frepository.ts` (+ `repository\u002F*.repo.ts`) | Drizzle 0.38 |\n| Composition root (DI) | `server\u002Fsrc\u002Fplatform\u002Fcontainer.ts` | hand-rolled |\n| Domain \u002F application core (pure) | `reviewer-core\u002Fsrc\u002F**` | pure TS |\n\n> The table above is a reference layout — map the names onto the host project's packages.\n> This skill's job is to keep new code\n> inside those boundaries, because they quietly erode exactly when a change \"feels routine\".\n\n## Guiding principle\n\n**The database, the LLM, GitHub, and git are external details, not the center.**\nInner layers define interfaces; outer layers implement them. When you don't know\nwhere something goes, ask: *\"what does this depend on?\"* — and place it so its\ndependencies point inward, never outward.\n\n## Do NOT flag (sanctioned patterns)\n\nA review loses credibility on false positives. These look like violations but are how this\ncodebase is designed to work — do not report them:\n\n- **A service constructing its OWN repository from `container.db`** (e.g.\n  `new SkillsRepository(container.db)` in the service constructor) — the repository is\n  module-private and the test seam stays the injected `db`\u002F`Container` (rule 3's sanctioned\n  exception). Constructing **another** module's repository is still a violation (rule 7).\n- **`reviewer-core` importing `@app\u002Fshared`** — that IS the allowed inward direction\n  (rule 8); only server-internal imports are the forbidden back-edge.\n- **Pure helpers living in `reviewer-core`** — purity is the bar, not emptiness; pure logic\n  belongs in the core, and moving it out is not a fix (rule 1).\n- **The LLM vendor SDK inside `reviewer-core\u002Fsrc\u002Fllm\u002F`** — the core is allowed to *ship* the\n  sanctioned `LLMProvider` implementation (e.g. `OpenRouterProvider`); everything else in the\n  core depends on the interface, never the SDK (rule 1).\n- **The composition-root cycle through `platform\u002Fcontainer.ts`** — the hand-rolled DI\n  intentionally passes the `Container` back into services it constructs; it is excluded from\n  `no-circular` by design (TD-001).\n\n---\n\n## 1. Dependencies point inward — `reviewer-core` stays pure (CRITICAL)\n\n`reviewer-core` is the innermost layer. Its only side effect is the **injected**\n`LLMProvider`. No `db`, `octokit`, `fs`, `simple-git`, `fetch`, or `process.env`.\nThe diff is an **input**, never something it fetches. If you reach for I\u002FO here, the\nlogic belongs in the server (a service or adapter), not in the core.\n\nWhy: purity is what lets the core run identically in every host (locally, in tooling,\nin the CI runner), and be tested with a fake `LLMProvider` and no infrastructure. One real import of\n`fs`\u002F`db` ends that.\n\n## 2. External systems only behind interfaces (CRITICAL)\n\nEvery outside system is reached through an interface declared in\n`server\u002Fsrc\u002Fvendor\u002Fshared\u002Fadapters.ts` (`LLMProvider`, `GitHubClient`, `GitClient`,\n`CodeIndex`, `Embedder`, `SecretsProvider`, `AuthProvider`). Services and the core\ndepend on the **interface**, never on a concrete adapter class.\n\nNever `import { OpenAIProvider }` (or `Octokit`, `simple-git`, the `postgres`\nclient…) into a service or the core. That inverts the dependency arrow and forces\nreal network\u002Fcredentials into tests.\n\n## 3. Instantiate only in the composition root (HIGH)\n\nConcrete **adapters** and **other modules' (shared) repositories** are constructed **only** in\n`server\u002Fsrc\u002Fplatform\u002Fcontainer.ts` (lazily, resolving secrets). Everything else\nreceives them via the `Container`. Tests inject fakes through `ContainerOverrides`\n— that is the whole point of the indirection.\n\nOne sanctioned exception (this is how the codebase already works): a module's service\nMAY construct its **own** repository from `container.db` — e.g. `SkillsService` does\n`new SkillsRepository(container.db)` in its constructor. The repository is\nmodule-private and the test seam remains the injected `db`\u002F`Container`. Constructing\n**another** module's repository this way is still a violation — reach shared entities\nthrough the container facade (rule 7).\n\nA `new SomeAdapter(...)` outside the container is a smell: it can't be overridden in\ntests and it hard-wires a choice the composition root should own.\n\n## 4. All DB access lives in repositories (CRITICAL)\n\nDrizzle (`db`, `t.*` tables, `eq\u002Fand\u002Fdesc`) appears **only** in\n`modules\u002F\u003Cf>\u002Frepository.ts` \u002F `repository\u002F*.repo.ts`. Services and routes call\nrepository methods; they never build queries. Repositories return **domain\ntypes \u002F rows**, not a Drizzle query builder or a half-built query — that would leak\nthe ORM upward and let callers depend on its shape.\n\nWhy: the repository is the seam that keeps \"what we store\" swappable and lets the\nservice be tested without a database. A leaked query builder re-couples every caller\nto Drizzle.\n\n## 5. Zod contracts are the single source of truth at boundaries (HIGH)\n\nValidate **once, at the edge**: parse untrusted input at the route and parse\u002Fserialize\noutput via `fastify-type-provider-zod`, using the shared schemas in\n`@app\u002Fshared` (`vendor\u002Fshared\u002Fcontracts\u002F`). Inward of that boundary, code works\nwith the already-parsed types (`z.infer`) — **parse, don't validate**; don't\nre-validate the same data deeper in. Don't redefine a contract per layer; extend\n`@app\u002Fshared` with a **new** file (never edit the barrel).\n\nThe tell-tale antipattern is a `req.body as {...}` cast (untyped trust at the edge)\n**followed by** scattered `typeof x === 'string'` \u002F `if (!x)` re-checks in the handler\nand service. These are two symptoms of the **same** missing edge-parse, so fix them as\none change: replace the cast with a single `Schema.parse(req.body)` at the route, and\nthen **delete the downstream manual re-checks** — once the payload is parsed at the\nboundary, every inward `typeof`\u002Fpresence guard on those fields is dead code, because the\ntype is already guaranteed. Flag the cast and its now-redundant re-checks together as one\nfinding, not as two unrelated ones.\n\nWhy: one gate means one place to trust. Re-validation inward is dead weight and drifts\nout of sync; redefining shapes per layer breaks the single source of truth.\n\n## 6. Routes are a thin edge (HIGH)\n\nA route does three things: read context\u002Fauth, parse the request with a contract, call\n**one** service method, return its result. No business logic, no Drizzle, no adapter\ncalls, no `new`-ing services-with-logic in the handler body.\n\nWhy: keeping orchestration in the service (not the handler) is what lets the same\nlogic be reused (CI runner, jobs) and tested without an HTTP layer.\n\n## 7. Respect facade boundaries (MEDIUM)\n\nCross-cutting subsystems are reached only through their published facade —\nrepo-intel **only** via `container.repoIntel.*`, never by importing files from\n`modules\u002Frepo-intel\u002F`'s internal pipeline. Shared entities (agents, reviews) are\nreached via `container.agentsRepo` \u002F `container.reviewRepo`, not by deep-importing\nanother module's repository.\n\nWhy: the facade is the contract; reaching past it couples you to internals that are\nfree to change behind it.\n\n## 8. Cross-package import direction (core→server back-edge is CRITICAL; else HIGH)\n\n`reviewer-core` must never import from `server`. `@app\u002Fshared` must import\nnothing runtime (only Zod + its own contracts) — it sits at the center so every\npackage can depend on it. The arrows: `server → reviewer-core → shared` and\n`server → shared`; never the reverse.\n\nA `reviewer-core → server` import is **CRITICAL**, not merely HIGH: it both breaks\nthe inward-only dependency rule *and* leaks the outer package into the core, so the\ncore stops being pure and shareable — that is a rule 1 purity break, not a mild\ncoupling. Rank a core→server back-edge at the top tier, alongside the rule 1\u002F2\nfindings — even when the imported symbol is only a type or an error class. Other\ndirection issues (e.g. `@app\u002Fshared` importing something runtime, which\ncouples the center outward) stay HIGH.\n\nWhy: a back-edge (core importing server) makes the \"pure, shareable\" core\nun-shareable and creates import cycles.\n\n## 9. The boundaries are enforced mechanically — keep the check green (HIGH)\n\nConventions erode; a check in CI doesn't. This is **already wired** — do not propose\nadding it: the `forbidden` rules live in `server\u002F.dependency-cruiser.cjs` (the source of\ntruth), run via `pnpm arch:check` (from `server\u002F`), and gate CI in\n`.github\u002Fworkflows\u002Fserver-unit.yml`. **Run `pnpm arch:check` before\u002Fafter a backend\nchange** — a new violation is a failing build, not a warning. What it forbids today:\n- `reviewer-core` → `server` internals, except the shared contracts (`no-core-to-server`, rule 8)\n- I\u002FO Node builtins (`fs`, `os`, `child_process`, `http`…) anywhere in `reviewer-core`, infra\n  SDKs (`simple-git`, `octokit`, `postgres`, `drizzle-orm`) in the core, and the LLM vendor SDK\n  outside the sanctioned provider impl in `reviewer-core\u002Fsrc\u002Fllm\u002F` (rule 1)\n- `@app\u002Fshared` (vendored at `src\u002Fvendor\u002Fshared`) → anything but `zod` + its own contracts (`shared-stays-pure`, rule 8)\n- `modules\u002F**\u002F{routes,*service}.ts` → `drizzle-orm` **and** → `db\u002Fschema` (rule 4: DB only in repositories)\n- `modules\u002F**\u002F*service.ts` & `reviewer-core\u002F**` → concrete `adapters\u002F**` impls (rule 2)\n- deep imports into `repo-intel`'s `pipeline`\u002F`service`\u002F`repository`, and any cross-module\n  `repository` import (rule 7)\n- circular dependencies (`no-circular`, now `error` per TD-001; the intentional\n  composition-root cycle through `platform\u002Fcontainer.ts` is excluded by path).\n\nWhen you add a boundary the config doesn't yet cover, **extend that file** — never invent a\nparallel one. Not everything is mechanizable (e.g. \"business logic in a route\", rule 6;\n`fetch` as a global in the core, rule 1) — those stay a review-time judgment. See\n[examples.md](examples.md) for the live `forbidden` block. `eslint-plugin-boundaries` is an\noptional second, in-editor line of defense (faster feedback than CI).\n\n---\n\n## Quick placement checklist\n\nWhen adding backend code, ask in order:\n1. Does it touch an external system (DB, LLM, GitHub, git, fs)? → behind an **adapter interface** (or a **repository** for the DB), constructed in the **container**.\n2. Is it orchestration \u002F a use case? → a **service** method.\n3. Is it pure review logic (prompt\u002Fgrounding\u002Fscoring)? → **reviewer-core** (and keep it pure).\n4. Is it HTTP shape (params\u002Fbody\u002Fresponse)? → a **route** + a **Zod contract** in `@app\u002Fshared`.\n5. Does my import point **outward**? → stop; invert it with an interface.\n","# Onion Architecture (TypeScript backend)\n\nKeeps the backend's dependencies pointing **inward**: the pure domain core\n(`reviewer-core`) knows nothing about the database, GitHub, git, or any SDK;\nthose are replaceable outer details reached only through interfaces. This skill is\nabout **layers, dependency direction, and where each kind of code lives** — not\nhow to write a Fastify route, a Drizzle query, or a Zod schema (those have their\nown skills).\n\nFor a good\u002Fbad code example per rule see [examples.md](examples.md); for sources\nand the canonical definition see [references.md](references.md).\n\nSibling skills (do not duplicate — defer to them for mechanics):\n- `engineering-paved-path:fastify-best-practices` → route\u002Fplugin\u002Fhook mechanics, JSON-schema validation, error handling.\n- ORM mechanics (how to write queries, relations, transactions, migrations) and schema-authoring\n  mechanics (Zod schemas, `safeParse`, `z.infer`, refinements) → dedicated ORM\u002Fvalidation skills, when the host project provides them.\n- `engineering-paved-path:react-frontend-architecture` → the same \"where does it live\" question for the **frontend**.\n\n## Severity Levels\n\n- **CRITICAL** — Breaks the dependency rule or leaks infrastructure into the core. Destroys testability and the ability to swap implementations; the core stops being pure.\n- **HIGH** — Erodes a boundary (DB\u002FSDK escapes its layer, logic in the wrong place). Compiles and runs, but couples layers and makes tests need real I\u002FO.\n- **MEDIUM** — Hurts navigability or invites future erosion.\n\n## The layers (outer → inner) and where they live (reference layout)\n\nDependencies may point **only inward** (toward the core). Nothing inner may import\nanything outer.\n\n| Layer | Where | Tool |\n|---|---|---|\n| Presentation \u002F edge | `server\u002Fsrc\u002Fmodules\u002F\u003Cf>\u002Froutes.ts` | Fastify 5 |\n| Application services | `server\u002Fsrc\u002Fmodules\u002F\u003Cf>\u002Fservice.ts` (+ `run-executor.ts`, `helpers.ts`) | — |\n| Ports (interfaces) | `server\u002Fsrc\u002Fvendor\u002Fshared\u002Fadapters.ts` + Zod contracts in `vendor\u002Fshared\u002Fcontracts\u002F` | Zod 3 |\n| Infrastructure adapters | `server\u002Fsrc\u002Fadapters\u002F**` (llm, github, git, astgrep, codeindex, embedder, depgraph, tokenizer, secrets, auth, skill-import) | vendor SDKs |\n| Data access (repositories) | `server\u002Fsrc\u002Fmodules\u002F\u003Cf>\u002Frepository.ts` (+ `repository\u002F*.repo.ts`) | Drizzle 0.38 |\n| Composition root (DI) | `server\u002Fsrc\u002Fplatform\u002Fcontainer.ts` | hand-rolled |\n| Domain \u002F application core (pure) | `reviewer-core\u002Fsrc\u002F**` | pure TS |\n\n> The table above is a reference layout — map the names onto the host project's packages.\n> This skill's job is to keep new code\n> inside those boundaries, because they quietly erode exactly when a change \"feels routine\".\n\n## Guiding principle\n\n**The database, the LLM, GitHub, and git are external details, not the center.**\nInner layers define interfaces; outer layers implement them. When you don't know\nwhere something goes, ask: *\"what does this depend on?\"* — and place it so its\ndependencies point inward, never outward.\n\n## Do NOT flag (sanctioned patterns)\n\nA review loses credibility on false positives. These look like violations but are how this\ncodebase is designed to work — do not report them:\n\n- **A service constructing its OWN repository from `container.db`** (e.g.\n  `new SkillsRepository(container.db)` in the service constructor) — the repository is\n  module-private and the test seam stays the injected `db`\u002F`Container` (rule 3's sanctioned\n  exception). Constructing **another** module's repository is still a violation (rule 7).\n- **`reviewer-core` importing `@app\u002Fshared`** — that IS the allowed inward direction\n  (rule 8); only server-internal imports are the forbidden back-edge.\n- **Pure helpers living in `reviewer-core`** — purity is the bar, not emptiness; pure logic\n  belongs in the core, and moving it out is not a fix (rule 1).\n- **The LLM vendor SDK inside `reviewer-core\u002Fsrc\u002Fllm\u002F`** — the core is allowed to *ship* the\n  sanctioned `LLMProvider` implementation (e.g. `OpenRouterProvider`); everything else in the\n  core depends on the interface, never the SDK (rule 1).\n- **The composition-root cycle through `platform\u002Fcontainer.ts`** — the hand-rolled DI\n  intentionally passes the `Container` back into services it constructs; it is excluded from\n  `no-circular` by design (TD-001).\n\n---\n\n## 1. Dependencies point inward — `reviewer-core` stays pure (CRITICAL)\n\n`reviewer-core` is the innermost layer. Its only side effect is the **injected**\n`LLMProvider`. No `db`, `octokit`, `fs`, `simple-git`, `fetch`, or `process.env`.\nThe diff is an **input**, never something it fetches. If you reach for I\u002FO here, the\nlogic belongs in the server (a service or adapter), not in the core.\n\nWhy: purity is what lets the core run identically in every host (locally, in tooling,\nin the CI runner), and be tested with a fake `LLMProvider` and no infrastructure. One real import of\n`fs`\u002F`db` ends that.\n\n## 2. External systems only behind interfaces (CRITICAL)\n\nEvery outside system is reached through an interface declared in\n`server\u002Fsrc\u002Fvendor\u002Fshared\u002Fadapters.ts` (`LLMProvider`, `GitHubClient`, `GitClient`,\n`CodeIndex`, `Embedder`, `SecretsProvider`, `AuthProvider`). Services and the core\ndepend on the **interface**, never on a concrete adapter class.\n\nNever `import { OpenAIProvider }` (or `Octokit`, `simple-git`, the `postgres`\nclient…) into a service or the core. That inverts the dependency arrow and forces\nreal network\u002Fcredentials into tests.\n\n## 3. Instantiate only in the composition root (HIGH)\n\nConcrete **adapters** and **other modules' (shared) repositories** are constructed **only** in\n`server\u002Fsrc\u002Fplatform\u002Fcontainer.ts` (lazily, resolving secrets). Everything else\nreceives them via the `Container`. Tests inject fakes through `ContainerOverrides`\n— that is the whole point of the indirection.\n\nOne sanctioned exception (this is how the codebase already works): a module's service\nMAY construct its **own** repository from `container.db` — e.g. `SkillsService` does\n`new SkillsRepository(container.db)` in its constructor. The repository is\nmodule-private and the test seam remains the injected `db`\u002F`Container`. Constructing\n**another** module's repository this way is still a violation — reach shared entities\nthrough the container facade (rule 7).\n\nA `new SomeAdapter(...)` outside the container is a smell: it can't be overridden in\ntests and it hard-wires a choice the composition root should own.\n\n## 4. All DB access lives in repositories (CRITICAL)\n\nDrizzle (`db`, `t.*` tables, `eq\u002Fand\u002Fdesc`) appears **only** in\n`modules\u002F\u003Cf>\u002Frepository.ts` \u002F `repository\u002F*.repo.ts`. Services and routes call\nrepository methods; they never build queries. Repositories return **domain\ntypes \u002F rows**, not a Drizzle query builder or a half-built query — that would leak\nthe ORM upward and let callers depend on its shape.\n\nWhy: the repository is the seam that keeps \"what we store\" swappable and lets the\nservice be tested without a database. A leaked query builder re-couples every caller\nto Drizzle.\n\n## 5. Zod contracts are the single source of truth at boundaries (HIGH)\n\nValidate **once, at the edge**: parse untrusted input at the route and parse\u002Fserialize\noutput via `fastify-type-provider-zod`, using the shared schemas in\n`@app\u002Fshared` (`vendor\u002Fshared\u002Fcontracts\u002F`). Inward of that boundary, code works\nwith the already-parsed types (`z.infer`) — **parse, don't validate**; don't\nre-validate the same data deeper in. Don't redefine a contract per layer; extend\n`@app\u002Fshared` with a **new** file (never edit the barrel).\n\nThe tell-tale antipattern is a `req.body as {...}` cast (untyped trust at the edge)\n**followed by** scattered `typeof x === 'string'` \u002F `if (!x)` re-checks in the handler\nand service. These are two symptoms of the **same** missing edge-parse, so fix them as\none change: replace the cast with a single `Schema.parse(req.body)` at the route, and\nthen **delete the downstream manual re-checks** — once the payload is parsed at the\nboundary, every inward `typeof`\u002Fpresence guard on those fields is dead code, because the\ntype is already guaranteed. Flag the cast and its now-redundant re-checks together as one\nfinding, not as two unrelated ones.\n\nWhy: one gate means one place to trust. Re-validation inward is dead weight and drifts\nout of sync; redefining shapes per layer breaks the single source of truth.\n\n## 6. Routes are a thin edge (HIGH)\n\nA route does three things: read context\u002Fauth, parse the request with a contract, call\n**one** service method, return its result. No business logic, no Drizzle, no adapter\ncalls, no `new`-ing services-with-logic in the handler body.\n\nWhy: keeping orchestration in the service (not the handler) is what lets the same\nlogic be reused (CI runner, jobs) and tested without an HTTP layer.\n\n## 7. Respect facade boundaries (MEDIUM)\n\nCross-cutting subsystems are reached only through their published facade —\nrepo-intel **only** via `container.repoIntel.*`, never by importing files from\n`modules\u002Frepo-intel\u002F`'s internal pipeline. Shared entities (agents, reviews) are\nreached via `container.agentsRepo` \u002F `container.reviewRepo`, not by deep-importing\nanother module's repository.\n\nWhy: the facade is the contract; reaching past it couples you to internals that are\nfree to change behind it.\n\n## 8. Cross-package import direction (core→server back-edge is CRITICAL; else HIGH)\n\n`reviewer-core` must never import from `server`. `@app\u002Fshared` must import\nnothing runtime (only Zod + its own contracts) — it sits at the center so every\npackage can depend on it. The arrows: `server → reviewer-core → shared` and\n`server → shared`; never the reverse.\n\nA `reviewer-core → server` import is **CRITICAL**, not merely HIGH: it both breaks\nthe inward-only dependency rule *and* leaks the outer package into the core, so the\ncore stops being pure and shareable — that is a rule 1 purity break, not a mild\ncoupling. Rank a core→server back-edge at the top tier, alongside the rule 1\u002F2\nfindings — even when the imported symbol is only a type or an error class. Other\ndirection issues (e.g. `@app\u002Fshared` importing something runtime, which\ncouples the center outward) stay HIGH.\n\nWhy: a back-edge (core importing server) makes the \"pure, shareable\" core\nun-shareable and creates import cycles.\n\n## 9. The boundaries are enforced mechanically — keep the check green (HIGH)\n\nConventions erode; a check in CI doesn't. This is **already wired** — do not propose\nadding it: the `forbidden` rules live in `server\u002F.dependency-cruiser.cjs` (the source of\ntruth), run via `pnpm arch:check` (from `server\u002F`), and gate CI in\n`.github\u002Fworkflows\u002Fserver-unit.yml`. **Run `pnpm arch:check` before\u002Fafter a backend\nchange** — a new violation is a failing build, not a warning. What it forbids today:\n- `reviewer-core` → `server` internals, except the shared contracts (`no-core-to-server`, rule 8)\n- I\u002FO Node builtins (`fs`, `os`, `child_process`, `http`…) anywhere in `reviewer-core`, infra\n  SDKs (`simple-git`, `octokit`, `postgres`, `drizzle-orm`) in the core, and the LLM vendor SDK\n  outside the sanctioned provider impl in `reviewer-core\u002Fsrc\u002Fllm\u002F` (rule 1)\n- `@app\u002Fshared` (vendored at `src\u002Fvendor\u002Fshared`) → anything but `zod` + its own contracts (`shared-stays-pure`, rule 8)\n- `modules\u002F**\u002F{routes,*service}.ts` → `drizzle-orm` **and** → `db\u002Fschema` (rule 4: DB only in repositories)\n- `modules\u002F**\u002F*service.ts` & `reviewer-core\u002F**` → concrete `adapters\u002F**` impls (rule 2)\n- deep imports into `repo-intel`'s `pipeline`\u002F`service`\u002F`repository`, and any cross-module\n  `repository` import (rule 7)\n- circular dependencies (`no-circular`, now `error` per TD-001; the intentional\n  composition-root cycle through `platform\u002Fcontainer.ts` is excluded by path).\n\nWhen you add a boundary the config doesn't yet cover, **extend that file** — never invent a\nparallel one. Not everything is mechanizable (e.g. \"business logic in a route\", rule 6;\n`fetch` as a global in the core, rule 1) — those stay a review-time judgment. See\n[examples.md](examples.md) for the live `forbidden` block. `eslint-plugin-boundaries` is an\noptional second, in-editor line of defense (faster feedback than CI).\n\n---\n\n## Quick placement checklist\n\nWhen adding backend code, ask in order:\n1. Does it touch an external system (DB, LLM, GitHub, git, fs)? → behind an **adapter interface** (or a **repository** for the DB), constructed in the **container**.\n2. Is it orchestration \u002F a use case? → a **service** method.\n3. Is it pure review logic (prompt\u002Fgrounding\u002Fscoring)? → **reviewer-core** (and keep it pure).\n4. Is it HTTP shape (params\u002Fbody\u002Fresponse)? → a **route** + a **Zod contract** in `@app\u002Fshared`.\n5. Does my import point **outward**? → stop; invert it with an interface.\n",{"name":5,"description":7},"main","7a21601142d172aa0f972ec0913737c45c37d410","plugins\u002Fengineering-paved-path\u002Fskills\u002Fonion-architecture","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace","https:\u002F\u002Fgithub.com\u002FSyukPublic","2026-07-18 02:16:07",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add SyukPublic\u002Fdev-digest-ai-marketplace --skill onion-architecture",{"tool":36,"command":37},"bunx","bunx skills add SyukPublic\u002Fdev-digest-ai-marketplace --skill onion-architecture",{"tool":39,"command":40},"pnpm","pnpm dlx skills add SyukPublic\u002Fdev-digest-ai-marketplace --skill onion-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Fonion-architecture\u002FSKILL.md",true,[44,50,54],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"examples.md","REFERENCE","参考文档",12135,"https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Fonion-architecture\u002Fexamples.md",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"README.md",12008,"https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Fonion-architecture\u002FREADME.md",{"path":55,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":56,"sourceHtmlUrl":57},"references.md",8651,"https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Fonion-architecture\u002Freferences.md",[59,66,73,80,87,94],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M799YJEVQSTVM499YQDKZXYW","sample-skill","Reviews recent changes and reports actionable findings for testing purposes","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fsite\u002Ftest-fixtures\u002Frepo-good\u002Fplugins\u002Ffixture-plugin\u002Fskills\u002Fsample-skill\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M799YDGTK8Q87AKM4XB48ZDN","workflow-retro","Post-run retrospective of the multi-agent SDD pipeline (spec-creator → implementation-planner → implementer \u002F test-writer → architecture-reviewer \u002F plan-verifier, plus nested researcher\u002FExplore agents). Manually invoked after a run to produce TRUE token\u002Ftool\u002Fduration\u002Fparallelism metrics — deep mode parses session + subagent journals from disk because parent-visible usage EXCLUDES subagent tokens — plus insights with concrete optimization actions, a trend row appended to the retro ledger (default docs\u002Fretros\u002Fledger.md), and an audit verdict. Trigger terms: workflow retro, retro, ретро, retrospective, pipeline metrics, agent token usage, cache hit, parallelism, як пройшов конвеєр.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Fworkflow-retro\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M799Y5Q6AFZJ3DDEK7AB2E9T","run-plan","Executes an APPROVED Development Plan through the SDD implementation pipeline: implementer wave(s) → test-writer gap pass → green barrier (tests + typecheck) → architecture-reviewer ∥ plan-verifier → bounded fix loop (max 2 iterations) → final report. HARD GATE: an existing plan file is a required input — no plan, no run. Unlike implementer (ships ONE slice) — this skill orchestrates the WHOLE plan across agents; unlike workflow-retro (measures a PAST run) — this skill performs the run; unlike a pre-publish diff review — this skill implements and verifies, it never publishes. Trigger terms: run-plan, run the plan, execute the plan, run the implementation pipeline, запусти план, запусти конвеєр, виконай план, прожени план через конвеєр.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Frun-plan\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M799Y1CJNCX6TSSPHNT7Z99M","mermaid-diagram","Create Mermaid diagrams in markdown. Use when the user wants to visualize workflows, architectures, API flows, data models, state machines, or system designs. Covers flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, and more.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Fmermaid-diagram\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M799XV3K3B4BAHNNTHP5EHQH","engineering-insights","Capture durable engineering insights into the host project's insights file (default docs\u002Fengineering-insights.md), and prune that log. Use during any session when a non-obvious discovery is confirmed — a gotcha, a fix's root cause, a why-it's-like-this decision, an antipattern, or a tool\u002Flibrary quirk — and at session wrap-up to sweep for learnings. Also use to review, dedup, or declutter the insights file. Trigger terms: insight, learning, gotcha, engineering insights, lesson learned, wrap-up, retrospective, prune insights.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Fengineering-insights\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M799XQ8GBDYEPFHCEYZD9VJ1","typescript-expert","TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Ftypescript-expert\u002FSKILL.md",[],[]]