opencodekit 0.23.2 → 0.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -14
- package/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +92 -19
- package/dist/template/.opencode/README.md +43 -6
- package/dist/template/.opencode/artifacts/harness-workflows/plan.md +317 -0
- package/dist/template/.opencode/command/audit.md +65 -0
- package/dist/template/.opencode/command/init.md +19 -2
- package/dist/template/.opencode/command/research.md +67 -16
- package/dist/template/.opencode/command/ship.md +55 -5
- package/dist/template/.opencode/command/verify.md +5 -5
- package/dist/template/.opencode/opencode.json +12 -0
- package/dist/template/.opencode/plugin/README.md +0 -6
- package/dist/template/.opencode/plugin/codesearch.ts +730 -0
- package/dist/template/.opencode/plugin/memory/tools.ts +6 -6
- package/dist/template/.opencode/plugin/session-summary.ts +0 -2
- package/dist/template/.opencode/plugin/srcwalk.ts +22 -157
- package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +1 -1
- package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +1 -1
- package/dist/template/.opencode/skill/deep-module-design/SKILL.md +1 -1
- package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +0 -2
- package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +11 -9
- package/dist/template/.opencode/skill/manifest.json +77 -0
- package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +1 -1
- package/dist/template/.opencode/skill/srcwalk/SKILL.md +10 -13
- package/dist/template/.opencode/tool/grepsearch.ts +92 -103
- package/dist/template/.opencode/workflows/audit-pattern.md +51 -0
- package/dist/template/.opencode/workflows/batch-implement.md +82 -0
- package/dist/template/.opencode/workflows/deep-research.md +58 -0
- package/dist/template/.opencode/workflows/development-lifecycle-workflow.md +129 -0
- package/package.json +1 -1
- package/dist/template/.opencode/command/clarify.md +0 -46
- package/dist/template/.opencode/command/commit.md +0 -53
- package/dist/template/.opencode/command/design.md +0 -129
- package/dist/template/.opencode/command/explore.md +0 -169
- package/dist/template/.opencode/command/improve-architecture.md +0 -55
- package/dist/template/.opencode/command/pr.md +0 -148
- package/dist/template/.opencode/command/refactor.md +0 -65
- package/dist/template/.opencode/command/review-codebase.md +0 -128
- package/dist/template/.opencode/command/test.md +0 -66
- package/dist/template/.opencode/command/ui-review.md +0 -109
- package/dist/template/.opencode/opencodex-fast.jsonc +0 -3
- package/dist/template/.opencode/plugin/rtk.ts +0 -43
- package/dist/template/.opencode/skill/agent-teams/SKILL.md +0 -268
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +0 -142
- package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +0 -135
- package/dist/template/.opencode/skill/condition-based-waiting/example.ts +0 -171
- package/dist/template/.opencode/skill/context-engineering/SKILL.md +0 -176
- package/dist/template/.opencode/skill/memory-system/SKILL.md +0 -147
- package/dist/template/.opencode/skill/structured-edit/SKILL.md +0 -191
- package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +0 -184
- package/dist/template/.opencode/skill/v0/SKILL.md +0 -158
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: structured-edit
|
|
3
|
-
description: Use when editing files to reduce str_replace failures - combines LSP location with read-verify-edit pattern for reliable edits
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
tags: [code-quality, workflow]
|
|
6
|
-
dependencies: []
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Structured Edit Protocol
|
|
10
|
-
|
|
11
|
-
## When to Use
|
|
12
|
-
|
|
13
|
-
- Editing files where exact string matches are error-prone (e.g., str_replace failures)
|
|
14
|
-
- Making targeted changes that require precise location and verification
|
|
15
|
-
|
|
16
|
-
## When NOT to Use
|
|
17
|
-
|
|
18
|
-
- One-line edits where a direct edit is safe and unambiguous
|
|
19
|
-
- Large refactors better served by full rewrites or file splits
|
|
20
|
-
|
|
21
|
-
## Common Rationalizations
|
|
22
|
-
|
|
23
|
-
| Rationalization | Rebuttal |
|
|
24
|
-
| ------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
25
|
-
| "I remember what the file looks like" | You remember what it looked like 5 edits ago. Read it fresh |
|
|
26
|
-
| "The edit is simple, I don't need to verify" | Simple edits fail most often — whitespace, encoding, duplicate matches |
|
|
27
|
-
| "LSP lookup is an extra step I can skip" | LSP takes 1 call. Retrying a failed edit takes 3-5 calls |
|
|
28
|
-
| "I'll just use a larger context block to be safe" | Larger blocks = more chances for invisible character mismatches. Use minimal unique context |
|
|
29
|
-
| "The file hasn't changed since I last read it" | Other edits, formatters, and git operations can modify files between your reads |
|
|
30
|
-
|
|
31
|
-
## Overview
|
|
32
|
-
|
|
33
|
-
The `str_replace` edit tool is the #1 source of failures in LLM coding. Models reproduce content with subtle differences (whitespace, encoding, line endings) causing "string not found" errors.
|
|
34
|
-
|
|
35
|
-
**Core principle:** Don't guess content — locate, read, verify, then edit.
|
|
36
|
-
|
|
37
|
-
## Why This Exists
|
|
38
|
-
|
|
39
|
-
`str_replace` failures happen when:
|
|
40
|
-
|
|
41
|
-
| Cause | Example |
|
|
42
|
-
| -------------------- | ------------------------------------------ |
|
|
43
|
-
| Whitespace mismatch | Tabs vs spaces, trailing spaces |
|
|
44
|
-
| Content changed | File modified since last read |
|
|
45
|
-
| Multiple matches | Same string appears twice in file |
|
|
46
|
-
| Encoding differences | Line endings (CRLF vs LF), invisible chars |
|
|
47
|
-
| Stale context | Editing from memory instead of fresh read |
|
|
48
|
-
|
|
49
|
-
**Result:** Wasted tokens on retries, frustrated developers, broken workflows.
|
|
50
|
-
|
|
51
|
-
## The Protocol
|
|
52
|
-
|
|
53
|
-
### Step 1: LOCATE
|
|
54
|
-
|
|
55
|
-
Use LSP to find exact positions instead of guessing:
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
// Find where a function is defined
|
|
59
|
-
lsp({ operation: "goToDefinition", filePath, line, character });
|
|
60
|
-
|
|
61
|
-
// Find all references to a symbol
|
|
62
|
-
lsp({ operation: "findReferences", filePath, line, character });
|
|
63
|
-
|
|
64
|
-
// Get all symbols in a file
|
|
65
|
-
lsp({ operation: "documentSymbol", filePath, line: 1, character: 1 });
|
|
66
|
-
|
|
67
|
-
// Search for symbol across workspace
|
|
68
|
-
lsp({ operation: "workspaceSymbol", filePath, line: 1, character: 1 });
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Step 2: READ
|
|
72
|
-
|
|
73
|
-
Get fresh file content at the located position:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
// Read context around target line
|
|
77
|
-
read({ filePath, offset: line - 10, limit: 30 });
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Always include context** — don't just read the target line.
|
|
81
|
-
|
|
82
|
-
### Step 3: VERIFY
|
|
83
|
-
|
|
84
|
-
Confirm expected content exists at the location:
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
// Check that what you expect is actually there
|
|
88
|
-
if (!content.includes(expectedSubstring)) {
|
|
89
|
-
// STOP — investigate before proceeding
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Step 4: EDIT
|
|
94
|
-
|
|
95
|
-
Apply minimal, scoped change with unique context:
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
// Include enough surrounding lines for uniqueness
|
|
99
|
-
edit({
|
|
100
|
-
filePath,
|
|
101
|
-
oldString: " // unique context before\n targetLine\n // unique context after",
|
|
102
|
-
newString: " // unique context before\n modifiedLine\n // unique context after",
|
|
103
|
-
});
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**Guidelines:**
|
|
107
|
-
|
|
108
|
-
- Include 2-3 lines before/after for uniqueness
|
|
109
|
-
- Never use just the target line
|
|
110
|
-
- Keep oldString minimal but unique
|
|
111
|
-
|
|
112
|
-
### Step 5: CONFIRM
|
|
113
|
-
|
|
114
|
-
Verify the edit succeeded:
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
// Read back the modified section
|
|
118
|
-
read({ filePath, offset: line - 5, limit: 15 });
|
|
119
|
-
|
|
120
|
-
// Confirm content matches intent
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Red Flags — STOP
|
|
124
|
-
|
|
125
|
-
If you catch yourself:
|
|
126
|
-
|
|
127
|
-
- Editing without reading first
|
|
128
|
-
- Assuming content hasn't changed
|
|
129
|
-
- Using large multi-line oldString values
|
|
130
|
-
- Skipping the verify step
|
|
131
|
-
- Guessing line numbers without LSP
|
|
132
|
-
|
|
133
|
-
**STOP.** Return to Step 1.
|
|
134
|
-
|
|
135
|
-
## Best Practices
|
|
136
|
-
|
|
137
|
-
### File Size Matters
|
|
138
|
-
|
|
139
|
-
From research on the "harness problem":
|
|
140
|
-
|
|
141
|
-
| File Size | Strategy |
|
|
142
|
-
| ------------- | ------------------------------------------ |
|
|
143
|
-
| < 100 lines | Full rewrite often easier than str_replace |
|
|
144
|
-
| 100-400 lines | Structured edit with good context |
|
|
145
|
-
| > 400 lines | Strongly prefer structured edits |
|
|
146
|
-
|
|
147
|
-
**Prefer smaller files** — composition over monoliths.
|
|
148
|
-
|
|
149
|
-
### Unique Context Selection
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
// BAD: Non-unique, whitespace-sensitive
|
|
153
|
-
oldString: "return result;";
|
|
154
|
-
|
|
155
|
-
// GOOD: Unique with surrounding context
|
|
156
|
-
oldString: " // Calculate final value\n const result = compute(input);\n return result;";
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### When to Use LSP vs Direct
|
|
160
|
-
|
|
161
|
-
| Scenario | Approach |
|
|
162
|
-
| ------------------------- | --------------------- |
|
|
163
|
-
| Finding function/class | LSP goToDefinition |
|
|
164
|
-
| Finding all usages | LSP findReferences |
|
|
165
|
-
| Modifying specific symbol | LSP + structured edit |
|
|
166
|
-
| Large refactoring | Consider full rewrite |
|
|
167
|
-
| Simple one-line change | Direct edit OK |
|
|
168
|
-
|
|
169
|
-
## Integration with Other Skills
|
|
170
|
-
|
|
171
|
-
**Use with:**
|
|
172
|
-
|
|
173
|
-
- `verification-before-completion` — Always verify edits succeeded
|
|
174
|
-
- `systematic-debugging` — When edit failures indicate deeper issues
|
|
175
|
-
- `defense-in-depth` — Add validation after structural changes
|
|
176
|
-
|
|
177
|
-
## Quick Reference
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
LOCATE → lsp({ operation: "goToDefinition" | "findReferences", ... })
|
|
181
|
-
READ → read({ filePath, offset: line-10, limit: 30 })
|
|
182
|
-
VERIFY → Check expected content exists
|
|
183
|
-
EDIT → edit({ oldString: "...unique context...", newString: "..." })
|
|
184
|
-
CONFIRM → read() again to verify success
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## The Bottom Line
|
|
188
|
-
|
|
189
|
-
**Don't trust your memory. Don't guess content. Locate, read, verify, edit, confirm.**
|
|
190
|
-
|
|
191
|
-
This protocol eliminates the #1 source of LLM coding failures.
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ubiquitous-language
|
|
3
|
-
description: Establishes and maintains shared vocabulary across codebase, context files, and team conversation — inspired by Evans' Domain-Driven Design and Pocock's AI agent glossary technique. Use when terms are ambiguous, the AI does the wrong thing, or you need to align code with domain concepts.
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
tags: [architecture, domain-driven-design, ai-workflow]
|
|
6
|
-
dependencies: []
|
|
7
|
-
agent_types: [planner, scout]
|
|
8
|
-
tools: [srcwalk_search, grep, memory]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Ubiquitous Language
|
|
12
|
-
|
|
13
|
-
> Based on Eric Evans' *Domain-Driven Design* and Matt Pocock's AI-agent glossary technique
|
|
14
|
-
|
|
15
|
-
## Overview
|
|
16
|
-
|
|
17
|
-
A ubiquitous language is a **shared vocabulary** that is used consistently across:
|
|
18
|
-
|
|
19
|
-
- **Code** — types, classes, functions, modules, files
|
|
20
|
-
- **Conversation** — how developers and domain experts talk about the system
|
|
21
|
-
- **AI context** — AGENTS.md, CLAUDE.md, and other files that guide AI agents
|
|
22
|
-
- **Specs and docs** — PRDs, design docs, specifications
|
|
23
|
-
|
|
24
|
-
When these four use the same words for the same concepts, communication is precise, AI agents produce correct code more often, and the "wrong thing" failure mode is dramatically reduced.
|
|
25
|
-
|
|
26
|
-
When they diverge, every translation gap is a bug waiting to happen.
|
|
27
|
-
|
|
28
|
-
> *"Conversations among developers and expressions of the code are all derived from the same domain model."* — Eric Evans
|
|
29
|
-
|
|
30
|
-
**Why this matters for AI agents:** Matt Pocock demonstrated that feeding a structured glossary (extracted from the codebase) as persistent context to an LLM reduces verbose reasoning and aligns implementation more closely with intent. Ubiquitous language isn't a documentation luxury — it's a direct input into AI correctness.
|
|
31
|
-
|
|
32
|
-
## When to Use
|
|
33
|
-
|
|
34
|
-
- Terms are used interchangeably that shouldn't be ("User" vs "Account" vs "Profile")
|
|
35
|
-
- AI agents consistently implement the wrong concept
|
|
36
|
-
- Specs use different vocabulary than the codebase
|
|
37
|
-
- Starting a new domain module that needs clear boundaries
|
|
38
|
-
- Onboarding new developers or agents who need to learn the vocabulary
|
|
39
|
-
- The codebase has multiple ways to refer to the same domain concept
|
|
40
|
-
|
|
41
|
-
## When NOT to Use
|
|
42
|
-
|
|
43
|
-
- Trivial utilities with no domain concept at stake
|
|
44
|
-
- Short-lived spike code
|
|
45
|
-
- Already consistent codebases with clear terminology (maintain, don't re-engineer)
|
|
46
|
-
|
|
47
|
-
## Core Principle
|
|
48
|
-
|
|
49
|
-
> **Every concept in the domain should have exactly one name in the codebase.**
|
|
50
|
-
|
|
51
|
-
If two terms mean the same thing, consolidate. If one term means two different things, split them into separate concepts with separate names.
|
|
52
|
-
|
|
53
|
-
## Technique 1: Glossary Extraction
|
|
54
|
-
|
|
55
|
-
### From Codebase
|
|
56
|
-
|
|
57
|
-
Scan the codebase for key terms and build a glossary:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
src/
|
|
61
|
-
types/ → Extract type/interface names
|
|
62
|
-
models/ → Extract model/entity names
|
|
63
|
-
routes/ → Extract resource names from URL patterns
|
|
64
|
-
services/ → Extract domain operation names
|
|
65
|
-
commands/ → Extract command/mutation names
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Automated approach:**
|
|
69
|
-
```bash
|
|
70
|
-
# Extract type definitions (TypeScript example)
|
|
71
|
-
grep -rn "^export (type|interface|class|enum) " src/ --include='*.ts' |
|
|
72
|
-
cut -d' ' -f3- | sort -u
|
|
73
|
-
|
|
74
|
-
# Extract module/file names that correspond to domain concepts
|
|
75
|
-
ls -d src/models/*/ | xargs -I{} basename {} | sort -u
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### From AGENTS.md / Context Files
|
|
79
|
-
|
|
80
|
-
Every term used in your AGENTS.md or CLAUDE.md should map to a code symbol. Cross-reference:
|
|
81
|
-
|
|
82
|
-
1. List every capitalized noun phrase in AGENTS.md
|
|
83
|
-
2. Search the codebase for each phrase
|
|
84
|
-
3. For mismatches: either rename the code symbol or update the context file
|
|
85
|
-
|
|
86
|
-
### Glossary Table Format
|
|
87
|
-
|
|
88
|
-
```markdown
|
|
89
|
-
## Glossary
|
|
90
|
-
|
|
91
|
-
| Term | Definition | Code Symbol | Context |
|
|
92
|
-
|------|------------|-------------|---------|
|
|
93
|
-
| Order | A customer's purchase request in PENDING state | `Order` class, `orders` table | Checkout context |
|
|
94
|
-
| OrderFulfillment | The shipping/delivery of items for an Order | `Fulfillment` class, `fulfillments` table | Fulfillment context |
|
|
95
|
-
| User | An authenticated person using the system | `User` model, `users` table | Auth context |
|
|
96
|
-
| Account | A User's billing/subscription profile | `Account` model, `accounts` table | Billing context |
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Technique 2: Bounded Context Mapping
|
|
100
|
-
|
|
101
|
-
In DDD, the same term can mean different things in different contexts. The "Ubiquitous" in "Ubiquitous Language" is bounded — it applies *within* one context, not globally.
|
|
102
|
-
|
|
103
|
-
**Example:** An "Order" in the **Checkout** context means "pending payment." An "Order" in the **Fulfillment** context means "packed and shipped." These are different concepts that happen to share a name.
|
|
104
|
-
|
|
105
|
-
### When Contexts Conflict
|
|
106
|
-
|
|
107
|
-
| Option | When | Tradeoff |
|
|
108
|
-
|---|---|---|
|
|
109
|
-
| **Split the term** | Different behaviors, data, lifecycle | Clearer but more types to manage |
|
|
110
|
-
| **Keep one term, document the phases** | Same entity, different states | Simpler but confusion at boundaries |
|
|
111
|
-
| **Use sub-types** | Shared core with context-specific properties | Precise but more complex |
|
|
112
|
-
|
|
113
|
-
**Default:** Split the term if the two contexts never share code. Keep one term if they share a code path.
|
|
114
|
-
|
|
115
|
-
## Technique 3: Glossary as AI Context
|
|
116
|
-
|
|
117
|
-
This technique — from Matt Pocock's AI Engineer Summit talk — directly improves AI agent output:
|
|
118
|
-
|
|
119
|
-
1. **Extract** your glossary from the codebase (Technique 1)
|
|
120
|
-
2. **Format** it as a markdown table in your AGENTS.md or a dedicated `.md` file
|
|
121
|
-
3. **Persist** it — include it in every prompt or reference it from context files
|
|
122
|
-
4. **Read thinking traces** — when the LLM uses a term incorrectly, update the glossary
|
|
123
|
-
|
|
124
|
-
### Example: Glossary Section in AGENTS.md
|
|
125
|
-
|
|
126
|
-
```markdown
|
|
127
|
-
## Glossary
|
|
128
|
-
|
|
129
|
-
- **Order** = `src/orders/Order.ts` — purchase request in PENDING state
|
|
130
|
-
- **Invoice** = `src/billing/Invoice.ts` — billing record generated from Order
|
|
131
|
-
- **Shipment** = `src/fulfillment/Shipment.ts` — physical delivery of items
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Why This Works
|
|
135
|
-
|
|
136
|
-
Pocock observed that reading the model's thinking traces confirmed this technique:
|
|
137
|
-
|
|
138
|
-
- **Reduces verbose reasoning** — the AI doesn't have to infer what a term means from context
|
|
139
|
-
- **Aligns implementation with intent** — the AI uses the correct code symbols from the start
|
|
140
|
-
- **Prevents drift** — the glossary is extracted from truth (the codebase), not from conversation
|
|
141
|
-
|
|
142
|
-
## Technique 4: Detecting Language Drift
|
|
143
|
-
|
|
144
|
-
Over time, vocabulary naturally diverges. Watch for:
|
|
145
|
-
|
|
146
|
-
| Signal | What to do |
|
|
147
|
-
|---|---|
|
|
148
|
-
| AI generates a new term the codebase doesn't use | Update the glossary or rename the generated code |
|
|
149
|
-
| Two developers use different names for the same concept | Align on one name, update code and context |
|
|
150
|
-
| AGENTS.md mentions a term not found in code | Add the code symbol or remove the stale term |
|
|
151
|
-
| Same term used for different concepts in code | Refactor or split the type |
|
|
152
|
-
| PR review consistently corrects naming | Create a glossary entry and enforce it |
|
|
153
|
-
|
|
154
|
-
### Drift Check Frequency
|
|
155
|
-
|
|
156
|
-
- **Per sprint** — scan for new terms in code vs AGENTS.md
|
|
157
|
-
- **Per AI session** — check that AGENTS.md terms match the module you're working in
|
|
158
|
-
- **Per refactor** — regenerate the glossary when domain types change
|
|
159
|
-
|
|
160
|
-
## Output Checklist
|
|
161
|
-
|
|
162
|
-
- [ ] Glossary extracted from codebase: types, modules, routes, domain operations
|
|
163
|
-
- [ ] AGENTS.md vocabulary cross-referenced against code symbols
|
|
164
|
-
- [ ] Bounded contexts identified where same term has different meanings
|
|
165
|
-
- [ ] Glossary formatted and persisted for AI context
|
|
166
|
-
- [ ] Language drift signals documented for ongoing maintenance
|
|
167
|
-
|
|
168
|
-
## See Also
|
|
169
|
-
|
|
170
|
-
- **spec-driven-development** — Define vocabulary in the spec before implementation
|
|
171
|
-
- **deep-module-design** — Module boundaries align with bounded contexts
|
|
172
|
-
- **memory-system** — Persist glossary for cross-session AI context
|
|
173
|
-
|
|
174
|
-
## Skill Result Contract
|
|
175
|
-
|
|
176
|
-
```xml
|
|
177
|
-
<skill_result>
|
|
178
|
-
<skill>ubiquitous-language</skill>
|
|
179
|
-
<status>success|partial|blocked|failure</status>
|
|
180
|
-
<evidence>Glossary generated, cross-references checked, bounded contexts mapped</evidence>
|
|
181
|
-
<artifacts>Glossary file, AGENTS.md updates, detected drifts</artifacts>
|
|
182
|
-
<risks>Unaligned terms deferred, contexts not fully mapped, or none</risks>
|
|
183
|
-
</skill_result>
|
|
184
|
-
```
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: v0
|
|
3
|
-
description: Use when you need AI-powered UI generation for React components, dashboards, or quick prototypes via v0. MUST load before creating v0 chats or generating components via v0 MCP.
|
|
4
|
-
mcp:
|
|
5
|
-
v0:
|
|
6
|
-
command: npx
|
|
7
|
-
args: ["mcp-remote", "https://mcp.v0.dev", "--header", "Authorization: Bearer ${V0_API_KEY}"]
|
|
8
|
-
env:
|
|
9
|
-
V0_API_KEY: "${V0_API_KEY}"
|
|
10
|
-
version: 1.0.0
|
|
11
|
-
tags: [ui, mcp, design]
|
|
12
|
-
dependencies: []
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# v0 AI Code Generation (MCP)
|
|
16
|
-
|
|
17
|
-
## When to Use
|
|
18
|
-
|
|
19
|
-
- When you need AI-generated UI components or chat-based design iteration via v0.
|
|
20
|
-
|
|
21
|
-
## When NOT to Use
|
|
22
|
-
|
|
23
|
-
- When you need to implement UI from a fixed design system without AI generation.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Prerequisites
|
|
27
|
-
|
|
28
|
-
Set your v0 API key as an environment variable:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
export V0_API_KEY="your-v0-api-key"
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
To get your v0 API key:
|
|
35
|
-
|
|
36
|
-
1. Go to [v0 account settings](https://v0.app/chat/settings/keys)
|
|
37
|
-
2. Create a new API key
|
|
38
|
-
3. Copy and set as environment variable
|
|
39
|
-
|
|
40
|
-
## Quick Start
|
|
41
|
-
|
|
42
|
-
After loading this skill, list available tools:
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
skill_mcp(skill_name="v0", list_tools=true)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Then invoke tools:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
skill_mcp(skill_name="v0", tool_name="create_chat", arguments='{"prompt": "Create a React dashboard component with a sidebar"}')
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Available Tools
|
|
55
|
-
|
|
56
|
-
### create_chat
|
|
57
|
-
|
|
58
|
-
Create a new v0 chat with a prompt.
|
|
59
|
-
|
|
60
|
-
| Parameter | Type | Required | Description |
|
|
61
|
-
| --------- | ------ | -------- | ---------------------------------- |
|
|
62
|
-
| `prompt` | string | Yes | The prompt for v0 to generate code |
|
|
63
|
-
|
|
64
|
-
**Example:**
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
skill_mcp(skill_name="v0", tool_name="create_chat", arguments='{"prompt": "Build a responsive navbar with dark mode toggle"}')
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### get_chat
|
|
71
|
-
|
|
72
|
-
Get details about an existing chat.
|
|
73
|
-
|
|
74
|
-
| Parameter | Type | Required | Description |
|
|
75
|
-
| --------- | ------ | -------- | -------------- |
|
|
76
|
-
| `chatId` | string | Yes | The v0 chat ID |
|
|
77
|
-
|
|
78
|
-
**Example:**
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
skill_mcp(skill_name="v0", tool_name="get_chat", arguments='{"chatId": "abc123"}')
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### find_chats
|
|
85
|
-
|
|
86
|
-
Search through your v0 chats.
|
|
87
|
-
|
|
88
|
-
| Parameter | Type | Required | Description |
|
|
89
|
-
| --------- | ------ | -------- | ------------ |
|
|
90
|
-
| `query` | string | No | Search query |
|
|
91
|
-
|
|
92
|
-
**Example:**
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
skill_mcp(skill_name="v0", tool_name="find_chats", arguments='{"query": "React components"}')
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### send_message
|
|
99
|
-
|
|
100
|
-
Continue a conversation in an existing chat.
|
|
101
|
-
|
|
102
|
-
| Parameter | Type | Required | Description |
|
|
103
|
-
| --------- | ------ | -------- | --------------- |
|
|
104
|
-
| `chatId` | string | Yes | The v0 chat ID |
|
|
105
|
-
| `message` | string | Yes | Message to send |
|
|
106
|
-
|
|
107
|
-
**Example:**
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
skill_mcp(skill_name="v0", tool_name="send_message", arguments='{"chatId": "abc123", "message": "Add dark mode support"}')
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Workflow
|
|
114
|
-
|
|
115
|
-
### 1. Generate a New Component
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
# Create a new chat with your requirements
|
|
119
|
-
skill_mcp(skill_name="v0", tool_name="create_chat", arguments='{"prompt": "Create a modern pricing table with 3 tiers using Tailwind CSS"}')
|
|
120
|
-
|
|
121
|
-
# The response includes a chat ID and generated code
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### 2. Iterate on Design
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
# Send follow-up messages to refine
|
|
128
|
-
skill_mcp(skill_name="v0", tool_name="send_message", arguments='{"chatId": "chat-id-here", "message": "Make the recommended tier more prominent with a gradient border"}')
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 3. Search Previous Work
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
# Find relevant previous chats
|
|
135
|
-
skill_mcp(skill_name="v0", tool_name="find_chats", arguments='{"query": "dashboard"}')
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Use Cases
|
|
139
|
-
|
|
140
|
-
- **Component Generation**: Create React/Next.js components from descriptions
|
|
141
|
-
- **UI Prototyping**: Rapidly prototype UI ideas
|
|
142
|
-
- **Design Iteration**: Refine designs through conversation
|
|
143
|
-
- **Code Assistance**: Get help with Tailwind CSS, responsive design, etc.
|
|
144
|
-
|
|
145
|
-
## Tips
|
|
146
|
-
|
|
147
|
-
- **Be specific** in prompts - include framework (React, Next.js), styling (Tailwind, CSS), and functionality details
|
|
148
|
-
- **Iterate** using `send_message` rather than creating new chats for refinements
|
|
149
|
-
- **Search first** with `find_chats` to reuse previous work
|
|
150
|
-
- **Include context** about your existing design system or component patterns
|
|
151
|
-
|
|
152
|
-
## Troubleshooting
|
|
153
|
-
|
|
154
|
-
**"Invalid API key"**: Ensure `V0_API_KEY` environment variable is set correctly.
|
|
155
|
-
|
|
156
|
-
**"Rate limit exceeded"**: v0 has usage limits. Wait a few minutes or check your plan.
|
|
157
|
-
|
|
158
|
-
**"Chat not found"**: Verify the chat ID is correct. Use `find_chats` to list available chats.
|