@fluentcommerce/ai-skills 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/LICENSE +21 -0
- package/README.md +622 -0
- package/bin/cli.mjs +1973 -0
- package/content/cli/agents/fluent-cli/agent.json +149 -0
- package/content/cli/agents/fluent-cli.md +132 -0
- package/content/cli/skills/fluent-bootstrap/SKILL.md +181 -0
- package/content/cli/skills/fluent-cli-index/SKILL.md +63 -0
- package/content/cli/skills/fluent-cli-mcp-cicd/SKILL.md +77 -0
- package/content/cli/skills/fluent-cli-reference/SKILL.md +1031 -0
- package/content/cli/skills/fluent-cli-retailer/SKILL.md +85 -0
- package/content/cli/skills/fluent-cli-settings/SKILL.md +106 -0
- package/content/cli/skills/fluent-connect/SKILL.md +886 -0
- package/content/cli/skills/fluent-module-deploy/SKILL.md +349 -0
- package/content/cli/skills/fluent-profile/SKILL.md +180 -0
- package/content/cli/skills/fluent-workflow/SKILL.md +310 -0
- package/content/dev/agents/fluent-dev/agent.json +88 -0
- package/content/dev/agents/fluent-dev.md +525 -0
- package/content/dev/reference-modules/catalog.json +4754 -0
- package/content/dev/skills/fluent-build/SKILL.md +192 -0
- package/content/dev/skills/fluent-connection-analysis/SKILL.md +386 -0
- package/content/dev/skills/fluent-custom-code/SKILL.md +895 -0
- package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +714 -0
- package/content/dev/skills/fluent-e2e-test/SKILL.md +394 -0
- package/content/dev/skills/fluent-event-api/SKILL.md +945 -0
- package/content/dev/skills/fluent-feature-explain/SKILL.md +603 -0
- package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +695 -0
- package/content/dev/skills/fluent-feature-plan/SKILL.md +227 -0
- package/content/dev/skills/fluent-job-batch/SKILL.md +138 -0
- package/content/dev/skills/fluent-mermaid-validate/SKILL.md +86 -0
- package/content/dev/skills/fluent-module-scaffold/SKILL.md +1928 -0
- package/content/dev/skills/fluent-module-validate/SKILL.md +775 -0
- package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +1108 -0
- package/content/dev/skills/fluent-retailer-config/SKILL.md +1111 -0
- package/content/dev/skills/fluent-rule-scaffold/SKILL.md +385 -0
- package/content/dev/skills/fluent-scope-decompose/SKILL.md +1021 -0
- package/content/dev/skills/fluent-session-audit-export/SKILL.md +632 -0
- package/content/dev/skills/fluent-session-summary/SKILL.md +195 -0
- package/content/dev/skills/fluent-settings/SKILL.md +1058 -0
- package/content/dev/skills/fluent-source-onboard/SKILL.md +632 -0
- package/content/dev/skills/fluent-system-monitoring/SKILL.md +767 -0
- package/content/dev/skills/fluent-test-data/SKILL.md +513 -0
- package/content/dev/skills/fluent-trace/SKILL.md +1143 -0
- package/content/dev/skills/fluent-transition-api/SKILL.md +346 -0
- package/content/dev/skills/fluent-version-manage/SKILL.md +744 -0
- package/content/dev/skills/fluent-workflow-analyzer/SKILL.md +959 -0
- package/content/dev/skills/fluent-workflow-builder/SKILL.md +319 -0
- package/content/dev/skills/fluent-workflow-deploy/SKILL.md +267 -0
- package/content/mcp-extn/agents/fluent-mcp.md +69 -0
- package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +461 -0
- package/content/mcp-official/agents/fluent-mcp-core.md +91 -0
- package/content/mcp-official/skills/fluent-mcp-core/SKILL.md +94 -0
- package/content/rfl/agents/fluent-rfl.md +56 -0
- package/content/rfl/skills/fluent-rfl-assess/SKILL.md +172 -0
- package/docs/CAPABILITY_MAP.md +77 -0
- package/docs/CLI_COVERAGE.md +47 -0
- package/docs/DEV_WORKFLOW.md +802 -0
- package/docs/FLOW_RUN.md +142 -0
- package/docs/USE_CASES.md +404 -0
- package/metadata.json +156 -0
- package/package.json +51 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-feature-plan
|
|
3
|
+
description: Produce comprehensive feature implementation plans with universal NEW/EXISTING/MODIFIED/REUSED/OOTB classification across all artifacts. Covers rules, workflows, settings, webhooks, GraphQL operations, cross-entity flows, and deployment. Triggers on "plan feature", "feature plan", "plan implementation", "design feature", "plan this feature", "what do I need to build".
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
6
|
+
argument-hint: <feature-description> [--profile PROFILE] [--retailer RETAILER_REF]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Feature Planner
|
|
10
|
+
|
|
11
|
+
Produce comprehensive, self-contained implementation plans for Fluent Commerce features. A "feature" spans multiple artifacts — rules, workflow rulesets, settings, webhooks, entity types, and deployments. The plan is the contract — an implementer can write code from it without ambiguity.
|
|
12
|
+
|
|
13
|
+
## Template Reference
|
|
14
|
+
|
|
15
|
+
**The full plan template with worked examples and section applicability guide lives at: `PLAN_TEMPLATE.md` (in this skill directory).**
|
|
16
|
+
|
|
17
|
+
Read that file before producing any plan. It defines:
|
|
18
|
+
- The 18-section structure with TOC (including §6.1 Complete Workflow Inventory and §3.6 Workflow Processing Flow)
|
|
19
|
+
- Universal Source classification (NEW / EXISTING / MODIFIED / REUSED / OOTB)
|
|
20
|
+
- Section applicability guide (which sections are required vs optional)
|
|
21
|
+
- Rules classification decision flow
|
|
22
|
+
- Diagram requirements (Mermaid stateDiagram-v2, sequenceDiagram, flowchart)
|
|
23
|
+
- Plan lifecycle (PENDING → APPROVED → implementation)
|
|
24
|
+
|
|
25
|
+
## When to Use
|
|
26
|
+
|
|
27
|
+
Use `/fluent-feature-plan` when the work involves **multiple artifacts**:
|
|
28
|
+
- A new capability needing workflow changes + new rules + settings + possibly webhooks
|
|
29
|
+
- A change spanning multiple entity types (ORDER → FULFILMENT → LOCATION)
|
|
30
|
+
- Any implementation request where the scope isn't covered by a single skill
|
|
31
|
+
|
|
32
|
+
**For single-artifact work**, the individual skill's Planning Gate is sufficient:
|
|
33
|
+
- Single new rule → `/fluent-rule-scaffold` Planning Gate
|
|
34
|
+
- Single workflow edit → `/fluent-workflow-builder` Planning Gate
|
|
35
|
+
- Settings-only change → `/fluent-settings` Planning Gate
|
|
36
|
+
- Retrospective feature documentation → `/fluent-feature-explain`
|
|
37
|
+
- Scope document decomposition → `/fluent-scope-decompose`
|
|
38
|
+
|
|
39
|
+
## Phase 1: Discovery
|
|
40
|
+
|
|
41
|
+
Before writing a plan, gather evidence to classify every artifact.
|
|
42
|
+
|
|
43
|
+
### 1.1 OOTB Rule Search
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
plugin.list name="<keyword>" # e.g., "Fulfilment", "Pickup", "Webhook"
|
|
47
|
+
plugin.list name="SendEvent" # standard event forwarding rules
|
|
48
|
+
plugin.list compact=true # full inventory (compact payload)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Determine which parts of the feature can use OOTB rules vs. need custom. For every rule the feature needs, try to find an OOTB match FIRST.
|
|
52
|
+
|
|
53
|
+
### 1.2 Existing Workflows
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Check what's deployed
|
|
57
|
+
fluent workflow list -p <PROFILE> -r <RETAILER_REF>
|
|
58
|
+
# Download if not local
|
|
59
|
+
fluent workflow download -p <PROFILE> -r <RETAILER_REF> -w all -o accounts/<PROFILE>/workflows/<RETAILER_REF>/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Read workflow JSONs to map existing statuses, rulesets, and triggers. Identify which workflows need modification and their current versions.
|
|
63
|
+
|
|
64
|
+
**For §6.1 Complete Workflow Inventory:** Parse each modified workflow's JSON to extract the complete ruleset list — entity type, subtype, trigger event, trigger status, and rule names. This feeds directly into the §6.1 table and §3.6 Workflow Processing Flow diagram. Don't rely on the implementer to manually enumerate rulesets.
|
|
65
|
+
|
|
66
|
+
### 1.3 Existing Settings
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Via MCP
|
|
70
|
+
graphql.query: settings(first: 100) filtered by name pattern
|
|
71
|
+
# Or via CLI
|
|
72
|
+
fluent setting list -p <PROFILE> -r <RETAILER_REF> -n "*keyword*"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Find settings that already exist vs. need creation.
|
|
76
|
+
|
|
77
|
+
### 1.4 Local Source Analysis
|
|
78
|
+
|
|
79
|
+
Search `accounts/<PROFILE>/SOURCE/` for:
|
|
80
|
+
- `module.json` — rule registrations
|
|
81
|
+
- `source-map.json` — if `/fluent-custom-code` was run
|
|
82
|
+
- `behavior-map.md` — rule behavior descriptions
|
|
83
|
+
- Existing Java rule classes for reusable patterns
|
|
84
|
+
|
|
85
|
+
### 1.5 Module Identification
|
|
86
|
+
|
|
87
|
+
Identify the target module for new custom rules:
|
|
88
|
+
- Search `accounts/<PROFILE>/SOURCE/` for existing modules
|
|
89
|
+
- If no module exists, flag `/fluent-module-scaffold` as a prerequisite task
|
|
90
|
+
|
|
91
|
+
## Phase 2: Classification
|
|
92
|
+
|
|
93
|
+
For EVERY artifact the feature touches, apply one of these labels:
|
|
94
|
+
|
|
95
|
+
| Label | Meaning | Required Detail in Plan |
|
|
96
|
+
|-------|---------|------------------------|
|
|
97
|
+
| **NEW** | Doesn't exist yet, must be created | Full pseudo logic / value shape / trigger spec |
|
|
98
|
+
| **EXISTING** | Already deployed, no modification needed | State current value, confirm no change |
|
|
99
|
+
| **MODIFIED** | Already exists but needs changes | Show before → after diff |
|
|
100
|
+
| **REUSED** | Pattern exists in codebase, copy the approach | Reference source file/rule |
|
|
101
|
+
| **OOTB** | Platform rule, use with configuration only | State which props/values to configure |
|
|
102
|
+
|
|
103
|
+
This applies universally across ALL plan sections — rules, rulesets, statuses, settings, webhooks, GraphQL operations, cross-entity impacts, files.
|
|
104
|
+
|
|
105
|
+
## Phase 3: Pseudo Logic for NEW Rules
|
|
106
|
+
|
|
107
|
+
For every **NEW** rule, write pseudo logic that is:
|
|
108
|
+
- **Unambiguous** — a developer can implement from it without asking questions
|
|
109
|
+
- **Shows data flow**: READ → VALIDATE → QUERY → BUILD → MUTATE → LOG
|
|
110
|
+
- **Shows branching**: IF/ELSE with error paths and thrown exceptions
|
|
111
|
+
- **References specific APIs**: `DynamicUtils.queryList()`, `SettingUtils.getSettingByRef()`, `JsonUtils.getJsonPath()`
|
|
112
|
+
- **Stays at design level** — NOT Java code, but precise enough to translate directly
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
FUNCTION run(context):
|
|
116
|
+
order = context.getEntity()
|
|
117
|
+
event = context.getEvent()
|
|
118
|
+
|
|
119
|
+
// 1. Extract required fields
|
|
120
|
+
pickupLocationRef = extractFromPath(event, props.pickupLocationPath)
|
|
121
|
+
IF pickupLocationRef IS NULL:
|
|
122
|
+
THROW "Pickup location ref required but null at path: {pickupLocationPath}"
|
|
123
|
+
|
|
124
|
+
// 2. Fetch order items
|
|
125
|
+
items = DynamicUtils.queryList(context, "items", OrderItem.class, null)
|
|
126
|
+
IF items IS EMPTY:
|
|
127
|
+
THROW "Order has no items — cannot create fulfilment"
|
|
128
|
+
|
|
129
|
+
// 3. Read config from setting
|
|
130
|
+
config = SettingUtils.getSettingByRef(context, props.configSettingName)
|
|
131
|
+
maxPickupHours = config.lobValue.maxPickupHours
|
|
132
|
+
|
|
133
|
+
// 4. Validate
|
|
134
|
+
IF requestedPickupTime > order.createdOn + maxPickupHours hours:
|
|
135
|
+
THROW "Pickup window expired"
|
|
136
|
+
|
|
137
|
+
// 5. Build and mutate
|
|
138
|
+
fulfilmentRef = "CURB-{order.ref}-{pickupLocationRef}"
|
|
139
|
+
DynamicUtils.create(context, CreateFulfilmentInput { ref, type, items, attributes })
|
|
140
|
+
|
|
141
|
+
// 6. Log
|
|
142
|
+
context.addLog("Created curbside fulfilment {fulfilmentRef}")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**For OOTB rules**: just state the configuration props to set in the ruleset — no pseudo logic needed.
|
|
146
|
+
|
|
147
|
+
**For EXISTING rules**: confirm "no code changes" or describe the modification.
|
|
148
|
+
|
|
149
|
+
## Phase 4: Plan Writing
|
|
150
|
+
|
|
151
|
+
**Write to:** `accounts/<PROFILE>/plans/<YYYY-MM-DD>-feature-plan-<slug>.md`
|
|
152
|
+
|
|
153
|
+
Follow the 18-section template from `PLAN_TEMPLATE.md` (sibling file). Validate all Mermaid diagram blocks per `/fluent-mermaid-validate` before writing the plan file. Key per-section notes:
|
|
154
|
+
|
|
155
|
+
| Section | Source-Column Required | Key Content |
|
|
156
|
+
|---------|----------------------|-------------|
|
|
157
|
+
| §4 Workflows | Yes (NEW/EXISTING/MODIFIED) | Workflow name, current version, action |
|
|
158
|
+
| §5 Statuses | Yes | Status, entity type, which ruleset adds it |
|
|
159
|
+
| §6 Rulesets | Yes | Trigger event, from/to status, ordered rule list with source annotations |
|
|
160
|
+
| §6.1 Complete Workflow Inventory | Yes (when modifying) | ALL rulesets in each modified workflow with NEW/EXISTING/MODIFIED annotations |
|
|
161
|
+
| §3.6 Workflow Processing Flow | Yes (when modifying) | Flowchart: complete status→ruleset→status chain, NEW/MODIFIED highlighted |
|
|
162
|
+
| §7 Rules Inventory | Yes | ALL rules for the feature with source + purpose |
|
|
163
|
+
| §8 Detailed Design | For NEW rules only | Class, params table, pseudo logic, GraphQL ops |
|
|
164
|
+
| §9 Settings | Yes | Context, contextId, value type, JSON example for NEW |
|
|
165
|
+
| §10 Webhooks | Yes | Setting name, method, payload shape |
|
|
166
|
+
| §11 Scheduled Events | Yes | Event name, delay, purpose |
|
|
167
|
+
| §12 GraphQL Ops | Yes (NEW/REUSED) | Query/mutation, root field, selected paths |
|
|
168
|
+
| §13 Cross-Entity | Yes | Source → target entity, mechanism |
|
|
169
|
+
| §14 Files | Yes (NEW/MODIFIED) | All created/modified files |
|
|
170
|
+
|
|
171
|
+
## Phase 5: Approval
|
|
172
|
+
|
|
173
|
+
1. Set `Status: PENDING`, `Revision: 1`
|
|
174
|
+
2. Present the full plan content to the user
|
|
175
|
+
3. Wait for explicit approval before any implementation
|
|
176
|
+
4. On approval: update `Status: APPROVED`, `Approved by: user`
|
|
177
|
+
5. On rejection: increment `Revision`, revise, re-present
|
|
178
|
+
6. On "just do it": write `Status: APPROVED (auto-skip)`, `Approved by: user (gate skipped)`, proceed
|
|
179
|
+
|
|
180
|
+
## Phase 6: Handoff to Implementation Skills
|
|
181
|
+
|
|
182
|
+
After approval, the plan becomes the source of truth. Each skill reads its relevant sections:
|
|
183
|
+
|
|
184
|
+
| Artifact Type | Implementation Skill | Plan Sections |
|
|
185
|
+
|--------------|---------------------|---------------|
|
|
186
|
+
| New custom rules | `/fluent-rule-scaffold` | §7 Rules, §8 Detailed Design |
|
|
187
|
+
| Workflow changes | `/fluent-workflow-builder` | §4 Workflows, §5 Statuses, §6 Rulesets |
|
|
188
|
+
| Settings | `/fluent-settings` | §9 Settings |
|
|
189
|
+
| Module validation | `/fluent-module-validate` | §17 Deployment (step 1) |
|
|
190
|
+
| Module build | `/fluent-build` | §17 Deployment (step 2) |
|
|
191
|
+
| Pre-deploy check | `/fluent-pre-deploy-check` | §17 Deployment (step 3) |
|
|
192
|
+
| Module deploy | `/fluent-module-deploy` | §17 Deployment (step 4) |
|
|
193
|
+
| Workflow deploy | `/fluent-workflow-deploy` | §17 Deployment (steps 5-6) |
|
|
194
|
+
| Data module scaffold | `/fluent-data-module-scaffold` | When the feature requires data modules (no Java) |
|
|
195
|
+
| E2E verification | `/fluent-e2e-test` | §16 Test Plan |
|
|
196
|
+
|
|
197
|
+
The deployment sequence in §17 defines execution order. Track tasks from §17 via TodoWrite.
|
|
198
|
+
|
|
199
|
+
**Module-first deployment:** When workflows are bundled inside the module (`resources/workflows/`), `fluent module install` deploys rules, workflows, and settings together. The separate `/fluent-workflow-deploy` step (steps 5-6) is only needed for standalone workflows NOT included in the module, or when workflows were excluded during module install (`--exclude workflows`).
|
|
200
|
+
|
|
201
|
+
**Critical ordering constraint:** Module deploy (registers rules) MUST complete before workflow deploy (references rules). Deploying workflows that reference unregistered custom rules causes NO_MATCH events at runtime. The §17 template enforces this: workflow deploy steps depend on module deploy.
|
|
202
|
+
|
|
203
|
+
**Version bump required for any content change:** Any change to Java code, workflow JSONs, settings, or resources requires bumping the module version in BOTH `resources/module.json` AND all `pom.xml` files. See `/fluent-build` for the sync procedure.
|
|
204
|
+
|
|
205
|
+
**Validation chain:** `/fluent-module-validate` -> `/fluent-build` -> `/fluent-pre-deploy-check` -> `/fluent-module-deploy`. The pre-deploy check is the final gate before deployment and produces a READY/BLOCKED verdict.
|
|
206
|
+
|
|
207
|
+
## Updating a Plan Mid-Implementation
|
|
208
|
+
|
|
209
|
+
If discovery during implementation reveals missing artifacts:
|
|
210
|
+
|
|
211
|
+
1. Edit the plan file in place — increment `Revision: N+1`
|
|
212
|
+
2. Add a revision note at the bottom with what changed and why
|
|
213
|
+
3. Re-present the changed sections for approval
|
|
214
|
+
4. Continue from the updated plan
|
|
215
|
+
|
|
216
|
+
## Cross-References
|
|
217
|
+
|
|
218
|
+
| For | Use |
|
|
219
|
+
|-----|-----|
|
|
220
|
+
| Plan template structure & worked examples | `PLAN_TEMPLATE.md` (in this skill directory) |
|
|
221
|
+
| OOTB rule search | `plugin.list` via MCP |
|
|
222
|
+
| Workflow analysis | `/fluent-workflow-analyzer` |
|
|
223
|
+
| Custom code analysis | `/fluent-custom-code` |
|
|
224
|
+
| Connection topology | `/fluent-connection-analysis` |
|
|
225
|
+
| Scope decomposition (from scope docs) | `/fluent-scope-decompose` |
|
|
226
|
+
| Feature reverse-engineering (existing) | `/fluent-feature-explain` |
|
|
227
|
+
| Module scaffolding (if needed) | `/fluent-module-scaffold` |
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-job-batch
|
|
3
|
+
description: Diagnose and monitor JOB/BATCH orchestration entity lifecycles in Fluent Commerce. Covers JOB and BATCH entity workflows, status tracking, failure investigation, and performance monitoring. Distinct from batch data ingestion API. Triggers on "job batch", "batch management", "job lifecycle", "job status", "batch monitoring", "batch operations", "job entity".
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
6
|
+
argument-hint: [--job-id <id>] [--batch-id <id>] [--status ACTIVE|COMPLETED|FAILED]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# JOB/BATCH Orchestration Lifecycle
|
|
10
|
+
|
|
11
|
+
Monitor and diagnose JOB and BATCH entity orchestration workflows in Fluent Commerce.
|
|
12
|
+
|
|
13
|
+
## Ownership Boundary
|
|
14
|
+
|
|
15
|
+
This skill owns JOB/BATCH entity lifecycle diagnostics and monitoring.
|
|
16
|
+
|
|
17
|
+
- **Batch data ingestion API** (batch.create/send/status/results) → `/fluent-mcp-tools`
|
|
18
|
+
- **Event query syntax** → `/fluent-event-api`
|
|
19
|
+
- **Root cause diagnosis** → `/fluent-trace`
|
|
20
|
+
- **Workflow structure** → `/fluent-workflow-analyzer`
|
|
21
|
+
|
|
22
|
+
## Disambiguation: JOB/BATCH Orchestration vs Batch Ingestion API
|
|
23
|
+
|
|
24
|
+
| Concept | What It Is | Skill |
|
|
25
|
+
|---------|-----------|-------|
|
|
26
|
+
| **JOB entity** | Root orchestratable entity with its own workflow (like ORDER or LOCATION) | This skill |
|
|
27
|
+
| **BATCH entity** | Child entity of JOB, progresses through workflow states | This skill |
|
|
28
|
+
| **batch.create/send/status/results** | MCP tools for uploading data records to Fluent via batch ingestion | `/fluent-mcp-tools` |
|
|
29
|
+
|
|
30
|
+
The batch ingestion API *creates* JOB and BATCH entities. This skill covers what happens *after* creation — the orchestration lifecycle.
|
|
31
|
+
|
|
32
|
+
## JOB Entity Lifecycle
|
|
33
|
+
|
|
34
|
+
JOB is one of the 10 root entity types that can have orchestration workflows.
|
|
35
|
+
|
|
36
|
+
### Status Flow
|
|
37
|
+
```
|
|
38
|
+
ACTIVE → COMPLETED (all batches succeeded)
|
|
39
|
+
ACTIVE → FAILED (one or more batches failed)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Key Behaviors
|
|
43
|
+
- **Auto-close:** JOB entities automatically close at midnight UTC
|
|
44
|
+
- **Workflow type:** `JOB::<subtype>` (subtype varies by implementation)
|
|
45
|
+
- **Root entity:** JOB is always its own root entity in event context
|
|
46
|
+
|
|
47
|
+
## BATCH Entity Lifecycle
|
|
48
|
+
|
|
49
|
+
BATCH entities are children of JOB, similar to how FULFILMENT is a child of ORDER.
|
|
50
|
+
|
|
51
|
+
### Status Flow
|
|
52
|
+
```
|
|
53
|
+
CREATE → BATCH_COMPLETE
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Key Behaviors
|
|
57
|
+
- **Operations:** Each BATCH contains multiple GraphQL mutations and webhook calls
|
|
58
|
+
- **Metrics:** Success rates, operation counts, performance tracking per batch
|
|
59
|
+
|
|
60
|
+
## Diagnostic Queries
|
|
61
|
+
|
|
62
|
+
### Find JOB Events
|
|
63
|
+
```
|
|
64
|
+
event.list({
|
|
65
|
+
"context.entityType": "JOB",
|
|
66
|
+
"eventType": "ORCHESTRATION",
|
|
67
|
+
"from": "<time_window_start>",
|
|
68
|
+
"count": 50
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Find BATCH Events for a JOB
|
|
73
|
+
```
|
|
74
|
+
event.list({
|
|
75
|
+
"context.rootEntityType": "JOB",
|
|
76
|
+
"context.rootEntityId": "<JOB_ID>",
|
|
77
|
+
"context.entityType": "BATCH",
|
|
78
|
+
"count": 100
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Find Failed Batches
|
|
83
|
+
```
|
|
84
|
+
event.list({
|
|
85
|
+
"context.entityType": "BATCH",
|
|
86
|
+
"eventStatus": "FAILED",
|
|
87
|
+
"from": "<time_window_start>",
|
|
88
|
+
"count": 50
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Query JOB Entity State
|
|
93
|
+
```graphql
|
|
94
|
+
{
|
|
95
|
+
jobs(id: [<JOB_ID>], first: 1) {
|
|
96
|
+
edges {
|
|
97
|
+
node {
|
|
98
|
+
id
|
|
99
|
+
ref
|
|
100
|
+
status
|
|
101
|
+
type
|
|
102
|
+
createdOn
|
|
103
|
+
updatedOn
|
|
104
|
+
attributes { name type value }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Note: The `jobs` GraphQL query root may not exist in all Fluent versions. If unavailable, use event.list to track JOB lifecycle via events.
|
|
112
|
+
|
|
113
|
+
## Troubleshooting
|
|
114
|
+
|
|
115
|
+
### JOB Stuck in ACTIVE
|
|
116
|
+
1. Check if batches are still processing: query BATCH events for the JOB
|
|
117
|
+
2. Check if auto-close time has passed (midnight UTC)
|
|
118
|
+
3. Check for exceptions: `event.list({ category: "exception", "context.rootEntityType": "JOB", "context.rootEntityId": "<ID>" })`
|
|
119
|
+
|
|
120
|
+
### BATCH Failed
|
|
121
|
+
1. Get exception details: `event.list({ category: "exception", "context.entityType": "BATCH", "context.entityId": "<BATCH_ID>" })`
|
|
122
|
+
2. Check operation details in event attributes
|
|
123
|
+
3. Hand off to `/fluent-trace` for root cause analysis
|
|
124
|
+
|
|
125
|
+
### Performance Issues
|
|
126
|
+
1. Check batch operation timing via `startTimer`/`stopTimer` in audit events
|
|
127
|
+
2. Use `metrics.topEvents` to see if JOB/BATCH events are unusually high-volume
|
|
128
|
+
3. Compare batch sizes and operation counts across jobs
|
|
129
|
+
|
|
130
|
+
## Integration with Other Skills
|
|
131
|
+
|
|
132
|
+
| Need | Skill |
|
|
133
|
+
|------|-------|
|
|
134
|
+
| Batch data upload (batch.create/send) | `/fluent-mcp-tools` |
|
|
135
|
+
| Event query syntax and filters | `/fluent-event-api` |
|
|
136
|
+
| Root cause for failed batches | `/fluent-trace` |
|
|
137
|
+
| JOB workflow structure | `/fluent-workflow-analyzer` |
|
|
138
|
+
| Event volume analytics | `/fluent-system-monitoring` |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluent-mermaid-validate
|
|
3
|
+
description: Validate Mermaid diagram syntax before including in plans, docs, or workflow analysis. Catches common pitfalls in stateDiagram-v2, sequenceDiagram, flowchart, and erDiagram. Not user-invocable — called internally by skills that generate diagrams.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
allowed-tools: Read
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Mermaid Syntax Validator
|
|
9
|
+
|
|
10
|
+
Validate all Mermaid diagram blocks before writing them to files. This skill is a reference for common syntax pitfalls — apply these rules whenever generating Mermaid diagrams.
|
|
11
|
+
|
|
12
|
+
## When to Apply
|
|
13
|
+
|
|
14
|
+
Every time you generate a Mermaid code block (` ```mermaid ... ``` `), validate it against the rules below BEFORE writing to a file. This applies to all diagram types used in Fluent Commerce skills.
|
|
15
|
+
|
|
16
|
+
## Common Pitfalls by Diagram Type
|
|
17
|
+
|
|
18
|
+
### stateDiagram-v2
|
|
19
|
+
|
|
20
|
+
| Pitfall | Bad | Good |
|
|
21
|
+
|---------|-----|------|
|
|
22
|
+
| Colon in note text | `note right of S : FC routing: HD / CC` | `note right of S : FC routing (HD, CC)` |
|
|
23
|
+
| Special chars in transition labels | `S1 --> S2 : All shipped/collected` | `S1 --> S2 : All shipped or collected` |
|
|
24
|
+
| Missing space before colon | `S1 --> S2: label` | `S1 --> S2 : label` |
|
|
25
|
+
| Unicode arrows in labels | `S1 --> S2 : A → B` | `S1 --> S2 : A then B` |
|
|
26
|
+
| Em dash in text | `note right of S : No changes — done` | `note right of S : No changes. Done` |
|
|
27
|
+
| Unquoted state with spaces | `state "My State" as MS` | OK (quoted is correct) |
|
|
28
|
+
| Duplicate state names without alias | Two states named `CREATED` for different entities | Use `state "CREATED" as FUL_CREATED` |
|
|
29
|
+
|
|
30
|
+
**Key rule:** After the `:` separator in notes and transitions, the remaining text must NOT contain `:`, `→`, `—`, or `/`.
|
|
31
|
+
|
|
32
|
+
### sequenceDiagram
|
|
33
|
+
|
|
34
|
+
| Pitfall | Bad | Good |
|
|
35
|
+
|---------|-----|------|
|
|
36
|
+
| Colon in message text | `A->>B: Read curbside.pickup.config` | `A->>B: Read curbside pickup config` |
|
|
37
|
+
| Colon in Note text | `Note over A,B: attrs: x, y` | `Note over A,B: attrs include x, y` |
|
|
38
|
+
| Arrow (→) in message | `A->>A: CREATED → BOOKED` | `A->>A: CREATED then BOOKED` |
|
|
39
|
+
| Participant name with special chars | `participant FC as FULFILMENT_CHOICE (CC)` | `participant FC as FULFILMENT_CHOICE` |
|
|
40
|
+
| Missing participant declaration | Using `WH` without declaring it | `participant WH as Webhook` |
|
|
41
|
+
| `<br/>` in messages | Works in some renderers | Prefer `\n` or split into separate messages |
|
|
42
|
+
|
|
43
|
+
**Key rule:** Message text after the `:` must not contain another `:`. Use commas, parentheses, or rephrase.
|
|
44
|
+
|
|
45
|
+
### flowchart (TD/LR)
|
|
46
|
+
|
|
47
|
+
| Pitfall | Bad | Good |
|
|
48
|
+
|---------|-----|------|
|
|
49
|
+
| Unicode arrows in node label | `A[READY → RECEIVED → PICKPACK]` | `A["READY - RECEIVED - PICKPACK"]` |
|
|
50
|
+
| Colon in node label | `A[type: CURBSIDE]` | `A["type CURBSIDE"]` or `A[type=CURBSIDE]` |
|
|
51
|
+
| Unquoted label with special chars | `A[Pick & Pack]` | `A["Pick & Pack"]` |
|
|
52
|
+
| Parentheses in unquoted label | `A[SendEvent(name)]` | `A["SendEvent(name)"]` |
|
|
53
|
+
| Subgraph with colon | `subgraph FC: Processing` | `subgraph FC Processing` |
|
|
54
|
+
| classDef with missing style | `classDef added` | `classDef added fill:#90EE90` |
|
|
55
|
+
|
|
56
|
+
**Key rule:** If a node label contains ANY special characters (`:`, `→`, `&`, `(`, `)`, `/`), wrap it in double quotes.
|
|
57
|
+
|
|
58
|
+
### erDiagram
|
|
59
|
+
|
|
60
|
+
| Pitfall | Bad | Good |
|
|
61
|
+
|---------|-----|------|
|
|
62
|
+
| Colon in attribute | `string ref : "order ref"` | `string ref "order ref"` |
|
|
63
|
+
| Relationship without label | `ORDER ||--o{ FULFILMENT` | `ORDER ||--o{ FULFILMENT : has` |
|
|
64
|
+
|
|
65
|
+
## Universal Rules
|
|
66
|
+
|
|
67
|
+
1. **No colons in free text** — After the initial `:` separator, never use another `:` in the same line
|
|
68
|
+
2. **No unicode arrows** — Replace `→` with `then`, `to`, or `-`; replace `←` with `from`
|
|
69
|
+
3. **No em dashes** — Replace `—` with `.` or `,` or rephrase
|
|
70
|
+
4. **No forward slashes in labels** — Replace `HD/CC` with `HD, CC` or `HD or CC`
|
|
71
|
+
5. **Quote complex labels** — Any flowchart node label with special characters must be in double quotes
|
|
72
|
+
6. **Validate state names** — State names in `stateDiagram-v2` must be alphanumeric + underscore only
|
|
73
|
+
7. **Consistent arrow style** — Use `-->` for state transitions, `->>` for sequence messages, `-->` for flowchart edges
|
|
74
|
+
|
|
75
|
+
## Validation Checklist
|
|
76
|
+
|
|
77
|
+
Before writing any file containing Mermaid blocks, verify each block:
|
|
78
|
+
|
|
79
|
+
- [ ] No colons in free text after the separator colon
|
|
80
|
+
- [ ] No unicode arrows (→, ←, ↔) anywhere in the diagram
|
|
81
|
+
- [ ] No em dashes (—) in labels or notes
|
|
82
|
+
- [ ] No forward slashes in labels or notes
|
|
83
|
+
- [ ] Flowchart node labels with special chars are double-quoted
|
|
84
|
+
- [ ] All participants declared in sequenceDiagram
|
|
85
|
+
- [ ] stateDiagram-v2 state names are simple identifiers
|
|
86
|
+
- [ ] classDef declarations include style properties
|