forgecraft-mcp 0.2.1 → 0.3.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 +6 -3
- 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/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/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 +4 -0
- 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.map +1 -1
- package/dist/tools/setup-project.js +5 -1
- 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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
tag: FINTECH
|
|
2
|
+
section: skills
|
|
3
|
+
skills:
|
|
4
|
+
- id: fintech-money-audit
|
|
5
|
+
name: Money Calculation Audit
|
|
6
|
+
filename: fintech-money-audit.md
|
|
7
|
+
description: "Audit codebase for monetary calculation safety"
|
|
8
|
+
tier: core
|
|
9
|
+
content: |
|
|
10
|
+
Audit the codebase for monetary calculation risks.
|
|
11
|
+
|
|
12
|
+
Scan for:
|
|
13
|
+
1. **Floating-point arithmetic on money**:
|
|
14
|
+
- Any use of `float`, `double`, or JavaScript `number` for currency amounts
|
|
15
|
+
- Arithmetic operations (+, -, *, /) on money values without decimal/integer cents
|
|
16
|
+
- Rounding errors in tax, discount, or fee calculations
|
|
17
|
+
2. **Currency handling**:
|
|
18
|
+
- Money values stored without currency code
|
|
19
|
+
- Mixed-currency arithmetic without explicit conversion
|
|
20
|
+
- Missing exchange rate snapshots for audit trail
|
|
21
|
+
3. **Rounding**:
|
|
22
|
+
- Inconsistent rounding modes (banker's rounding vs. standard)
|
|
23
|
+
- Rounding applied at intermediate steps instead of final result
|
|
24
|
+
- Missing rounding specification in calculations
|
|
25
|
+
4. **Overflow / precision**:
|
|
26
|
+
- Integer cents stored in types too small for large amounts
|
|
27
|
+
- Multiplication (e.g., interest) without precision guards
|
|
28
|
+
- Division without remainder handling
|
|
29
|
+
|
|
30
|
+
For each finding, report:
|
|
31
|
+
- **File**: path
|
|
32
|
+
- **Line**: number
|
|
33
|
+
- **Risk**: CRITICAL | HIGH | MEDIUM
|
|
34
|
+
- **Issue**: what could go wrong
|
|
35
|
+
- **Fix**: recommended change (e.g., use Decimal library, store as integer cents)
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@modelcontextprotocol/server-postgres"]
|
|
8
8
|
tags: [DATA-PIPELINE, API, HEALTHCARE]
|
|
9
9
|
category: database
|
|
10
|
+
tier: recommended
|
|
10
11
|
env:
|
|
11
12
|
POSTGRES_CONNECTION_STRING: ""
|
|
12
13
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/postgres"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
tag: HEALTHCARE
|
|
2
|
+
section: skills
|
|
3
|
+
skills:
|
|
4
|
+
- id: healthcare-phi-audit
|
|
5
|
+
name: PHI Audit
|
|
6
|
+
filename: healthcare-phi-audit.md
|
|
7
|
+
description: "Scan codebase for PHI exposure risks"
|
|
8
|
+
tier: core
|
|
9
|
+
content: |
|
|
10
|
+
Audit the codebase for Protected Health Information (PHI) exposure risks.
|
|
11
|
+
|
|
12
|
+
Scan for:
|
|
13
|
+
1. **Logging**: Search for log statements that might include PHI fields:
|
|
14
|
+
- Patient name, DOB, SSN, MRN, address, phone, email
|
|
15
|
+
- Diagnosis codes, treatment plans, lab results
|
|
16
|
+
- Any field from a patient/member/encounter model
|
|
17
|
+
2. **Error messages**: Check that error responses don't leak PHI in:
|
|
18
|
+
- API error bodies
|
|
19
|
+
- Exception messages
|
|
20
|
+
- Stack traces exposed to clients
|
|
21
|
+
3. **Storage**: Verify PHI at rest is protected:
|
|
22
|
+
- Database fields containing PHI are identified and encrypted
|
|
23
|
+
- File uploads with PHI use encrypted storage
|
|
24
|
+
- Temporary files are cleaned up
|
|
25
|
+
4. **Transmission**: Verify PHI in transit:
|
|
26
|
+
- All endpoints serving PHI require HTTPS
|
|
27
|
+
- No PHI in URL query parameters (use POST body)
|
|
28
|
+
- No PHI in client-side analytics or tracking
|
|
29
|
+
|
|
30
|
+
Report each finding with:
|
|
31
|
+
- **File**: path
|
|
32
|
+
- **Line**: number
|
|
33
|
+
- **Risk**: HIGH | MEDIUM | LOW
|
|
34
|
+
- **PHI type**: what data is exposed
|
|
35
|
+
- **Fix**: recommended remediation
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
tag: HIPAA
|
|
2
|
+
section: skills
|
|
3
|
+
skills:
|
|
4
|
+
- id: hipaa-compliance-check
|
|
5
|
+
name: HIPAA Compliance Check
|
|
6
|
+
filename: hipaa-compliance-check.md
|
|
7
|
+
description: "Verify HIPAA technical safeguard compliance"
|
|
8
|
+
tier: core
|
|
9
|
+
content: |
|
|
10
|
+
Check the project for HIPAA technical safeguard compliance.
|
|
11
|
+
|
|
12
|
+
Verify each requirement:
|
|
13
|
+
|
|
14
|
+
**Access Controls (§164.312(a))**:
|
|
15
|
+
- [ ] Unique user identification — every user has a unique ID
|
|
16
|
+
- [ ] Emergency access procedure — documented break-glass process
|
|
17
|
+
- [ ] Automatic logoff — session timeout configured
|
|
18
|
+
- [ ] Encryption/decryption — PHI encrypted at rest
|
|
19
|
+
|
|
20
|
+
**Audit Controls (§164.312(b))**:
|
|
21
|
+
- [ ] Audit logging enabled for all PHI access
|
|
22
|
+
- [ ] Logs include: who, what, when, where (IP)
|
|
23
|
+
- [ ] Logs are tamper-evident (append-only, signed, or immutable storage)
|
|
24
|
+
- [ ] Log retention meets minimum period (6 years)
|
|
25
|
+
|
|
26
|
+
**Integrity Controls (§164.312(c))**:
|
|
27
|
+
- [ ] Data validation on PHI fields
|
|
28
|
+
- [ ] Checksums or signatures for data integrity verification
|
|
29
|
+
|
|
30
|
+
**Transmission Security (§164.312(e))**:
|
|
31
|
+
- [ ] TLS 1.2+ enforced for all PHI transmission
|
|
32
|
+
- [ ] No PHI in URL parameters
|
|
33
|
+
- [ ] Encryption for PHI in message queues or event streams
|
|
34
|
+
|
|
35
|
+
For each gap, report:
|
|
36
|
+
- **Requirement**: HIPAA section reference
|
|
37
|
+
- **Status**: COMPLIANT | GAP | PARTIAL
|
|
38
|
+
- **Finding**: what's missing
|
|
39
|
+
- **Remediation**: specific implementation steps
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "mcp-server-docker"]
|
|
8
8
|
tags: [INFRA]
|
|
9
9
|
category: deployment
|
|
10
|
+
tier: recommended
|
|
10
11
|
url: "https://github.com/ckreiling/mcp-server-docker"
|
|
11
12
|
|
|
12
13
|
- name: kubernetes
|
|
@@ -15,4 +16,5 @@ servers:
|
|
|
15
16
|
args: ["-y", "mcp-server-kubernetes"]
|
|
16
17
|
tags: [INFRA]
|
|
17
18
|
category: deployment
|
|
19
|
+
tier: optional
|
|
18
20
|
url: "https://github.com/strowk/mcp-k8s-go"
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@modelcontextprotocol/server-filesystem", "/"]
|
|
8
8
|
tags: [CLI, LIBRARY]
|
|
9
9
|
category: general
|
|
10
|
+
tier: recommended
|
|
10
11
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem"
|
|
11
12
|
|
|
12
13
|
- name: npm-search
|
|
@@ -15,4 +16,5 @@ servers:
|
|
|
15
16
|
args: ["-y", "mcp-server-npm-search"]
|
|
16
17
|
tags: [LIBRARY]
|
|
17
18
|
category: documentation
|
|
19
|
+
tier: optional
|
|
18
20
|
url: "https://github.com/nicholasgriffintn/npm-search-mcp-server"
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@modelcontextprotocol/server-postgres"]
|
|
8
8
|
tags: [MEDALLION-ARCHITECTURE, DATA-PIPELINE]
|
|
9
9
|
category: database
|
|
10
|
+
tier: recommended
|
|
10
11
|
env:
|
|
11
12
|
POSTGRES_CONNECTION_STRING: ""
|
|
12
13
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/postgres"
|
|
@@ -17,4 +18,5 @@ servers:
|
|
|
17
18
|
args: ["-y", "@modelcontextprotocol/server-filesystem"]
|
|
18
19
|
tags: [MEDALLION-ARCHITECTURE, DATA-PIPELINE]
|
|
19
20
|
category: filesystem
|
|
21
|
+
tier: optional
|
|
20
22
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem"
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@modelcontextprotocol/server-github"]
|
|
8
8
|
tags: [SOC2, UNIVERSAL]
|
|
9
9
|
category: version-control
|
|
10
|
+
tier: recommended
|
|
10
11
|
env:
|
|
11
12
|
GITHUB_PERSONAL_ACCESS_TOKEN: ""
|
|
12
13
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/github"
|
|
@@ -17,6 +18,7 @@ servers:
|
|
|
17
18
|
args: ["-y", "mcp-server-sentry"]
|
|
18
19
|
tags: [SOC2, API]
|
|
19
20
|
category: monitoring
|
|
21
|
+
tier: optional
|
|
20
22
|
env:
|
|
21
23
|
SENTRY_AUTH_TOKEN: ""
|
|
22
24
|
url: "https://github.com/modelcontextprotocol/servers"
|
|
@@ -7,6 +7,7 @@ servers:
|
|
|
7
7
|
args: ["-y", "@modelcontextprotocol/server-postgres"]
|
|
8
8
|
tags: [DATA-PIPELINE, API, SOCIAL]
|
|
9
9
|
category: database
|
|
10
|
+
tier: recommended
|
|
10
11
|
env:
|
|
11
12
|
POSTGRES_CONNECTION_STRING: ""
|
|
12
13
|
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/postgres"
|
|
@@ -17,6 +18,7 @@ servers:
|
|
|
17
18
|
args: ["-y", "mcp-server-redis"]
|
|
18
19
|
tags: [REALTIME, SOCIAL]
|
|
19
20
|
category: database
|
|
21
|
+
tier: optional
|
|
20
22
|
env:
|
|
21
23
|
REDIS_URL: "redis://localhost:6379"
|
|
22
24
|
url: "https://github.com/nicholasgriffintn/redis-mcp-server"
|
|
@@ -182,6 +182,69 @@ hooks:
|
|
|
182
182
|
fi
|
|
183
183
|
echo "🔍 Production quality scan passed"
|
|
184
184
|
|
|
185
|
+
- name: function-length
|
|
186
|
+
trigger: pre-commit
|
|
187
|
+
description: "Warn when staged functions exceed the configured maximum line count"
|
|
188
|
+
filename: pre-commit-function-length.sh
|
|
189
|
+
script: |
|
|
190
|
+
#!/bin/bash
|
|
191
|
+
MAX_LENGTH={{max_function_length | default: 50}}
|
|
192
|
+
STAGED=$(git diff --cached --name-only --diff-filter=ACM)
|
|
193
|
+
SOURCE_FILES=$(echo "$STAGED" | grep -E '\.(ts|tsx|js|jsx)$' | grep -vE '(\.test\.|\.spec\.|__tests__|tests/)')
|
|
194
|
+
if [ -z "$SOURCE_FILES" ]; then exit 0; fi
|
|
195
|
+
WARNINGS=0
|
|
196
|
+
for file in $SOURCE_FILES; do
|
|
197
|
+
# Heuristic: find function/method declarations and count lines to next declaration or closing brace
|
|
198
|
+
awk -v max="$MAX_LENGTH" -v fname="$file" '
|
|
199
|
+
/^[[:space:]]*(export )?(async )?(function |const [a-zA-Z]+ = (async )?\(|[a-zA-Z]+\(.*\) \{|[a-zA-Z]+\(.*\): )/ {
|
|
200
|
+
if (start > 0 && NR - start > max) {
|
|
201
|
+
printf " ⚠️ %s:%d — function starting here is %d lines (max %d)\n", fname, start, NR - start, max
|
|
202
|
+
warnings++
|
|
203
|
+
}
|
|
204
|
+
start = NR
|
|
205
|
+
}
|
|
206
|
+
END {
|
|
207
|
+
if (start > 0 && NR - start > max) {
|
|
208
|
+
printf " ⚠️ %s:%d — function starting here is %d lines (max %d)\n", fname, start, NR - start, max
|
|
209
|
+
warnings++
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
' "$file"
|
|
213
|
+
WARNINGS=$((WARNINGS + $?))
|
|
214
|
+
done
|
|
215
|
+
# Warning only — does not block commit since bash heuristics aren't perfect
|
|
216
|
+
exit 0
|
|
217
|
+
|
|
218
|
+
- name: import-cycle-detector
|
|
219
|
+
trigger: pre-commit
|
|
220
|
+
description: "Detect circular import dependencies in TypeScript and Python projects"
|
|
221
|
+
filename: pre-commit-import-cycles.sh
|
|
222
|
+
script: |
|
|
223
|
+
#!/bin/bash
|
|
224
|
+
echo "🔄 Checking for circular imports..."
|
|
225
|
+
if [ -f "tsconfig.json" ]; then
|
|
226
|
+
if command -v npx &> /dev/null; then
|
|
227
|
+
RESULT=$(npx --yes madge --circular --extensions ts src/ 2>&1)
|
|
228
|
+
if echo "$RESULT" | grep -q "Found.*circular"; then
|
|
229
|
+
echo "❌ Circular imports detected in TypeScript:"
|
|
230
|
+
echo "$RESULT"
|
|
231
|
+
exit 1
|
|
232
|
+
fi
|
|
233
|
+
echo " ✅ No circular imports (TypeScript)"
|
|
234
|
+
fi
|
|
235
|
+
fi
|
|
236
|
+
if [ -f "pyproject.toml" ] || [ -f "setup.py" ]; then
|
|
237
|
+
if command -v lint-imports &> /dev/null; then
|
|
238
|
+
lint-imports 2>&1
|
|
239
|
+
if [ $? -ne 0 ]; then
|
|
240
|
+
echo "❌ Circular imports detected in Python"
|
|
241
|
+
exit 1
|
|
242
|
+
fi
|
|
243
|
+
echo " ✅ No circular imports (Python)"
|
|
244
|
+
fi
|
|
245
|
+
fi
|
|
246
|
+
echo "🔄 Import cycle check passed"
|
|
247
|
+
|
|
185
248
|
- name: code-review
|
|
186
249
|
trigger: pre-commit
|
|
187
250
|
description: "AI assistant reviews diff against project standards"
|
|
@@ -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.
|