forgecraft-mcp 0.2.1 → 0.4.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.
- package/dist/analyzers/language-detector.d.ts +17 -0
- package/dist/analyzers/language-detector.d.ts.map +1 -0
- package/dist/analyzers/language-detector.js +89 -0
- package/dist/analyzers/language-detector.js.map +1 -0
- package/dist/analyzers/package-json.d.ts.map +1 -1
- package/dist/analyzers/package-json.js +5 -5
- package/dist/analyzers/package-json.js.map +1 -1
- package/dist/analyzers/project-context.d.ts +23 -0
- package/dist/analyzers/project-context.d.ts.map +1 -0
- package/dist/analyzers/project-context.js +181 -0
- package/dist/analyzers/project-context.js.map +1 -0
- package/dist/index.js +4 -27
- package/dist/index.js.map +1 -1
- package/dist/registry/composer.d.ts +3 -1
- package/dist/registry/composer.d.ts.map +1 -1
- package/dist/registry/composer.js +28 -0
- package/dist/registry/composer.js.map +1 -1
- package/dist/registry/loader.d.ts.map +1 -1
- package/dist/registry/loader.js +40 -1
- package/dist/registry/loader.js.map +1 -1
- package/dist/registry/mcp-discovery.js +1 -0
- package/dist/registry/mcp-discovery.js.map +1 -1
- package/dist/registry/renderer.d.ts +19 -2
- package/dist/registry/renderer.d.ts.map +1 -1
- package/dist/registry/renderer.js +64 -2
- package/dist/registry/renderer.js.map +1 -1
- package/dist/shared/filesystem.d.ts +45 -0
- package/dist/shared/filesystem.d.ts.map +1 -0
- package/dist/shared/filesystem.js +122 -0
- package/dist/shared/filesystem.js.map +1 -0
- package/dist/shared/types.d.ts +48 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/tools/add-module.d.ts +1 -1
- package/dist/tools/audit.js +2 -2
- package/dist/tools/audit.js.map +1 -1
- package/dist/tools/configure-mcp.d.ts +3 -0
- package/dist/tools/configure-mcp.d.ts.map +1 -1
- package/dist/tools/configure-mcp.js +38 -1
- package/dist/tools/configure-mcp.js.map +1 -1
- package/dist/tools/convert.js +4 -4
- package/dist/tools/convert.js.map +1 -1
- package/dist/tools/forgecraft-router.d.ts +127 -0
- package/dist/tools/forgecraft-router.d.ts.map +1 -0
- package/dist/tools/forgecraft-router.js +305 -0
- package/dist/tools/forgecraft-router.js.map +1 -0
- package/dist/tools/generate-claude-md.d.ts +1 -0
- package/dist/tools/generate-claude-md.d.ts.map +1 -1
- package/dist/tools/generate-claude-md.js +23 -57
- package/dist/tools/generate-claude-md.js.map +1 -1
- package/dist/tools/get-reference.d.ts +28 -0
- package/dist/tools/get-reference.d.ts.map +1 -0
- package/dist/tools/get-reference.js +63 -0
- package/dist/tools/get-reference.js.map +1 -0
- package/dist/tools/list.d.ts +18 -2
- package/dist/tools/list.d.ts.map +1 -1
- package/dist/tools/list.js +50 -2
- package/dist/tools/list.js.map +1 -1
- package/dist/tools/refresh-project.d.ts.map +1 -1
- package/dist/tools/refresh-project.js +8 -10
- package/dist/tools/refresh-project.js.map +1 -1
- package/dist/tools/scaffold.d.ts +5 -1
- package/dist/tools/scaffold.d.ts.map +1 -1
- package/dist/tools/scaffold.js +58 -31
- package/dist/tools/scaffold.js.map +1 -1
- package/dist/tools/setup-project.d.ts +3 -3
- package/dist/tools/setup-project.d.ts.map +1 -1
- package/dist/tools/setup-project.js +8 -4
- package/dist/tools/setup-project.js.map +1 -1
- package/package.json +1 -1
- package/templates/analytics/mcp-servers.yaml +1 -0
- package/templates/api/mcp-servers.yaml +1 -0
- package/templates/api/skills.yaml +54 -0
- package/templates/cli/mcp-servers.yaml +1 -0
- package/templates/data-lineage/mcp-servers.yaml +2 -0
- package/templates/data-pipeline/mcp-servers.yaml +1 -0
- package/templates/data-pipeline/skills.yaml +56 -0
- package/templates/fintech/mcp-servers.yaml +1 -0
- package/templates/fintech/skills.yaml +35 -0
- package/templates/game/mcp-servers.yaml +1 -0
- package/templates/healthcare/mcp-servers.yaml +1 -0
- package/templates/healthcare/skills.yaml +35 -0
- package/templates/hipaa/mcp-servers.yaml +1 -0
- package/templates/hipaa/skills.yaml +39 -0
- package/templates/infra/mcp-servers.yaml +2 -0
- package/templates/library/mcp-servers.yaml +2 -0
- package/templates/medallion-architecture/mcp-servers.yaml +2 -0
- package/templates/ml/mcp-servers.yaml +1 -0
- package/templates/mobile/mcp-servers.yaml +1 -0
- package/templates/observability-xray/mcp-servers.yaml +1 -0
- package/templates/realtime/mcp-servers.yaml +1 -0
- package/templates/soc2/mcp-servers.yaml +2 -0
- package/templates/social/mcp-servers.yaml +2 -0
- package/templates/state-machine/mcp-servers.yaml +1 -0
- package/templates/universal/hooks.yaml +63 -0
- package/templates/universal/instructions.yaml +41 -118
- package/templates/universal/mcp-servers.yaml +12 -0
- package/templates/universal/nfr.yaml +1 -1
- package/templates/universal/reference.yaml +111 -0
- package/templates/universal/review.yaml +2 -2
- package/templates/universal/skills.yaml +106 -0
- package/templates/web-react/mcp-servers.yaml +2 -0
- package/templates/web-react/skills.yaml +56 -0
- package/templates/web-static/mcp-servers.yaml +2 -0
- package/templates/web3/mcp-servers.yaml +1 -0
- package/templates/zero-trust/mcp-servers.yaml +1 -0
|
@@ -18,10 +18,11 @@ blocks:
|
|
|
18
18
|
title: "Code Standards"
|
|
19
19
|
content: |
|
|
20
20
|
## Code Standards
|
|
21
|
-
- Maximum function/method length: {{max_function_length | default: 50}} lines
|
|
22
|
-
- Maximum file length: {{max_file_length | default: 300}} lines
|
|
21
|
+
- Maximum function/method length: {{max_function_length | default: 50}} lines (hook-enforced).
|
|
22
|
+
- Maximum file length: {{max_file_length | default: 300}} lines (hook-enforced).
|
|
23
23
|
- Maximum function parameters: {{max_function_params | default: 5}}. If more, use a parameter object.
|
|
24
|
-
-
|
|
24
|
+
- No circular imports — module dependency graph must be acyclic (hook-enforced).
|
|
25
|
+
- Every public function/method must have {{#if language_is_typescript}}a JSDoc comment{{/if}}{{#if language_is_python}}a docstring (Google or NumPy style){{/if}} with typed params and returns.
|
|
25
26
|
- Delete orphaned code. Do not comment it out. Git has history.
|
|
26
27
|
- Before creating a new utility, search the entire codebase for existing ones.
|
|
27
28
|
- Reuse existing patterns — check shared modules before writing new.
|
|
@@ -81,7 +82,7 @@ blocks:
|
|
|
81
82
|
### Modular from Day One
|
|
82
83
|
- Feature-based modules over layer-based. Each feature owns its models, service, repository, routes.
|
|
83
84
|
- Module dependency graph must be acyclic.
|
|
84
|
-
- Every module has a clear public API via __init__.py
|
|
85
|
+
- Every module has a clear public API via {{#if language_is_typescript}}index.ts{{/if}}{{#if language_is_python}}__init__.py{{/if}} exports.
|
|
85
86
|
|
|
86
87
|
- id: layered-architecture
|
|
87
88
|
tier: recommended
|
|
@@ -124,7 +125,7 @@ blocks:
|
|
|
124
125
|
|
|
125
126
|
### Data Transfer Objects (DTOs)
|
|
126
127
|
- Use DTOs at layer boundaries — never pass domain entities to/from the API layer.
|
|
127
|
-
- **Request DTOs**: validated at the API boundary (Zod schema → typed object).
|
|
128
|
+
- **Request DTOs**: validated at the API boundary ({{#if language_is_typescript}}Zod schema{{/if}}{{#if language_is_python}}Pydantic model{{/if}} → typed object).
|
|
128
129
|
- **Response DTOs**: shaped for the consumer, not mirroring the domain model.
|
|
129
130
|
- **Domain ↔ Persistence mapping**: repositories map between domain entities and DB rows/documents.
|
|
130
131
|
- DTOs are plain data objects — no methods, no behavior, no framework decorators.
|
|
@@ -178,8 +179,9 @@ blocks:
|
|
|
178
179
|
- Instead: `order.getShippingCity()` or pass the needed data directly.
|
|
179
180
|
|
|
180
181
|
### Immutability by Default
|
|
181
|
-
- Use `const` over `let`. Use `readonly` on properties and parameters.
|
|
182
|
-
- Prefer `ReadonlyArray<T>`, `Readonly<T>`, `ReadonlyMap`, `ReadonlySet`.
|
|
182
|
+
{{#if language_is_typescript}}- Use `const` over `let`. Use `readonly` on properties and parameters.
|
|
183
|
+
- Prefer `ReadonlyArray<T>`, `Readonly<T>`, `ReadonlyMap`, `ReadonlySet`.{{/if}}{{#if language_is_python}}- Use `Final` for constants. Use `frozen=True` on dataclasses.
|
|
184
|
+
- Prefer `tuple` over `list` for immutable sequences. Use `MappingProxyType` for immutable dicts.{{/if}}
|
|
183
185
|
- When you need to "modify" data, create a new copy with the change.
|
|
184
186
|
- Mutable state is the #1 source of bugs. Restrict it to the smallest possible scope.
|
|
185
187
|
|
|
@@ -196,117 +198,7 @@ blocks:
|
|
|
196
198
|
- Factories are the natural companion to dependency injection — the DI container
|
|
197
199
|
IS the top-level factory.
|
|
198
200
|
|
|
199
|
-
|
|
200
|
-
tier: optional
|
|
201
|
-
title: "Domain-Driven Design Essentials"
|
|
202
|
-
content: |
|
|
203
|
-
## Domain-Driven Design (DDD) Essentials
|
|
204
|
-
|
|
205
|
-
### Entities vs. Value Objects
|
|
206
|
-
- **Entity**: has identity (ID) that persists across state changes. Two users with the
|
|
207
|
-
same name are NOT the same user. Compared by ID.
|
|
208
|
-
- **Value Object**: defined by its attributes, not identity. Two `Money(100, "USD")` are
|
|
209
|
-
the same. Immutable. Compared by value.
|
|
210
|
-
- When in doubt, make it a Value Object — they're simpler and safer.
|
|
211
|
-
|
|
212
|
-
### Eliminate Primitive Obsession
|
|
213
|
-
- Don't use raw `string` for email, `number` for currency, `string` for phone.
|
|
214
|
-
- Wrap domain concepts in typed Value Objects: `EmailAddress`, `Money`, `PhoneNumber`.
|
|
215
|
-
- Value Objects enforce validation at construction — an invalid email can never exist.
|
|
216
|
-
- This moves validation FROM every call site TO the constructor — DRY + safe.
|
|
217
|
-
|
|
218
|
-
### Aggregates
|
|
219
|
-
- An aggregate is a cluster of domain objects treated as a single unit for data changes.
|
|
220
|
-
- One entity is the **aggregate root** — all external access goes through it.
|
|
221
|
-
- Aggregates enforce invariants: `Order` ensures its `OrderLines` don't exceed the limit.
|
|
222
|
-
- Reference other aggregates by ID, not by direct object reference.
|
|
223
|
-
|
|
224
|
-
### Bounded Contexts
|
|
225
|
-
- A bounded context is a boundary within which a domain model has a specific meaning.
|
|
226
|
-
- The word "Account" means different things in Billing vs. Auth vs. Social.
|
|
227
|
-
- Each context owns its models, language, and persistence — no shared database tables.
|
|
228
|
-
- Contexts communicate via well-defined interfaces, events, or an **Anti-Corruption Layer**
|
|
229
|
-
that translates between contexts.
|
|
230
|
-
|
|
231
|
-
### Domain Events
|
|
232
|
-
- When something important happens in the domain, publish an event: `OrderPlaced`,
|
|
233
|
-
`MemberDeactivated`, `PaymentFailed`.
|
|
234
|
-
- Events decouple modules: the Order module publishes `OrderPlaced`, the Notification
|
|
235
|
-
module subscribes — neither imports the other.
|
|
236
|
-
- Events are past-tense named facts. They carry the data needed by subscribers.
|
|
237
|
-
- In-process event bus for monoliths; message broker (SQS, Kafka, NATS) for distributed.
|
|
238
|
-
|
|
239
|
-
- id: cqrs-event-patterns
|
|
240
|
-
tier: optional
|
|
241
|
-
title: "CQRS & Event Patterns"
|
|
242
|
-
content: |
|
|
243
|
-
## CQRS & Event-Driven Patterns
|
|
244
|
-
|
|
245
|
-
### CQRS (Command Query Responsibility Segregation)
|
|
246
|
-
When read and write patterns diverge significantly:
|
|
247
|
-
- **Command side**: validates, enforces business rules, writes to the canonical store.
|
|
248
|
-
- **Query side**: reads from optimized read models (denormalized views, search indices).
|
|
249
|
-
- Start simple: same database, separate service methods. Optimize to separate stores
|
|
250
|
-
only when read/write scaling demands it.
|
|
251
|
-
- CQRS is not mandatory everywhere — use it where read/write asymmetry is real.
|
|
252
|
-
|
|
253
|
-
### Event Sourcing (when appropriate)
|
|
254
|
-
- Store the sequence of events, not just current state.
|
|
255
|
-
- Useful for: audit trails, temporal queries, debugging, undo/redo.
|
|
256
|
-
- NOT appropriate for: simple CRUD, low-value data, early-stage features.
|
|
257
|
-
- If you use event sourcing, you MUST also maintain a read-projection.
|
|
258
|
-
|
|
259
|
-
### Pub/Sub & Message Patterns
|
|
260
|
-
- **Fire and forget**: publish event, don't wait for subscribers.
|
|
261
|
-
- **Request/Reply**: send command, wait for response.
|
|
262
|
-
- In-process: use an event emitter or mediator.
|
|
263
|
-
- Distributed: use durable message queues with at-least-once delivery.
|
|
264
|
-
|
|
265
|
-
- id: design-patterns-reference
|
|
266
|
-
tier: optional
|
|
267
|
-
title: "Design Patterns Quick Reference"
|
|
268
|
-
content: |
|
|
269
|
-
## Design Patterns — When to Reach for What
|
|
270
|
-
|
|
271
|
-
### Creational
|
|
272
|
-
- **Factory Method / Abstract Factory**: Use when instantiation logic is complex or varies by context.
|
|
273
|
-
Prefer over `new` in business logic — keep constructors for DI only.
|
|
274
|
-
- **Builder**: Use when constructing objects with many optional parameters. Fluent API preferred.
|
|
275
|
-
- **Singleton**: Almost never in application code. Use DI to manage lifecycle instead.
|
|
276
|
-
Acceptable only for: loggers, config singletons in composition root.
|
|
277
|
-
|
|
278
|
-
### Structural
|
|
279
|
-
- **Adapter**: Wrap third-party APIs to match your port interfaces. Isolates vendor lock-in.
|
|
280
|
-
- **Facade**: Simplify complex subsystem interactions behind a unified interface.
|
|
281
|
-
Every module's `index.ts` exports are a facade.
|
|
282
|
-
- **Decorator**: Add behavior (logging, caching, retry, auth) without modifying the original.
|
|
283
|
-
Middleware pipelines are decorator chains.
|
|
284
|
-
- **Proxy**: Lazy loading, access control, or caching in front of expensive resources.
|
|
285
|
-
|
|
286
|
-
### Behavioral
|
|
287
|
-
- **Strategy**: Extract interchangeable algorithms behind an interface. Inject the right one.
|
|
288
|
-
Examples: pricing calculators, render strategies, sort algorithms.
|
|
289
|
-
- **Observer / Pub-Sub**: Decouple event producers from consumers. Use for: domain events,
|
|
290
|
-
UI state changes, webhook fan-out. See CQRS & Event Patterns section.
|
|
291
|
-
- **Chain of Responsibility**: Middleware pipelines (Express, Koa). Each handler decides
|
|
292
|
-
to process or pass to the next. Order matters.
|
|
293
|
-
- **Command**: Encapsulate actions as objects. Enables: undo/redo, queuing, audit trail.
|
|
294
|
-
|
|
295
|
-
### Enterprise
|
|
296
|
-
- **Repository**: Encapsulate data access behind a collection-like interface. Defined in the
|
|
297
|
-
domain layer, implemented in the infrastructure layer as adapters.
|
|
298
|
-
- **Unit of Work**: Track changes within a transaction boundary. Commit or roll back atomically.
|
|
299
|
-
Pair with Repository for database operations.
|
|
300
|
-
- **Saga**: Coordinate multi-step distributed operations. Each step has a compensating action
|
|
301
|
-
for rollback. Use for: order processing, payment flows, multi-service workflows.
|
|
302
|
-
- **Outbox**: Write events to a local outbox table in the same transaction as the state change.
|
|
303
|
-
A separate process reliably publishes them. Guarantees at-least-once event delivery.
|
|
304
|
-
|
|
305
|
-
### Anti-Patterns to Avoid
|
|
306
|
-
- **God Object**: One class that knows/does everything. Split by responsibility.
|
|
307
|
-
- **Service Locator**: Global registry looked up at runtime. Use constructor injection instead.
|
|
308
|
-
- **Anemic Domain Model**: Entities with only getters/setters, logic in services.
|
|
309
|
-
Push behavior into domain objects.
|
|
201
|
+
> **Design reference patterns** (DDD, CQRS, GoF) available on demand via `get_design_reference` tool.
|
|
310
202
|
|
|
311
203
|
- id: twelve-factor-ops
|
|
312
204
|
tier: optional
|
|
@@ -416,6 +308,37 @@ blocks:
|
|
|
416
308
|
- Define invariants, not examples: "sorting is idempotent", "encode then decode = identity".
|
|
417
309
|
- Property tests complement, not replace, example-based tests.
|
|
418
310
|
|
|
311
|
+
- id: tdd-methodology
|
|
312
|
+
tier: core
|
|
313
|
+
title: "Test-Driven Development"
|
|
314
|
+
content: |
|
|
315
|
+
## Test-Driven Development (TDD)
|
|
316
|
+
|
|
317
|
+
### Red-Green-Refactor — The Only Cycle
|
|
318
|
+
1. **RED**: Write a failing test that describes the desired behavior. Run it. It MUST fail.
|
|
319
|
+
If it passes, the test is wrong — it's not testing what you think.
|
|
320
|
+
2. **GREEN**: Write the minimum code to make the test pass. No more.
|
|
321
|
+
3. **REFACTOR**: Clean up while all tests stay green. No new behavior in this step.
|
|
322
|
+
Repeat. Every feature, every function, every bug fix follows this cycle.
|
|
323
|
+
|
|
324
|
+
### Tests Are Specifications, Not Confirmations
|
|
325
|
+
- Write tests against **expected behavior**, never against current implementation.
|
|
326
|
+
- A test that passes on broken code is worse than no test — it provides false confidence.
|
|
327
|
+
- Never weaken an assertion to match what the code currently does. If the code disagrees
|
|
328
|
+
with the spec, the code is wrong.
|
|
329
|
+
- Never write a test suite after the fact that just "locks in" existing behavior without
|
|
330
|
+
verifying it's correct.
|
|
331
|
+
|
|
332
|
+
### Bug Fix Protocol
|
|
333
|
+
- **Every bug fix starts with a failing test** that reproduces the bug.
|
|
334
|
+
- The test must fail before the fix and pass after. No exceptions.
|
|
335
|
+
- If you can't write a reproducing test, you don't understand the bug well enough to fix it.
|
|
336
|
+
|
|
337
|
+
### One Behavior Per Test
|
|
338
|
+
- Each test verifies exactly one behavior or rule.
|
|
339
|
+
- A test with multiple unrelated assertions is testing multiple things — split it.
|
|
340
|
+
- Test name = the specification: `rejects_expired_tokens`, not `test_auth`.
|
|
341
|
+
|
|
419
342
|
- id: data-guardrails
|
|
420
343
|
tier: core
|
|
421
344
|
title: "Data Guardrails"
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "forgecraft-mcp"]
|
|
8
8
|
tags: [UNIVERSAL]
|
|
9
9
|
category: scaffolding
|
|
10
|
+
tier: core
|
|
10
11
|
url: "https://github.com/jghiringhelli/forgecraft-mcp"
|
|
11
12
|
|
|
12
13
|
- name: context7
|
|
@@ -15,6 +16,7 @@ servers:
|
|
|
15
16
|
args: ["-y", "@upstash/context7-mcp@latest"]
|
|
16
17
|
tags: [UNIVERSAL]
|
|
17
18
|
category: documentation
|
|
19
|
+
tier: recommended
|
|
18
20
|
url: "https://github.com/upstash/context7"
|
|
19
21
|
|
|
20
22
|
- name: sequential-thinking
|
|
@@ -23,4 +25,14 @@ servers:
|
|
|
23
25
|
args: ["-y", "@modelcontextprotocol/server-sequential-thinking"]
|
|
24
26
|
tags: [UNIVERSAL]
|
|
25
27
|
category: general
|
|
28
|
+
tier: optional
|
|
26
29
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking"
|
|
30
|
+
|
|
31
|
+
- name: spec-workflow
|
|
32
|
+
description: "Spec-driven TDD workflow with structured requirements, design docs, and red-green-refactor quality gates"
|
|
33
|
+
command: npx
|
|
34
|
+
args: ["-y", "spec-workflow-mcp"]
|
|
35
|
+
tags: [UNIVERSAL]
|
|
36
|
+
category: testing
|
|
37
|
+
tier: optional
|
|
38
|
+
url: "https://github.com/Pimzino/spec-workflow-mcp"
|
|
@@ -177,7 +177,7 @@ blocks:
|
|
|
177
177
|
### Code Quality Metrics
|
|
178
178
|
- Cyclomatic complexity: flag functions > 10, block > 15.
|
|
179
179
|
- Dead code detection.
|
|
180
|
-
- Documentation coverage: all public APIs have docstrings/
|
|
180
|
+
- Documentation coverage: all public APIs have {{#if language_is_typescript}}JSDoc{{/if}}{{#if language_is_python}}docstrings{{/if}}.
|
|
181
181
|
|
|
182
182
|
### Technical Debt Tracking
|
|
183
183
|
- Tech debt items logged in Status.md.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
tag: UNIVERSAL
|
|
2
|
+
section: reference
|
|
3
|
+
blocks:
|
|
4
|
+
- id: domain-driven-design
|
|
5
|
+
title: "Domain-Driven Design Essentials"
|
|
6
|
+
content: |
|
|
7
|
+
## Domain-Driven Design (DDD) Essentials
|
|
8
|
+
|
|
9
|
+
### Entities vs. Value Objects
|
|
10
|
+
- **Entity**: has identity (ID) that persists across state changes. Two users with the
|
|
11
|
+
same name are NOT the same user. Compared by ID.
|
|
12
|
+
- **Value Object**: defined by its attributes, not identity. Two `Money(100, "USD")` are
|
|
13
|
+
the same. Immutable. Compared by value.
|
|
14
|
+
- When in doubt, make it a Value Object — they're simpler and safer.
|
|
15
|
+
|
|
16
|
+
### Eliminate Primitive Obsession
|
|
17
|
+
- Don't use raw `string` for email, `number` for currency, `string` for phone.
|
|
18
|
+
- Wrap domain concepts in typed Value Objects: `EmailAddress`, `Money`, `PhoneNumber`.
|
|
19
|
+
- Value Objects enforce validation at construction — an invalid email can never exist.
|
|
20
|
+
- This moves validation FROM every call site TO the constructor — DRY + safe.
|
|
21
|
+
|
|
22
|
+
### Aggregates
|
|
23
|
+
- An aggregate is a cluster of domain objects treated as a single unit for data changes.
|
|
24
|
+
- One entity is the **aggregate root** — all external access goes through it.
|
|
25
|
+
- Aggregates enforce invariants: `Order` ensures its `OrderLines` don't exceed the limit.
|
|
26
|
+
- Reference other aggregates by ID, not by direct object reference.
|
|
27
|
+
|
|
28
|
+
### Bounded Contexts
|
|
29
|
+
- A bounded context is a boundary within which a domain model has a specific meaning.
|
|
30
|
+
- The word "Account" means different things in Billing vs. Auth vs. Social.
|
|
31
|
+
- Each context owns its models, language, and persistence — no shared database tables.
|
|
32
|
+
- Contexts communicate via well-defined interfaces, events, or an **Anti-Corruption Layer**
|
|
33
|
+
that translates between contexts.
|
|
34
|
+
|
|
35
|
+
### Domain Events
|
|
36
|
+
- When something important happens in the domain, publish an event: `OrderPlaced`,
|
|
37
|
+
`MemberDeactivated`, `PaymentFailed`.
|
|
38
|
+
- Events decouple modules: the Order module publishes `OrderPlaced`, the Notification
|
|
39
|
+
module subscribes — neither imports the other.
|
|
40
|
+
- Events are past-tense named facts. They carry the data needed by subscribers.
|
|
41
|
+
- In-process event bus for monoliths; message broker (SQS, Kafka, NATS) for distributed.
|
|
42
|
+
|
|
43
|
+
- id: cqrs-event-patterns
|
|
44
|
+
title: "CQRS & Event Patterns"
|
|
45
|
+
content: |
|
|
46
|
+
## CQRS & Event-Driven Patterns
|
|
47
|
+
|
|
48
|
+
### CQRS (Command Query Responsibility Segregation)
|
|
49
|
+
When read and write patterns diverge significantly:
|
|
50
|
+
- **Command side**: validates, enforces business rules, writes to the canonical store.
|
|
51
|
+
- **Query side**: reads from optimized read models (denormalized views, search indices).
|
|
52
|
+
- Start simple: same database, separate service methods. Optimize to separate stores
|
|
53
|
+
only when read/write scaling demands it.
|
|
54
|
+
- CQRS is not mandatory everywhere — use it where read/write asymmetry is real.
|
|
55
|
+
|
|
56
|
+
### Event Sourcing (when appropriate)
|
|
57
|
+
- Store the sequence of events, not just current state.
|
|
58
|
+
- Useful for: audit trails, temporal queries, debugging, undo/redo.
|
|
59
|
+
- NOT appropriate for: simple CRUD, low-value data, early-stage features.
|
|
60
|
+
- If you use event sourcing, you MUST also maintain a read-projection.
|
|
61
|
+
|
|
62
|
+
### Pub/Sub & Message Patterns
|
|
63
|
+
- **Fire and forget**: publish event, don't wait for subscribers.
|
|
64
|
+
- **Request/Reply**: send command, wait for response.
|
|
65
|
+
- In-process: use an event emitter or mediator.
|
|
66
|
+
- Distributed: use durable message queues with at-least-once delivery.
|
|
67
|
+
|
|
68
|
+
- id: design-patterns-reference
|
|
69
|
+
title: "Design Patterns Quick Reference"
|
|
70
|
+
content: |
|
|
71
|
+
## Design Patterns — When to Reach for What
|
|
72
|
+
|
|
73
|
+
### Creational
|
|
74
|
+
- **Factory Method / Abstract Factory**: Use when instantiation logic is complex or varies by context.
|
|
75
|
+
Prefer over `new` in business logic — keep constructors for DI only.
|
|
76
|
+
- **Builder**: Use when constructing objects with many optional parameters. Fluent API preferred.
|
|
77
|
+
- **Singleton**: Almost never in application code. Use DI to manage lifecycle instead.
|
|
78
|
+
Acceptable only for: loggers, config singletons in composition root.
|
|
79
|
+
|
|
80
|
+
### Structural
|
|
81
|
+
- **Adapter**: Wrap third-party APIs to match your port interfaces. Isolates vendor lock-in.
|
|
82
|
+
- **Facade**: Simplify complex subsystem interactions behind a unified interface.
|
|
83
|
+
Every module's public exports are a facade.
|
|
84
|
+
- **Decorator**: Add behavior (logging, caching, retry, auth) without modifying the original.
|
|
85
|
+
Middleware pipelines are decorator chains.
|
|
86
|
+
- **Proxy**: Lazy loading, access control, or caching in front of expensive resources.
|
|
87
|
+
|
|
88
|
+
### Behavioral
|
|
89
|
+
- **Strategy**: Extract interchangeable algorithms behind an interface. Inject the right one.
|
|
90
|
+
Examples: pricing calculators, render strategies, sort algorithms.
|
|
91
|
+
- **Observer / Pub-Sub**: Decouple event producers from consumers. Use for: domain events,
|
|
92
|
+
UI state changes, webhook fan-out. See CQRS & Event Patterns section.
|
|
93
|
+
- **Chain of Responsibility**: Middleware pipelines (Express, Koa). Each handler decides
|
|
94
|
+
to process or pass to the next. Order matters.
|
|
95
|
+
- **Command**: Encapsulate actions as objects. Enables: undo/redo, queuing, audit trail.
|
|
96
|
+
|
|
97
|
+
### Enterprise
|
|
98
|
+
- **Repository**: Encapsulate data access behind a collection-like interface. Defined in the
|
|
99
|
+
domain layer, implemented in the infrastructure layer as adapters.
|
|
100
|
+
- **Unit of Work**: Track changes within a transaction boundary. Commit or roll back atomically.
|
|
101
|
+
Pair with Repository for database operations.
|
|
102
|
+
- **Saga**: Coordinate multi-step distributed operations. Each step has a compensating action
|
|
103
|
+
for rollback. Use for: order processing, payment flows, multi-service workflows.
|
|
104
|
+
- **Outbox**: Write events to a local outbox table in the same transaction as the state change.
|
|
105
|
+
A separate process reliably publishes them. Guarantees at-least-once event delivery.
|
|
106
|
+
|
|
107
|
+
### Anti-Patterns to Avoid
|
|
108
|
+
- **God Object**: One class that knows/does everything. Split by responsibility.
|
|
109
|
+
- **Service Locator**: Global registry looked up at runtime. Use constructor injection instead.
|
|
110
|
+
- **Anemic Domain Model**: Entities with only getters/setters, logic in services.
|
|
111
|
+
Push behavior into domain objects.
|
|
@@ -10,7 +10,7 @@ blocks:
|
|
|
10
10
|
Focus on component boundaries, dependency flow, and failure modes.
|
|
11
11
|
checklist:
|
|
12
12
|
- id: component-boundaries
|
|
13
|
-
description: "Component boundaries are well-defined with clear public APIs (
|
|
13
|
+
description: "Component boundaries are well-defined with clear public APIs (module exports)."
|
|
14
14
|
severity: critical
|
|
15
15
|
- id: dependency-graph
|
|
16
16
|
description: "Dependency graph is acyclic. No circular imports between modules."
|
|
@@ -85,7 +85,7 @@ blocks:
|
|
|
85
85
|
description: "No long method chains through objects (a.b().c().d()). Objects expose only the information their callers need."
|
|
86
86
|
severity: nice-to-have
|
|
87
87
|
- id: immutability
|
|
88
|
-
description: "
|
|
88
|
+
description: "Immutable by default — prefer constants and frozen structures. Mutable state restricted to smallest possible scope."
|
|
89
89
|
severity: important
|
|
90
90
|
- id: pure-functions
|
|
91
91
|
description: "Domain logic, validation, and transformations are pure (same input → same output, no side effects). Side effects pushed to adapters."
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
tag: UNIVERSAL
|
|
2
|
+
section: skills
|
|
3
|
+
skills:
|
|
4
|
+
- id: code-review
|
|
5
|
+
name: Code Review
|
|
6
|
+
filename: code-review.md
|
|
7
|
+
description: "Structured code review with checklist and severity ratings"
|
|
8
|
+
tier: core
|
|
9
|
+
content: |
|
|
10
|
+
Review the code changes in this project. For each file changed:
|
|
11
|
+
|
|
12
|
+
1. **Read** the file and understand the context
|
|
13
|
+
2. **Check** against these criteria:
|
|
14
|
+
- Correctness: Does the logic do what it claims?
|
|
15
|
+
- Security: Any injection, auth bypass, or data leak risks?
|
|
16
|
+
- Performance: Any N+1 queries, unbounded loops, or memory leaks?
|
|
17
|
+
- Readability: Are names intention-revealing? Is complexity justified?
|
|
18
|
+
- Tests: Are edge cases covered? Can tests fail?
|
|
19
|
+
|
|
20
|
+
3. **Output** findings in this format:
|
|
21
|
+
- **File**: path/to/file
|
|
22
|
+
- **Line**: number
|
|
23
|
+
- **Severity**: CRITICAL | IMPORTANT | SUGGESTION
|
|
24
|
+
- **Issue**: description
|
|
25
|
+
- **Fix**: recommended change
|
|
26
|
+
|
|
27
|
+
If $ARGUMENTS is provided, focus the review on those specific files or concerns.
|
|
28
|
+
Otherwise, review all staged or recently changed files (use `git diff --name-only`).
|
|
29
|
+
|
|
30
|
+
- id: run-tests
|
|
31
|
+
name: Run Tests
|
|
32
|
+
filename: run-tests.md
|
|
33
|
+
description: "Run test suite and analyze failures"
|
|
34
|
+
tier: core
|
|
35
|
+
content: |
|
|
36
|
+
Run the project's test suite and analyze the results.
|
|
37
|
+
|
|
38
|
+
Steps:
|
|
39
|
+
{{#if language_is_typescript}}
|
|
40
|
+
1. Run `npm test` or `npx vitest run`
|
|
41
|
+
2. If tests fail, read the failing test files and the source code they test
|
|
42
|
+
3. Identify root cause — is it a test bug or a source bug?
|
|
43
|
+
4. Propose a fix with explanation
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#if language_is_python}}
|
|
46
|
+
1. Run `pytest -v` or `python -m pytest`
|
|
47
|
+
2. If tests fail, read the failing test files and the source code they test
|
|
48
|
+
3. Identify root cause — is it a test bug or a source bug?
|
|
49
|
+
4. Propose a fix with explanation
|
|
50
|
+
{{/if}}
|
|
51
|
+
|
|
52
|
+
If $ARGUMENTS is provided, run only matching tests (e.g., a specific file or pattern).
|
|
53
|
+
|
|
54
|
+
Always report:
|
|
55
|
+
- Total tests: passed / failed / skipped
|
|
56
|
+
- Coverage summary if available
|
|
57
|
+
- Any flaky test patterns detected
|
|
58
|
+
|
|
59
|
+
- id: debug-error
|
|
60
|
+
name: Debug Error
|
|
61
|
+
filename: debug-error.md
|
|
62
|
+
description: "Investigate and fix an error from logs or stack trace"
|
|
63
|
+
tier: recommended
|
|
64
|
+
content: |
|
|
65
|
+
Debug the following error. $ARGUMENTS should contain the error message or stack trace.
|
|
66
|
+
|
|
67
|
+
Investigation steps:
|
|
68
|
+
1. Parse the error message and stack trace
|
|
69
|
+
2. Identify the source file and line number
|
|
70
|
+
3. Read the relevant source code
|
|
71
|
+
4. Trace the data flow backward to find the root cause
|
|
72
|
+
5. Check for similar patterns elsewhere in the codebase
|
|
73
|
+
6. Propose a fix with:
|
|
74
|
+
- **Root cause**: why this happened
|
|
75
|
+
- **Fix**: the code change
|
|
76
|
+
- **Prevention**: how to prevent recurrence (test, type guard, validation)
|
|
77
|
+
|
|
78
|
+
Do NOT guess. Read the actual code before proposing solutions.
|
|
79
|
+
|
|
80
|
+
- id: refactor-file
|
|
81
|
+
name: Refactor File
|
|
82
|
+
filename: refactor-file.md
|
|
83
|
+
description: "Refactor a file following SOLID principles and project conventions"
|
|
84
|
+
tier: recommended
|
|
85
|
+
content: |
|
|
86
|
+
Refactor the file specified in $ARGUMENTS following project conventions.
|
|
87
|
+
|
|
88
|
+
Analysis steps:
|
|
89
|
+
1. Read the file completely
|
|
90
|
+
2. Check against SOLID principles:
|
|
91
|
+
- **S**: Does each function/class have one responsibility?
|
|
92
|
+
- **O**: Can behavior be extended without modifying existing code?
|
|
93
|
+
- **L**: Are subtypes substitutable?
|
|
94
|
+
- **I**: Are interfaces focused?
|
|
95
|
+
- **D**: Are dependencies injected?
|
|
96
|
+
3. Check project conventions:
|
|
97
|
+
- Max function length: 50 lines
|
|
98
|
+
- Max file length: 300 lines
|
|
99
|
+
- Max parameters: 5 (use parameter object if more)
|
|
100
|
+
- Intention-revealing names, no abbreviations
|
|
101
|
+
4. Propose changes grouped by priority:
|
|
102
|
+
- MUST: Violations of project standards
|
|
103
|
+
- SHOULD: Improvements to readability/maintainability
|
|
104
|
+
- COULD: Optional enhancements
|
|
105
|
+
|
|
106
|
+
Make changes incrementally. Run tests after each change to verify nothing breaks.
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@anthropic/chrome-devtools-mcp@latest"]
|
|
8
8
|
tags: [WEB-REACT, WEB-STATIC, ANALYTICS]
|
|
9
9
|
category: devtools
|
|
10
|
+
tier: recommended
|
|
10
11
|
url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/chrome-devtools-mcp"
|
|
11
12
|
|
|
12
13
|
- name: playwright
|
|
@@ -15,4 +16,5 @@ servers:
|
|
|
15
16
|
args: ["-y", "@anthropic/mcp-server-playwright"]
|
|
16
17
|
tags: [WEB-REACT, WEB-STATIC]
|
|
17
18
|
category: testing
|
|
19
|
+
tier: recommended
|
|
18
20
|
url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-server-playwright"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
tag: WEB-REACT
|
|
2
|
+
section: skills
|
|
3
|
+
skills:
|
|
4
|
+
- id: react-add-component
|
|
5
|
+
name: Add React Component
|
|
6
|
+
filename: react-add-component.md
|
|
7
|
+
description: "Scaffold a new React component following project patterns"
|
|
8
|
+
tier: core
|
|
9
|
+
content: |
|
|
10
|
+
Create a new React component. $ARGUMENTS should contain the component name and description.
|
|
11
|
+
|
|
12
|
+
Steps:
|
|
13
|
+
1. Analyze existing component patterns:
|
|
14
|
+
- File naming convention (PascalCase, kebab-case, index.tsx barrel)
|
|
15
|
+
- Component style (function components, arrow functions)
|
|
16
|
+
- Styling approach (CSS modules, Tailwind, styled-components, etc.)
|
|
17
|
+
- State management pattern (hooks, context, store)
|
|
18
|
+
- Props pattern (inline types, separate interface, shared types)
|
|
19
|
+
2. Create the component matching discovered patterns:
|
|
20
|
+
- Component file with proper TypeScript props interface
|
|
21
|
+
- Styles file if the project uses co-located styles
|
|
22
|
+
- Index barrel export if the project uses them
|
|
23
|
+
3. Add tests:
|
|
24
|
+
- Renders without crashing
|
|
25
|
+
- Displays expected content with given props
|
|
26
|
+
- Handles user interaction (click, input) if applicable
|
|
27
|
+
4. Export from the nearest index file
|
|
28
|
+
|
|
29
|
+
Follow existing patterns. Do NOT introduce new styling or state management approaches.
|
|
30
|
+
|
|
31
|
+
- id: react-optimize-performance
|
|
32
|
+
name: Optimize React Performance
|
|
33
|
+
filename: react-optimize-performance.md
|
|
34
|
+
description: "Find and fix React performance issues"
|
|
35
|
+
tier: recommended
|
|
36
|
+
content: |
|
|
37
|
+
Analyze React components for performance issues. If $ARGUMENTS specifies a component, focus there. Otherwise, scan the project.
|
|
38
|
+
|
|
39
|
+
Check for:
|
|
40
|
+
1. **Unnecessary re-renders**:
|
|
41
|
+
- Components missing `React.memo` where props rarely change
|
|
42
|
+
- Inline object/array/function creation in JSX props
|
|
43
|
+
- Missing `useCallback` / `useMemo` for expensive operations
|
|
44
|
+
2. **State management**:
|
|
45
|
+
- State stored too high in the tree causing cascading renders
|
|
46
|
+
- Derived state that should be computed (not stored)
|
|
47
|
+
- Missing state colocation
|
|
48
|
+
3. **Data fetching**:
|
|
49
|
+
- Missing loading/error states
|
|
50
|
+
- No request deduplication or caching
|
|
51
|
+
- Waterfalls (sequential fetches that could be parallel)
|
|
52
|
+
4. **Bundle size**:
|
|
53
|
+
- Large imports that could be lazy-loaded
|
|
54
|
+
- Missing code splitting at route boundaries
|
|
55
|
+
|
|
56
|
+
For each issue found, provide the file, line, problem, and fix with code.
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@anthropic/chrome-devtools-mcp@latest"]
|
|
8
8
|
tags: [WEB-REACT, WEB-STATIC, ANALYTICS]
|
|
9
9
|
category: devtools
|
|
10
|
+
tier: recommended
|
|
10
11
|
url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/chrome-devtools-mcp"
|
|
11
12
|
|
|
12
13
|
- name: playwright
|
|
@@ -15,4 +16,5 @@ servers:
|
|
|
15
16
|
args: ["-y", "@anthropic/mcp-server-playwright"]
|
|
16
17
|
tags: [WEB-REACT, WEB-STATIC]
|
|
17
18
|
category: testing
|
|
19
|
+
tier: recommended
|
|
18
20
|
url: "https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-server-playwright"
|