depguard-guard
Skill0 starsChanged 33 days agoMITView on GitHub
Review import boundaries in <app> for hexagonal soundness; flag every domain.ts adapter import, slice-to-slice edge, kernel-only violation, otel import, and dynamic-execution import, and block any relaxation of the no-restricted-imports groups in eslint.config.mjs across the <scope> slice.
In this repository23 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- add-handlerSkill
- add-moduleSkill
- claim-checkSkill
- clean-room-rebuildSkill
- corpus-retrievalSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- graphifySkill
- grillingSkill
- learnSkill
- ownership-authorSkill
- planSkill
- researchSkill
- reviewSkill
- shipSkill
- specSkill
- tddSkill
- verified-statusSkill
- nodejs-best-practicesSkill
- nodejs-portSkill
- nodejs-reviewSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Do not activate for diffs with no import surface and no eslint.config.mjs edit.
- Very specific: line 31
Every stat needs a source.
- Distinctive: line 32
Do not emit the final report as a fenced code block when raw line-anchored output is expected — the report is plain text, one finding per …
- Distinctive: line 33
Verify by reading the cited file and line before reporting.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<app> Depguard Guard
A reusable import-boundary review workflow for the <app> codebase. An agent (e.g. the depguard reviewer role) invokes this skill on any diff that touches src/**/*.ts, package.json, or eslint.config.mjs. The module invariants are domain.ts purity (node builtins + #shared/ only), no slice-to-slice imports, #shared/ imports node builtins only, otel is CUT, and dynamic execution (node:vm, eval, new Function) is out of bounds — all encoded as no-restricted-imports groups in eslint.config.mjs; the skill enforces them absolutely and reports any escape hatch.
When to Activate
- A diff adds or modifies an import in a
domain.ts(fastify,pg,kysely,#gen/*, another feature's path) — or any transport/persistence import in what claims to be domain code. - A diff edits
eslint.config.mjs, or loosens ano-restricted-importsgroup, or adds an override that touches the deny lists. - A new dependency is introduced whose adapter surface reaches
<app>in src code. - A reviewer asks for a boundary pass before approving a PR that touches the import or lint surface.
Do not activate for diffs with no import surface and no eslint.config.mjs edit.
Core Principles
- The deny rules are absolute. They are not defaults to relax for a deadline; any edit that weakens a no-restricted-imports group is a BLOCK.
- The import line is the boundary. A
domain.tsthat carriesfastifyinside is an adapter wearing a domain costume; the fix is moving the code across the layer boundary. - Slices never import each other. A shared shape moves down to
#shared/through an architect decision, never as a cross-slice edge. - eslint is the first reviewer.
pnpm lint(eslint) is the gate this category mirrors; the skill catches what the linter cannot see — config edits that revoke rules, dependency surfaces, and review-time proposals. - Cite the invariant, then the alternative. "BLOCK — domain.ts purity" is the rule; "move it to the slice's http.ts or ports.ts" is the review.
Rules
- Anti-hallucination: do not invent forbidden imports that are not in the diff. Every finding cites a path and line that exists in the tree.
- Every stat needs a source. If you cite the hexagonal dependency rules, name the doc; if you cite the linter's behavior, name the ESLint rule doc (
no-restricted-imports). No unsourced claims. - Do not emit the final report as a fenced code block when raw line-anchored output is expected — the report is plain text, one finding per line, severity-prefixed.
- Verify by reading the cited file and line before reporting. A finding that cites an import the diff does not contain is a hallucination.
- Zero adapter imports in
src/features/*/domain.tsis the floor; eslint enforces it via the domain-pure no-restricted-imports group ineslint.config.mjs. The skill enforces the config + dependency surface the linter cannot see. - otel is CUT from this template (observability = Fastify's built-in JSON logger + /healthz + /readyz): any otel import in
src/orpackage.jsonis a BLOCK. - Zero dynamic-execution imports (
node:vm,eval,new Function) in src code, and zero slice-to-slice imports, without an architect decision recorded in the PR.
Research References
Provenance table — fill the link column from the primary source before relying on a claim. No claim may appear in a finding without a row here.
| claim | source | year | link |
| no-restricted-imports denies imports by module name and pattern | ESLint documentation, no-restricted-imports | 2024 | <TODO: primary doc link> |
| domain.ts purity is the hexagon's core invariant | dependency-rules doc / hexagonal architecture | 2024 | <TODO: primary doc link> |
| Slices never import each other (vertical isolation) | dependency-rules doc | 2024 | <TODO: primary doc link> |
| eslint flat config evaluates from eslint.config.mjs | ESLint flat config documentation | 2024 | <TODO: primary doc link> |
Output Format
A line-anchored report, one finding per line, severity-prefixed, followed by a summary line. Plain text — not a fenced block:
BLOCK src/features/widgets/domain.ts:9 `import fastify` — domain.ts purity violated; move it to the slice's http.ts or ports.ts.
BLOCK src/features/authsignup/usecase.ts:12 `#features/widgets` — slices never import each other; route the shared shape to #shared/ via the architect.
WARN eslint.config.mjs:41 the domain-pure no-restricted-imports group dropped `pg` — boundary revoked; route to architect.
PASS src/features/widgets/postgres.ts no forbidden imports; the adapter layer is exactly where pg belongs.Summary line: depguard-guard: N block(s), M warning(s), K pass — verdict: BLOCK | APPROVE. Any non-zero BLOCK is an automatic BLOCK verdict.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

