@mrciphersmith/keryx 0.4.27 → 0.4.29
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.
- package/README.md +2 -2
- package/dist/cli.js +105640 -105242
- package/dist/core.js +24 -200
- package/dist/keryx-general-worker-entry.js +355 -418
- package/package.json +3 -3
- package/src/gdskills/bundled/agents/work-planner.md +1 -1
- package/src/gdskills/bundled/install-manifest.json +4 -26
- package/src/gdskills/bundled/rules/core/clean-architecture.mdc +25 -153
- package/src/gdskills/bundled/rules/core/code-review-learned-profile.mdc +1 -2
- package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +1 -0
- package/src/gdskills/bundled/rules/core/definition-of-done.mdc +0 -1
- package/src/gdskills/bundled/rules/core/error-handling.mdc +57 -108
- package/src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc +4 -5
- package/src/gdskills/bundled/rules/core/jobs-documentation.mdc +8 -8
- package/src/gdskills/bundled/rules/core/skill-authoring.mdc +190 -0
- package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +12 -10
- package/src/gdskills/bundled/rules/core/solid-principles.mdc +48 -123
- package/src/gdskills/bundled/skills/core/reviewer-skill-creator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.md +12 -21
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.md +3 -3
- package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/orchestration/task-implementer/input-contract.schema.json +1 -1
- package/src/gdskills/bundled/skills/planning/autodoc-orchestrator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/planning/interview/SKILL.md +3 -4
- package/src/gdskills/bundled/skills/planning/interviewer/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/quality/git-publish/SKILL.md +60 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.md +3 -3
- package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +6 -6
- package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +23 -25
- package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +100 -421
- package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/review/review-degradation/SKILL.md +6 -6
- package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +36 -33
- package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +63 -134
- package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +4 -5
- package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.detail.md +18 -20
- package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +12 -18
- package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-finding.schema.json +2 -2
- package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-input.schema.json +2 -10
- package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +35 -35
- package/src/gdskills/bundled/skills/review/review-pr-contract/SKILL.md +4 -5
- package/src/gdskills/bundled/skills/review/review-premise/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/review/review-regression/SKILL.md +2 -4
- package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +13 -14
- package/src/gdskills/bundled/skills/review/review-style/SKILL.md +41 -44
- package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +10 -10
- package/src/gdskills/bundled/skills/review/review-ui-ux/SKILL.md +10 -11
- package/src/gdskills/bundled/skills/review/review-verifier/SKILL.md +5 -5
- package/src/gdskills/bundled/skills/shared/git-merge-base.md +1 -1
- package/src/gdskills/bundled/stacks/csharp-dotnet/rules/patterns.mdc +4 -3
- package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/coding-style.mdc +3 -3
- package/src/gdskills/bundled/stacks/mobx/agent-refs.json +1 -1
- package/src/gdskills/bundled/stacks/mobx/governance/scout.json +2 -2
- package/src/gdskills/bundled/stacks/mobx/skills/mobx-store-implementation/SKILL.md +2 -2
- package/src/gdskills/bundled/stacks/ruby-rails/rules/coding-style.mdc +4 -4
- package/src/gdskills/bundled/stacks/vue/governance/scout.json +1 -1
- package/src/gdskills/contracts/review-finding.schema.json +2 -2
- package/src/gdskills/bundled/rules/core/code-review-ai-assistant.mdc +0 -49
- package/src/gdskills/bundled/rules/core/gproject-contracts.mdc +0 -198
- package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.md +0 -177
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.md +0 -414
- package/src/gdskills/bundled/skills/orchestration/job-documenter/input-contract.schema.json +0 -55
- package/src/gdskills/bundled/skills/orchestration/job-documenter/output-contract.schema.json +0 -58
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +0 -209
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +0 -209
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.md +0 -208
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +0 -255
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +0 -255
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.md +0 -254
- package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +0 -209
- package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +0 -209
- package/src/gdskills/bundled/skills/planning/planner/SKILL.md +0 -208
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +0 -171
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +0 -171
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.md +0 -170
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +0 -184
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +0 -184
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.md +0 -183
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +0 -249
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +0 -249
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.md +0 -248
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +0 -199
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +0 -199
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.md +0 -198
- package/src/gdskills/bundled/skills/quality/commit/SKILL.md +0 -87
- package/src/gdskills/bundled/skills/quality/pr/SKILL.md +0 -95
- package/src/gdskills/bundled/skills/quality/push/SKILL.md +0 -73
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.md +0 -238
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.md +0 -301
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.md +0 -208
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/keryx",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.29",
|
|
4
4
|
"description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"fast-uri": "^3.1.9",
|
|
80
80
|
"body-parser": "^2.4.0",
|
|
81
81
|
"ip-address": "^10.7.4",
|
|
82
|
-
"hono": "^4.13.
|
|
82
|
+
"hono": "^4.13.16",
|
|
83
83
|
"qs": "^6.17.1",
|
|
84
84
|
"zod": "^4.6.6",
|
|
85
|
-
"@hono/node-server": "^2.1.
|
|
85
|
+
"@hono/node-server": "^2.1.6",
|
|
86
86
|
"protobufjs": "7.6.6",
|
|
87
87
|
"sharp": "0.35.5",
|
|
88
88
|
"minimatch": "^11.0.1"
|
|
@@ -281,7 +281,6 @@
|
|
|
281
281
|
"quality-skills",
|
|
282
282
|
"review-core-skills",
|
|
283
283
|
"react-review-skills",
|
|
284
|
-
"mobx-review-skill",
|
|
285
284
|
"mobx-store-template-rule",
|
|
286
285
|
"mobx-rules",
|
|
287
286
|
"mobx-skills",
|
|
@@ -368,7 +367,6 @@
|
|
|
368
367
|
"src/gdskills/bundled/rules/core/async-patterns.mdc",
|
|
369
368
|
"src/gdskills/bundled/rules/core/clean-architecture.mdc",
|
|
370
369
|
"src/gdskills/bundled/rules/core/cli-interface-design.mdc",
|
|
371
|
-
"src/gdskills/bundled/rules/core/code-review-ai-assistant.mdc",
|
|
372
370
|
"src/gdskills/bundled/rules/core/code-review-learned-profile.mdc",
|
|
373
371
|
"src/gdskills/bundled/rules/core/code-style-patterns.mdc",
|
|
374
372
|
"src/gdskills/bundled/rules/core/commit-message-formatting.mdc",
|
|
@@ -380,7 +378,6 @@
|
|
|
380
378
|
"src/gdskills/bundled/rules/core/frontend-assistant.mdc",
|
|
381
379
|
"src/gdskills/bundled/rules/core/git-concurrency.mdc",
|
|
382
380
|
"src/gdskills/bundled/rules/core/git-rules.mdc",
|
|
383
|
-
"src/gdskills/bundled/rules/core/gproject-contracts.mdc",
|
|
384
381
|
"src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc",
|
|
385
382
|
"src/gdskills/bundled/rules/core/implementation-plans.mdc",
|
|
386
383
|
"src/gdskills/bundled/rules/core/jobs-documentation.mdc",
|
|
@@ -392,6 +389,7 @@
|
|
|
392
389
|
"src/gdskills/bundled/rules/core/security-baseline.mdc",
|
|
393
390
|
"src/gdskills/bundled/rules/core/session-plan-bridge.mdc",
|
|
394
391
|
"src/gdskills/bundled/rules/core/shared-definitions.mdc",
|
|
392
|
+
"src/gdskills/bundled/rules/core/skill-authoring.mdc",
|
|
395
393
|
"src/gdskills/bundled/rules/core/skills-storage-workflow.mdc",
|
|
396
394
|
"src/gdskills/bundled/rules/core/solid-principles.mdc",
|
|
397
395
|
"src/gdskills/bundled/rules/core/storybook-guidelines.mdc",
|
|
@@ -441,7 +439,7 @@
|
|
|
441
439
|
},
|
|
442
440
|
"quality-skills": {
|
|
443
441
|
"kind": "skill",
|
|
444
|
-
"description": "Quality skills: security, perf, root-cause, testing,
|
|
442
|
+
"description": "Quality skills: security, perf, root-cause, testing, git publishing, dependency and migration workflows.",
|
|
445
443
|
"paths": [
|
|
446
444
|
"src/gdskills/bundled/skills/quality/**"
|
|
447
445
|
],
|
|
@@ -476,9 +474,7 @@
|
|
|
476
474
|
"src/gdskills/bundled/skills/review/review-verifier/**",
|
|
477
475
|
"src/gdskills/bundled/skills/review/review-premise/**",
|
|
478
476
|
"src/gdskills/bundled/skills/review/review-pr-feedback/**",
|
|
479
|
-
"src/gdskills/bundled/skills/review/code-
|
|
480
|
-
"src/gdskills/bundled/skills/review/code-learned-review/**",
|
|
481
|
-
"src/gdskills/bundled/skills/review/code-style-review/**"
|
|
477
|
+
"src/gdskills/bundled/skills/review/code-learned-review/**"
|
|
482
478
|
],
|
|
483
479
|
"targets": [
|
|
484
480
|
"claude",
|
|
@@ -508,23 +504,6 @@
|
|
|
508
504
|
"cost": "medium",
|
|
509
505
|
"stability": "stable"
|
|
510
506
|
},
|
|
511
|
-
"mobx-review-skill": {
|
|
512
|
-
"kind": "skill",
|
|
513
|
-
"description": "Focused MobX store/state-logic review skill.",
|
|
514
|
-
"paths": [
|
|
515
|
-
"src/gdskills/bundled/skills/review/code-mobx-store-review/**"
|
|
516
|
-
],
|
|
517
|
-
"targets": [
|
|
518
|
-
"claude",
|
|
519
|
-
"keryx-shell"
|
|
520
|
-
],
|
|
521
|
-
"dependencies": [
|
|
522
|
-
"core-common-rules"
|
|
523
|
-
],
|
|
524
|
-
"defaultInstall": true,
|
|
525
|
-
"cost": "light",
|
|
526
|
-
"stability": "stable"
|
|
527
|
-
},
|
|
528
507
|
"mobx-store-template-rule": {
|
|
529
508
|
"kind": "rule",
|
|
530
509
|
"description": "MobX store authoring template/rule.",
|
|
@@ -981,7 +960,7 @@
|
|
|
981
960
|
},
|
|
982
961
|
"mobx-skills": {
|
|
983
962
|
"kind": "skill",
|
|
984
|
-
"description": "MobX stack pack skills (store implementation, observable testing) from src/gdskills/bundled/stacks/mobx/skills/. Complements
|
|
963
|
+
"description": "MobX stack pack skills (store implementation, observable testing) from src/gdskills/bundled/stacks/mobx/skills/. Complements the store checklist in review-frontend, which reviews MobX stores.",
|
|
985
964
|
"paths": [
|
|
986
965
|
"src/gdskills/bundled/stacks/mobx/skills/**"
|
|
987
966
|
],
|
|
@@ -1331,7 +1310,6 @@
|
|
|
1331
1310
|
"capability:mobx": {
|
|
1332
1311
|
"family": "capability",
|
|
1333
1312
|
"modules": [
|
|
1334
|
-
"mobx-review-skill",
|
|
1335
1313
|
"mobx-store-template-rule",
|
|
1336
1314
|
"mobx-rules",
|
|
1337
1315
|
"mobx-skills"
|
|
@@ -6,158 +6,30 @@ alwaysApply: false
|
|
|
6
6
|
# Clean Architecture
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
|
-
|
|
9
|
+
Backend layering follows Clean Architecture (Robert C. Martin): presentation, application,
|
|
10
|
+
domain and infrastructure, with dependencies pointing inward and a domain that imports no
|
|
11
|
+
framework, ORM or external SDK. This rule holds only what that name leaves open.
|
|
10
12
|
|
|
11
13
|
## When To Apply
|
|
12
|
-
Apply when creating new modules, services, or features; when deciding where to place a new class or function; when wiring up dependencies between layers.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- Domain → Infrastructure (FORBIDDEN)
|
|
35
|
-
- Domain → Framework (FORBIDDEN)
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Rules
|
|
40
|
-
|
|
41
|
-
### Rule 1: Domain Layer Has No Framework Imports
|
|
42
|
-
The domain layer must import nothing from:
|
|
43
|
-
- ORM packages (`prisma`, `typeorm`, `mongoose`)
|
|
44
|
-
- HTTP frameworks (`express`, `fastapi`, `nestjs`)
|
|
45
|
-
- External SDKs (AWS SDK, Stripe, etc.)
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
// BAD — domain entity knows about Prisma
|
|
49
|
-
import { Prisma } from '@prisma/client';
|
|
50
|
-
class Order {
|
|
51
|
-
static fromPrisma(row: Prisma.OrderGetPayload<{}>): Order {}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// GOOD — domain is pure TypeScript
|
|
55
|
-
class Order {
|
|
56
|
-
constructor(
|
|
57
|
-
readonly id: OrderId,
|
|
58
|
-
readonly status: OrderStatus,
|
|
59
|
-
readonly lines: OrderLine[],
|
|
60
|
-
) {}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Rule 2: Repositories Are Interfaces in Domain, Implementations in Infrastructure
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
// Domain layer — interface only
|
|
68
|
-
export interface OrderRepository {
|
|
69
|
-
findById(id: OrderId): Promise<Order | null>;
|
|
70
|
-
save(order: Order): Promise<void>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Infrastructure layer — concrete implementation
|
|
74
|
-
export class PrismaOrderRepository implements OrderRepository {
|
|
75
|
-
constructor(private readonly prisma: PrismaClient) {}
|
|
76
|
-
async findById(id: OrderId) { /* ... */ }
|
|
77
|
-
async save(order: Order) { /* ... */ }
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Rule 3: DTOs Live at Layer Boundaries
|
|
82
|
-
- **Request DTOs** (validation) → Presentation layer
|
|
83
|
-
- **Application DTOs** (use-case input/output) → Application layer
|
|
84
|
-
- **Domain objects** → Domain layer
|
|
85
|
-
- **Persistence models** → Infrastructure layer
|
|
86
|
-
|
|
87
|
-
Never pass a Prisma row directly to a controller, or a request DTO directly into a domain entity.
|
|
88
|
-
|
|
89
|
-
### Rule 4: Use Cases Orchestrate, Domain Encapsulates Logic
|
|
90
|
-
- Use cases (Application layer): coordinate repositories and domain services, handle transactions
|
|
91
|
-
- Domain entities: contain business rules, invariants, validations
|
|
92
|
-
- Controllers: parse input, call use case, format output — nothing else
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
// BAD — business logic leaking into controller
|
|
96
|
-
app.post('/orders', async (req, res) => {
|
|
97
|
-
if (req.body.items.length === 0) { /* domain rule in controller */ }
|
|
98
|
-
const discounted = req.body.total * 0.9; /* domain logic */
|
|
99
|
-
await db.orders.create({ data: req.body }); /* infrastructure in controller */
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// GOOD — controller delegates everything
|
|
103
|
-
app.post('/orders', async (req, res) => {
|
|
104
|
-
const dto = parseCreateOrderDto(req.body);
|
|
105
|
-
const result = await createOrderUseCase.execute(dto);
|
|
106
|
-
res.status(201).json(formatOrderResponse(result));
|
|
107
|
-
});
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Rule 5: No God Services
|
|
111
|
-
A service that touches more than 2 domain aggregates is doing too much. Split it.
|
|
112
|
-
|
|
113
|
-
### Rule 6: Module Boundaries Are Enforced by Imports
|
|
114
|
-
If module A imports from module B's internal files (`b/internal/...`), that is a boundary violation. Public APIs of modules are their index exports only.
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## Directory Structure Pattern
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
src/
|
|
122
|
-
├── domain/
|
|
123
|
-
│ ├── order/
|
|
124
|
-
│ │ ├── Order.ts # entity
|
|
125
|
-
│ │ ├── OrderRepository.ts # interface
|
|
126
|
-
│ │ └── OrderService.ts # domain service
|
|
127
|
-
├── application/
|
|
128
|
-
│ ├── order/
|
|
129
|
-
│ │ ├── CreateOrderUseCase.ts
|
|
130
|
-
│ │ └── dto/
|
|
131
|
-
│ │ ├── CreateOrderDto.ts
|
|
132
|
-
│ │ └── OrderResponseDto.ts
|
|
133
|
-
├── infrastructure/
|
|
134
|
-
│ ├── persistence/
|
|
135
|
-
│ │ └── PrismaOrderRepository.ts
|
|
136
|
-
│ └── http/
|
|
137
|
-
│ └── StripePaymentGateway.ts
|
|
138
|
-
└── presentation/
|
|
139
|
-
└── http/
|
|
140
|
-
└── OrderController.ts
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Iron Laws
|
|
146
|
-
|
|
147
|
-
**IRON LAW 1: The domain layer has zero framework imports. If it imports Prisma, Express, or any SDK — fix it.**
|
|
148
|
-
**IRON LAW 2: Business rules live in the domain layer, not in controllers or use cases.**
|
|
149
|
-
**IRON LAW 3: A controller that queries the database directly violates the architecture unconditionally.**
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Red Flags — Stop and re-read this rule if you are thinking:
|
|
154
|
-
|
|
155
|
-
| Rationalization | Why it's wrong |
|
|
156
|
-
|---|---|
|
|
157
|
-
| "It's a small project, layers are overkill" | Layerless code becomes unmaintainable the moment it needs testing or a second database |
|
|
158
|
-
| "I'll just pass the Prisma object through, it's easier" | The domain now depends on Prisma — every Prisma version upgrade potentially breaks business logic |
|
|
159
|
-
| "The use case is thin, I'll put the logic in the controller" | Controllers are discarded when the transport changes (HTTP → gRPC, REST → GraphQL) |
|
|
160
|
-
| "I'll clean up the layers after the feature ships" | Features shipped with wrong architecture become the foundation for future features |
|
|
161
|
-
| "The repository interface is just ceremony" | The interface enables testing without a database — eliminating it eliminates testability |
|
|
162
|
-
|
|
163
|
-
**IRON LAW: IF CHANGING THE DATABASE REQUIRES CHANGING BUSINESS LOGIC, THE ARCHITECTURE IS WRONG.**
|
|
14
|
+
Apply to backend code when creating new modules, services, or features; when deciding where to place a new class or function; when wiring up dependencies between layers. Frontend layering (service → store → component, business logic in the store) is `code-style-patterns.mdc`, not this rule.
|
|
15
|
+
|
|
16
|
+
## Mandatory Behavior
|
|
17
|
+
|
|
18
|
+
- **Business rules live in domain entities and domain services**, not in use cases. A use
|
|
19
|
+
case coordinates repositories and domain services and owns the transaction; a controller
|
|
20
|
+
parses input, calls one use case and formats the output.
|
|
21
|
+
- **A controller that queries the database is a violation whatever its size**: there is no
|
|
22
|
+
thin-controller exception.
|
|
23
|
+
- **A repository is the I/O boundary that gets an interface** (`solid-principles.mdc`,
|
|
24
|
+
D): the interface is declared in the domain, the implementation lives in infrastructure.
|
|
25
|
+
- **Each boundary maps its own types.** A persistence row never reaches a controller, and a
|
|
26
|
+
request DTO never enters a domain entity. Request DTOs belong to presentation, use-case
|
|
27
|
+
input and output to application, persistence models to infrastructure.
|
|
28
|
+
- **A service that touches more than 2 domain aggregates is split.**
|
|
29
|
+
- **A module's public API is its index exports.** Importing another module's internal files
|
|
30
|
+
(`b/internal/...`) crosses its boundary.
|
|
31
|
+
- **Project size is not an exemption**: the layers apply to a small service too.
|
|
32
|
+
- **Layout:** follow the project's existing layout. With none, use
|
|
33
|
+
`src/{domain,application,infrastructure,presentation}/<module>/`.
|
|
34
|
+
|
|
35
|
+
The check for a change: replacing the database or the transport changes no domain file.
|
|
@@ -61,8 +61,7 @@ nothing.
|
|
|
61
61
|
|
|
62
62
|
## Response Format
|
|
63
63
|
|
|
64
|
-
1. Verdict in one line — the canonical verdict vocabulary
|
|
65
|
-
`core/code-review-ai-assistant.mdc`):
|
|
64
|
+
1. Verdict in one line — the canonical verdict vocabulary:
|
|
66
65
|
- `APPROVE` — no blocking issues; changes accepted as-is
|
|
67
66
|
- `APPROVE WITH SUGGESTIONS` — accepted but improvements noted for follow-up
|
|
68
67
|
- `REQUEST CHANGES` — has issues that must be fixed before merge
|
|
@@ -40,6 +40,7 @@ Key principles (see canonical source for full detail with examples):
|
|
|
40
40
|
- Avoid heavy logic in render.
|
|
41
41
|
|
|
42
42
|
## Architecture
|
|
43
|
+
Frontend only; backend layering, with a domain layer, is `clean-architecture.mdc`.
|
|
43
44
|
- Service layer: IO/API only.
|
|
44
45
|
- Store layer: business logic and state transitions.
|
|
45
46
|
- Component layer: view rendering.
|
|
@@ -60,7 +60,6 @@ this list is what says whether the bar moved.
|
|
|
60
60
|
| `rules/core/subagent-status-protocol.md` | How the result is reported: `STATUS:` on line one, the five statuses, and the verification block every `DONE` response carries. |
|
|
61
61
|
| `rules/core/git-concurrency.mdc` | Clause 5: a task is not done until its diff is committed, whether the worker or the orchestrator commits it. |
|
|
62
62
|
| `.metaproject/skills/gdskills/orchestration/task-implementer/SKILL.md` | The worker-side reading of clause 3: skipped verification is a failed verification, and partial is not done. |
|
|
63
|
-
| `rules/core/gproject-contracts.mdc` | The gproject return payload only. It is silent on clauses 2-5; that silence is not an exemption, and a gproject subagent reporting `DONE` still owes the verification block from `rules/core/subagent-status-protocol.md`. |
|
|
64
63
|
| `rules/core/requirements-package-standard.mdc` | Clause 2 for a documentation package, where the gates are structural (required files, versions, links, honest status) rather than lint and tests. |
|
|
65
64
|
|
|
66
65
|
Two readings of `DONE_WITH_CONCERNS` are in circulation, and this rule settles
|
|
@@ -1,153 +1,102 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Error handling
|
|
2
|
+
description: "Error handling standard shared by code writers and reviewers, with the severities reviewers use: failure is observable, carries context, keeps its cause, and is never signalled by a value a caller can mistake for success. Use when implementing functions that can fail, calling external APIs, handling async operations, or reviewing that code."
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Error Handling
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
|
-
|
|
9
|
+
One standard for writing and reviewing failure paths. It describes how this codebase already handles errors (typed and contextual throws, `cause` chains, no silent catches), so a writer following it and a reviewer checking it reach the same answer.
|
|
10
10
|
|
|
11
11
|
## When To Apply
|
|
12
|
-
Apply whenever
|
|
12
|
+
Apply whenever code interacts with external systems, parses input, performs I/O, or runs an operation that can fail, and when reviewing such code.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
Recoverable errors are data, not exceptions. Use the **Result pattern** to make failure explicit in the type signature:
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
type Result<T, E = Error> =
|
|
22
|
-
| { ok: true; value: T }
|
|
23
|
-
| { ok: false; error: E };
|
|
24
|
-
|
|
25
|
-
function ok<T>(value: T): Result<T, never> {
|
|
26
|
-
return { ok: true, value };
|
|
27
|
-
}
|
|
28
|
-
function err<E>(error: E): Result<never, E> {
|
|
29
|
-
return { ok: false, error };
|
|
30
|
-
}
|
|
31
|
-
```
|
|
16
|
+
## Rules
|
|
32
17
|
|
|
33
|
-
|
|
18
|
+
### Rule 1: Signal failure explicitly
|
|
19
|
+
A function that can fail signals the failure in a form the caller cannot mistake for success:
|
|
20
|
+
- **Throw** an error. This is the default in this codebase.
|
|
21
|
+
- **Return a discriminated result** (`{ ok: true, value } | { ok: false, error }` or a tagged union) when callers are expected to branch on an anticipated failure, such as a parse or a lookup. This is allowed, not required.
|
|
34
22
|
|
|
35
|
-
|
|
23
|
+
Never signal failure with `null`, `undefined`, `false`, `-1` or an empty collection when a caller could read that value as a valid result.
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
Any function that performs I/O, calls an external API, or parses external data MUST return `Result<T, E>` instead of throwing.
|
|
25
|
+
A language whose norm differs (Rust's `Result`, Go's `(T, error)`) follows its norm; its stack rule states it and overrides this rule for that language.
|
|
39
26
|
|
|
40
27
|
```typescript
|
|
41
|
-
// BAD —
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return res.data; // throws if 404
|
|
28
|
+
// BAD — "not found" and "empty" are the same value to the caller
|
|
29
|
+
function readEntries(path: string): Entry[] {
|
|
30
|
+
try { return parse(readFileSync(path, "utf8")); } catch { return []; }
|
|
45
31
|
}
|
|
46
32
|
|
|
47
|
-
// GOOD — failure is
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (res.status === 404) return err(new NotFoundError(id));
|
|
52
|
-
return ok(res.data);
|
|
33
|
+
// GOOD — the failure is visible and says what failed
|
|
34
|
+
function readEntries(path: string): Entry[] {
|
|
35
|
+
try { return parse(readFileSync(path, "utf8")); }
|
|
36
|
+
catch (error) { throw new Error(`cannot read entries from ${path}`, { cause: error }); }
|
|
53
37
|
}
|
|
54
38
|
```
|
|
55
39
|
|
|
56
|
-
### Rule 2:
|
|
57
|
-
|
|
40
|
+
### Rule 2: The message names what failed and for which input
|
|
41
|
+
An error message identifies the operation and the input it failed on: `cannot read entries from ${path}`, not `something went wrong`.
|
|
58
42
|
|
|
59
|
-
|
|
60
|
-
// BAD
|
|
61
|
-
throw new Error('user not found');
|
|
43
|
+
Use a typed error class (`class XError extends Error`) when a caller needs to tell this failure apart from others, or when it crosses a module boundary that handles it. A plain `Error` with a contextual message is fine inside a module.
|
|
62
44
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Common typed errors to define per domain:
|
|
73
|
-
- `NotFoundError(resource, id)`
|
|
74
|
-
- `ValidationError(field, message)`
|
|
75
|
-
- `UnauthorizedError(action)`
|
|
76
|
-
- `ConflictError(resource, detail)`
|
|
77
|
-
- `ExternalServiceError(service, cause)`
|
|
45
|
+
### Rule 3: No silent failures
|
|
46
|
+
Every `catch` either:
|
|
47
|
+
- rethrows, or returns the failure per Rule 1;
|
|
48
|
+
- takes a fallback that is correct for the caller, and says why in a comment;
|
|
49
|
+
- marks the result as degraded where the caller can see it.
|
|
78
50
|
|
|
79
|
-
|
|
80
|
-
Never swallow errors without action. Every `catch` block must either:
|
|
81
|
-
- Re-throw (or return `err(...)`)
|
|
82
|
-
- Log with full context AND take fallback action
|
|
83
|
-
- Explicitly mark the result as degraded
|
|
51
|
+
An empty `catch`, or one that only logs, is a defect when the caller then proceeds as if the operation succeeded.
|
|
84
52
|
|
|
85
53
|
```typescript
|
|
86
|
-
// BAD —
|
|
87
|
-
try {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await sendNotification(user);
|
|
94
|
-
} catch (e) {
|
|
95
|
-
logger.warn('notification failed', { userId: user.id, error: e });
|
|
96
|
-
// explicit decision: continue without notification
|
|
97
|
-
}
|
|
54
|
+
// BAD — the write failed, the caller is told it succeeded
|
|
55
|
+
try { await writeState(next); } catch {}
|
|
56
|
+
return { saved: true };
|
|
57
|
+
|
|
58
|
+
// GOOD — a deliberate, explained fallback
|
|
59
|
+
try { await removeTempFile(path); }
|
|
60
|
+
catch { /* best effort: a leftover temp file is swept by the next run */ }
|
|
98
61
|
```
|
|
99
62
|
|
|
100
|
-
### Rule 4: No
|
|
101
|
-
|
|
63
|
+
### Rule 4: No unhandled promise rejections
|
|
64
|
+
Every promise is awaited inside a `try/catch` or has a `.catch()`; a fire-and-forget call handles its own rejection. Examples are in `async-patterns.mdc` Rule 4.
|
|
102
65
|
|
|
103
|
-
### Rule 5:
|
|
104
|
-
When catching and
|
|
66
|
+
### Rule 5: Keep the cause
|
|
67
|
+
When catching and rethrowing, pass the original as `cause`. Do not both log and rethrow the same error in one `catch`: whoever handles it logs it.
|
|
105
68
|
|
|
106
69
|
```typescript
|
|
107
|
-
// BAD — original stack
|
|
108
|
-
catch (e) { throw new Error(
|
|
70
|
+
// BAD — the original stack is lost
|
|
71
|
+
catch (e) { throw new Error("database failed"); }
|
|
109
72
|
|
|
110
|
-
// GOOD
|
|
111
|
-
catch (e) { throw new DatabaseError(
|
|
73
|
+
// GOOD
|
|
74
|
+
catch (e) { throw new DatabaseError("write failed", { cause: e }); }
|
|
112
75
|
```
|
|
113
76
|
|
|
114
|
-
### Rule 6:
|
|
115
|
-
|
|
77
|
+
### Rule 6: Assertions guard invariants, not recoverable input
|
|
78
|
+
Do not throw from an `assert` on input a caller can legitimately send. Validate it and fail per Rule 1.
|
|
116
79
|
|
|
117
80
|
---
|
|
118
81
|
|
|
119
|
-
##
|
|
82
|
+
## Review severities (shared with reviewers)
|
|
120
83
|
|
|
121
|
-
|
|
122
|
-
External boundary (API, DB, filesystem)
|
|
123
|
-
└─ Return Result<T, DomainError> ← convert to typed error here
|
|
124
|
-
└─ Domain / use-case layer
|
|
125
|
-
└─ Return Result<T, E> up the stack
|
|
126
|
-
└─ Controller / handler
|
|
127
|
-
└─ Map to HTTP status / user message here
|
|
128
|
-
```
|
|
84
|
+
`review-clean-code`, `review-logic`, `review-backend` and `review-frontend` rate failure paths by this table and keep only framework-specific rows of their own (a NestJS exception type, a MobX store's `try/catch/finally`). Change a row here, never in a reviewer.
|
|
129
85
|
|
|
130
|
-
|
|
86
|
+
| Signal | A finding when | Default | Not a finding |
|
|
87
|
+
|---|---|---|---|
|
|
88
|
+
| `catch` that hides a failure (Rule 3) | the caller then proceeds as if it succeeded | `major` — `blocker` only if the caller then persists or returns wrong data | a correct fallback with a comment giving the reason |
|
|
89
|
+
| Failure returned as `null` / `false` / `-1` / `[]` (Rule 1) | a caller can read it as a valid result | `major` with that caller named, else `minor` | a type that makes absence explicit and is checked |
|
|
90
|
+
| Rethrow without `cause`; message without operation or input (Rules 2, 5) | at a module boundary / any new message | `minor` | a throw that is not a `Result`; a plain contextual `Error` inside a module |
|
|
91
|
+
| Log and rethrow in one `catch` (Rule 5) | always | `minor` | — |
|
|
92
|
+
| Unhandled promise rejection (Rule 4) | it reaches the process | `blocker` (crash) | a rejection a framework's exception layer turns into an error response: rate that response instead |
|
|
93
|
+
| `catch (err: any)` in TypeScript | always | `minor` | `catch (err: unknown)` |
|
|
131
94
|
|
|
132
95
|
---
|
|
133
96
|
|
|
134
97
|
## Iron Laws
|
|
135
98
|
|
|
136
|
-
**IRON LAW 1: A
|
|
137
|
-
**IRON LAW 2:
|
|
138
|
-
**IRON LAW 3:
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## Red Flags — Stop and re-read this rule if you are thinking:
|
|
143
|
-
|
|
144
|
-
| Rationalization | Why it's wrong |
|
|
145
|
-
|---|---|
|
|
146
|
-
| "I'll just throw here, the caller will handle it" | The caller often doesn't handle it — unhandled rejections crash processes silently |
|
|
147
|
-
| "The error is unlikely, I'll skip the error case" | Unlikely errors are exactly the ones that cause production incidents |
|
|
148
|
-
| "I'll add proper error handling in a follow-up" | Error handling added after-the-fact misses edge cases that were obvious during initial implementation |
|
|
149
|
-
| "Using Result makes the code verbose" | Verbosity here is intentional: it forces the caller to acknowledge that failure is possible |
|
|
150
|
-
| "I'll wrap everything in a try/catch at the top" | Top-level catch loses all type information and context — handle errors close to their source |
|
|
151
|
-
| "I can just check if the value is null after" | Null is not an error type — it conveys nothing about why the operation failed |
|
|
152
|
-
|
|
153
|
-
**IRON LAW: SILENCE IS NOT A VALID ERROR STRATEGY. EVERY FAILURE PATH MUST BE OBSERVABLE.**
|
|
99
|
+
**IRON LAW 1: A catch that hides a failure from a caller who then proceeds is forbidden.**
|
|
100
|
+
**IRON LAW 2: A failure is never signalled by a value a caller can read as success.**
|
|
101
|
+
**IRON LAW 3: A rethrow keeps the original error as `cause`.**
|
|
102
|
+
</content>
|
|
@@ -14,7 +14,7 @@ Apply to any agent that:
|
|
|
14
14
|
- Runs for more than one phase / step
|
|
15
15
|
- Involves tests, review, or PR creation
|
|
16
16
|
|
|
17
|
-
Applies to: `job-orchestrator`, `
|
|
17
|
+
Applies to: `job-orchestrator`, `flow-orchestrator`, `task-implementer` (for multi-task jobs), any custom orchestration.
|
|
18
18
|
Does NOT apply to: single-file quick fixes, standalone read-only analysis, ad-hoc one-liners.
|
|
19
19
|
|
|
20
20
|
---
|
|
@@ -54,8 +54,7 @@ Agent: <skill name + version>
|
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
**Storage:**
|
|
57
|
-
- In `job-orchestrator` jobs:
|
|
58
|
-
- In `feature-dev`: saved to `<project_root>/.feature-spec.md` (gitignored) or printed and confirmed by user
|
|
57
|
+
- In `job-orchestrator` jobs: written to `.metaproject/jobs/<job-name>/man/spec.md` in the folder `keryx job init` created (`keryx job document` has no spec type)
|
|
59
58
|
- In any agent: at minimum, the spec is presented to the user and confirmed before code is written
|
|
60
59
|
|
|
61
60
|
**Timing:** Spec is created after requirements are gathered but BEFORE any branch is created or code is written.
|
|
@@ -108,8 +107,8 @@ PR: <PR URL or "not created">
|
|
|
108
107
|
```
|
|
109
108
|
|
|
110
109
|
**Storage:**
|
|
111
|
-
- In `job-orchestrator` jobs:
|
|
112
|
-
- In
|
|
110
|
+
- In `job-orchestrator` jobs: written to a file and recorded with `keryx job document <job-name> --type implementation-report --file <path>`
|
|
111
|
+
- In a PR-driven flow: appended to the PR description + printed to user
|
|
113
112
|
- In any agent: at minimum, printed as the final message
|
|
114
113
|
|
|
115
114
|
**Timing:** Created as the very last step before reporting done to the user or orchestrator.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Job documentation structure and conventions for .metaproject/jobs (default) or $GDMETAPRO_JOBS_ROOT. Used by job-
|
|
2
|
+
description: "Job documentation structure and conventions for .metaproject/jobs (default) or $GDMETAPRO_JOBS_ROOT. Used by job-orchestrator and the `keryx job` commands."
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ Jobs are the documentation artifacts produced by the `job-orchestrator` pipeline
|
|
|
14
14
|
|
|
15
15
|
Apply when:
|
|
16
16
|
- `job-orchestrator` creates a new job
|
|
17
|
-
- `job
|
|
17
|
+
- `keryx job init` or `keryx job document` creates or updates job documentation
|
|
18
18
|
- User asks about job documentation structure or conventions
|
|
19
19
|
|
|
20
20
|
## Relationship to `docs/`
|
|
@@ -45,7 +45,7 @@ The jobs root is resolved in this priority order:
|
|
|
45
45
|
JOBS_ROOT="${GDMETAPRO_JOBS_ROOT:-.metaproject/jobs}"
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
`PROJECT_DIR` is always known by Phase 0.2 of the orchestrator. Sub-agents (
|
|
48
|
+
`PROJECT_DIR` is always known by Phase 0.2 of the orchestrator. Sub-agents (context-collector, task-implementer, etc.) **never resolve JOBS_ROOT themselves** — they receive it explicitly from the orchestrator in the dispatch prompt.
|
|
49
49
|
|
|
50
50
|
## Job Folder Naming
|
|
51
51
|
|
|
@@ -112,7 +112,7 @@ The README is the entry point for both humans and AI agents. It MUST contain:
|
|
|
112
112
|
1. [x] Analyze issue (issue-analyzer)
|
|
113
113
|
2. [ ] Prepare feature branch
|
|
114
114
|
3. [ ] Implement tasks (task-implementer)
|
|
115
|
-
4. [ ] Review (
|
|
115
|
+
4. [ ] Review (review-orchestrator)
|
|
116
116
|
5. [ ] Fix review findings
|
|
117
117
|
6. [ ] Final checks
|
|
118
118
|
7. [ ] Generate report
|
|
@@ -122,7 +122,7 @@ The README is the entry point for both humans and AI agents. It MUST contain:
|
|
|
122
122
|
|-------|-------|--------|
|
|
123
123
|
| issue-analyzer | Analysis | completed |
|
|
124
124
|
| task-implementer | Implementation | in-progress |
|
|
125
|
-
|
|
|
125
|
+
| review-orchestrator | Review | pending |
|
|
126
126
|
|
|
127
127
|
## Documents
|
|
128
128
|
|
|
@@ -215,7 +215,7 @@ Every document (in both `man/` and `ai/`) MUST end with a metadata block:
|
|
|
215
215
|
|
|
216
216
|
## Lifecycle
|
|
217
217
|
|
|
218
|
-
1. **Init** — Orchestrator determines job name,
|
|
219
|
-
2. **Active** — After each sub-agent completes, orchestrator
|
|
220
|
-
3. **Finalize** — Orchestrator
|
|
218
|
+
1. **Init** — Orchestrator determines job name, then runs `keryx job init --name <slug>` to create the job folder and its plan
|
|
219
|
+
2. **Active** — After each sub-agent completes, orchestrator writes its result to a file and records it with `keryx job document <job-name> --type <type> --file <path>`; the command copies it into the job package and lists it in the job state.
|
|
220
|
+
3. **Finalize** — Orchestrator records the final report with `keryx job document` and closes the job with `keryx job complete <job-name>`.
|
|
221
221
|
4. **Archived** — Job folder remains in `jobs/` indefinitely. Old jobs are NOT auto-deleted.
|