compound-workflow 1.8.0 → 1.9.1

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 (92) hide show
  1. package/README.md +62 -68
  2. package/package.json +2 -8
  3. package/scripts/check-pack-readme.mjs +1 -16
  4. package/scripts/check-workflow-contracts.mjs +34 -44
  5. package/scripts/install-cli.mjs +273 -555
  6. package/src/AGENTS.md +59 -192
  7. package/src/{.agents/agents → agents}/research/best-practices-researcher.md +2 -2
  8. package/src/{.agents/commands → commands}/assess.md +4 -4
  9. package/src/commands/install.md +43 -0
  10. package/src/{.agents/commands → commands}/metrics.md +1 -1
  11. package/src/{.agents/commands → commands}/test-browser.md +8 -8
  12. package/src/commands/workflow-agents.md +101 -0
  13. package/src/{.agents/commands → commands}/workflow-brainstorm.md +5 -5
  14. package/src/{.agents/commands → commands}/workflow-compound.md +1 -1
  15. package/src/{.agents/commands → commands}/workflow-plan.md +62 -85
  16. package/src/commands/workflow-work.md +839 -0
  17. package/src/{.agents/references → references}/README.md +1 -1
  18. package/src/{.agents/skills → skills}/capture-skill/SKILL.md +1 -1
  19. package/src/{.agents/skills → skills}/compound-docs/SKILL.md +6 -6
  20. package/src/{.agents/skills → skills}/compound-docs/references/yaml-schema.md +2 -2
  21. package/src/skills/setup-agents/SKILL.md +247 -0
  22. package/src/skills/standards/SKILL.md +79 -0
  23. package/src/skills/standards/references/architecture.md +228 -0
  24. package/src/skills/standards/references/code-quality.md +192 -0
  25. package/src/skills/standards/references/presentation.md +515 -0
  26. package/src/skills/standards/references/services.md +172 -0
  27. package/src/skills/standards/references/state-management.md +936 -0
  28. package/.claude-plugin/plugin.json +0 -7
  29. package/.cursor-plugin/plugin.json +0 -20
  30. package/.cursor-plugin/registration.json +0 -5
  31. package/scripts/check-version-parity.mjs +0 -36
  32. package/scripts/generate-platform-artifacts.mjs +0 -230
  33. package/src/.agents/commands/install.md +0 -51
  34. package/src/.agents/commands/workflow-work.md +0 -690
  35. package/src/.agents/registry.json +0 -48
  36. package/src/.agents/scripts/self-check.mjs +0 -227
  37. package/src/.agents/scripts/sync-opencode.mjs +0 -362
  38. package/src/.agents/skills/presentation-composability/SKILL.md +0 -72
  39. package/src/.agents/skills/react-ddd-mvc-frontend/SKILL.md +0 -51
  40. package/src/.agents/skills/react-ddd-mvc-frontend/references/feature-structure.md +0 -25
  41. package/src/.agents/skills/react-ddd-mvc-frontend/references/implementation-principles.md +0 -21
  42. package/src/.agents/skills/react-ddd-mvc-frontend/references/responsibility-gates.md +0 -41
  43. package/src/.agents/skills/react-ddd-mvc-frontend/references/source-map.md +0 -11
  44. package/src/.agents/skills/standards/SKILL.md +0 -747
  45. package/src/.agents/skills/xstate-actor-orchestration/SKILL.md +0 -197
  46. package/src/.agents/skills/xstate-actor-orchestration/agents/openai.yaml +0 -4
  47. package/src/.agents/skills/xstate-actor-orchestration/assets/statecharts/.gitkeep +0 -0
  48. package/src/.agents/skills/xstate-actor-orchestration/references/actor-system-patterns.md +0 -71
  49. package/src/.agents/skills/xstate-actor-orchestration/references/event-contracts.md +0 -73
  50. package/src/.agents/skills/xstate-actor-orchestration/references/functional-domain-patterns.md +0 -53
  51. package/src/.agents/skills/xstate-actor-orchestration/references/machine-structure-and-tags.md +0 -36
  52. package/src/.agents/skills/xstate-actor-orchestration/references/react-container-pattern.md +0 -45
  53. package/src/.agents/skills/xstate-actor-orchestration/references/reliability-observability.md +0 -39
  54. package/src/.agents/skills/xstate-actor-orchestration/references/skill-validation.md +0 -33
  55. package/src/.agents/skills/xstate-actor-orchestration/references/source-map.md +0 -44
  56. package/src/.agents/skills/xstate-actor-orchestration/references/statechart-review-and-signoff.md +0 -59
  57. package/src/.agents/skills/xstate-actor-orchestration/references/testing-strategy.md +0 -35
  58. package/src/.agents/skills/xstate-actor-orchestration/scripts/create-statechart-artifact.sh +0 -71
  59. package/src/.agents/skills/xstate-actor-orchestration/scripts/validate-skill.sh +0 -138
  60. package/src/generated/opencode.managed.json +0 -115
  61. /package/src/{.agents/agents → agents}/research/framework-docs-researcher.md +0 -0
  62. /package/src/{.agents/agents → agents}/research/git-history-analyzer.md +0 -0
  63. /package/src/{.agents/agents → agents}/research/learnings-researcher.md +0 -0
  64. /package/src/{.agents/agents → agents}/research/repo-research-analyst.md +0 -0
  65. /package/src/{.agents/agents → agents}/review/agent-native-reviewer.md +0 -0
  66. /package/src/{.agents/agents → agents}/review/planning-technical-reviewer.md +0 -0
  67. /package/src/{.agents/agents → agents}/workflow/bug-reproduction-validator.md +0 -0
  68. /package/src/{.agents/agents → agents}/workflow/lint.md +0 -0
  69. /package/src/{.agents/agents → agents}/workflow/spec-flow-analyzer.md +0 -0
  70. /package/src/{.agents/commands → commands}/workflow-review.md +0 -0
  71. /package/src/{.agents/commands → commands}/workflow-tech-review.md +0 -0
  72. /package/src/{.agents/commands → commands}/workflow-triage.md +0 -0
  73. /package/src/{.agents/references → references}/standards/README.md +0 -0
  74. /package/src/{.agents/skills → skills}/agent-browser/SKILL.md +0 -0
  75. /package/src/{.agents/skills → skills}/audit-traceability/SKILL.md +0 -0
  76. /package/src/{.agents/skills → skills}/brainstorming/SKILL.md +0 -0
  77. /package/src/{.agents/skills → skills}/compound-docs/assets/critical-pattern-template.md +0 -0
  78. /package/src/{.agents/skills → skills}/compound-docs/assets/resolution-template.md +0 -0
  79. /package/src/{.agents/skills → skills}/compound-docs/schema.project.yaml +0 -0
  80. /package/src/{.agents/skills → skills}/compound-docs/schema.yaml +0 -0
  81. /package/src/{.agents/skills → skills}/data-foundations/SKILL.md +0 -0
  82. /package/src/{.agents/skills → skills}/document-review/SKILL.md +0 -0
  83. /package/src/{.agents/skills → skills}/file-todos/SKILL.md +0 -0
  84. /package/src/{.agents/skills → skills}/file-todos/assets/todo-template.md +0 -0
  85. /package/src/{.agents/skills → skills}/financial-workflow-integrity/SKILL.md +0 -0
  86. /package/src/{.agents/skills → skills}/git-worktree/SKILL.md +0 -0
  87. /package/src/{.agents/skills → skills}/pii-protection-prisma/SKILL.md +0 -0
  88. /package/src/{.agents/skills → skills}/process-metrics/SKILL.md +0 -0
  89. /package/src/{.agents/skills → skills}/process-metrics/assets/daily-template.md +0 -0
  90. /package/src/{.agents/skills → skills}/process-metrics/assets/monthly-template.md +0 -0
  91. /package/src/{.agents/skills → skills}/process-metrics/assets/weekly-template.md +0 -0
  92. /package/src/{.agents/skills → skills}/technical-review/SKILL.md +0 -0
@@ -1,197 +0,0 @@
1
- ---
2
- name: xstate-actor-orchestration
3
- description: Implement complex interaction models with XState v5 actor systems, including receptionist-style actor lookup with system IDs, orchestrator/coordinator parent actors, cross-actor messaging, lifecycle management with invoke/spawn, persistence and recovery, runtime inspection, and model-based testing. Use when designing or refactoring state-heavy workflows, async process coordination, retries/timeouts, or multi-actor frontend/backend logic in JavaScript or TypeScript.
4
- ---
5
-
6
- # XState Actor Orchestration
7
-
8
- Execute this workflow to design and implement robust interaction models with XState v5.
9
-
10
- ## Workflow
11
-
12
- 1. Model the interaction boundary.
13
- - Identify external actors (UI, API, queues, timers, humans).
14
- - Identify internal actors (orchestrator, workers, adapters).
15
- - Define success, partial success, terminal failure, and compensation behavior.
16
-
17
- 2. Choose actor topology.
18
- - Use a root orchestrator actor for cross-step coordination and policy decisions.
19
- - Use worker actors for isolated tasks (IO, retries, transforms).
20
- - Use receptionist-style lookup (`systemId` + `system.get`) when actors must be discoverable across branches.
21
- - Use direct parent-child refs when communication can stay local.
22
-
23
- 3. Define event contracts before transitions.
24
- - Create explicit event unions and payload schemas.
25
- - Use namespaced event types (`checkout.submit`, `payment.authorized`).
26
- - Plan wildcard routes for orchestration (`payment.*`, `checkout.*`, `*`) with explicit precedence.
27
- - Keep error events explicit and typed.
28
-
29
- 4. Compose machine structure before writing actions.
30
- - Start with nested states to scope events and transitions to relevant regions.
31
- - Use parallel states when regions are independent and can progress concurrently.
32
- - Use sequential flow only when one stage must complete before the next starts.
33
- - Apply tags as stable UI selectors for state intent (`loading`, `error`, `submitting`), not ad-hoc booleans.
34
-
35
- 5. Implement with typed machine setup.
36
- - Use `setup({...}).createMachine(...)`.
37
- - Prefer named actions/guards/actors over inline logic.
38
- - Use `invoke` for state-scoped lifetimes and `spawn`/`spawnChild` for dynamic long-lived workers.
39
- - Use `emit(...)` for imperative out-of-band notifications when a fire-and-forget signal is needed.
40
-
41
- 6. Add reliability policy.
42
- - Model retries, backoff, and circuit-breaker behavior as explicit states.
43
- - Persist snapshots for restart/resume flows when required.
44
- - Model idempotency boundaries for side effects.
45
-
46
- 7. Add observability.
47
- - Attach `inspect` at root actor creation for runtime traces.
48
- - Emit domain-level telemetry from actions, not from random call sites.
49
-
50
- 8. Prove behavior.
51
- - Add unit tests for guards/actions and transition paths.
52
- - Add model/path-based coverage for critical flows.
53
- - Verify timeout, cancellation, and recovery paths.
54
-
55
- 9. Produce statechart review artifact and sign-off package.
56
- - For every proposed or updated machine, generate a Mermaid statechart artifact.
57
- - Store artifacts under `assets/statecharts/`.
58
- - Treat the diagram as required for review discussion and final sign-off.
59
- - Record review notes and approval in a paired sign-off file.
60
- - Add or update the artifact at the current workflow phase:
61
- - Brainstorm: create a draft diagram for option discussion.
62
- - Implementation plan: refine the diagram into the proposed target design.
63
- - Implementation/delivery: finalize the as-built diagram and complete sign-off.
64
-
65
- ## Pattern Selection
66
-
67
- Use the references selectively:
68
- - Start with [references/source-map.md](references/source-map.md) to pick source docs.
69
- - Use [references/actor-system-patterns.md](references/actor-system-patterns.md) for receptionist/orchestrator structures.
70
- - Use [references/event-contracts.md](references/event-contracts.md) before coding transitions.
71
- - Use [references/functional-domain-patterns.md](references/functional-domain-patterns.md) for pure transforms and early-return style.
72
- - Use [references/machine-structure-and-tags.md](references/machine-structure-and-tags.md) for nested/parallel composition and tags.
73
- - Use [references/react-container-pattern.md](references/react-container-pattern.md) for React integration with containers and pure components.
74
- - Use [references/reliability-observability.md](references/reliability-observability.md) for persistence/inspection/retry policy.
75
- - Use [references/testing-strategy.md](references/testing-strategy.md) for verification.
76
- - Use [references/statechart-review-and-signoff.md](references/statechart-review-and-signoff.md) for required Mermaid artifact workflow.
77
- - Use [references/skill-validation.md](references/skill-validation.md) to validate skill quality without Python tooling.
78
-
79
- ## Implementation Rules
80
-
81
- - Keep orchestrator context small and policy-focused.
82
- - Keep domain/entity object transformations in pure functions or dedicated modules, not large inline action bodies.
83
- - Use immutable transforms (`input -> output`) that are directly unit-testable.
84
- - Use early returns in actions/guards/transforms instead of deep nested `if/else` trees.
85
- - Never model machine control flow with booleans; represent control flow with states, substates, and tags.
86
- - Do not send untyped catch-all events (`{ type: 'ERROR', data: any }`).
87
- - Route by event namespace first, then by event detail.
88
- - Keep wildcard transitions as fallback, not primary business routing.
89
- - Prefer one-way responsibilities: orchestrator decides; workers execute; adapters translate external systems.
90
- - In React, use container components as controllers that bind actor refs/selectors to presentational components.
91
- - Keep presentational components pure; they receive props and render only.
92
- - Use `useSelector` to read actor snapshot/state/context in containers.
93
- - Use `useEffect` to subscribe to emitted actor events for fire-and-forget UI effects (toasts, navigation, analytics).
94
- - Do not complete machine review without a Mermaid statechart and a sign-off record.
95
-
96
- ## Validation (No Python Required)
97
-
98
- Run:
99
-
100
- ```bash
101
- ./scripts/validate-skill.sh .
102
- ```
103
-
104
- Validate before proposing completion:
105
- - Frontmatter includes only `name` and `description`.
106
- - `name` matches folder naming rules.
107
- - `agents/openai.yaml` includes a `default_prompt` mentioning `$<skill-name>`.
108
- - No unresolved TODO placeholders remain.
109
- - Local references linked from `SKILL.md` exist.
110
- - `assets/statecharts/` exists for diagram artifacts.
111
-
112
- Generate a new artifact bundle:
113
-
114
- ```bash
115
- ./scripts/create-statechart-artifact.sh . <machine-name> [timestamp] [DRAFT|PLANNED|APPROVED]
116
- ```
117
-
118
- ## Minimal Starter Skeleton
119
-
120
- ```ts
121
- import { setup, assign, sendTo, fromPromise } from 'xstate';
122
-
123
- type FlowEvent =
124
- | { type: 'flow.start'; input: { orderId: string } }
125
- | { type: 'payment.ok'; txnId: string }
126
- | { type: 'payment.fail'; reason: string }
127
- | { type: 'flow.cancel' };
128
-
129
- interface FlowContext {
130
- orderId?: string;
131
- txnId?: string;
132
- error?: string;
133
- }
134
-
135
- const paymentLogic = fromPromise(async ({ input }: { input: { orderId: string } }) => {
136
- return { txnId: `txn-${input.orderId}` };
137
- });
138
-
139
- export const flowMachine = setup({
140
- types: {
141
- context: {} as FlowContext,
142
- events: {} as FlowEvent,
143
- },
144
- actors: {
145
- paymentLogic,
146
- },
147
- actions: {
148
- captureInput: assign(({ event }) =>
149
- event.type === 'flow.start' ? { orderId: event.input.orderId } : {}
150
- ),
151
- setError: assign(({ event }) =>
152
- event.type === 'payment.fail' ? { error: event.reason } : {}
153
- ),
154
- notifyWorker: sendTo('payment-worker', ({ context }) => ({
155
- type: 'run',
156
- orderId: context.orderId,
157
- })),
158
- },
159
- }).createMachine({
160
- id: 'flow.orchestrator',
161
- initial: 'idle',
162
- context: {},
163
- states: {
164
- idle: {
165
- on: {
166
- 'flow.start': {
167
- target: 'authorizing',
168
- actions: 'captureInput',
169
- },
170
- },
171
- },
172
- authorizing: {
173
- invoke: {
174
- id: 'payment-worker',
175
- src: 'paymentLogic',
176
- input: ({ context }) => ({ orderId: context.orderId! }),
177
- onDone: {
178
- target: 'done',
179
- actions: assign(({ event }) => ({ txnId: event.output.txnId })),
180
- },
181
- onError: {
182
- target: 'failed',
183
- actions: assign(({ event }) => ({ error: String(event.error) })),
184
- },
185
- },
186
- on: {
187
- 'flow.cancel': 'cancelled',
188
- },
189
- },
190
- done: { type: 'final' },
191
- failed: {},
192
- cancelled: {},
193
- },
194
- });
195
- ```
196
-
197
- Adapt the skeleton to domain events and actor topology; keep contracts and state semantics explicit.
@@ -1,4 +0,0 @@
1
- interface:
2
- display_name: "XState Actor Orchestration"
3
- short_description: "Design and implement advanced XState actor systems"
4
- default_prompt: "Use $xstate-actor-orchestration to model and implement this interaction flow with receptionist and orchestrator actor patterns."
@@ -1,71 +0,0 @@
1
- # Actor System Patterns
2
-
3
- ## 1. Orchestrator pattern
4
-
5
- Use one actor as the policy owner for a workflow.
6
-
7
- Responsibilities:
8
- - Accept domain commands/events.
9
- - Start/stop workers.
10
- - Enforce timeout/retry/cancel policy.
11
- - Translate worker outcomes into business states.
12
-
13
- Do not put IO logic directly in orchestrator actions unless trivial.
14
-
15
- ## 2. Receptionist pattern in XState terms
16
-
17
- In XState v5, this is implemented through actor-system registration and lookup:
18
- - Register actors with `systemId`.
19
- - Resolve actors via `system.get(systemId)` when direct refs are unavailable.
20
-
21
- Use this when actors in different branches need late-bound communication.
22
-
23
- ## 3. Topology decision table
24
-
25
- - Parent-child only:
26
- - Use when communication is local and lifetime is tightly coupled.
27
- - Receptionist lookup:
28
- - Use when actor discovery must cross hierarchy boundaries.
29
- - Event bus adapter actor:
30
- - Use when integration requires protocol translation or fan-out.
31
-
32
- ## 4. Lifecycle guidance
33
-
34
- - `invoke`:
35
- - Prefer for state-bound tasks that should stop when exiting a state.
36
- - `spawn`/`spawnChild`:
37
- - Prefer for dynamic or longer-lived workers.
38
- - Root actor:
39
- - Own system-wide inspection and persistence boundaries.
40
-
41
- ## 5. Minimal receptionist example
42
-
43
- ```ts
44
- import { createMachine, createActor, sendTo } from 'xstate';
45
-
46
- const workerMachine = createMachine({
47
- id: 'worker',
48
- initial: 'idle',
49
- states: { idle: {} },
50
- });
51
-
52
- const rootMachine = createMachine({
53
- entry: ({ spawnChild }) => {
54
- spawnChild(workerMachine, {
55
- id: 'worker-local',
56
- systemId: 'worker.service',
57
- });
58
- },
59
- on: {
60
- 'task.dispatch': {
61
- actions: sendTo(({ system }) => system.get('worker.service')!, {
62
- type: 'task.run',
63
- }),
64
- },
65
- },
66
- });
67
-
68
- createActor(rootMachine).start();
69
- ```
70
-
71
- Guard against missing registrations before `sendTo`.
@@ -1,73 +0,0 @@
1
- # Event Contract Rules
2
-
3
- ## Event naming
4
-
5
- Use namespaced, domain-specific names:
6
- - `checkout.submit`
7
- - `payment.authorized`
8
- - `payment.declined`
9
- - `fulfillment.timeout`
10
-
11
- Avoid generic names unless they are machine-internal and local.
12
-
13
- Use consistent namespace depth per bounded context:
14
- - `<domain>.<action>` for simple flows (`cart.add`).
15
- - `<domain>.<subdomain>.<action>` for larger systems (`checkout.payment.authorize`).
16
-
17
- ## Event typing
18
-
19
- Define discriminated unions and keep payloads explicit.
20
-
21
- ```ts
22
- type CheckoutEvent =
23
- | { type: 'checkout.submit'; cartId: string }
24
- | { type: 'payment.authorized'; txnId: string }
25
- | { type: 'payment.declined'; code: string; reason: string }
26
- | { type: 'checkout.cancel' };
27
- ```
28
-
29
- For wildcard routing, declare namespace fallback variants in machine transitions and keep explicit types for domain events.
30
-
31
- ## Command vs fact
32
-
33
- - Command events request behavior (`checkout.submit`).
34
- - Fact events report outcomes (`payment.authorized`).
35
-
36
- Keep this distinction explicit to simplify orchestration.
37
-
38
- ## Wildcard routing patterns
39
-
40
- Use wildcard transitions for orchestration and fallback handling:
41
- - `payment.*` to handle payment namespace events.
42
- - `checkout.*` to route checkout namespace events.
43
- - `*` as global fallback.
44
-
45
- Use exact matches for business-critical transitions and wildcard matches for coarse routing.
46
- Exact transitions take precedence over wildcard transitions.
47
-
48
- Example:
49
-
50
- ```ts
51
- createMachine({
52
- on: {
53
- 'checkout.submit': { target: '.submitting' },
54
- 'checkout.*': { actions: 'trackCheckoutNamespaceEvent' },
55
- 'payment.*': { actions: 'routePaymentNamespaceEvent' },
56
- '*': { actions: 'trackUnhandledEvent' },
57
- },
58
- });
59
- ```
60
-
61
- Avoid putting domain success logic exclusively behind wildcard handlers.
62
-
63
- ## Error contract
64
-
65
- Model expected business errors as typed events/states.
66
- Use unexpected errors for fault handling paths.
67
-
68
- ## Versioning
69
-
70
- When an event contract changes:
71
- 1. Add new event variant.
72
- 2. Support both versions temporarily in adapters.
73
- 3. Remove old variant after migration.
@@ -1,53 +0,0 @@
1
- # Functional Domain and Entity Transform Patterns
2
-
3
- Use these rules for domain/entity object transformation code used by machines.
4
-
5
- ## Core rules
6
-
7
- 1. Keep transforms pure.
8
- - Accept input data and return next data.
9
- - Do not mutate input objects.
10
- - Do not perform IO in transforms.
11
-
12
- 2. Keep transforms outside machine config where possible.
13
- - Prefer `domain/` or `entities/` modules for reusable transform logic.
14
- - Keep actions/guards small and orchestration-focused.
15
-
16
- 3. Prefer immutable updates.
17
- - Return new objects/arrays.
18
- - Keep output shape predictable and typed.
19
-
20
- 4. Prefer early returns over nested `if/else`.
21
- - Exit quickly for invalid or terminal branches.
22
- - Keep the main success path linear.
23
-
24
- ## Example
25
-
26
- ```ts
27
- type Payment = { amount: number; currency: string; status: 'new' | 'authorized' };
28
-
29
- export function authorizePayment(payment: Payment, limit: number): Payment {
30
- if (payment.amount <= 0) return payment;
31
- if (payment.amount > limit) return payment;
32
- if (payment.status === 'authorized') return payment;
33
-
34
- return {
35
- ...payment,
36
- status: 'authorized',
37
- };
38
- }
39
- ```
40
-
41
- ## Machine integration pattern
42
-
43
- - Use machine actions to call pure transforms.
44
- - Keep action code thin:
45
- - Read current context.
46
- - Call pure transform.
47
- - Assign returned value.
48
-
49
- ## Testing expectations
50
-
51
- - Unit test transform modules directly without actor runtime.
52
- - Cover edge conditions first.
53
- - Keep golden-path and failure-path tests explicit.
@@ -1,36 +0,0 @@
1
- # Machine Structure and Tags
2
-
3
- Use structure as the primary control-flow model.
4
-
5
- ## 1. Scope with nested states
6
-
7
- - Use parent/child states to limit where events are handled.
8
- - Keep transitions local to the smallest valid scope.
9
- - Move shared transitions to parent states when behavior is intentionally shared.
10
-
11
- ## 2. Choose parallel vs sequential intentionally
12
-
13
- - Use parallel states when regions are independent and can progress concurrently.
14
- - Use sequential states when one stage must complete before another can start.
15
- - Do not force sequential flow for unrelated concerns.
16
-
17
- ## 3. Model flow with states, not booleans
18
-
19
- - Do not use boolean flags to represent machine mode (`isLoading`, `isSaving`, `hasError`).
20
- - Represent each mode with explicit states/substates and tags.
21
- - Keep booleans only for raw domain facts that do not encode control flow.
22
-
23
- ## 4. Use tags for declarative UI state selection
24
-
25
- - Add tags for stable UI concerns (e.g., `busy`, `error`, `success`, `canRetry`).
26
- - In React, derive render behavior from `snapshot.hasTag(...)` and selectors.
27
- - Keep tags semantic and durable across refactors.
28
-
29
- ## 5. Namespace-aware routing strategy
30
-
31
- - Prefer exact event transitions for business-critical behavior.
32
- - Add namespace wildcards for orchestration routing:
33
- - `billing.*`
34
- - `checkout.*`
35
- - `*` fallback
36
- - Keep wildcard handlers observability-focused unless intentionally routing.
@@ -1,45 +0,0 @@
1
- # React Container Pattern for XState
2
-
3
- Use containers as controllers and components as pure render units.
4
-
5
- ## 1. Container responsibilities
6
-
7
- - Create or receive actor refs.
8
- - Read state/context via `useSelector`.
9
- - Map selected values into stable component props.
10
- - Wire event handlers that send events to actors.
11
-
12
- ## 2. Presentational component responsibilities
13
-
14
- - Receive props only.
15
- - Render UI only.
16
- - Avoid actor imports and machine knowledge.
17
-
18
- ## 3. `useSelector` guidance
19
-
20
- - Prefer narrow selectors to limit rerenders.
21
- - Select tags and derived values, not whole snapshots.
22
- - Keep selectors deterministic and side-effect free.
23
-
24
- ## 4. `emit` + `useEffect` for fire-and-forget UI actions
25
-
26
- - Use machine `emit(...)` to publish imperative signals (toast, navigation, analytics).
27
- - Subscribe in container `useEffect`.
28
- - Trigger UI side effects from emitted events, not from render paths.
29
-
30
- Example pattern:
31
-
32
- ```ts
33
- useEffect(() => {
34
- const sub = actorRef.on('ui.toast', (event) => {
35
- toast(event.message);
36
- });
37
- return () => sub.unsubscribe();
38
- }, [actorRef]);
39
- ```
40
-
41
- ## 5. Composition guidance
42
-
43
- - Container composes presentational components from selected state/context.
44
- - Keep props cohesive; avoid passing entire context objects by default.
45
- - Compose feature UI from multiple containers if actor boundaries differ.
@@ -1,39 +0,0 @@
1
- # Reliability and Observability
2
-
3
- ## Retry and timeout policy
4
-
5
- Represent policy as states, not hidden timers.
6
-
7
- Common structure:
8
- - `working`
9
- - `retry_wait`
10
- - `failed_transient`
11
- - `failed_terminal`
12
-
13
- Track attempt counts in context and cap retries.
14
-
15
- ## Persistence
16
-
17
- Use persisted snapshots for resumable workflows:
18
- - Capture via `actor.getPersistedSnapshot()`.
19
- - Restore via `createActor(logic, { snapshot })`.
20
-
21
- Use persistence when workflows must survive reload/restart.
22
-
23
- ## Inspection
24
-
25
- Attach an inspector at root actor creation.
26
- Listen for:
27
- - `@xstate.actor`
28
- - `@xstate.event`
29
- - `@xstate.snapshot`
30
- - `@xstate.microstep`
31
-
32
- Use inspection for diagnostics and test assertions, not business decisions.
33
-
34
- ## Recovery design checklist
35
-
36
- 1. Can the same external side effect run twice safely?
37
- 2. Which state is safe to restore into?
38
- 3. What event can resume the workflow after restart?
39
- 4. Which failures are user-recoverable vs terminal?
@@ -1,33 +0,0 @@
1
- # Skill Validation Without Python
2
-
3
- Use this checklist when Python-based validation tooling is unavailable or undesired.
4
-
5
- ## Command
6
-
7
- Run the shell validator from the skill root:
8
-
9
- ```bash
10
- ./scripts/validate-skill.sh .
11
- ```
12
-
13
- ## What the shell validator checks
14
-
15
- 1. `SKILL.md` exists and has valid frontmatter delimiters.
16
- 2. Frontmatter contains only `name` and `description`.
17
- 3. `name` follows skill naming constraints (`[a-z0-9-]`, max 64 chars).
18
- 4. Skill folder name matches frontmatter `name`.
19
- 5. `agents/openai.yaml` exists.
20
- 6. `default_prompt` exists and mentions `$<skill-name>`.
21
- 7. `assets/statecharts/` exists for Mermaid artifacts.
22
- 8. `scripts/create-statechart-artifact.sh` exists and is executable.
23
- 9. No unresolved TODO placeholders remain in checked files.
24
- 10. Every local `references/*.md` link in `SKILL.md` points to an existing file.
25
-
26
- ## Additional manual checks
27
-
28
- 1. Confirm `description` includes clear trigger contexts.
29
- 2. Confirm workflow steps are imperative and actionable.
30
- 3. Confirm references stay one level deep from `SKILL.md`.
31
- 4. Confirm examples reflect XState v5 APIs used by your codebase.
32
- 5. Confirm each proposed/updated machine includes a `.mmd` diagram and `.signoff.md` record.
33
- 6. Confirm sign-off status advances by workflow phase (`DRAFT` -> `PLANNED` -> `APPROVED`).
@@ -1,44 +0,0 @@
1
- # Source Map
2
-
3
- Use these sources in order, loading only what the task needs.
4
-
5
- ## Core docs (Mintlify set provided by user)
6
-
7
- - Introduction: https://statelyai-xstate.mintlify.app/introduction
8
- - Actors: https://statelyai-xstate.mintlify.app/concepts/actors
9
- - Actions: https://statelyai-xstate.mintlify.app/guides/actions
10
- - Error handling: https://statelyai-xstate.mintlify.app/guides/error-handling
11
- - Transitions: https://statelyai-xstate.mintlify.app/concepts/transitions
12
- - Hierarchical composition: https://statelyai-xstate.mintlify.app/guides/parent-child
13
- - Parallel states: https://statelyai-xstate.mintlify.app/guides/parallel-states
14
- - TypeScript: https://statelyai-xstate.mintlify.app/advanced/typescript
15
- - Visualization: https://statelyai-xstate.mintlify.app/advanced/visualization
16
- - Inspection: https://statelyai-xstate.mintlify.app/advanced/inspection
17
- - Testing: https://statelyai-xstate.mintlify.app/advanced/testing
18
-
19
- ## Supplemental official docs (needed for receptionist/system patterns)
20
-
21
- - System (actor registration and lookup): https://stately.ai/docs/system
22
- - Invoke: https://stately.ai/docs/invoke
23
- - Spawn: https://stately.ai/docs/spawn
24
- - Transitions (wildcards): https://stately.ai/docs/transitions#wildcard-transitions
25
- - Parent states: https://stately.ai/docs/parent-states
26
- - Parallel states: https://stately.ai/docs/parallel-states
27
- - Tags: https://stately.ai/docs/tags
28
- - Event emitter (`emit`): https://stately.ai/docs/event-emitter
29
- - React integration (`@xstate/react`, `useSelector`): https://stately.ai/docs/xstate-react
30
- - Visualization: https://stately.ai/docs/visualization
31
- - Persistence: https://stately.ai/docs/persistence
32
- - Graph/path testing: https://stately.ai/docs/graph
33
- - Migration notes: https://stately.ai/docs/migration
34
-
35
- ## Pattern context
36
-
37
- - XState v5 launch article (mentions receptionist pattern and actor-system direction):
38
- https://stately.ai/blog/2023-12-01-xstate-v5
39
-
40
- ## Loading guidance
41
-
42
- 1. Load only one section at a time based on current task.
43
- 2. Prefer API and concept docs over blog content for implementation details.
44
- 3. Use blog content for rationale and pattern naming only.
@@ -1,59 +0,0 @@
1
- # Statechart Review and Sign-Off
2
-
3
- Use this process for every new machine proposal and every machine update.
4
-
5
- This artifact is part of the compound workflow. Produce or update it in every phase, not only at the end.
6
-
7
- ## Required artifact bundle
8
-
9
- For each machine change, create both files under `assets/statecharts/`:
10
- - `<machine-name>-<timestamp>.mmd`
11
- - `<machine-name>-<timestamp>.signoff.md`
12
-
13
- Generate with:
14
-
15
- ```bash
16
- ./scripts/create-statechart-artifact.sh . <machine-name>
17
- ```
18
-
19
- ## Mermaid diagram requirements
20
-
21
- Represent:
22
- - Top-level states and nested states.
23
- - Parallel regions where applicable.
24
- - Key transitions, including wildcard routing (`domain.*`, `*`) when used.
25
- - Terminal states and cancellation/failure paths.
26
- - Tags that UI depends on (capture in sign-off notes if diagram labels become noisy).
27
-
28
- ## Review discussion checklist
29
-
30
- 1. Are scopes correct (events handled only where valid)?
31
- 2. Are parallel states used only for independent regions?
32
- 3. Are wildcard transitions fallback-oriented and not hiding core business flow?
33
- 4. Are retry/recovery states explicit?
34
- 5. Are UI-relevant tags represented and consistent with component selectors?
35
- 6. Are emitted imperative events (`emit`) intentional and documented?
36
-
37
- ## Phase-aware usage
38
-
39
- 1. Brainstorm phase
40
- - Produce a draft `.mmd` artifact to compare options.
41
- - Mark sign-off status as `DRAFT`.
42
-
43
- 2. Implementation-plan phase
44
- - Update the same artifact line to the planned machine structure.
45
- - Mark sign-off status as `PLANNED`.
46
- - Capture unresolved decisions in review notes.
47
-
48
- 3. Implementation/delivery phase
49
- - Update artifact to as-built machine behavior.
50
- - Mark sign-off status as `APPROVED` when reviewed.
51
- - Treat missing final artifact/sign-off as incomplete delivery.
52
-
53
- ## Final sign-off checklist
54
-
55
- 1. Diagram reflects current machine implementation.
56
- 2. Event namespace and wildcard behavior are reviewed.
57
- 3. Failure/cancel/recovery paths are reviewed.
58
- 4. Reviewer and date are recorded in `.signoff.md`.
59
- 5. Implementation is not marked complete until sign-off is present.