agent-directives 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +385 -0
  2. package/directives/adaptive-routing.md +361 -0
  3. package/directives/architecture-boundaries.md +223 -0
  4. package/directives/codebase-navigation.md +325 -0
  5. package/directives/context-handoff.md +220 -0
  6. package/directives/error-memory.md +169 -0
  7. package/directives/exploration-mode.md +266 -0
  8. package/directives/session-decisions.md +193 -0
  9. package/directives/specification-driven-development.md +278 -0
  10. package/directives/task-framing.md +154 -0
  11. package/directives/test-driven-development.md +305 -0
  12. package/directives/type-driven-development.md +173 -0
  13. package/directives/verification.md +266 -0
  14. package/directives/workspace-isolation.md +219 -0
  15. package/dist/cli.d.ts +3 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +232 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/context-audit.d.ts +30 -0
  20. package/dist/context-audit.d.ts.map +1 -0
  21. package/dist/context-audit.js +75 -0
  22. package/dist/context-audit.js.map +1 -0
  23. package/dist/install.d.ts +18 -0
  24. package/dist/install.d.ts.map +1 -0
  25. package/dist/install.js +28 -0
  26. package/dist/install.js.map +1 -0
  27. package/dist/manifest.d.ts +25 -0
  28. package/dist/manifest.d.ts.map +1 -0
  29. package/dist/manifest.js +29 -0
  30. package/dist/manifest.js.map +1 -0
  31. package/dist/prompt.d.ts +3 -0
  32. package/dist/prompt.d.ts.map +1 -0
  33. package/dist/prompt.js +29 -0
  34. package/dist/prompt.js.map +1 -0
  35. package/dist/targets.d.ts +10 -0
  36. package/dist/targets.d.ts.map +1 -0
  37. package/dist/targets.js +32 -0
  38. package/dist/targets.js.map +1 -0
  39. package/manifest.json +387 -0
  40. package/package.json +74 -0
  41. package/skills/architecture-boundary-reviewer/SKILL.md +228 -0
  42. package/skills/code-reviewer/SKILL.md +77 -0
  43. package/skills/codebase-health-reviewer/SKILL.md +234 -0
  44. package/skills/harness-hooks-reviewer/SKILL.md +159 -0
  45. package/skills/implementation-task-planner/SKILL.md +205 -0
  46. package/skills/mcp-integration-reviewer/SKILL.md +157 -0
  47. package/skills/product-requirements-writer/SKILL.md +205 -0
  48. package/skills/production-readiness-reviewer/SKILL.md +240 -0
  49. package/skills/self-audit/SKILL.md +134 -0
  50. package/skills/spec-reviewer/SKILL.md +304 -0
  51. package/skills/subagent-driven-development/SKILL.md +236 -0
  52. package/skills/systematic-debugging/SKILL.md +313 -0
  53. package/skills/test-reviewer/SKILL.md +293 -0
  54. package/templates/AGENTS.md +120 -0
  55. package/templates/CLAUDE.md +115 -0
  56. package/templates/copilot-instructions.md +116 -0
  57. package/templates/decision-log.md +44 -0
package/manifest.json ADDED
@@ -0,0 +1,387 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "entries": [
4
+ {
5
+ "id": "adaptive-routing",
6
+ "type": "directive",
7
+ "path": "directives/adaptive-routing.md",
8
+ "description": "Selects the lightest safe workflow path, relevant directives/skills, and handoff requirements based on task intent, risk, and touched surfaces.",
9
+ "version": "1.3.0",
10
+ "required": true,
11
+ "category": "workflow",
12
+ "tools": [
13
+ "claude",
14
+ "copilot",
15
+ "codex",
16
+ "cursor"
17
+ ]
18
+ },
19
+ {
20
+ "id": "architecture-boundaries",
21
+ "type": "directive",
22
+ "path": "directives/architecture-boundaries.md",
23
+ "description": "Preserves architecture DAG boundaries for imports, exports, packages, services, shared code, and dependency direction.",
24
+ "version": "1.0.0",
25
+ "required": false,
26
+ "category": "architecture",
27
+ "tools": [
28
+ "claude",
29
+ "copilot",
30
+ "codex",
31
+ "cursor"
32
+ ]
33
+ },
34
+ {
35
+ "id": "codebase-navigation",
36
+ "type": "directive",
37
+ "path": "directives/codebase-navigation.md",
38
+ "description": "Guides progressive codebase orientation with the SAFE pattern before implementation, review, or unfamiliar work.",
39
+ "version": "1.1.0",
40
+ "required": true,
41
+ "category": "workflow",
42
+ "tools": [
43
+ "claude",
44
+ "copilot",
45
+ "codex",
46
+ "cursor"
47
+ ]
48
+ },
49
+ {
50
+ "id": "context-handoff",
51
+ "type": "directive",
52
+ "path": "directives/context-handoff.md",
53
+ "description": "Compresses task state at directive or session boundaries so later phases can continue from a compact, current-state handoff instead of drifting through accumulated chat history.",
54
+ "version": "1.0.0",
55
+ "required": false,
56
+ "category": "workflow",
57
+ "tools": [
58
+ "claude",
59
+ "codex"
60
+ ]
61
+ },
62
+ {
63
+ "id": "error-memory",
64
+ "type": "directive",
65
+ "path": "directives/error-memory.md",
66
+ "description": "Captures repeated mistakes in durable error memory only when recurrence and prevention criteria are met.",
67
+ "version": "1.0.0",
68
+ "required": false,
69
+ "category": "memory",
70
+ "tools": [
71
+ "claude",
72
+ "codex"
73
+ ]
74
+ },
75
+ {
76
+ "id": "exploration-mode",
77
+ "type": "directive",
78
+ "path": "directives/exploration-mode.md",
79
+ "description": "Supports investigation and option discovery before committing to an implementation approach.",
80
+ "version": "1.0.0",
81
+ "required": true,
82
+ "category": "workflow",
83
+ "tools": [
84
+ "claude",
85
+ "copilot",
86
+ "codex",
87
+ "cursor"
88
+ ]
89
+ },
90
+ {
91
+ "id": "session-decisions",
92
+ "type": "directive",
93
+ "path": "directives/session-decisions.md",
94
+ "description": "Captures durable decisions for repo policy, architecture, workflow, and cross-cutting conventions.",
95
+ "version": "1.0.0",
96
+ "required": false,
97
+ "category": "memory",
98
+ "tools": [
99
+ "claude",
100
+ "codex"
101
+ ]
102
+ },
103
+ {
104
+ "id": "specification-driven-development",
105
+ "type": "directive",
106
+ "path": "directives/specification-driven-development.md",
107
+ "description": "Requires written specifications for features or changes large enough that build-and-see would risk rework.",
108
+ "version": "1.0.0",
109
+ "required": false,
110
+ "category": "workflow",
111
+ "tools": [
112
+ "claude",
113
+ "copilot",
114
+ "codex",
115
+ "cursor"
116
+ ]
117
+ },
118
+ {
119
+ "id": "task-framing",
120
+ "type": "directive",
121
+ "path": "directives/task-framing.md",
122
+ "description": "Frames non-trivial, ambiguous, high-risk, or cross-cutting tasks before substantial edits.",
123
+ "version": "1.0.0",
124
+ "required": true,
125
+ "category": "workflow",
126
+ "tools": [
127
+ "claude",
128
+ "copilot",
129
+ "codex",
130
+ "cursor"
131
+ ]
132
+ },
133
+ {
134
+ "id": "test-driven-development",
135
+ "type": "directive",
136
+ "path": "directives/test-driven-development.md",
137
+ "description": "Defines RED/GREEN/REFACTOR expectations for behavior-changing implementation work and bug fixes.",
138
+ "version": "1.0.0",
139
+ "required": false,
140
+ "category": "testing",
141
+ "tools": [
142
+ "claude",
143
+ "copilot",
144
+ "codex",
145
+ "cursor"
146
+ ]
147
+ },
148
+ {
149
+ "id": "type-driven-development",
150
+ "type": "directive",
151
+ "path": "directives/type-driven-development.md",
152
+ "description": "Requires type and contract definition before implementation in typed projects or public API work.",
153
+ "version": "1.0.0",
154
+ "required": false,
155
+ "category": "testing",
156
+ "tools": [
157
+ "claude",
158
+ "copilot",
159
+ "codex",
160
+ "cursor"
161
+ ]
162
+ },
163
+ {
164
+ "id": "verification",
165
+ "type": "directive",
166
+ "path": "directives/verification.md",
167
+ "description": "Requires structured evidence of correctness before quality gates and pull requests.",
168
+ "version": "1.0.0",
169
+ "required": true,
170
+ "category": "workflow",
171
+ "tools": [
172
+ "claude",
173
+ "copilot",
174
+ "codex",
175
+ "cursor"
176
+ ]
177
+ },
178
+ {
179
+ "id": "workspace-isolation",
180
+ "type": "directive",
181
+ "path": "directives/workspace-isolation.md",
182
+ "description": "Keeps mutable work in an isolated workspace by detecting existing isolation first, preferring native tools, and falling back to git worktrees only when needed.",
183
+ "version": "1.0.0",
184
+ "required": false,
185
+ "category": "workflow",
186
+ "tools": [
187
+ "claude",
188
+ "codex"
189
+ ]
190
+ },
191
+ {
192
+ "id": "architecture-boundary-reviewer",
193
+ "type": "skill",
194
+ "path": "skills/architecture-boundary-reviewer/SKILL.md",
195
+ "description": "Load when changes touch imports, exports, public APIs, file moves, packages, services, layers, shared code, dependency direction, cycles, or the user asks if architecture boundaries still hold.",
196
+ "version": "1.0.0",
197
+ "required": false,
198
+ "category": "review",
199
+ "tools": [
200
+ "claude",
201
+ "copilot",
202
+ "codex",
203
+ "cursor"
204
+ ]
205
+ },
206
+ {
207
+ "id": "code-reviewer",
208
+ "type": "skill",
209
+ "path": "skills/code-reviewer/SKILL.md",
210
+ "description": "Load when the user asks to review a PR, branch, diff, local changes, or says approve, merge, or check this change for bugs, regressions, security, maintainability, or merge risk.",
211
+ "version": "1.1.0",
212
+ "required": true,
213
+ "category": "review",
214
+ "tools": [
215
+ "claude",
216
+ "copilot",
217
+ "codex",
218
+ "cursor"
219
+ ]
220
+ },
221
+ {
222
+ "id": "codebase-health-reviewer",
223
+ "type": "skill",
224
+ "path": "skills/codebase-health-reviewer/SKILL.md",
225
+ "description": "Load when reviewing TypeScript/JavaScript refactors, cleanup, AI-generated code, shared utilities, dead code, duplication, complexity, circular dependencies, Fallow output, or maintainability drift.",
226
+ "version": "1.1.0",
227
+ "required": false,
228
+ "category": "review",
229
+ "tools": [
230
+ "claude",
231
+ "copilot",
232
+ "codex",
233
+ "cursor"
234
+ ]
235
+ },
236
+ {
237
+ "id": "harness-hooks-reviewer",
238
+ "type": "skill",
239
+ "path": "skills/harness-hooks-reviewer/SKILL.md",
240
+ "description": "Load when adding or reviewing agent harness hooks, start/stop hooks, pre-write/pre-command hooks, post-change automation, or deterministic agent workflow scripts.",
241
+ "version": "1.0.0",
242
+ "required": false,
243
+ "category": "review",
244
+ "tools": [
245
+ "claude",
246
+ "copilot",
247
+ "codex",
248
+ "cursor"
249
+ ]
250
+ },
251
+ {
252
+ "id": "implementation-task-planner",
253
+ "type": "skill",
254
+ "path": "skills/implementation-task-planner/SKILL.md",
255
+ "description": "Load when the user has a PRD, issue, acceptance criteria, or requirements doc and wants a staged implementation task list with relevant files, tests, validation steps, and review checkpoints.",
256
+ "version": "1.0.0",
257
+ "required": false,
258
+ "category": "planning",
259
+ "tools": [
260
+ "claude",
261
+ "copilot",
262
+ "codex",
263
+ "cursor"
264
+ ]
265
+ },
266
+ {
267
+ "id": "mcp-integration-reviewer",
268
+ "type": "skill",
269
+ "path": "skills/mcp-integration-reviewer/SKILL.md",
270
+ "description": "Load when adding or reviewing MCP servers, agent tools, tool schemas, internal API bridges, structured search, docs/ticketing/analytics connectors, or agent-accessible write tools.",
271
+ "version": "1.0.0",
272
+ "required": false,
273
+ "category": "review",
274
+ "tools": [
275
+ "claude",
276
+ "copilot",
277
+ "codex",
278
+ "cursor"
279
+ ]
280
+ },
281
+ {
282
+ "id": "product-requirements-writer",
283
+ "type": "skill",
284
+ "path": "skills/product-requirements-writer/SKILL.md",
285
+ "description": "Load when the user wants to turn a feature idea, product request, vague requirement, or problem statement into a concrete PRD/spec before implementation planning or coding.",
286
+ "version": "1.0.0",
287
+ "required": false,
288
+ "category": "planning",
289
+ "tools": [
290
+ "claude",
291
+ "copilot",
292
+ "codex",
293
+ "cursor"
294
+ ]
295
+ },
296
+ {
297
+ "id": "production-readiness-reviewer",
298
+ "type": "skill",
299
+ "path": "skills/production-readiness-reviewer/SKILL.md",
300
+ "description": "Load when reviewing changes that may affect production safety: persistence, migrations, external services, async jobs, auth/security/privacy, infra/config/deploy, critical user paths, performance/scale, or cross-service compatibility.",
301
+ "version": "1.1.0",
302
+ "required": false,
303
+ "category": "review",
304
+ "tools": [
305
+ "claude",
306
+ "copilot",
307
+ "codex",
308
+ "cursor"
309
+ ]
310
+ },
311
+ {
312
+ "id": "self-audit",
313
+ "type": "skill",
314
+ "path": "skills/self-audit/SKILL.md",
315
+ "description": "Load when implementation is past GREEN/REFACTOR and the user asks for pre-PR verification, self-audit, scope check, weakest-assumption review, anomaly triage, or a confidence check.",
316
+ "version": "1.0.0",
317
+ "required": false,
318
+ "category": "review",
319
+ "tools": [
320
+ "claude",
321
+ "copilot",
322
+ "codex",
323
+ "cursor"
324
+ ]
325
+ },
326
+ {
327
+ "id": "spec-reviewer",
328
+ "type": "skill",
329
+ "path": "skills/spec-reviewer/SKILL.md",
330
+ "description": "Load when the user asks whether implementation matches a spec, requirements doc, acceptance criteria, or design plan, or says check what is missing, incomplete, or divergent before merge.",
331
+ "version": "1.1.0",
332
+ "required": false,
333
+ "category": "review",
334
+ "tools": [
335
+ "claude",
336
+ "copilot",
337
+ "codex",
338
+ "cursor"
339
+ ]
340
+ },
341
+ {
342
+ "id": "subagent-driven-development",
343
+ "type": "skill",
344
+ "path": "skills/subagent-driven-development/SKILL.md",
345
+ "description": "Load when executing an existing implementation plan with multiple mostly independent tasks using delegated subagents, fresh task context, parent-owned review, and final integration verification.",
346
+ "version": "1.0.0",
347
+ "required": false,
348
+ "category": "workflow",
349
+ "tools": [
350
+ "claude",
351
+ "copilot",
352
+ "codex",
353
+ "cursor"
354
+ ]
355
+ },
356
+ {
357
+ "id": "systematic-debugging",
358
+ "type": "skill",
359
+ "path": "skills/systematic-debugging/SKILL.md",
360
+ "description": "Load when the user reports a bug, failing test, CI/build/lint/typecheck failure, regression, flaky behavior, unexpected behavior, or asks to fix a failure or root-cause it.",
361
+ "version": "1.0.0",
362
+ "required": true,
363
+ "category": "debugging",
364
+ "tools": [
365
+ "claude",
366
+ "copilot",
367
+ "codex",
368
+ "cursor"
369
+ ]
370
+ },
371
+ {
372
+ "id": "test-reviewer",
373
+ "type": "skill",
374
+ "path": "skills/test-reviewer/SKILL.md",
375
+ "description": "Load when the user asks to write or review tests, TDD cases, eval scenarios, coverage, assertions, or mocks, or says tests are shallow, flaky, brittle, or too close to implementation.",
376
+ "version": "1.1.0",
377
+ "required": true,
378
+ "category": "testing",
379
+ "tools": [
380
+ "claude",
381
+ "copilot",
382
+ "codex",
383
+ "cursor"
384
+ ]
385
+ }
386
+ ]
387
+ }
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "agent-directives",
3
+ "version": "0.1.0",
4
+ "description": "Reusable agent directives, skills, and CLI tooling for AI coding workflows",
5
+ "license": "MIT",
6
+ "author": "Rob Simpson <rsimpson2@me.com>",
7
+ "type": "module",
8
+ "engines": {
9
+ "node": ">=20"
10
+ },
11
+ "bin": {
12
+ "agent-directives": "./dist/cli.js"
13
+ },
14
+ "files": [
15
+ "dist/",
16
+ "directives/",
17
+ "skills/",
18
+ "templates/",
19
+ "manifest.json",
20
+ "README.md"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public",
24
+ "provenance": true,
25
+ "registry": "https://registry.npmjs.org/"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/pertrai1/agent-directives.git"
30
+ },
31
+ "homepage": "https://github.com/pertrai1/agent-directives#readme",
32
+ "bugs": {
33
+ "url": "https://github.com/pertrai1/agent-directives/issues"
34
+ },
35
+ "scripts": {
36
+ "check": "npm run typecheck && npm run lint && npm run validate && npm run version:check && npm run manifest:check && npm run test:cli && npm run test:version-bumps && npm run test:package-release && npm run pack:check",
37
+ "build": "tsc -p tsconfig.build.json",
38
+ "typecheck": "tsc --noEmit",
39
+ "validate": "tsx scripts/validate-directives.ts",
40
+ "version:check": "tsx scripts/validate-version-bumps.ts",
41
+ "eval:scenario": "tsx scripts/eval-scenario.ts",
42
+ "eval:report": "tsx evals/report-results.ts",
43
+ "context:audit": "tsx src/cli.ts context-audit",
44
+ "manifest": "tsx scripts/generate-manifest.ts",
45
+ "manifest:check": "npm run manifest && git diff --exit-code manifest.json",
46
+ "pack:check": "npm run build && npm pack --dry-run",
47
+ "cli": "tsx src/cli.ts",
48
+ "test:cli": "tsx scripts/test-cli.ts",
49
+ "test:version-bumps": "tsx scripts/test-version-bumps.ts",
50
+ "test:package-release": "tsx scripts/test-package-release.ts",
51
+ "lint": "eslint .",
52
+ "lint:fix": "eslint . --fix",
53
+ "prepare": "npm run build",
54
+ "changeset": "changeset",
55
+ "version": "changeset version",
56
+ "release": "npm run build && changeset publish"
57
+ },
58
+ "dependencies": {
59
+ "commander": "^14.0.3"
60
+ },
61
+ "devDependencies": {
62
+ "@changesets/changelog-github": "^0.7.0",
63
+ "@changesets/cli": "^2.31.0",
64
+ "@eslint/js": "^10.0.1",
65
+ "@eslint/markdown": "^8.0.2",
66
+ "@types/node": "^24.0.0",
67
+ "eslint": "^10.4.0",
68
+ "eslint-plugin-llm-core": "^0.23.0",
69
+ "globals": "^17.6.0",
70
+ "tsx": "^4.19.2",
71
+ "typescript": "^5.4.5",
72
+ "typescript-eslint": "^8.60.0"
73
+ }
74
+ }
@@ -0,0 +1,228 @@
1
+ ---
2
+ name: "architecture-boundary-reviewer"
3
+ description: "Load when changes touch imports, exports, public APIs, file moves, packages, services, layers, shared code, dependency direction, cycles, or the user asks if architecture boundaries still hold."
4
+ version: 1.0.0
5
+ required: false
6
+ category: review
7
+ tools:
8
+ - claude
9
+ - copilot
10
+ - codex
11
+ - cursor
12
+ routing:
13
+ triggers:
14
+ - imports
15
+ - exports
16
+ - packages
17
+ - shared-code
18
+ - service-boundaries
19
+ - architecture-review
20
+ paths:
21
+ - boundary-path
22
+ - review-path
23
+ ---
24
+
25
+ # Architecture Boundary Reviewer
26
+
27
+ You are a specialist in reviewing whether a change preserves the project's
28
+ architectural dependency graph. Your job is to catch illegal imports, boundary
29
+ leaks, cycles, public API bypasses, and shared-code misuse before the change is
30
+ merged.
31
+
32
+ This skill complements test-reviewer and spec-reviewer. Tests can pass while the
33
+ architecture gets worse. Boundary review asks: *does this change still fit the
34
+ DAG?*
35
+
36
+ ---
37
+
38
+ ## When to Use
39
+
40
+ Use this skill before merging or final verification when a change includes any of
41
+ these signals:
42
+
43
+ - New or changed imports/exports
44
+ - File moves between folders, packages, services, or layers
45
+ - New shared utilities or changes to existing shared/common code
46
+ - New package/workspace dependencies
47
+ - Cross-feature, cross-service, or cross-package calls
48
+ - Public API or package entry point changes
49
+ - Refactors that move behavior across layers
50
+ - Any Fallow, lint, dependency-cruiser, Nx, or GitNexus warning about boundaries,
51
+ cycles, dependency direction, or architecture drift
52
+
53
+ Do not use this skill for pure text/docs changes unless they alter documented
54
+ architecture rules.
55
+
56
+ ---
57
+
58
+ ## Review Principle: Every Edge Has a Direction
59
+
60
+ Every dependency edge has architectural meaning. Review both explicit edges and
61
+ implicit edges:
62
+
63
+ | Edge type | Examples |
64
+ | --- | --- |
65
+ | Static import | `import { x } from "../infra/db"` |
66
+ | Dynamic import | `await import("./feature")` |
67
+ | Public export | `export * from "./internal"` |
68
+ | Package dependency | adding a dependency to `package.json` |
69
+ | Runtime registration | plugin registries, callbacks, dependency injection |
70
+ | Test leakage | production code importing test fixtures/helpers |
71
+ | Deep import | importing `feature/internal/foo` instead of the feature API |
72
+
73
+ The review fails if a new edge points in a forbidden direction, bypasses the
74
+ public contract, or creates a cycle.
75
+
76
+ ---
77
+
78
+ ## Review Process
79
+
80
+ ### Step 1: Load the Boundary Contract
81
+
82
+ Find the strongest available source of truth:
83
+
84
+ 1. Project instruction files (`AGENTS.md`, `CLAUDE.md`, Copilot instructions)
85
+ 2. Architecture docs, ADRs, or decision logs
86
+ 3. Existing lint/monorepo/boundary configuration
87
+ 4. Package/workspace structure and public `exports`
88
+ 5. Existing import patterns near the changed code
89
+ 6. Tool output from Fallow or GitNexus if available
90
+
91
+ Record whether each rule is **explicit** or **inferred**. Inferred rules should be
92
+ stated with lower confidence.
93
+
94
+ ### Step 2: Classify Changed Files
95
+
96
+ For every changed production file, classify it:
97
+
98
+ ```md
99
+ - File: `src/domain/user.ts`
100
+ - Zone: `domain`
101
+ - Public API: exported through `src/domain/index.ts`? yes/no
102
+ - Allowed imports: `shared` only
103
+ - Changed role: added validation helper
104
+ ```
105
+
106
+ If a file cannot be classified, flag it as an uncertainty. Do not invent a
107
+ confident architecture label.
108
+
109
+ ### Step 3: List Changed Edges
110
+
111
+ Inspect the diff and list every added/changed edge:
112
+
113
+ ```md
114
+ - `src/features/auth/login.ts` → `src/shared/validation.ts` (allowed)
115
+ - `src/domain/user.ts` → `src/infra/db.ts` (violation: domain imports infra)
116
+ ```
117
+
118
+ Focus on changed edges first, then look for newly exposed public exports and
119
+ file moves that affect dependents.
120
+
121
+ ### Step 4: Check for Five Boundary Failures
122
+
123
+ | Failure | What to look for | Severity |
124
+ | --- | --- | --- |
125
+ | Upward import | lower/core layer imports upper/UI/app layer | Critical |
126
+ | Sideways internal import | feature imports another feature's internals | Critical |
127
+ | Public API bypass | package/feature deep import skips entry point | Warning/Critical |
128
+ | Cycle introduced | circular file/package/layer dependency | Critical |
129
+ | Shared pollution | shared/common imports app/feature specifics or receives unstable behavior | Warning |
130
+
131
+ ### Step 5: Use Tool Evidence When Available
132
+
133
+ For TypeScript/JavaScript projects with Fallow:
134
+
135
+ ```bash
136
+ npx fallow list --boundaries
137
+ npx fallow dead-code --boundary-violations
138
+ npx fallow dead-code --circular-deps
139
+ ```
140
+
141
+ For graph-backed orientation with GitNexus:
142
+
143
+ ```bash
144
+ gitnexus analyze
145
+ gitnexus wiki
146
+ ```
147
+
148
+ Use GitNexus/MCP graph context to identify dependents, clusters, services, and
149
+ execution flows. Treat GitNexus as evidence for understanding impact unless the
150
+ project has explicit GitNexus queries that enforce boundary rules.
151
+
152
+ If a tool is unavailable, do not fail the review solely for that reason. State the
153
+ manual evidence used instead.
154
+
155
+ ---
156
+
157
+ ## Output Format
158
+
159
+ ```md
160
+ ## Architecture Boundary Review
161
+
162
+ ### Boundary Contract
163
+ - Source: explicit/inferred rule source
164
+ - Zones/layers involved: ...
165
+ - Allowed direction: ...
166
+
167
+ ### Changed Edges
168
+ | From | To | Status | Notes |
169
+ | --- | --- | --- | --- |
170
+ | `src/...` | `src/...` | Allowed / Violation / Unclear | reason |
171
+
172
+ ### Findings
173
+ #### CRITICAL: Domain imports infrastructure directly
174
+ - Edge: `src/domain/user.ts` → `src/infra/db.ts`
175
+ - Rule violated: domain may not import infrastructure
176
+ - Why it matters: reverses dependency direction and couples core logic to storage
177
+ - Fix: define a port/interface in domain/application; implement it in infra
178
+
179
+ ### Tool Evidence
180
+ - Fallow: `npx fallow dead-code --boundary-violations` → 0 violations / N violations / unavailable
181
+ - Cycle check: ...
182
+ - GitNexus/dependency graph: ...
183
+
184
+ ### Verdict
185
+ - ✅ Pass — no illegal edges found
186
+ - ⚠️ Pass with documented uncertainty — human should review named assumptions
187
+ - ❌ Block — boundary violation must be fixed before merge
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Fix Patterns
193
+
194
+ | Violation | Preferred fix |
195
+ | --- | --- |
196
+ | Domain imports infrastructure | Create a port/interface; inject implementation from upper layer |
197
+ | UI imports database/client | Route through application/use-case/service boundary |
198
+ | Feature imports sibling internals | Depend on sibling public API or extract shared behavior |
199
+ | Shared imports feature/app code | Pass data/config in; move specific behavior out of shared |
200
+ | Deep package import | Export through package entry point or add approved subpath export |
201
+ | Cycle from convenience import | Split types/constants, invert dependency, or move shared concept down |
202
+
203
+ ---
204
+
205
+ ## Common Pitfalls
206
+
207
+ 1. **Only reviewing files, not edges.** A file can look reasonable while the new
208
+ import graph is invalid.
209
+ 2. **Treating `shared` as a safe dumping ground.** Shared code must be more stable
210
+ and less specific than its consumers.
211
+ 3. **Ignoring test-to-production leakage.** Production code must never depend on
212
+ test fixtures, mocks, or factories.
213
+ 4. **Approving deep imports because they compile.** Compiling does not make an
214
+ internal path part of the public contract.
215
+ 5. **Adding boundary enforcement during an unrelated change.** Propose a separate
216
+ issue/PR for new repo-wide policy unless the user requested it.
217
+
218
+ ---
219
+
220
+ ## Verification Checklist
221
+
222
+ - [ ] Boundary contract source identified as explicit or inferred
223
+ - [ ] Every changed production file classified into a zone/layer/package/service
224
+ - [ ] Every added/changed import/export/package edge reviewed
225
+ - [ ] Public API bypasses and deep imports checked
226
+ - [ ] Circular dependency risk checked manually or with a tool
227
+ - [ ] Fallow/GitNexus/lint evidence included when available
228
+ - [ ] Verdict is Pass, Pass with uncertainty, or Block with concrete fixes