forgecraft-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +251 -0
- package/dist/analyzers/anti-pattern.d.ts +21 -0
- package/dist/analyzers/anti-pattern.d.ts.map +1 -0
- package/dist/analyzers/anti-pattern.js +130 -0
- package/dist/analyzers/anti-pattern.js.map +1 -0
- package/dist/analyzers/completeness.d.ts +15 -0
- package/dist/analyzers/completeness.d.ts.map +1 -0
- package/dist/analyzers/completeness.js +207 -0
- package/dist/analyzers/completeness.js.map +1 -0
- package/dist/analyzers/folder-structure.d.ts +35 -0
- package/dist/analyzers/folder-structure.d.ts.map +1 -0
- package/dist/analyzers/folder-structure.js +151 -0
- package/dist/analyzers/folder-structure.js.map +1 -0
- package/dist/analyzers/package-json.d.ts +22 -0
- package/dist/analyzers/package-json.d.ts.map +1 -0
- package/dist/analyzers/package-json.js +229 -0
- package/dist/analyzers/package-json.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/composer.d.ts +32 -0
- package/dist/registry/composer.d.ts.map +1 -0
- package/dist/registry/composer.js +169 -0
- package/dist/registry/composer.js.map +1 -0
- package/dist/registry/loader.d.ts +37 -0
- package/dist/registry/loader.d.ts.map +1 -0
- package/dist/registry/loader.js +278 -0
- package/dist/registry/loader.js.map +1 -0
- package/dist/registry/renderer.d.ts +53 -0
- package/dist/registry/renderer.d.ts.map +1 -0
- package/dist/registry/renderer.js +275 -0
- package/dist/registry/renderer.js.map +1 -0
- package/dist/shared/config/index.d.ts +15 -0
- package/dist/shared/config/index.d.ts.map +1 -0
- package/dist/shared/config/index.js +16 -0
- package/dist/shared/config/index.js.map +1 -0
- package/dist/shared/errors/index.d.ts +30 -0
- package/dist/shared/errors/index.d.ts.map +1 -0
- package/dist/shared/errors/index.js +44 -0
- package/dist/shared/errors/index.js.map +1 -0
- package/dist/shared/logger/index.d.ts +27 -0
- package/dist/shared/logger/index.d.ts.map +1 -0
- package/dist/shared/logger/index.js +59 -0
- package/dist/shared/logger/index.js.map +1 -0
- package/dist/shared/types.d.ts +212 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +30 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tools/add-hook.d.ts +26 -0
- package/dist/tools/add-hook.d.ts.map +1 -0
- package/dist/tools/add-hook.js +82 -0
- package/dist/tools/add-hook.js.map +1 -0
- package/dist/tools/add-module.d.ts +29 -0
- package/dist/tools/add-module.d.ts.map +1 -0
- package/dist/tools/add-module.js +244 -0
- package/dist/tools/add-module.js.map +1 -0
- package/dist/tools/audit.d.ts +26 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +111 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/classify.d.ts +23 -0
- package/dist/tools/classify.d.ts.map +1 -0
- package/dist/tools/classify.js +73 -0
- package/dist/tools/classify.js.map +1 -0
- package/dist/tools/configure-mcp.d.ts +49 -0
- package/dist/tools/configure-mcp.d.ts.map +1 -0
- package/dist/tools/configure-mcp.js +127 -0
- package/dist/tools/configure-mcp.js.map +1 -0
- package/dist/tools/convert.d.ts +27 -0
- package/dist/tools/convert.d.ts.map +1 -0
- package/dist/tools/convert.js +154 -0
- package/dist/tools/convert.js.map +1 -0
- package/dist/tools/generate-claude-md.d.ts +29 -0
- package/dist/tools/generate-claude-md.d.ts.map +1 -0
- package/dist/tools/generate-claude-md.js +116 -0
- package/dist/tools/generate-claude-md.js.map +1 -0
- package/dist/tools/get-nfr.d.ts +20 -0
- package/dist/tools/get-nfr.d.ts.map +1 -0
- package/dist/tools/get-nfr.js +53 -0
- package/dist/tools/get-nfr.js.map +1 -0
- package/dist/tools/list.d.ts +33 -0
- package/dist/tools/list.d.ts.map +1 -0
- package/dist/tools/list.js +155 -0
- package/dist/tools/list.js.map +1 -0
- package/dist/tools/refresh-project.d.ts +34 -0
- package/dist/tools/refresh-project.d.ts.map +1 -0
- package/dist/tools/refresh-project.js +257 -0
- package/dist/tools/refresh-project.js.map +1 -0
- package/dist/tools/review.d.ts +31 -0
- package/dist/tools/review.d.ts.map +1 -0
- package/dist/tools/review.js +62 -0
- package/dist/tools/review.js.map +1 -0
- package/dist/tools/scaffold.d.ts +32 -0
- package/dist/tools/scaffold.d.ts.map +1 -0
- package/dist/tools/scaffold.js +160 -0
- package/dist/tools/scaffold.js.map +1 -0
- package/dist/tools/setup-project.d.ts +37 -0
- package/dist/tools/setup-project.d.ts.map +1 -0
- package/dist/tools/setup-project.js +270 -0
- package/dist/tools/setup-project.js.map +1 -0
- package/package.json +69 -0
- package/templates/analytics/claude-md.yaml +37 -0
- package/templates/analytics/structure.yaml +25 -0
- package/templates/api/claude-md.yaml +85 -0
- package/templates/api/nfr.yaml +23 -0
- package/templates/api/review.yaml +103 -0
- package/templates/api/structure.yaml +34 -0
- package/templates/cli/claude-md.yaml +31 -0
- package/templates/cli/review.yaml +53 -0
- package/templates/cli/structure.yaml +16 -0
- package/templates/data-pipeline/claude-md.yaml +42 -0
- package/templates/data-pipeline/nfr.yaml +39 -0
- package/templates/data-pipeline/structure.yaml +23 -0
- package/templates/fintech/claude-md.yaml +42 -0
- package/templates/fintech/nfr.yaml +46 -0
- package/templates/game/claude-md.yaml +42 -0
- package/templates/healthcare/claude-md.yaml +42 -0
- package/templates/healthcare/nfr.yaml +47 -0
- package/templates/infra/claude-md.yaml +104 -0
- package/templates/infra/nfr.yaml +46 -0
- package/templates/infra/review.yaml +65 -0
- package/templates/infra/structure.yaml +25 -0
- package/templates/library/claude-md.yaml +36 -0
- package/templates/library/review.yaml +56 -0
- package/templates/library/structure.yaml +19 -0
- package/templates/ml/claude-md.yaml +42 -0
- package/templates/ml/nfr.yaml +39 -0
- package/templates/ml/structure.yaml +25 -0
- package/templates/mobile/claude-md.yaml +44 -0
- package/templates/mobile/nfr.yaml +49 -0
- package/templates/mobile/structure.yaml +27 -0
- package/templates/realtime/claude-md.yaml +42 -0
- package/templates/social/claude-md.yaml +43 -0
- package/templates/state-machine/claude-md.yaml +42 -0
- package/templates/universal/claude-md.yaml +477 -0
- package/templates/universal/hooks.yaml +196 -0
- package/templates/universal/nfr.yaml +197 -0
- package/templates/universal/review.yaml +164 -0
- package/templates/universal/structure.yaml +52 -0
- package/templates/web-react/claude-md.yaml +110 -0
- package/templates/web-react/hooks.yaml +44 -0
- package/templates/web-react/nfr.yaml +27 -0
- package/templates/web-react/review.yaml +94 -0
- package/templates/web-react/structure.yaml +46 -0
- package/templates/web-static/claude-md.yaml +73 -0
- package/templates/web3/claude-md.yaml +44 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
tag: INFRA
|
|
2
|
+
section: review
|
|
3
|
+
blocks:
|
|
4
|
+
- id: infra-architecture-review
|
|
5
|
+
tier: recommended
|
|
6
|
+
dimension: architecture
|
|
7
|
+
title: "Infrastructure Architecture Review"
|
|
8
|
+
description: |
|
|
9
|
+
Evaluate IaC patterns, resource organization, and environment management.
|
|
10
|
+
checklist:
|
|
11
|
+
- id: iac-all-resources
|
|
12
|
+
description: "All production resources defined in IaC. No manually created resources."
|
|
13
|
+
severity: critical
|
|
14
|
+
- id: module-reuse
|
|
15
|
+
description: "Common patterns (VPC, database, service) extracted into reusable modules, not copy-pasted."
|
|
16
|
+
severity: important
|
|
17
|
+
- id: environment-isolation
|
|
18
|
+
description: "Environments fully isolated: separate state files, separate accounts/projects where possible."
|
|
19
|
+
severity: critical
|
|
20
|
+
- id: blast-radius
|
|
21
|
+
description: "Stacks/modules scoped to limit blast radius. A bad deploy to one stack doesn't affect others."
|
|
22
|
+
severity: important
|
|
23
|
+
|
|
24
|
+
- id: infra-security-review
|
|
25
|
+
tier: recommended
|
|
26
|
+
dimension: code-quality
|
|
27
|
+
title: "Infrastructure Security Review"
|
|
28
|
+
description: |
|
|
29
|
+
Evaluate network security, access control, and secrets management.
|
|
30
|
+
checklist:
|
|
31
|
+
- id: least-privilege
|
|
32
|
+
description: "IAM roles use minimum required permissions. No wildcard actions on production."
|
|
33
|
+
severity: critical
|
|
34
|
+
- id: no-public-exposure
|
|
35
|
+
description: "Databases and application servers in private subnets. Only load balancers are publicly accessible."
|
|
36
|
+
severity: critical
|
|
37
|
+
- id: secrets-managed
|
|
38
|
+
description: "All secrets in a secrets manager with rotation. No hardcoded credentials in IaC files."
|
|
39
|
+
severity: critical
|
|
40
|
+
- id: encryption-at-rest
|
|
41
|
+
description: "Storage volumes, databases, and backups encrypted at rest. KMS keys managed per environment."
|
|
42
|
+
severity: important
|
|
43
|
+
|
|
44
|
+
- id: infra-ops-review
|
|
45
|
+
tier: recommended
|
|
46
|
+
dimension: performance
|
|
47
|
+
title: "Infrastructure Operations Review"
|
|
48
|
+
description: |
|
|
49
|
+
Evaluate monitoring, cost management, and operational readiness.
|
|
50
|
+
checklist:
|
|
51
|
+
- id: resource-limits
|
|
52
|
+
description: "CPU and memory limits defined for all containers. No unbounded resource consumption."
|
|
53
|
+
severity: critical
|
|
54
|
+
- id: auto-scaling
|
|
55
|
+
description: "Auto-scaling configured with sensible min/max. Tested under load."
|
|
56
|
+
severity: important
|
|
57
|
+
- id: cost-tagging
|
|
58
|
+
description: "Every resource tagged with Environment, Service, Owner. Untagged resources flagged in CI."
|
|
59
|
+
severity: important
|
|
60
|
+
- id: monitoring-alerting
|
|
61
|
+
description: "Dashboards and alerts for all services. Every alert has a runbook link and clear ownership."
|
|
62
|
+
severity: important
|
|
63
|
+
- id: backup-tested
|
|
64
|
+
description: "Backup and restore procedures tested. RPO/RTO validated against targets."
|
|
65
|
+
severity: critical
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
tag: INFRA
|
|
2
|
+
section: structure
|
|
3
|
+
entries:
|
|
4
|
+
- path: terraform/
|
|
5
|
+
description: "Terraform root — one directory per stack/environment"
|
|
6
|
+
- path: terraform/modules/
|
|
7
|
+
description: "Reusable Terraform modules (VPC, ECS, RDS, etc.)"
|
|
8
|
+
- path: terraform/environments/
|
|
9
|
+
description: "Per-environment tfvars: dev.tfvars, staging.tfvars, prod.tfvars"
|
|
10
|
+
- path: cdk/
|
|
11
|
+
description: "CDK app (if using CDK instead of Terraform)"
|
|
12
|
+
- path: cdk/lib/
|
|
13
|
+
description: "CDK stack definitions — one file per stack"
|
|
14
|
+
- path: cdk/bin/
|
|
15
|
+
description: "CDK app entry point"
|
|
16
|
+
- path: docker/
|
|
17
|
+
description: "Dockerfiles and docker-compose for local development"
|
|
18
|
+
- path: docker/docker-compose.yml
|
|
19
|
+
description: "Local development stack: app + backing services"
|
|
20
|
+
- path: scripts/
|
|
21
|
+
description: "Operational scripts: deploy, migrate, seed, rotate-secrets"
|
|
22
|
+
- path: .github/workflows/
|
|
23
|
+
description: "CI/CD pipeline definitions (GitHub Actions)"
|
|
24
|
+
- path: docs/runbooks/
|
|
25
|
+
description: "Operational runbooks: incident response, failover, scaling"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
tag: LIBRARY
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: library-standards
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "Library Standards"
|
|
7
|
+
content: |
|
|
8
|
+
## Library / Package Standards
|
|
9
|
+
|
|
10
|
+
### Public API
|
|
11
|
+
- Clear, minimal public API surface. Export only what consumers need.
|
|
12
|
+
- Barrel file (index.ts / __init__.py) defines the public API explicitly.
|
|
13
|
+
- Internal modules prefixed with underscore or in internal/ directory.
|
|
14
|
+
- Every public API has JSDoc/docstring with examples.
|
|
15
|
+
|
|
16
|
+
### Versioning & Compatibility
|
|
17
|
+
- Semantic versioning: MAJOR.MINOR.PATCH.
|
|
18
|
+
- MAJOR: breaking API changes. MINOR: new features, backward compatible. PATCH: bug fixes.
|
|
19
|
+
- CHANGELOG.md maintained with every release.
|
|
20
|
+
- Deprecation warnings before removal (minimum 1 minor version).
|
|
21
|
+
|
|
22
|
+
### Distribution
|
|
23
|
+
- Package includes only dist/ and necessary runtime files.
|
|
24
|
+
- Types included (declaration files for TypeScript).
|
|
25
|
+
- Peer dependencies used for framework integrations.
|
|
26
|
+
- Minimize runtime dependencies — every dep is a risk.
|
|
27
|
+
|
|
28
|
+
### Testing
|
|
29
|
+
- Test against the public API, not internals.
|
|
30
|
+
- Test with multiple versions of peer dependencies.
|
|
31
|
+
- Integration tests simulate real consumer usage patterns.
|
|
32
|
+
|
|
33
|
+
### Documentation
|
|
34
|
+
- README with: install, quick start, API reference, examples.
|
|
35
|
+
- Usage examples for every major feature.
|
|
36
|
+
- Migration guide for every major version bump.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
tag: LIBRARY
|
|
2
|
+
section: review
|
|
3
|
+
blocks:
|
|
4
|
+
- id: library-architecture-review
|
|
5
|
+
tier: recommended
|
|
6
|
+
dimension: architecture
|
|
7
|
+
title: "Library Architecture Review"
|
|
8
|
+
description: |
|
|
9
|
+
Evaluate public API surface, backward compatibility, and consumer ergonomics.
|
|
10
|
+
checklist:
|
|
11
|
+
- id: public-api-surface
|
|
12
|
+
description: "Public API is minimal and intentional. Every export has a reason. Internal modules are not leaked."
|
|
13
|
+
severity: critical
|
|
14
|
+
- id: backward-compatibility
|
|
15
|
+
description: "Semantic versioning enforced. Breaking changes gated behind major version bumps."
|
|
16
|
+
severity: critical
|
|
17
|
+
- id: tree-shaking
|
|
18
|
+
description: "Package supports tree-shaking: named exports, sideEffects: false, ESM output."
|
|
19
|
+
severity: important
|
|
20
|
+
- id: type-exports
|
|
21
|
+
description: "TypeScript types exported and documented. Declaration files (.d.ts) ship with the package."
|
|
22
|
+
severity: important
|
|
23
|
+
|
|
24
|
+
- id: library-code-quality-review
|
|
25
|
+
tier: recommended
|
|
26
|
+
dimension: code-quality
|
|
27
|
+
title: "Library Code Quality Review"
|
|
28
|
+
description: |
|
|
29
|
+
Evaluate API consistency, documentation, and error messages for consumers.
|
|
30
|
+
checklist:
|
|
31
|
+
- id: api-consistency
|
|
32
|
+
description: "Consistent naming conventions and parameter ordering across all public methods."
|
|
33
|
+
severity: important
|
|
34
|
+
- id: jsdoc-coverage
|
|
35
|
+
description: "100% JSDoc coverage on all public APIs with typed params, returns, and examples."
|
|
36
|
+
severity: critical
|
|
37
|
+
- id: error-messages
|
|
38
|
+
description: "Error messages are actionable for consumers: what went wrong, what they should do."
|
|
39
|
+
severity: important
|
|
40
|
+
|
|
41
|
+
- id: library-test-review
|
|
42
|
+
tier: recommended
|
|
43
|
+
dimension: tests
|
|
44
|
+
title: "Library Test Review"
|
|
45
|
+
description: |
|
|
46
|
+
Evaluate public API contract tests and cross-environment compatibility.
|
|
47
|
+
checklist:
|
|
48
|
+
- id: contract-tests
|
|
49
|
+
description: "Every public API method has contract tests verifying inputs, outputs, and error cases."
|
|
50
|
+
severity: critical
|
|
51
|
+
- id: cross-env-testing
|
|
52
|
+
description: "Tests run in target environments (Node versions, browser if applicable)."
|
|
53
|
+
severity: important
|
|
54
|
+
- id: example-tests
|
|
55
|
+
description: "README examples are executable tests that stay in sync with the API."
|
|
56
|
+
severity: nice-to-have
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
tag: LIBRARY
|
|
2
|
+
section: structure
|
|
3
|
+
language: typescript
|
|
4
|
+
entries:
|
|
5
|
+
- path: src/index.ts
|
|
6
|
+
type: file
|
|
7
|
+
description: "Public API barrel — exports only what consumers need"
|
|
8
|
+
- path: src/shared
|
|
9
|
+
type: directory
|
|
10
|
+
description: "Shared internal utilities"
|
|
11
|
+
- path: dist
|
|
12
|
+
type: directory
|
|
13
|
+
description: "Compiled output (not committed)"
|
|
14
|
+
- path: README.md
|
|
15
|
+
type: file
|
|
16
|
+
description: "Install, quick start, API reference"
|
|
17
|
+
- path: CHANGELOG.md
|
|
18
|
+
type: file
|
|
19
|
+
description: "Release history"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
tag: ML
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: training-pipelines
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "Model Training & Experiment Tracking"
|
|
7
|
+
content: |
|
|
8
|
+
## Model Training & Experiment Tracking
|
|
9
|
+
|
|
10
|
+
- Track every experiment with a tool like MLflow, Weights & Biases, or DVC. Log hyperparameters, metrics, dataset versions, and the git commit hash for full reproducibility.
|
|
11
|
+
- Pin all dependencies (Python version, library versions, CUDA version) in a lockfile or Docker image. A training run from six months ago must be reproducible today.
|
|
12
|
+
- Separate data preprocessing, feature engineering, model training, and evaluation into distinct pipeline stages with clear interfaces.
|
|
13
|
+
- Use configuration files (YAML/TOML) for hyperparameters rather than hard-coding them. Support overrides via CLI arguments for sweep runs.
|
|
14
|
+
- Always hold out a test set that is never used during training or hyperparameter tuning. Report final metrics exclusively on this set.
|
|
15
|
+
- Version datasets alongside code. Use content-addressable storage or DVC to track dataset lineage and detect drift between training runs.
|
|
16
|
+
- Set random seeds for all sources of non-determinism (NumPy, PyTorch, TensorFlow, data shuffling) to ensure reproducible results on the same hardware.
|
|
17
|
+
|
|
18
|
+
- id: feature-engineering
|
|
19
|
+
tier: recommended
|
|
20
|
+
title: "Feature Engineering & Data Preparation"
|
|
21
|
+
content: |
|
|
22
|
+
## Feature Engineering & Data Preparation
|
|
23
|
+
|
|
24
|
+
- Build a centralized feature store (or at minimum a shared feature module) to avoid duplicating feature logic across training and serving.
|
|
25
|
+
- Document every feature: its definition, data source, expected range, update frequency, and any known caveats or biases.
|
|
26
|
+
- Compute feature statistics (mean, std, min, max, null rate) on the training set and persist them. Apply the same transformations at inference time using these saved statistics—never recompute from inference data.
|
|
27
|
+
- Handle missing values explicitly. Choose an imputation strategy per feature (mean, median, mode, sentinel value, or model-based) and document the rationale.
|
|
28
|
+
- Detect and handle data leakage: ensure no future information leaks into features, and that train/validation/test splits respect temporal or entity boundaries.
|
|
29
|
+
- Monitor feature distributions in production. Alert when serving-time distributions diverge significantly from training-time distributions (data/concept drift).
|
|
30
|
+
|
|
31
|
+
- id: model-deployment
|
|
32
|
+
tier: recommended
|
|
33
|
+
title: "Model Versioning & Deployment"
|
|
34
|
+
content: |
|
|
35
|
+
## Model Versioning & Serving
|
|
36
|
+
|
|
37
|
+
- Store trained model artifacts in a model registry with semantic versioning. Tag each artifact with the training run ID, dataset version, and evaluation metrics.
|
|
38
|
+
- Serve models behind a versioned API endpoint. Support A/B testing and canary rollouts by routing a percentage of traffic to a new model version.
|
|
39
|
+
- Define minimum performance thresholds (accuracy, latency p99, throughput) as promotion gates. A model must pass automated evaluation before being promoted to production.
|
|
40
|
+
- Implement shadow mode: run a new model in parallel with the current production model, compare outputs, and alert on significant divergence before cutting over.
|
|
41
|
+
- Log all predictions with input features, model version, and timestamp. This enables debugging, bias auditing, and retraining on production data.
|
|
42
|
+
- Set up automated retraining triggers based on performance degradation, data drift detection, or a fixed schedule. Ensure the retraining pipeline is fully automated end-to-end.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
tag: ML
|
|
2
|
+
section: nfr
|
|
3
|
+
blocks:
|
|
4
|
+
- id: ml-performance
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "ML Model Performance"
|
|
7
|
+
content: |
|
|
8
|
+
## NFR: ML Model Performance
|
|
9
|
+
|
|
10
|
+
### Inference Latency
|
|
11
|
+
- p50 inference latency: < {{ml_p50_ms | default: 50ms}}.
|
|
12
|
+
- p99 inference latency: < {{ml_p99_ms | default: 200ms}}.
|
|
13
|
+
- Batch inference throughput: process {{batch_throughput | default: 10000}} samples/minute.
|
|
14
|
+
|
|
15
|
+
### Model Quality
|
|
16
|
+
- Primary metric: {{primary_metric | default: accuracy}} ≥ {{primary_threshold | default: 0.90}}.
|
|
17
|
+
- Model quality regression blocks deployment — automated evaluation in CI/CD.
|
|
18
|
+
- A/B testing framework for comparing model versions in production.
|
|
19
|
+
|
|
20
|
+
### Data Quality
|
|
21
|
+
- Data drift detection on model inputs. Alert when distribution shifts beyond threshold.
|
|
22
|
+
- Schema validation on training and inference data. Reject malformed inputs.
|
|
23
|
+
- Feature freshness monitored. Stale features flagged.
|
|
24
|
+
|
|
25
|
+
- id: ml-reproducibility
|
|
26
|
+
tier: recommended
|
|
27
|
+
title: "ML Reproducibility"
|
|
28
|
+
content: |
|
|
29
|
+
## NFR: ML Reproducibility
|
|
30
|
+
|
|
31
|
+
### Experiment Tracking
|
|
32
|
+
- Every training run logged: hyperparameters, metrics, dataset version, code version.
|
|
33
|
+
- Experiment tracker (MLflow, Weights & Biases, Neptune) mandatory — not optional.
|
|
34
|
+
- Model lineage: trace any deployed model back to its training data and code.
|
|
35
|
+
|
|
36
|
+
### Versioning
|
|
37
|
+
- Datasets versioned (DVC, Delta Lake, or artifact store).
|
|
38
|
+
- Models versioned with metadata: training date, dataset hash, performance metrics.
|
|
39
|
+
- Random seeds set and logged for reproducibility.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
tag: ML
|
|
2
|
+
section: structure
|
|
3
|
+
entries:
|
|
4
|
+
- path: notebooks/
|
|
5
|
+
description: "Exploration notebooks — never used in production code"
|
|
6
|
+
- path: src/data/
|
|
7
|
+
description: "Data loading, validation, and preprocessing pipelines"
|
|
8
|
+
- path: src/features/
|
|
9
|
+
description: "Feature engineering: transformations, feature store connectors"
|
|
10
|
+
- path: src/models/
|
|
11
|
+
description: "Model definitions, training loops, evaluation"
|
|
12
|
+
- path: src/serving/
|
|
13
|
+
description: "Model serving: API wrappers, batch inference scripts"
|
|
14
|
+
- path: src/config/
|
|
15
|
+
description: "Hyperparameters, feature configs, experiment configs (YAML)"
|
|
16
|
+
- path: tests/
|
|
17
|
+
description: "Unit tests for data transforms, feature logic, model contracts"
|
|
18
|
+
- path: tests/data_validation/
|
|
19
|
+
description: "Data quality tests: schema checks, distribution tests"
|
|
20
|
+
- path: models/
|
|
21
|
+
description: "Serialized models and metadata (gitignored, stored in artifact registry)"
|
|
22
|
+
- path: data/
|
|
23
|
+
description: "Local data cache (gitignored). Source of truth is remote storage."
|
|
24
|
+
- path: pipelines/
|
|
25
|
+
description: "Orchestration definitions: Airflow DAGs, Kubeflow pipelines, or Prefect flows"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
tag: MOBILE
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: responsive-offline
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "Responsive Design & Offline-First"
|
|
7
|
+
content: |
|
|
8
|
+
## Responsive Design & Offline-First Patterns
|
|
9
|
+
|
|
10
|
+
- Design mobile-first: start with the smallest viewport and progressively enhance for larger screens. Use CSS media queries or container queries to adapt layout, not separate mobile pages.
|
|
11
|
+
- Implement an offline-first architecture: the app should be functional without a network connection, using locally cached data, and sync when connectivity is restored.
|
|
12
|
+
- Use a local database (SQLite, IndexedDB, Realm, WatermelonDB) as the primary data source for the UI. Sync with the server in the background using a conflict resolution strategy (last-write-wins, CRDTs, or manual merge).
|
|
13
|
+
- Queue mutations (writes, updates, deletes) locally when offline. Process the queue in order when connectivity resumes, handling conflicts and failures for each operation.
|
|
14
|
+
- Implement a network status indicator in the UI. Clearly communicate to users when they are offline and which features are unavailable or operating on stale data.
|
|
15
|
+
- Cache API responses with appropriate TTLs. Use stale-while-revalidate patterns to show cached data immediately while fetching fresh data in the background.
|
|
16
|
+
- Test all user flows in airplane mode and on throttled connections (3G, high latency). Offline behavior should feel intentional, not broken.
|
|
17
|
+
|
|
18
|
+
- id: push-lifecycle
|
|
19
|
+
tier: recommended
|
|
20
|
+
title: "Push Notifications & App Lifecycle"
|
|
21
|
+
content: |
|
|
22
|
+
## Push Notifications & App Lifecycle
|
|
23
|
+
|
|
24
|
+
- Request notification permission contextually—explain the value before prompting. Never request permission on first launch without context; wait until the user encounters a feature that benefits from notifications.
|
|
25
|
+
- Implement a server-side notification preferences model. Users should control notification categories (marketing, transactional, social) independently, and preferences must be enforced server-side.
|
|
26
|
+
- Handle notification payloads gracefully in all app states: foreground (in-app banner), background (system notification), and terminated (cold start with deep link to relevant screen).
|
|
27
|
+
- Use silent/data notifications for background data sync. Keep background execution time under OS limits (< 30 seconds on iOS) to avoid being throttled.
|
|
28
|
+
- Manage app lifecycle transitions (active → background → suspended → terminated) explicitly. Save unsaved state on `onPause`/`onBackground`, restore it on `onResume`, and release expensive resources (camera, GPS, Bluetooth) when backgrounded.
|
|
29
|
+
- Handle deep links and universal links with a centralized routing mechanism. Every screen reachable by deep link must handle being the entry point (no assumed navigation stack).
|
|
30
|
+
- Implement token refresh for push notification services (FCM, APNs). Re-register the device token on every app launch and update the server if it changes.
|
|
31
|
+
|
|
32
|
+
- id: platform-performance
|
|
33
|
+
tier: recommended
|
|
34
|
+
title: "Platform Patterns & Performance"
|
|
35
|
+
content: |
|
|
36
|
+
## Platform-Specific Patterns & Mobile Performance
|
|
37
|
+
|
|
38
|
+
- Respect platform conventions: use platform-native navigation patterns (bottom tabs on iOS, drawer on Android), system fonts, haptic feedback, and gesture behaviors that users expect.
|
|
39
|
+
- Optimize list rendering: use virtualized/recycled lists (FlatList, RecyclerView, UICollectionView) for any list longer than ~20 items. Never render hundreds of items in a scroll view.
|
|
40
|
+
- Minimize main thread work. Move file I/O, JSON parsing, image decoding, and network calls off the main/UI thread. Jank-free scrolling requires < 16ms per frame on the UI thread.
|
|
41
|
+
- Reduce app binary size: use tree shaking, asset compression, on-demand resource loading, and avoid bundling unused native libraries. Monitor binary size in CI and set growth budgets.
|
|
42
|
+
- Implement graceful permission handling: check permission status before requesting, explain why the permission is needed, handle denial gracefully, and provide a path to re-enable via system settings.
|
|
43
|
+
- Cache images in memory and on disk with size limits. Use progressive loading (blur placeholder → thumbnail → full resolution) for a smooth visual experience.
|
|
44
|
+
- Test on real devices across OS versions, screen sizes, and memory configurations. Emulators miss real-world issues like thermal throttling, low memory kills, and vendor-specific OS behaviors.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
tag: MOBILE
|
|
2
|
+
section: nfr
|
|
3
|
+
blocks:
|
|
4
|
+
- id: mobile-performance
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "Mobile Performance"
|
|
7
|
+
content: |
|
|
8
|
+
## NFR: Mobile Performance
|
|
9
|
+
|
|
10
|
+
### App Size
|
|
11
|
+
- Initial download: < {{app_size_mb | default: 30}} MB.
|
|
12
|
+
- On-demand asset downloading for heavy content (maps, ML models, media packs).
|
|
13
|
+
- Monitor app size in CI — PRs that increase binary > 5% require justification.
|
|
14
|
+
|
|
15
|
+
### Startup
|
|
16
|
+
- Cold start to interactive: < {{cold_start_ms | default: 2000}} ms.
|
|
17
|
+
- Lazy-initialize non-critical services. Show skeleton UI immediately.
|
|
18
|
+
- Splash screen is not a crutch — measure time-to-interactive, not time-to-splash.
|
|
19
|
+
|
|
20
|
+
### Battery & Network
|
|
21
|
+
- Background work budgeted. No unnecessary wake-locks, polling, or GPS.
|
|
22
|
+
- Network requests batched where possible. Respect low-data mode settings.
|
|
23
|
+
- Offline-first: core features work without connectivity. Sync on reconnect.
|
|
24
|
+
|
|
25
|
+
### Runtime
|
|
26
|
+
- 60 FPS for scrolling and animations. Profile and fix jank.
|
|
27
|
+
- Memory budget per screen. Monitor for leaks (LeakCanary, Instruments).
|
|
28
|
+
- No main-thread blocking operations > 16ms.
|
|
29
|
+
|
|
30
|
+
- id: mobile-ux
|
|
31
|
+
tier: recommended
|
|
32
|
+
title: "Mobile UX Quality"
|
|
33
|
+
content: |
|
|
34
|
+
## NFR: Mobile UX Quality
|
|
35
|
+
|
|
36
|
+
### Platform Compliance
|
|
37
|
+
- Follow platform guidelines: Material Design (Android), Human Interface Guidelines (iOS).
|
|
38
|
+
- Support system dark mode, dynamic type / font scaling, and accessibility features.
|
|
39
|
+
- Deep links and universal links configured and tested.
|
|
40
|
+
|
|
41
|
+
### Crash Rate
|
|
42
|
+
- Target crash-free rate: ≥ {{crash_free_target | default: 99.5%}}.
|
|
43
|
+
- Crash reporting (Crashlytics, Sentry) integrated. Crashes triaged within 24 hours.
|
|
44
|
+
- ANR (Application Not Responding) rate: < 0.5%.
|
|
45
|
+
|
|
46
|
+
### Updates
|
|
47
|
+
- Over-the-air updates for JS layer (CodePush, Expo Updates) where appropriate.
|
|
48
|
+
- Force-update mechanism for critical security patches.
|
|
49
|
+
- Backward-compatible API versioning — old app versions must gracefully degrade.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
tag: MOBILE
|
|
2
|
+
section: structure
|
|
3
|
+
entries:
|
|
4
|
+
- path: src/screens/
|
|
5
|
+
description: "Screen-level components — one directory per screen"
|
|
6
|
+
- path: src/components/
|
|
7
|
+
description: "Shared UI components: buttons, cards, inputs, modals"
|
|
8
|
+
- path: src/navigation/
|
|
9
|
+
description: "Navigation configuration: stack, tab, drawer navigators"
|
|
10
|
+
- path: src/services/
|
|
11
|
+
description: "API client, storage, auth, push notifications, analytics"
|
|
12
|
+
- path: src/hooks/
|
|
13
|
+
description: "Custom React Native hooks"
|
|
14
|
+
- path: src/store/
|
|
15
|
+
description: "State management: slices, selectors, async thunks"
|
|
16
|
+
- path: src/utils/
|
|
17
|
+
description: "Platform-agnostic utilities and helpers"
|
|
18
|
+
- path: src/theme/
|
|
19
|
+
description: "Design tokens, colors, typography, spacing"
|
|
20
|
+
- path: src/locales/
|
|
21
|
+
description: "Translation JSON files per locale"
|
|
22
|
+
- path: assets/
|
|
23
|
+
description: "Images, fonts, animations (Lottie)"
|
|
24
|
+
- path: __tests__/
|
|
25
|
+
description: "Unit and integration tests"
|
|
26
|
+
- path: e2e/
|
|
27
|
+
description: "End-to-end tests (Detox, Maestro, or Appium)"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
tag: REALTIME
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: websocket-patterns
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "WebSocket & Connection Management"
|
|
7
|
+
content: |
|
|
8
|
+
## WebSocket & Connection Lifecycle
|
|
9
|
+
|
|
10
|
+
- Implement automatic reconnection with exponential backoff and jitter (base 1s, max 30s). Track connection state (connecting, open, closing, closed) and expose it to the UI.
|
|
11
|
+
- Use heartbeat/ping-pong frames at regular intervals (every 30s) to detect dead connections. Close and reconnect if a pong is not received within the timeout window.
|
|
12
|
+
- Authenticate WebSocket connections during the handshake (via token in query param or first message). Reject unauthenticated connections immediately—do not allow message exchange before auth.
|
|
13
|
+
- Assign each connection a unique session ID. Map sessions to user identities server-side for targeted messaging, presence tracking, and connection auditing.
|
|
14
|
+
- Support graceful degradation: if WebSocket connections fail (corporate proxies, firewalls), fall back to Server-Sent Events or long polling automatically.
|
|
15
|
+
- Implement connection rate limiting per IP and per user to prevent resource exhaustion from misbehaving clients or attacks.
|
|
16
|
+
- Buffer outbound messages on the client during disconnection and replay them in order upon reconnection to avoid data loss.
|
|
17
|
+
|
|
18
|
+
- id: event-driven-architecture
|
|
19
|
+
tier: recommended
|
|
20
|
+
title: "Event-Driven Architecture"
|
|
21
|
+
content: |
|
|
22
|
+
## Event-Driven & Pub/Sub Patterns
|
|
23
|
+
|
|
24
|
+
- Use a message broker (Redis Pub/Sub, NATS, Kafka) to fan out events across multiple server instances. Never rely on in-process state for multi-node real-time systems.
|
|
25
|
+
- Define a clear event schema with versioning. Every event must include: event type, version, timestamp, producer ID, correlation ID, and payload.
|
|
26
|
+
- Implement topic-based or channel-based subscriptions. Clients should subscribe only to the channels they need to minimize unnecessary message delivery.
|
|
27
|
+
- Use message acknowledgment for critical events: the consumer must explicitly ack after processing. Unacked messages are redelivered after a timeout.
|
|
28
|
+
- Deduplicate events on the consumer side using the event ID. Network retries and broker redelivery can produce duplicates that must not cause double-processing.
|
|
29
|
+
- Separate command messages (requests to change state) from event messages (notifications of state changes). Commands go to a single handler; events fan out to many subscribers.
|
|
30
|
+
|
|
31
|
+
- id: backpressure-scaling
|
|
32
|
+
tier: recommended
|
|
33
|
+
title: "Backpressure & Scaling"
|
|
34
|
+
content: |
|
|
35
|
+
## Backpressure, Flow Control & Scaling
|
|
36
|
+
|
|
37
|
+
- Implement backpressure at every layer. If a consumer cannot keep up, signal the producer to slow down rather than buffering unboundedly and risking OOM.
|
|
38
|
+
- Set maximum buffer sizes for outbound message queues per connection. If the buffer fills (slow client), drop non-critical messages or disconnect the client with a warning.
|
|
39
|
+
- Use rate limiting on inbound messages per client (e.g., max 100 messages/second). Reject excess messages with an error code rather than silently dropping them.
|
|
40
|
+
- Design for horizontal scaling: use sticky sessions or a shared session store so that any server node can handle any client's messages after a reconnection.
|
|
41
|
+
- Monitor key metrics: active connections, messages per second (in/out), message latency p50/p95/p99, buffer utilization, and reconnection rate. Alert on anomalies.
|
|
42
|
+
- Load-test real-time features with realistic connection counts (10x expected peak) and message rates to identify bottlenecks before they appear in production.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
tag: SOCIAL
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: ugc-moderation
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "User-Generated Content & Moderation"
|
|
7
|
+
content: |
|
|
8
|
+
## User-Generated Content & Moderation
|
|
9
|
+
|
|
10
|
+
- Treat all user-generated content (UGC) as untrusted input. Sanitize HTML, validate file types and sizes, and strip EXIF metadata from uploaded images to prevent data leakage.
|
|
11
|
+
- Implement a multi-layer moderation pipeline: automated filters (keyword blocklists, ML classifiers) → queue for human review → final disposition (approve, reject, escalate).
|
|
12
|
+
- Use a content status model: all UGC transitions through states (pending → approved / rejected / flagged). Only approved content is visible to other users by default.
|
|
13
|
+
- Implement user-driven reporting with structured categories (spam, harassment, misinformation, illegal content). Deduplicate reports and escalate based on volume and severity.
|
|
14
|
+
- Apply rate limiting on content creation: new accounts should have stricter limits (e.g., max 5 posts/day) that relax as the account ages and builds trust.
|
|
15
|
+
- Maintain appeal workflows: users whose content is removed should be notified with the reason and given a clear path to appeal the decision.
|
|
16
|
+
- Log all moderation actions (who, what, when, why) for accountability and to train automated classifiers over time.
|
|
17
|
+
|
|
18
|
+
- id: feeds-notifications
|
|
19
|
+
tier: recommended
|
|
20
|
+
title: "Feeds & Notification Systems"
|
|
21
|
+
content: |
|
|
22
|
+
## Feed Generation & Notifications
|
|
23
|
+
|
|
24
|
+
- Use a fan-out-on-write strategy for small-to-medium scale: when a user posts, push the post ID to each follower's feed cache (e.g., Redis sorted set by timestamp).
|
|
25
|
+
- For high-follower accounts (celebrities), use fan-out-on-read: merge their posts into the feed at read time to avoid writing to millions of follower feeds.
|
|
26
|
+
- Implement cursor-based pagination for feeds (`?after=<post_id>&limit=20`). Never use offset-based pagination—it produces inconsistent results as new content is inserted.
|
|
27
|
+
- Separate notification delivery from notification generation. Generate notifications as events, then deliver them through multiple channels (in-app, push, email) based on user preferences.
|
|
28
|
+
- Batch and debounce notifications to avoid spamming: "5 people liked your post" rather than 5 individual notifications within a minute.
|
|
29
|
+
- Store notification read/unread state per user. Provide a "mark all as read" endpoint and support real-time badge count updates via WebSocket or SSE.
|
|
30
|
+
|
|
31
|
+
- id: privacy-social-graph
|
|
32
|
+
tier: recommended
|
|
33
|
+
title: "Privacy & Social Graph"
|
|
34
|
+
content: |
|
|
35
|
+
## Privacy Controls & Social Graph
|
|
36
|
+
|
|
37
|
+
- Default to private. New accounts should have restrictive visibility settings that users explicitly open up, not the reverse.
|
|
38
|
+
- Model privacy as a per-resource, per-audience policy: each piece of content can be visible to `public`, `followers`, `mutual_follows`, `specific_list`, or `only_me`.
|
|
39
|
+
- Enforce privacy at the data access layer (query filters), not just the UI. A direct API call with a content ID must still respect the viewer's permission relative to the content owner.
|
|
40
|
+
- Support account blocking and muting as first-class features. Blocked users cannot view the blocker's content, send messages, or appear in their feeds—enforced server-side.
|
|
41
|
+
- Store the social graph (follow/friend relationships) in a structure optimized for common queries: "does A follow B?" (O(1) lookup), "who does A follow?" (paginated list), "mutual friends of A and B" (set intersection).
|
|
42
|
+
- Implement data export (GDPR Article 20) and account deletion (GDPR Article 17) as automated, auditable processes. Deletion must cascade to all content, messages, and derived data.
|
|
43
|
+
- Rate-limit follow/friend actions to prevent spam following. Detect and flag accounts exhibiting bot-like social graph manipulation patterns.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
tag: STATE-MACHINE
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: state-transition-design
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "State Transition Design"
|
|
7
|
+
content: |
|
|
8
|
+
## State Transition Patterns
|
|
9
|
+
|
|
10
|
+
- Define all valid states and transitions as an explicit, declarative configuration (object map, table, or DSL)—never as scattered if/else chains across the codebase.
|
|
11
|
+
- Make the state machine the single source of truth for "what can happen next." UI elements, API validations, and business logic should all derive their behavior from the machine definition.
|
|
12
|
+
- Every transition should be triggered by a named event. Use past-tense names for events that report something happened (`PAYMENT_RECEIVED`) and imperative names for commands (`SUBMIT_ORDER`).
|
|
13
|
+
- Model transitions as pure functions: `(currentState, event) → nextState + effects`. Keep the transition logic free of side effects; execute effects (API calls, notifications) separately.
|
|
14
|
+
- Validate transitions before executing them. If an event is not valid in the current state, reject it with a clear error rather than silently ignoring it.
|
|
15
|
+
- Persist the current state and a history of transitions (event, from-state, to-state, timestamp, actor) for auditability and debugging.
|
|
16
|
+
- Visualize the state machine from its definition (e.g., generate a Mermaid or Graphviz diagram). Review the diagram in PRs that modify state logic.
|
|
17
|
+
|
|
18
|
+
- id: guards-actions
|
|
19
|
+
tier: recommended
|
|
20
|
+
title: "Guards, Actions & Side Effects"
|
|
21
|
+
content: |
|
|
22
|
+
## Guards, Actions & Side Effects
|
|
23
|
+
|
|
24
|
+
- Use guard conditions to make transitions conditional: a transition fires only if the guard predicate evaluates to true given the current context.
|
|
25
|
+
- Keep guards as pure, synchronous predicates. If a guard needs async data, fetch the data before sending the event to the machine—don't make the machine wait on I/O.
|
|
26
|
+
- Separate actions into three categories: entry actions (run when entering a state), exit actions (run when leaving a state), and transition actions (run during a specific transition).
|
|
27
|
+
- Actions should be fire-and-forget from the machine's perspective. If an action can fail and the failure matters, model the failure as a new event that the machine handles.
|
|
28
|
+
- Use the context (extended state) to carry data that influences guards and actions. Update context immutably during transitions to maintain a clear audit trail.
|
|
29
|
+
- Implement an effect/service layer that the machine invokes but does not depend on directly. This makes the machine testable in isolation without mocking external systems.
|
|
30
|
+
|
|
31
|
+
- id: hierarchical-parallel
|
|
32
|
+
tier: recommended
|
|
33
|
+
title: "Hierarchical & Parallel States"
|
|
34
|
+
content: |
|
|
35
|
+
## Hierarchical & Parallel State Patterns
|
|
36
|
+
|
|
37
|
+
- Use hierarchical (nested) states to avoid transition explosion. Common behaviors shared by sibling states should be defined on the parent state.
|
|
38
|
+
- Model independent concurrent behaviors as parallel (orthogonal) state regions. For example, a form component might have parallel regions for validation state and submission state.
|
|
39
|
+
- Define clear entry and exit points for compound states. Use initial states for child regions and final states to signal region completion.
|
|
40
|
+
- Avoid deeply nested hierarchies (> 3 levels). If nesting grows complex, consider decomposing into separate communicating machines via the actor model.
|
|
41
|
+
- Use `done` events to coordinate between parallel regions or between parent and child machines. A parent can transition when all child regions reach their final states.
|
|
42
|
+
- Test state machines exhaustively: cover every state, every transition, every guard branch, and every unreachable-state assertion. Use model-based testing to auto-generate transition paths.
|