@massa-ai/cursor-plugin 1.27.0 → 1.30.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/.cursor-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/agent-profiles/balanced/massa-ai-judge.md +1 -2
- package/agent-profiles/cheap/massa-ai-judge.md +1 -2
- package/agent-profiles/heavy/massa-ai-judge.md +1 -2
- package/agent-profiles/home/massa-ai-judge.md +1 -2
- package/agent-profiles/work/massa-ai-judge.md +1 -2
- package/agents/massa-ai-judge.md +1 -2
- package/install.sh +254 -82
- package/package.json +1 -1
- package/skills/agents/judge/SKILL.md +3 -3
- package/skills/massa-ai/SKILL.md +8 -3
- package/skills/massa-ai/references/agent-orchestration.md +1 -1
- package/skills/massa-ai/references/coding-guidelines.md +67 -0
- package/skills/massa-ai/references/installation.md +3 -3
- package/skills/massa-ai/references/mcp-tools.md +3 -1
- package/skills/massa-ai/references/skill-architect/examples.md +256 -0
- package/skills/massa-ai/references/skill-architect/patterns.md +317 -0
- package/skills/massa-ai/references/skill-architect/quality-checklist.md +70 -0
- package/skills/massa-ai/scripts/validate_skill.ts +364 -0
- package/skills/massa-ai/workflows/pr-review.md +246 -0
- package/skills/massa-ai/workflows/skill-architect.md +393 -0
- package/skills/massa-ai/workflows/to-prd.md +81 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Coding Guidelines
|
|
2
|
+
|
|
3
|
+
Source: Karpathy Guidelines (Useful-Agent-Skills)
|
|
4
|
+
|
|
5
|
+
Behavioral guidelines to reduce common LLM coding mistakes. These principles bias toward caution over speed—for trivial tasks, use judgment.
|
|
6
|
+
|
|
7
|
+
## 1. Think Before Coding
|
|
8
|
+
|
|
9
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
10
|
+
|
|
11
|
+
Before implementing:
|
|
12
|
+
|
|
13
|
+
- State assumptions explicitly. If uncertain, ask.
|
|
14
|
+
- If multiple interpretations exist, present them—don't pick silently.
|
|
15
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
16
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
17
|
+
- Disagree honestly. If the user's approach seems wrong, say so—don't be sycophantic.
|
|
18
|
+
|
|
19
|
+
## 2. Simplicity First
|
|
20
|
+
|
|
21
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
22
|
+
|
|
23
|
+
- No features beyond what was asked.
|
|
24
|
+
- No abstractions for single-use code.
|
|
25
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
26
|
+
- No error handling for impossible scenarios.
|
|
27
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
28
|
+
|
|
29
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
|
30
|
+
|
|
31
|
+
## 3. Surgical Changes
|
|
32
|
+
|
|
33
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
34
|
+
|
|
35
|
+
When editing existing code:
|
|
36
|
+
|
|
37
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
38
|
+
- Don't refactor things that aren't broken.
|
|
39
|
+
- Match existing style, even if you'd do it differently.
|
|
40
|
+
- If you notice unrelated dead code, mention it—don't delete it.
|
|
41
|
+
|
|
42
|
+
When your changes create orphans:
|
|
43
|
+
|
|
44
|
+
- Remove imports/variables/functions that YOUR changes made unused.
|
|
45
|
+
- Don't remove pre-existing dead code unless asked.
|
|
46
|
+
|
|
47
|
+
**The test:** Every changed line should trace directly to the user's request.
|
|
48
|
+
|
|
49
|
+
## 4. Goal-Driven Execution
|
|
50
|
+
|
|
51
|
+
**Define success criteria. Loop until verified.**
|
|
52
|
+
|
|
53
|
+
Transform tasks into verifiable goals:
|
|
54
|
+
|
|
55
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
56
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
57
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
58
|
+
|
|
59
|
+
For multi-step tasks, state a brief plan:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
1. [Step] → verify: [check]
|
|
63
|
+
2. [Step] → verify: [check]
|
|
64
|
+
3. [Step] → verify: [check]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
|
@@ -100,9 +100,9 @@ behavior through MCP declarations and non-destructive runtime probes.
|
|
|
100
100
|
- Preferred: `bash scripts/install-agents.sh --agent <host>` — the single writer
|
|
101
101
|
of host MCP config (Claude Code, Claude Desktop, Codex, Cursor, OpenCode).
|
|
102
102
|
Plugin installers call it; nothing else writes an MCP entry.
|
|
103
|
-
- OpenCode:
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
- OpenCode: `@massa-ai/opencode-plugin` is hooks-only (AD-017) and delegates
|
|
104
|
+
MCP registration to `install-agents.sh --agent opencode` on every install,
|
|
105
|
+
same as every other host — no separate MCP step needed.
|
|
106
106
|
- VS Code/Antigravity: `.vscode/mcp.json` or `./scripts/setup-vscode.sh`.
|
|
107
107
|
- Docker: run the `mcp` service through `docker compose run --rm -i mcp`.
|
|
108
108
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# massa-ai Tool Contracts (
|
|
1
|
+
# massa-ai Tool Contracts (54 Tools)
|
|
2
2
|
|
|
3
3
|
Load when exact MCP schemas, REST fallbacks, response modes, or
|
|
4
4
|
polling rules are needed. Prefer the active tool declaration over copied
|
|
@@ -138,6 +138,8 @@ depends on exact content.
|
|
|
138
138
|
|---|---|---|
|
|
139
139
|
| `rename_project` | Rename a project identity transactionally | Req: `sourceProjectId`, `targetProjectId`. Default `dryRun=true`; apply with `dryRun=false` + `operationId` + `expectedPlanHash`. Administrative, not workflow-recurring. |
|
|
140
140
|
| `merge_projects` | Merge one project identity into another | Req: `sourceProjectId`, `targetProjectId`. Same dryRun/planHash contract as `rename_project`. Administrative, not workflow-recurring. |
|
|
141
|
+
| `profile_list` | List shipped model profiles and each detected host's current profile + bundle version | No required args; optional `host` to scope to one. Offline — reads on-disk variant directories only, never the registry. |
|
|
142
|
+
| `profile_set` | Switch the installed massa-ai agents to a registry model profile | Req: `profile`. Optional `host` (default: every detected, supported host), `dryRun` (default `false`) to preview without writing. Local trust model — mutates installed agent files on the machine the MCP server runs on; a host session restart is required to take effect. |
|
|
141
143
|
|
|
142
144
|
## Retrieval Order
|
|
143
145
|
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Description & Instruction Examples
|
|
2
|
+
|
|
3
|
+
Reference for writing effective skill descriptions and instructions.
|
|
4
|
+
Read this during the Architecture phase (for descriptions) and Craft phase
|
|
5
|
+
(for instructions).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Good Descriptions
|
|
10
|
+
|
|
11
|
+
Each example follows the pattern: [What] + [When/Triggers] + [Not-when].
|
|
12
|
+
|
|
13
|
+
### Document & Asset Creation
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
description: Analyzes Figma design files and generates developer handoff documentation.
|
|
17
|
+
Use when user uploads .fig files, asks for "design specs", "component
|
|
18
|
+
documentation", or "design-to-code handoff". Do NOT use for general
|
|
19
|
+
design discussions or UI feedback.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
description: Creates distinctive, production-grade frontend interfaces with high design
|
|
24
|
+
quality. Use this skill when the user asks to build web components, pages,
|
|
25
|
+
artifacts, posters, or applications (examples include websites, landing
|
|
26
|
+
pages, dashboards, React components, HTML/CSS layouts, or when
|
|
27
|
+
styling/beautifying any web UI). Generates creative, polished code and UI
|
|
28
|
+
design that avoids generic AI aesthetics.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Workflow Automation
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
description: Manages Linear project workflows including sprint planning, task creation,
|
|
35
|
+
and status tracking. Use when user mentions "sprint", "Linear tasks",
|
|
36
|
+
"project planning", or asks to "create tickets". Do NOT use for general
|
|
37
|
+
project management advice without Linear context.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
description: End-to-end customer onboarding workflow for PayFlow. Handles account
|
|
42
|
+
creation, payment setup, and subscription management. Use when user says
|
|
43
|
+
"onboard new customer", "set up subscription", or "create PayFlow account".
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### MCP Enhancement
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
description: Automatically analyzes and fixes detected bugs in GitHub Pull Requests
|
|
50
|
+
using Sentry's error monitoring data via their MCP server. Use when user
|
|
51
|
+
mentions "Sentry errors", "fix bugs from monitoring", "PR review with
|
|
52
|
+
error data", or asks to analyze production errors in code.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Bad Descriptions (and Why)
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
# ❌ Too vague — no trigger phrases, no specifics
|
|
61
|
+
description: Helps with projects.
|
|
62
|
+
# Why it fails: the agent can't determine WHEN to load this.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
# ❌ Missing triggers — describes capability but not activation
|
|
67
|
+
description: Creates sophisticated multi-page documentation systems.
|
|
68
|
+
# Why it fails: What would a user SAY to trigger this? "Create docs"?
|
|
69
|
+
# "Write documentation"? Include the actual phrases.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
# ❌ Too technical, no user perspective
|
|
74
|
+
description: Implements the Project entity model with hierarchical relationships.
|
|
75
|
+
# Why it fails: Users don't think in entity models. They think in tasks.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
# ❌ Too broad — will overtrigger
|
|
80
|
+
description: Processes documents.
|
|
81
|
+
# Why it fails: Loads for ANY document task. Add file types and specifics.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# ❌ Overlap without boundaries
|
|
86
|
+
description: Analyzes data and creates visualizations.
|
|
87
|
+
# Why it fails: Conflicts with built-in capabilities and other skills.
|
|
88
|
+
# Add specifics about WHAT data and WHAT kind of visualizations.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Fixing Overtriggering with Negative Triggers
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
# Before: triggers on all data tasks
|
|
97
|
+
description: Advanced data analysis for CSV files.
|
|
98
|
+
|
|
99
|
+
# After: scoped with negative triggers
|
|
100
|
+
description: Advanced data analysis for CSV files. Use for statistical modeling,
|
|
101
|
+
regression, clustering. Do NOT use for simple data exploration
|
|
102
|
+
(use data-viz skill instead) or for reading CSV files without analysis.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Good Instructions
|
|
108
|
+
|
|
109
|
+
### Specific and Actionable
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
# ✅ Good — tells the agent exactly what to do
|
|
113
|
+
|
|
114
|
+
Run `python scripts/[validate].py --input {filename}` to check data format.
|
|
115
|
+
If validation fails, common issues include:
|
|
116
|
+
|
|
117
|
+
- Missing required fields → add them to the CSV
|
|
118
|
+
- Invalid date formats → use YYYY-MM-DD
|
|
119
|
+
- Encoding errors → convert to UTF-8 first
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
# ❌ Bad — vague and unactionable
|
|
124
|
+
|
|
125
|
+
Validate the data before proceeding.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Error Handling
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
# ✅ Good — specific error, cause, solution
|
|
132
|
+
|
|
133
|
+
## Common Issues
|
|
134
|
+
|
|
135
|
+
### MCP Connection Failed
|
|
136
|
+
|
|
137
|
+
If you see "Connection refused":
|
|
138
|
+
|
|
139
|
+
1. Verify MCP server is running: Check Settings > Extensions
|
|
140
|
+
2. Confirm API key is valid
|
|
141
|
+
3. Try reconnecting: Settings > Extensions > [Service] > Reconnect
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
# ❌ Bad — no specifics
|
|
146
|
+
|
|
147
|
+
If something goes wrong, try again.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Resource References
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
# ✅ Good — says WHEN and WHY to read the file
|
|
154
|
+
|
|
155
|
+
Before writing queries, consult `references/[api-patterns].md` for:
|
|
156
|
+
|
|
157
|
+
- Rate limiting guidance (if making >10 calls)
|
|
158
|
+
- Pagination patterns (if results may exceed 100 items)
|
|
159
|
+
- Error codes and handling (if calls may fail)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```markdown
|
|
163
|
+
# ❌ Bad — no guidance on when to read
|
|
164
|
+
|
|
165
|
+
See references/ for more information.
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Critical Instructions
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
# ✅ Good — prominent, specific, verifiable
|
|
172
|
+
|
|
173
|
+
CRITICAL: Before calling create_project, verify:
|
|
174
|
+
|
|
175
|
+
- Project name is non-empty
|
|
176
|
+
- At least one team member assigned
|
|
177
|
+
- Start date is not in the past
|
|
178
|
+
If any check fails, tell the user what's missing before proceeding.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```markdown
|
|
182
|
+
# ❌ Bad — buried, vague, not verifiable
|
|
183
|
+
|
|
184
|
+
Make sure to validate things properly.
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Examples in Skills
|
|
188
|
+
|
|
189
|
+
```markdown
|
|
190
|
+
# ✅ Good — realistic user input with concrete output
|
|
191
|
+
|
|
192
|
+
## Examples
|
|
193
|
+
|
|
194
|
+
### Example 1: New sprint setup
|
|
195
|
+
|
|
196
|
+
User says: "Help me plan the Q4 sprint for the mobile team"
|
|
197
|
+
Actions:
|
|
198
|
+
|
|
199
|
+
1. Fetch current backlog from Linear (MCP)
|
|
200
|
+
2. Check team capacity (3 engineers, 2-week sprint)
|
|
201
|
+
3. Prioritize by impact score
|
|
202
|
+
4. Create 12 tasks with estimates
|
|
203
|
+
Result: Sprint board populated with 12 prioritized tasks, each with
|
|
204
|
+
story points and assignees. Summary posted to #mobile-team Slack.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
# ❌ Bad — generic, no concrete details
|
|
209
|
+
|
|
210
|
+
### Example 1: Setup
|
|
211
|
+
|
|
212
|
+
User says: "Set up a project"
|
|
213
|
+
Result: Project gets created.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Anti-Patterns Checklist
|
|
219
|
+
|
|
220
|
+
Before finalizing any skill, verify NONE of these are present:
|
|
221
|
+
|
|
222
|
+
### Structural Anti-Patterns
|
|
223
|
+
|
|
224
|
+
- [ ] File named SKILL.MD, skill.md, or any variant (must be exactly SKILL.md)
|
|
225
|
+
- [ ] Folder has spaces or capitals (must be kebab-case)
|
|
226
|
+
- [ ] README.md exists inside the skill folder
|
|
227
|
+
- [ ] XML angle brackets (< >) in YAML frontmatter
|
|
228
|
+
- [ ] "claude" or "anthropic" in the skill name
|
|
229
|
+
- [ ] Missing --- delimiters around frontmatter
|
|
230
|
+
- [ ] SKILL.md exceeds 500 lines without progressive disclosure
|
|
231
|
+
|
|
232
|
+
### Description Anti-Patterns
|
|
233
|
+
|
|
234
|
+
- [ ] No trigger phrases included
|
|
235
|
+
- [ ] Too vague (could match anything)
|
|
236
|
+
- [ ] Too technical (user perspective missing)
|
|
237
|
+
- [ ] No negative triggers when overlap risk exists
|
|
238
|
+
- [ ] Exceeds 1024 characters
|
|
239
|
+
|
|
240
|
+
### Instruction Anti-Patterns
|
|
241
|
+
|
|
242
|
+
- [ ] Vague directions without specific actions
|
|
243
|
+
- [ ] Critical instructions buried in middle of document
|
|
244
|
+
- [ ] No examples of realistic usage
|
|
245
|
+
- [ ] No error handling guidance
|
|
246
|
+
- [ ] References to external files without load conditions
|
|
247
|
+
- [ ] Wall-of-text instructions without structure
|
|
248
|
+
- [ ] Assumes skill is the only one loaded
|
|
249
|
+
- [ ] Uses prose where a script would be deterministic
|
|
250
|
+
|
|
251
|
+
### Quality Anti-Patterns
|
|
252
|
+
|
|
253
|
+
- [ ] No validation step in workflow
|
|
254
|
+
- [ ] No stopping conditions for iterative processes
|
|
255
|
+
- [ ] Missing rollback/failure handling
|
|
256
|
+
- [ ] Over-reliance on "be careful" instead of specific checks
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Skill Patterns Reference
|
|
2
|
+
|
|
3
|
+
This document details the five proven patterns for skill architecture.
|
|
4
|
+
Read this when deciding how to structure a skill's workflow during the
|
|
5
|
+
Architecture phase.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. Sequential Workflow Orchestration (line ~20)
|
|
10
|
+
2. Multi-MCP Coordination (line ~70)
|
|
11
|
+
3. Iterative Refinement (line ~120)
|
|
12
|
+
4. Context-Aware Tool Selection (line ~170)
|
|
13
|
+
5. Domain-Specific Intelligence (line ~210)
|
|
14
|
+
6. Choosing Between Patterns (line ~250)
|
|
15
|
+
7. Combining Patterns (line ~280)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. Sequential Workflow Orchestration
|
|
20
|
+
|
|
21
|
+
**Use when:** Users need multi-step processes executed in a specific order,
|
|
22
|
+
where each step depends on the previous one.
|
|
23
|
+
|
|
24
|
+
**Problem-first framing:** "I need to onboard a new customer" → Skill
|
|
25
|
+
orchestrates the right calls in the right sequence.
|
|
26
|
+
|
|
27
|
+
**Key characteristics:**
|
|
28
|
+
|
|
29
|
+
- Explicit step ordering with dependencies between steps
|
|
30
|
+
- Validation gates between steps (don't proceed if step N fails)
|
|
31
|
+
- Rollback instructions for failures
|
|
32
|
+
- Data flows from earlier steps to later ones
|
|
33
|
+
|
|
34
|
+
**Structure template:**
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
## Workflow: [Name]
|
|
38
|
+
|
|
39
|
+
### Step 1: [Action]
|
|
40
|
+
Call tool: `tool_name`
|
|
41
|
+
Parameters: [what's needed]
|
|
42
|
+
Validation: [how to know it succeeded]
|
|
43
|
+
On failure: [what to do]
|
|
44
|
+
|
|
45
|
+
### Step 2: [Action]
|
|
46
|
+
Depends on: Step 1 (uses [specific output])
|
|
47
|
+
Call tool: `tool_name`
|
|
48
|
+
Parameters: [include output from Step 1]
|
|
49
|
+
Validation: [check]
|
|
50
|
+
|
|
51
|
+
### Step 3: [Action]
|
|
52
|
+
...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**When to choose this pattern:**
|
|
56
|
+
|
|
57
|
+
- The workflow has a natural linear order
|
|
58
|
+
- Steps have clear dependencies
|
|
59
|
+
- Skipping a step would break the workflow
|
|
60
|
+
- Users currently do these steps manually in sequence
|
|
61
|
+
|
|
62
|
+
**Watch out for:**
|
|
63
|
+
|
|
64
|
+
- Rigid ordering when some steps could be parallel
|
|
65
|
+
- Missing rollback logic (what if step 3 fails after step 1 and 2 succeeded?)
|
|
66
|
+
- Not validating between steps
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 2. Multi-MCP Coordination
|
|
71
|
+
|
|
72
|
+
**Use when:** Workflows span multiple external services, each connected
|
|
73
|
+
via its own MCP server.
|
|
74
|
+
|
|
75
|
+
**Key characteristics:**
|
|
76
|
+
|
|
77
|
+
- Clear phase separation by service
|
|
78
|
+
- Data passing between MCP servers
|
|
79
|
+
- Validation before moving to next phase
|
|
80
|
+
- Centralized error handling across services
|
|
81
|
+
|
|
82
|
+
**Structure template:**
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
## Workflow: [Name]
|
|
86
|
+
|
|
87
|
+
### Phase 1: [Service A] ([MCP name])
|
|
88
|
+
1. [Action using Service A tools]
|
|
89
|
+
2. [Action using Service A tools]
|
|
90
|
+
Output: [data needed by Phase 2]
|
|
91
|
+
|
|
92
|
+
### Phase 2: [Service B] ([MCP name])
|
|
93
|
+
Input: [data from Phase 1]
|
|
94
|
+
1. [Action using Service B tools]
|
|
95
|
+
2. [Action using Service B tools]
|
|
96
|
+
Output: [data needed by Phase 3]
|
|
97
|
+
|
|
98
|
+
### Phase 3: [Service C] ([MCP name])
|
|
99
|
+
...
|
|
100
|
+
|
|
101
|
+
## Error Handling
|
|
102
|
+
- If Phase 1 fails: [action]
|
|
103
|
+
- If Phase 2 fails but Phase 1 succeeded: [action]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**When to choose this pattern:**
|
|
107
|
+
|
|
108
|
+
- The workflow crosses service boundaries
|
|
109
|
+
- Multiple MCP servers are involved
|
|
110
|
+
- Data needs to flow between services
|
|
111
|
+
- Users currently switch between tools manually
|
|
112
|
+
|
|
113
|
+
**Watch out for:**
|
|
114
|
+
|
|
115
|
+
- Assuming all MCPs are connected (check availability first)
|
|
116
|
+
- Not handling partial failures (Phase 2 fails but Phase 1 already ran)
|
|
117
|
+
- Tight coupling between phases (prefer passing data explicitly)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 3. Iterative Refinement
|
|
122
|
+
|
|
123
|
+
**Use when:** Output quality improves through multiple review-and-fix cycles.
|
|
124
|
+
|
|
125
|
+
**Key characteristics:**
|
|
126
|
+
|
|
127
|
+
- Initial draft generation
|
|
128
|
+
- Quality check against explicit criteria
|
|
129
|
+
- Refinement loop with clear stopping conditions
|
|
130
|
+
- Finalization step
|
|
131
|
+
|
|
132
|
+
**Structure template:**
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
## Workflow: [Name]
|
|
136
|
+
|
|
137
|
+
### Initial Draft
|
|
138
|
+
1. Gather input data
|
|
139
|
+
2. Generate first version
|
|
140
|
+
3. Save to working file
|
|
141
|
+
|
|
142
|
+
### Quality Check
|
|
143
|
+
Run validation: `scripts/[check_quality].py`
|
|
144
|
+
Criteria:
|
|
145
|
+
- [Criterion 1]: [how to check]
|
|
146
|
+
- [Criterion 2]: [how to check]
|
|
147
|
+
- [Criterion 3]: [how to check]
|
|
148
|
+
|
|
149
|
+
### Refinement Loop
|
|
150
|
+
For each issue found:
|
|
151
|
+
1. Identify the specific problem
|
|
152
|
+
2. Fix it
|
|
153
|
+
3. Re-validate
|
|
154
|
+
|
|
155
|
+
STOP when:
|
|
156
|
+
- All criteria pass, OR
|
|
157
|
+
- 3 iterations completed (diminishing returns), OR
|
|
158
|
+
- User signals satisfaction
|
|
159
|
+
|
|
160
|
+
### Finalization
|
|
161
|
+
1. Apply final formatting
|
|
162
|
+
2. Generate summary of changes
|
|
163
|
+
3. Save final version
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**When to choose this pattern:**
|
|
167
|
+
|
|
168
|
+
- Output quality is subjective or multi-dimensional
|
|
169
|
+
- First drafts are usually "close but not quite"
|
|
170
|
+
- Users currently review and ask for revisions manually
|
|
171
|
+
- There are explicit quality criteria to check against
|
|
172
|
+
|
|
173
|
+
**Watch out for:**
|
|
174
|
+
|
|
175
|
+
- Infinite loops (always define stopping conditions)
|
|
176
|
+
- Over-polishing (3 iterations is usually enough)
|
|
177
|
+
- Vague quality criteria (make them checkable)
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 4. Context-Aware Tool Selection
|
|
182
|
+
|
|
183
|
+
**Use when:** The same goal can be achieved with different tools depending
|
|
184
|
+
on the input or context.
|
|
185
|
+
|
|
186
|
+
**Key characteristics:**
|
|
187
|
+
|
|
188
|
+
- Decision tree based on input properties
|
|
189
|
+
- Fallback options when primary choice isn't available
|
|
190
|
+
- Transparency about why a particular path was chosen
|
|
191
|
+
|
|
192
|
+
**Structure template:**
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
## Workflow: [Name]
|
|
196
|
+
|
|
197
|
+
### Analyze Input
|
|
198
|
+
Check: [what properties to examine]
|
|
199
|
+
- Property A: [value range or type]
|
|
200
|
+
- Property B: [value range or type]
|
|
201
|
+
|
|
202
|
+
### Decision Tree
|
|
203
|
+
IF [condition 1]:
|
|
204
|
+
→ Use [Tool/Approach A]
|
|
205
|
+
Rationale: [why this is better for this case]
|
|
206
|
+
ELIF [condition 2]:
|
|
207
|
+
→ Use [Tool/Approach B]
|
|
208
|
+
Rationale: [why]
|
|
209
|
+
ELSE:
|
|
210
|
+
→ Use [Tool/Approach C] (default)
|
|
211
|
+
|
|
212
|
+
### Execute
|
|
213
|
+
Based on decision, execute using the selected approach.
|
|
214
|
+
|
|
215
|
+
### Explain Choice
|
|
216
|
+
Tell the user which approach was selected and why.
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**When to choose this pattern:**
|
|
220
|
+
|
|
221
|
+
- Multiple valid approaches exist for the same goal
|
|
222
|
+
- The "best" approach depends on input characteristics
|
|
223
|
+
- Users don't know (or shouldn't need to know) which tool is optimal
|
|
224
|
+
|
|
225
|
+
**Watch out for:**
|
|
226
|
+
|
|
227
|
+
- Decision criteria that overlap (ambiguous routing)
|
|
228
|
+
- Missing fallback for edge cases
|
|
229
|
+
- Not explaining the choice to the user
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 5. Domain-Specific Intelligence
|
|
234
|
+
|
|
235
|
+
**Use when:** The skill's value comes from specialized knowledge, not just
|
|
236
|
+
tool orchestration.
|
|
237
|
+
|
|
238
|
+
**Key characteristics:**
|
|
239
|
+
|
|
240
|
+
- Domain rules and constraints embedded in logic
|
|
241
|
+
- Compliance or validation checks before action
|
|
242
|
+
- Comprehensive audit trails
|
|
243
|
+
- Expert-level decision making
|
|
244
|
+
|
|
245
|
+
**Structure template:**
|
|
246
|
+
|
|
247
|
+
```markdown
|
|
248
|
+
## Workflow: [Name]
|
|
249
|
+
|
|
250
|
+
### Pre-Check ([Domain] Rules)
|
|
251
|
+
Before proceeding, verify:
|
|
252
|
+
1. [Domain rule 1]: [how to check]
|
|
253
|
+
2. [Domain rule 2]: [how to check]
|
|
254
|
+
3. [Domain rule 3]: [how to check]
|
|
255
|
+
|
|
256
|
+
IF any rule fails:
|
|
257
|
+
→ [Escalation or alternative path]
|
|
258
|
+
→ Document the failure
|
|
259
|
+
|
|
260
|
+
### Execute
|
|
261
|
+
Only if pre-checks pass:
|
|
262
|
+
1. [Action with domain context]
|
|
263
|
+
2. [Action with domain context]
|
|
264
|
+
|
|
265
|
+
### Audit Trail
|
|
266
|
+
Log:
|
|
267
|
+
- All checks performed and results
|
|
268
|
+
- Decisions made and rationale
|
|
269
|
+
- Actions taken
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**When to choose this pattern:**
|
|
273
|
+
|
|
274
|
+
- The skill needs expert knowledge to execute correctly
|
|
275
|
+
- There are compliance, safety, or quality rules to enforce
|
|
276
|
+
- Getting it wrong has significant consequences
|
|
277
|
+
- Users benefit from the skill's "expertise" more than its automation
|
|
278
|
+
|
|
279
|
+
**Watch out for:**
|
|
280
|
+
|
|
281
|
+
- Outdated domain knowledge (plan for updates)
|
|
282
|
+
- Over-encoding rules that change frequently (reference external docs instead)
|
|
283
|
+
- Not documenting the reasoning for decisions
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## 6. Choosing Between Patterns
|
|
288
|
+
|
|
289
|
+
| Signal | Suggested Pattern |
|
|
290
|
+
|--------|------------------|
|
|
291
|
+
| "Do A, then B, then C" | Sequential Workflow |
|
|
292
|
+
| "Get data from X, send to Y, notify in Z" | Multi-MCP Coordination |
|
|
293
|
+
| "Make it good, then review and improve" | Iterative Refinement |
|
|
294
|
+
| "Handle PDFs differently from CSVs" | Context-Aware Selection |
|
|
295
|
+
| "Follow our compliance rules" | Domain-Specific Intelligence |
|
|
296
|
+
| Steps have no dependencies | Consider parallel execution |
|
|
297
|
+
| User says "it depends" a lot | Context-Aware Selection |
|
|
298
|
+
| Quality is subjective | Iterative Refinement |
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## 7. Combining Patterns
|
|
303
|
+
|
|
304
|
+
Most real skills combine patterns. Common combinations:
|
|
305
|
+
|
|
306
|
+
- **Sequential + Domain Intelligence:** Follow steps in order, but embed
|
|
307
|
+
expert checks at critical points (e.g., compliance check before payment)
|
|
308
|
+
- **Multi-MCP + Iterative:** Coordinate across services, then refine the
|
|
309
|
+
combined output
|
|
310
|
+
- **Context-Aware + Sequential:** Choose the right tool first, then follow
|
|
311
|
+
a sequential workflow specific to that tool
|
|
312
|
+
- **Domain Intelligence + Iterative:** Apply domain rules, generate output,
|
|
313
|
+
review against domain criteria, refine
|
|
314
|
+
|
|
315
|
+
When combining, identify the PRIMARY pattern (the one that shapes the
|
|
316
|
+
overall flow) and SECONDARY patterns (the ones that apply within specific
|
|
317
|
+
steps).
|