forgecraft-mcp 1.2.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +525 -525
  2. package/dist/cli/help.js +44 -44
  3. package/dist/registry/renderer-skeletons.js +92 -92
  4. package/dist/shared/gs-score-logger.js +6 -6
  5. package/dist/tools/add-module.js +123 -123
  6. package/dist/tools/advice-registry.js +18 -18
  7. package/dist/tools/check-cascade-report.js +64 -64
  8. package/dist/tools/configure-mcp.d.ts +3 -0
  9. package/dist/tools/configure-mcp.d.ts.map +1 -1
  10. package/dist/tools/configure-mcp.js +10 -0
  11. package/dist/tools/configure-mcp.js.map +1 -1
  12. package/dist/tools/forgecraft-dispatch.d.ts.map +1 -1
  13. package/dist/tools/forgecraft-dispatch.js +3 -0
  14. package/dist/tools/forgecraft-dispatch.js.map +1 -1
  15. package/dist/tools/forgecraft-schema-params.d.ts +9 -0
  16. package/dist/tools/forgecraft-schema-params.d.ts.map +1 -1
  17. package/dist/tools/forgecraft-schema-params.js +21 -0
  18. package/dist/tools/forgecraft-schema-params.js.map +1 -1
  19. package/dist/tools/forgecraft-schema.d.ts +9 -0
  20. package/dist/tools/forgecraft-schema.d.ts.map +1 -1
  21. package/dist/tools/refresh-output.js +14 -14
  22. package/dist/tools/scaffold-spec-stubs.js +115 -115
  23. package/dist/tools/scaffold-templates.js +62 -62
  24. package/dist/tools/setup-artifact-writers.d.ts +30 -0
  25. package/dist/tools/setup-artifact-writers.d.ts.map +1 -1
  26. package/dist/tools/setup-artifact-writers.js +120 -8
  27. package/dist/tools/setup-artifact-writers.js.map +1 -1
  28. package/dist/tools/setup-phase1.d.ts +3 -0
  29. package/dist/tools/setup-phase1.d.ts.map +1 -1
  30. package/dist/tools/setup-phase1.js +79 -35
  31. package/dist/tools/setup-phase1.js.map +1 -1
  32. package/dist/tools/setup-phase2.d.ts +2 -0
  33. package/dist/tools/setup-phase2.d.ts.map +1 -1
  34. package/dist/tools/setup-phase2.js +10 -1
  35. package/dist/tools/setup-phase2.js.map +1 -1
  36. package/dist/tools/setup-project.d.ts +18 -0
  37. package/dist/tools/setup-project.d.ts.map +1 -1
  38. package/dist/tools/setup-project.js +77 -1
  39. package/dist/tools/setup-project.js.map +1 -1
  40. package/dist/tools/spec-parser-tags.d.ts +9 -0
  41. package/dist/tools/spec-parser-tags.d.ts.map +1 -1
  42. package/dist/tools/spec-parser-tags.js +92 -0
  43. package/dist/tools/spec-parser-tags.js.map +1 -1
  44. package/package.json +89 -86
  45. package/templates/analytics/instructions.yaml +37 -37
  46. package/templates/analytics/mcp-servers.yaml +11 -11
  47. package/templates/analytics/structure.yaml +25 -25
  48. package/templates/api/instructions.yaml +231 -231
  49. package/templates/api/mcp-servers.yaml +22 -13
  50. package/templates/api/nfr.yaml +23 -23
  51. package/templates/api/review.yaml +103 -103
  52. package/templates/api/structure.yaml +34 -34
  53. package/templates/api/verification.yaml +132 -132
  54. package/templates/cli/instructions.yaml +31 -31
  55. package/templates/cli/mcp-servers.yaml +11 -11
  56. package/templates/cli/review.yaml +53 -53
  57. package/templates/cli/structure.yaml +16 -16
  58. package/templates/data-lineage/instructions.yaml +28 -28
  59. package/templates/data-lineage/mcp-servers.yaml +22 -22
  60. package/templates/data-pipeline/instructions.yaml +84 -84
  61. package/templates/data-pipeline/mcp-servers.yaml +13 -13
  62. package/templates/data-pipeline/nfr.yaml +39 -39
  63. package/templates/data-pipeline/structure.yaml +23 -23
  64. package/templates/fintech/hooks.yaml +55 -55
  65. package/templates/fintech/instructions.yaml +112 -112
  66. package/templates/fintech/mcp-servers.yaml +13 -13
  67. package/templates/fintech/nfr.yaml +46 -46
  68. package/templates/fintech/playbook.yaml +210 -210
  69. package/templates/fintech/verification.yaml +239 -239
  70. package/templates/game/instructions.yaml +289 -289
  71. package/templates/game/mcp-servers.yaml +38 -38
  72. package/templates/game/nfr.yaml +64 -64
  73. package/templates/game/playbook.yaml +214 -214
  74. package/templates/game/review.yaml +97 -97
  75. package/templates/game/structure.yaml +67 -67
  76. package/templates/game/verification.yaml +174 -174
  77. package/templates/healthcare/instructions.yaml +42 -42
  78. package/templates/healthcare/mcp-servers.yaml +13 -13
  79. package/templates/healthcare/nfr.yaml +47 -47
  80. package/templates/hipaa/instructions.yaml +41 -41
  81. package/templates/hipaa/mcp-servers.yaml +13 -13
  82. package/templates/infra/instructions.yaml +104 -104
  83. package/templates/infra/mcp-servers.yaml +20 -20
  84. package/templates/infra/nfr.yaml +46 -46
  85. package/templates/infra/review.yaml +65 -65
  86. package/templates/infra/structure.yaml +25 -25
  87. package/templates/library/instructions.yaml +36 -36
  88. package/templates/library/mcp-servers.yaml +20 -20
  89. package/templates/library/review.yaml +56 -56
  90. package/templates/library/structure.yaml +19 -19
  91. package/templates/medallion-architecture/instructions.yaml +41 -41
  92. package/templates/medallion-architecture/mcp-servers.yaml +22 -22
  93. package/templates/ml/instructions.yaml +85 -85
  94. package/templates/ml/mcp-servers.yaml +11 -11
  95. package/templates/ml/nfr.yaml +39 -39
  96. package/templates/ml/structure.yaml +25 -25
  97. package/templates/ml/verification.yaml +156 -156
  98. package/templates/mobile/instructions.yaml +44 -44
  99. package/templates/mobile/mcp-servers.yaml +11 -11
  100. package/templates/mobile/nfr.yaml +49 -49
  101. package/templates/mobile/structure.yaml +27 -27
  102. package/templates/mobile/verification.yaml +121 -121
  103. package/templates/observability-xray/instructions.yaml +40 -40
  104. package/templates/observability-xray/mcp-servers.yaml +15 -15
  105. package/templates/realtime/instructions.yaml +42 -42
  106. package/templates/realtime/mcp-servers.yaml +13 -13
  107. package/templates/soc2/instructions.yaml +41 -41
  108. package/templates/soc2/mcp-servers.yaml +24 -24
  109. package/templates/social/instructions.yaml +43 -43
  110. package/templates/social/mcp-servers.yaml +24 -24
  111. package/templates/state-machine/instructions.yaml +42 -42
  112. package/templates/state-machine/mcp-servers.yaml +11 -11
  113. package/templates/tools-registry.yaml +164 -164
  114. package/templates/universal/hooks.yaml +531 -531
  115. package/templates/universal/instructions.yaml +1692 -1692
  116. package/templates/universal/mcp-servers.yaml +50 -50
  117. package/templates/universal/nfr.yaml +197 -197
  118. package/templates/universal/reference.yaml +326 -326
  119. package/templates/universal/review.yaml +204 -204
  120. package/templates/universal/skills.yaml +262 -262
  121. package/templates/universal/structure.yaml +67 -67
  122. package/templates/universal/verification.yaml +416 -416
  123. package/templates/web-react/hooks.yaml +44 -44
  124. package/templates/web-react/instructions.yaml +207 -207
  125. package/templates/web-react/mcp-servers.yaml +20 -20
  126. package/templates/web-react/nfr.yaml +27 -27
  127. package/templates/web-react/review.yaml +94 -94
  128. package/templates/web-react/structure.yaml +46 -46
  129. package/templates/web-react/verification.yaml +126 -126
  130. package/templates/web-static/instructions.yaml +115 -115
  131. package/templates/web-static/mcp-servers.yaml +20 -20
  132. package/templates/web3/instructions.yaml +44 -44
  133. package/templates/web3/mcp-servers.yaml +11 -11
  134. package/templates/web3/verification.yaml +159 -159
  135. package/templates/zero-trust/instructions.yaml +41 -41
  136. package/templates/zero-trust/mcp-servers.yaml +15 -15
@@ -1,41 +1,41 @@
1
- tag: SOC2
2
- section: instructions
3
- blocks:
4
- - id: access-control-validation
5
- tier: recommended
6
- title: "Access Control Validation"
7
- content: |
8
- ## Access Control Validation
9
-
10
- - Implement role-based access control (RBAC) with the principle of least privilege. No user or service account gets more access than required.
11
- - Define access control matrices mapping roles to resources and operations. Review and update quarterly.
12
- - Enforce multi-factor authentication (MFA) for all administrative and privileged access.
13
- - Automate access reviews: flag dormant accounts (no login in 90 days), over-provisioned roles, and orphaned service accounts.
14
- - Log all access control changes (role assignments, permission grants, policy updates) with who-changed-what-when detail.
15
- - Test access controls with negative tests: verify that unauthorized roles are denied, not just that authorized roles succeed.
16
-
17
- - id: change-management
18
- tier: recommended
19
- title: "Change Management & Audit Trail"
20
- content: |
21
- ## Change Management & Audit Trail
22
-
23
- - Every production change requires a documented change request with description, risk assessment, rollback plan, and approval.
24
- - Enforce separation of duties: the person who writes code cannot be the sole approver for deployment.
25
- - Maintain an immutable audit trail of all changes: code commits, config changes, infrastructure modifications, access grants.
26
- - Implement automated change detection: alert on unexpected file changes, config drift, or unauthorized deployments.
27
- - Conduct post-incident reviews for all unplanned changes. Document root cause, timeline, and preventive measures.
28
- - Tag all deployments with version, timestamp, deployer, and change request ID for full traceability.
29
-
30
- - id: incident-response
31
- tier: recommended
32
- title: "Incident Response Procedures"
33
- content: |
34
- ## Incident Response Procedures
35
-
36
- - Define and document an incident response plan with clear roles: incident commander, communications lead, technical lead.
37
- - Classify incidents by severity (P1-P4) with defined response times, escalation paths, and communication templates.
38
- - Implement automated incident detection: anomaly alerts, threshold breaches, security event correlation.
39
- - Conduct tabletop exercises quarterly to test incident response procedures with realistic scenarios.
40
- - Maintain a post-mortem culture: blameless retrospectives within 48 hours, action items tracked to completion.
41
- - Ensure incident logs are retained for SOC2 audit periods (minimum 12 months) with tamper-evident storage.
1
+ tag: SOC2
2
+ section: instructions
3
+ blocks:
4
+ - id: access-control-validation
5
+ tier: recommended
6
+ title: "Access Control Validation"
7
+ content: |
8
+ ## Access Control Validation
9
+
10
+ - Implement role-based access control (RBAC) with the principle of least privilege. No user or service account gets more access than required.
11
+ - Define access control matrices mapping roles to resources and operations. Review and update quarterly.
12
+ - Enforce multi-factor authentication (MFA) for all administrative and privileged access.
13
+ - Automate access reviews: flag dormant accounts (no login in 90 days), over-provisioned roles, and orphaned service accounts.
14
+ - Log all access control changes (role assignments, permission grants, policy updates) with who-changed-what-when detail.
15
+ - Test access controls with negative tests: verify that unauthorized roles are denied, not just that authorized roles succeed.
16
+
17
+ - id: change-management
18
+ tier: recommended
19
+ title: "Change Management & Audit Trail"
20
+ content: |
21
+ ## Change Management & Audit Trail
22
+
23
+ - Every production change requires a documented change request with description, risk assessment, rollback plan, and approval.
24
+ - Enforce separation of duties: the person who writes code cannot be the sole approver for deployment.
25
+ - Maintain an immutable audit trail of all changes: code commits, config changes, infrastructure modifications, access grants.
26
+ - Implement automated change detection: alert on unexpected file changes, config drift, or unauthorized deployments.
27
+ - Conduct post-incident reviews for all unplanned changes. Document root cause, timeline, and preventive measures.
28
+ - Tag all deployments with version, timestamp, deployer, and change request ID for full traceability.
29
+
30
+ - id: incident-response
31
+ tier: recommended
32
+ title: "Incident Response Procedures"
33
+ content: |
34
+ ## Incident Response Procedures
35
+
36
+ - Define and document an incident response plan with clear roles: incident commander, communications lead, technical lead.
37
+ - Classify incidents by severity (P1-P4) with defined response times, escalation paths, and communication templates.
38
+ - Implement automated incident detection: anomaly alerts, threshold breaches, security event correlation.
39
+ - Conduct tabletop exercises quarterly to test incident response procedures with realistic scenarios.
40
+ - Maintain a post-mortem culture: blameless retrospectives within 48 hours, action items tracked to completion.
41
+ - Ensure incident logs are retained for SOC2 audit periods (minimum 12 months) with tamper-evident storage.
@@ -1,24 +1,24 @@
1
- tag: SOC2
2
- section: mcp-servers
3
- servers:
4
- - name: github
5
- description: "GitHub repository management — PR reviews, access controls, audit trails for change management"
6
- command: npx
7
- args: ["-y", "@modelcontextprotocol/server-github"]
8
- tags: [SOC2, UNIVERSAL]
9
- category: version-control
10
- tier: recommended
11
- env:
12
- GITHUB_PERSONAL_ACCESS_TOKEN: ""
13
- url: "https://github.com/modelcontextprotocol/servers/tree/main/src/github"
14
-
15
- - name: sentry
16
- description: "Sentry error and incident tracking — incident response monitoring and alerting"
17
- command: npx
18
- args: ["-y", "mcp-server-sentry"]
19
- tags: [SOC2, API]
20
- category: monitoring
21
- tier: optional
22
- env:
23
- SENTRY_AUTH_TOKEN: ""
24
- url: "https://github.com/modelcontextprotocol/servers"
1
+ tag: SOC2
2
+ section: mcp-servers
3
+ servers:
4
+ - name: github
5
+ description: "GitHub repository management — PR reviews, access controls, audit trails for change management"
6
+ command: npx
7
+ args: ["-y", "@modelcontextprotocol/server-github"]
8
+ tags: [SOC2, UNIVERSAL]
9
+ category: version-control
10
+ tier: recommended
11
+ env:
12
+ GITHUB_PERSONAL_ACCESS_TOKEN: ""
13
+ url: "https://github.com/modelcontextprotocol/servers/tree/main/src/github"
14
+
15
+ - name: sentry
16
+ description: "Sentry error and incident tracking — incident response monitoring and alerting"
17
+ command: npx
18
+ args: ["-y", "mcp-server-sentry"]
19
+ tags: [SOC2, API]
20
+ category: monitoring
21
+ tier: optional
22
+ env:
23
+ SENTRY_AUTH_TOKEN: ""
24
+ url: "https://github.com/modelcontextprotocol/servers"
@@ -1,43 +1,43 @@
1
- tag: SOCIAL
2
- section: instructions
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.
1
+ tag: SOCIAL
2
+ section: instructions
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.
@@ -1,24 +1,24 @@
1
- tag: SOCIAL
2
- section: mcp-servers
3
- servers:
4
- - name: postgres
5
- description: "PostgreSQL database inspection, queries, and schema management — common backend for social platforms"
6
- command: npx
7
- args: ["-y", "@modelcontextprotocol/server-postgres"]
8
- tags: [DATA-PIPELINE, API, SOCIAL]
9
- category: database
10
- tier: recommended
11
- env:
12
- POSTGRES_CONNECTION_STRING: ""
13
- url: "https://github.com/modelcontextprotocol/servers/tree/main/src/postgres"
14
-
15
- - name: redis
16
- description: "Redis key-value store management — caching, sessions, feeds, and real-time features"
17
- command: npx
18
- args: ["-y", "mcp-server-redis"]
19
- tags: [REALTIME, SOCIAL]
20
- category: database
21
- tier: optional
22
- env:
23
- REDIS_URL: "redis://localhost:6379"
24
- url: "https://github.com/nicholasgriffintn/redis-mcp-server"
1
+ tag: SOCIAL
2
+ section: mcp-servers
3
+ servers:
4
+ - name: postgres
5
+ description: "PostgreSQL database inspection, queries, and schema management — common backend for social platforms"
6
+ command: npx
7
+ args: ["-y", "@modelcontextprotocol/server-postgres"]
8
+ tags: [DATA-PIPELINE, API, SOCIAL]
9
+ category: database
10
+ tier: recommended
11
+ env:
12
+ POSTGRES_CONNECTION_STRING: ""
13
+ url: "https://github.com/modelcontextprotocol/servers/tree/main/src/postgres"
14
+
15
+ - name: redis
16
+ description: "Redis key-value store management — caching, sessions, feeds, and real-time features"
17
+ command: npx
18
+ args: ["-y", "mcp-server-redis"]
19
+ tags: [REALTIME, SOCIAL]
20
+ category: database
21
+ tier: optional
22
+ env:
23
+ REDIS_URL: "redis://localhost:6379"
24
+ url: "https://github.com/nicholasgriffintn/redis-mcp-server"
@@ -1,42 +1,42 @@
1
- tag: STATE-MACHINE
2
- section: instructions
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.
1
+ tag: STATE-MACHINE
2
+ section: instructions
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.
@@ -1,11 +1,11 @@
1
- tag: STATE-MACHINE
2
- section: mcp-servers
3
- servers:
4
- - name: sequential-thinking
5
- description: "Dynamic, reflective problem-solving through thought sequences — ideal for modeling state transitions"
6
- command: npx
7
- args: ["-y", "@modelcontextprotocol/server-sequential-thinking"]
8
- tags: [UNIVERSAL, STATE-MACHINE]
9
- category: general
10
- tier: optional
11
- url: "https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking"
1
+ tag: STATE-MACHINE
2
+ section: mcp-servers
3
+ servers:
4
+ - name: sequential-thinking
5
+ description: "Dynamic, reflective problem-solving through thought sequences — ideal for modeling state transitions"
6
+ command: npx
7
+ args: ["-y", "@modelcontextprotocol/server-sequential-thinking"]
8
+ tags: [UNIVERSAL, STATE-MACHINE]
9
+ category: general
10
+ tier: optional
11
+ url: "https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking"