ai-eng-system 0.0.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.
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/.claude-plugin/agents/agent-creator.md +206 -0
- package/dist/.claude-plugin/agents/ai_engineer.md +187 -0
- package/dist/.claude-plugin/agents/api_builder_enhanced.md +82 -0
- package/dist/.claude-plugin/agents/architect-advisor.md +88 -0
- package/dist/.claude-plugin/agents/backend_architect.md +88 -0
- package/dist/.claude-plugin/agents/code_reviewer.md +208 -0
- package/dist/.claude-plugin/agents/command-creator.md +331 -0
- package/dist/.claude-plugin/agents/cost_optimizer.md +284 -0
- package/dist/.claude-plugin/agents/database_optimizer.md +175 -0
- package/dist/.claude-plugin/agents/deployment_engineer.md +186 -0
- package/dist/.claude-plugin/agents/docs-writer.md +99 -0
- package/dist/.claude-plugin/agents/documentation_specialist.md +212 -0
- package/dist/.claude-plugin/agents/frontend-reviewer.md +51 -0
- package/dist/.claude-plugin/agents/full_stack_developer.md +391 -0
- package/dist/.claude-plugin/agents/infrastructure_builder.md +77 -0
- package/dist/.claude-plugin/agents/java-pro.md +182 -0
- package/dist/.claude-plugin/agents/ml_engineer.md +176 -0
- package/dist/.claude-plugin/agents/monitoring_expert.md +79 -0
- package/dist/.claude-plugin/agents/performance_engineer.md +193 -0
- package/dist/.claude-plugin/agents/plugin-validator.md +378 -0
- package/dist/.claude-plugin/agents/prompt-optimizer.md +63 -0
- package/dist/.claude-plugin/agents/security_scanner.md +332 -0
- package/dist/.claude-plugin/agents/seo-specialist.md +73 -0
- package/dist/.claude-plugin/agents/skill-creator.md +311 -0
- package/dist/.claude-plugin/agents/test-docs-writer-2.md +46 -0
- package/dist/.claude-plugin/agents/test-docs-writer-usage.md +40 -0
- package/dist/.claude-plugin/agents/test-docs-writer.md +98 -0
- package/dist/.claude-plugin/agents/test_generator.md +260 -0
- package/dist/.claude-plugin/agents/tool-creator.md +474 -0
- package/dist/.claude-plugin/commands/compound.md +26 -0
- package/dist/.claude-plugin/commands/context.md +318 -0
- package/dist/.claude-plugin/commands/create-agent.md +48 -0
- package/dist/.claude-plugin/commands/create-command.md +48 -0
- package/dist/.claude-plugin/commands/create-plugin.md +400 -0
- package/dist/.claude-plugin/commands/create-skill.md +48 -0
- package/dist/.claude-plugin/commands/create-tool.md +53 -0
- package/dist/.claude-plugin/commands/deploy.md +35 -0
- package/dist/.claude-plugin/commands/optimize.md +79 -0
- package/dist/.claude-plugin/commands/plan.md +215 -0
- package/dist/.claude-plugin/commands/recursive-init.md +217 -0
- package/dist/.claude-plugin/commands/research.md +199 -0
- package/dist/.claude-plugin/commands/review.md +73 -0
- package/dist/.claude-plugin/commands/seo.md +40 -0
- package/dist/.claude-plugin/commands/work.md +460 -0
- package/dist/.claude-plugin/hooks.json +15 -0
- package/dist/.claude-plugin/marketplace.json +54 -0
- package/dist/.claude-plugin/plugin.json +24 -0
- package/dist/.claude-plugin/skills/AGENTS.md +37 -0
- package/dist/.claude-plugin/skills/devops/coolify-deploy/SKILL.md +8 -0
- package/dist/.claude-plugin/skills/devops/git-worktree/SKILL.md +11 -0
- package/dist/.claude-plugin/skills/plugin-dev/SKILL.md +322 -0
- package/dist/.claude-plugin/skills/plugin-dev/references/agent-format.md +248 -0
- package/dist/.claude-plugin/skills/plugin-dev/references/claude-code-plugins.md +372 -0
- package/dist/.claude-plugin/skills/plugin-dev/references/command-format.md +312 -0
- package/dist/.claude-plugin/skills/plugin-dev/references/opencode-plugins.md +406 -0
- package/dist/.claude-plugin/skills/plugin-dev/references/opencode-tools.md +470 -0
- package/dist/.claude-plugin/skills/plugin-dev/references/skill-format.md +328 -0
- package/dist/.claude-plugin/skills/prompting/incentive-prompting/SKILL.md +162 -0
- package/dist/.claude-plugin/skills/research/comprehensive-research/SKILL.md +343 -0
- package/dist/.opencode/agent/ai-eng/ai-innovation/ai_engineer.md +186 -0
- package/dist/.opencode/agent/ai-eng/ai-innovation/ml_engineer.md +175 -0
- package/dist/.opencode/agent/ai-eng/ai-innovation/prompt-optimizer.md +62 -0
- package/dist/.opencode/agent/ai-eng/business-analytics/seo-specialist.md +72 -0
- package/dist/.opencode/agent/ai-eng/development/api_builder_enhanced.md +81 -0
- package/dist/.opencode/agent/ai-eng/development/architect-advisor.md +87 -0
- package/dist/.opencode/agent/ai-eng/development/backend_architect.md +87 -0
- package/dist/.opencode/agent/ai-eng/development/database_optimizer.md +174 -0
- package/dist/.opencode/agent/ai-eng/development/docs-writer.md +98 -0
- package/dist/.opencode/agent/ai-eng/development/documentation_specialist.md +211 -0
- package/dist/.opencode/agent/ai-eng/development/frontend-reviewer.md +50 -0
- package/dist/.opencode/agent/ai-eng/development/full_stack_developer.md +390 -0
- package/dist/.opencode/agent/ai-eng/development/java-pro.md +181 -0
- package/dist/.opencode/agent/ai-eng/development/test-docs-writer-2.md +45 -0
- package/dist/.opencode/agent/ai-eng/development/test-docs-writer-usage.md +39 -0
- package/dist/.opencode/agent/ai-eng/development/test-docs-writer.md +97 -0
- package/dist/.opencode/agent/ai-eng/meta/agent-creator.md +208 -0
- package/dist/.opencode/agent/ai-eng/meta/command-creator.md +333 -0
- package/dist/.opencode/agent/ai-eng/meta/skill-creator.md +313 -0
- package/dist/.opencode/agent/ai-eng/meta/tool-creator.md +476 -0
- package/dist/.opencode/agent/ai-eng/operations/cost_optimizer.md +283 -0
- package/dist/.opencode/agent/ai-eng/operations/deployment_engineer.md +185 -0
- package/dist/.opencode/agent/ai-eng/operations/infrastructure_builder.md +76 -0
- package/dist/.opencode/agent/ai-eng/operations/monitoring_expert.md +78 -0
- package/dist/.opencode/agent/ai-eng/quality-testing/code_reviewer.md +207 -0
- package/dist/.opencode/agent/ai-eng/quality-testing/performance_engineer.md +192 -0
- package/dist/.opencode/agent/ai-eng/quality-testing/plugin-validator.md +380 -0
- package/dist/.opencode/agent/ai-eng/quality-testing/security_scanner.md +331 -0
- package/dist/.opencode/agent/ai-eng/quality-testing/test_generator.md +259 -0
- package/dist/.opencode/command/ai-eng/compound.md +26 -0
- package/dist/.opencode/command/ai-eng/context.md +318 -0
- package/dist/.opencode/command/ai-eng/create-agent.md +48 -0
- package/dist/.opencode/command/ai-eng/create-command.md +48 -0
- package/dist/.opencode/command/ai-eng/create-plugin.md +400 -0
- package/dist/.opencode/command/ai-eng/create-skill.md +48 -0
- package/dist/.opencode/command/ai-eng/create-tool.md +53 -0
- package/dist/.opencode/command/ai-eng/deploy.md +35 -0
- package/dist/.opencode/command/ai-eng/optimize.md +79 -0
- package/dist/.opencode/command/ai-eng/plan.md +215 -0
- package/dist/.opencode/command/ai-eng/recursive-init.md +217 -0
- package/dist/.opencode/command/ai-eng/research.md +199 -0
- package/dist/.opencode/command/ai-eng/review.md +73 -0
- package/dist/.opencode/command/ai-eng/seo.md +40 -0
- package/dist/.opencode/command/ai-eng/work.md +460 -0
- package/dist/.opencode/opencode.jsonc +8 -0
- package/dist/.opencode/plugin/ai-eng-system.ts +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -0
- package/dist/skills/AGENTS.md +37 -0
- package/dist/skills/devops/coolify-deploy/SKILL.md +8 -0
- package/dist/skills/devops/git-worktree/SKILL.md +11 -0
- package/dist/skills/plugin-dev/SKILL.md +322 -0
- package/dist/skills/plugin-dev/references/agent-format.md +248 -0
- package/dist/skills/plugin-dev/references/claude-code-plugins.md +372 -0
- package/dist/skills/plugin-dev/references/command-format.md +312 -0
- package/dist/skills/plugin-dev/references/opencode-plugins.md +406 -0
- package/dist/skills/plugin-dev/references/opencode-tools.md +470 -0
- package/dist/skills/plugin-dev/references/skill-format.md +328 -0
- package/dist/skills/prompting/incentive-prompting/SKILL.md +162 -0
- package/dist/skills/research/comprehensive-research/SKILL.md +343 -0
- package/package.json +73 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
# OpenCode Plugin System
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
OpenCode extensions use a different but equally powerful system based on plugins, commands, agents, skills, and custom tools. Understanding this system enables creating well-organized extensions that integrate seamlessly with OpenCode.
|
|
6
|
+
|
|
7
|
+
## Directory Structure
|
|
8
|
+
|
|
9
|
+
Every OpenCode extension follows this organizational pattern:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
project/
|
|
13
|
+
├── .opencode/
|
|
14
|
+
│ ├── plugin/ # Plugin code (TypeScript)
|
|
15
|
+
│ ├── command/ # Slash commands (.md files)
|
|
16
|
+
│ ├── agent/ # Agent definitions (.md files)
|
|
17
|
+
│ └── tool/ # Custom tools (TypeScript files)
|
|
18
|
+
├── .opencode/skills/ # Skills (auto-discovered)
|
|
19
|
+
└── opencode.json # Configuration (optional)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Critical Rules
|
|
23
|
+
|
|
24
|
+
1. **Plugin Code**: TypeScript files in `.opencode/plugin/`
|
|
25
|
+
2. **Component Locations**: Commands, agents in `.opencode/` with table format
|
|
26
|
+
3. **Skills**: Auto-discovered by opencode-skills plugin from `.opencode/skills/`
|
|
27
|
+
4. **Naming Convention**: Use kebab-case for all file names
|
|
28
|
+
|
|
29
|
+
## Plugin System
|
|
30
|
+
|
|
31
|
+
### Plugin Structure
|
|
32
|
+
|
|
33
|
+
Plugins are TypeScript modules that extend OpenCode:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import type { Plugin } from "@opencode-ai/plugin"
|
|
37
|
+
|
|
38
|
+
const plugin: Plugin = async ({ project, client, $, directory, worktree }) => {
|
|
39
|
+
console.log("Plugin loaded")
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
// Plugin hooks and tools here
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default plugin
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Plugin Events
|
|
50
|
+
|
|
51
|
+
OpenCode plugins can hook into various events:
|
|
52
|
+
|
|
53
|
+
| Event | Description |
|
|
54
|
+
|--------|-------------|
|
|
55
|
+
| `command.executed` | After command execution |
|
|
56
|
+
| `file.edited` | After file modification |
|
|
57
|
+
| `file.watcher.updated` | When file watcher detects changes |
|
|
58
|
+
| `installation.updated` | When installation changes |
|
|
59
|
+
| `lsp.client.diagnostics` | When LSP diagnostics update |
|
|
60
|
+
| `lsp.updated` | When LSP state changes |
|
|
61
|
+
| `message.part.removed` | When message part removed |
|
|
62
|
+
| `message.part.updated` | When message part updated |
|
|
63
|
+
| `message.removed` | When message removed |
|
|
64
|
+
| `message.updated` | When message updated |
|
|
65
|
+
| `permission.replied` | When permission response |
|
|
66
|
+
| `permission.updated` | When permission changes |
|
|
67
|
+
| `server.connected` | When server connects |
|
|
68
|
+
| `session.created` | When session created |
|
|
69
|
+
| `session.compacted` | When session compacted |
|
|
70
|
+
| `session.deleted` | When session deleted |
|
|
71
|
+
| `session.diff` | When session diff requested |
|
|
72
|
+
| `session.error` | When session error occurs |
|
|
73
|
+
| `session.idle` | When session goes idle |
|
|
74
|
+
| `session.status` | When session status changes |
|
|
75
|
+
| `session.updated` | When session updated |
|
|
76
|
+
| `todo.updated` | When todo list updates |
|
|
77
|
+
| `tool.execute.after` | After tool execution |
|
|
78
|
+
| `tool.execute.before` | Before tool execution |
|
|
79
|
+
| `tui.prompt.append` | When TUI prompt appends |
|
|
80
|
+
| `tui.command.execute` | When TUI command executes |
|
|
81
|
+
| `tui.toast.show` | When TUI toast shows |
|
|
82
|
+
|
|
83
|
+
### Plugin Example
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import type { Plugin } from "@opencode-ai/plugin"
|
|
87
|
+
|
|
88
|
+
export default (async ({ project, client, $, directory, worktree }) => {
|
|
89
|
+
return {
|
|
90
|
+
"tool.execute.before": async (input, output) => {
|
|
91
|
+
if (input.tool === "read" && output.args.filePath.includes(".env")) {
|
|
92
|
+
throw new Error("Do not read .env files")
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Commands
|
|
100
|
+
|
|
101
|
+
### Command Format
|
|
102
|
+
|
|
103
|
+
Commands are Markdown files with table frontmatter:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
| description | agent |
|
|
107
|
+
|---|---|
|
|
108
|
+
| Command description | agent-name |
|
|
109
|
+
|
|
110
|
+
# Command Content
|
|
111
|
+
|
|
112
|
+
Command instructions here with $ARGUMENTS placeholder...
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Frontmatter Table
|
|
116
|
+
|
|
117
|
+
| Field | Description |
|
|
118
|
+
|--------|-------------|
|
|
119
|
+
| **description** | Brief description shown in command list |
|
|
120
|
+
| **agent** | Which agent should handle this command (optional) |
|
|
121
|
+
| **subtask** | Run as subtask (optional) |
|
|
122
|
+
| **model** | Override default model (optional) |
|
|
123
|
+
| **temperature** | Override temperature (optional) |
|
|
124
|
+
|
|
125
|
+
### Dynamic Arguments
|
|
126
|
+
|
|
127
|
+
- `$ARGUMENTS`: All arguments as single string
|
|
128
|
+
- `$1`, `$2`, `$3`: Positional arguments
|
|
129
|
+
- `@file.txt`: Include file content
|
|
130
|
+
- `!`command``: Include shell command output
|
|
131
|
+
|
|
132
|
+
### Command Example
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
| description | agent |
|
|
136
|
+
|---|---|
|
|
137
|
+
| Run tests with coverage | build |
|
|
138
|
+
|
|
139
|
+
# Test Command
|
|
140
|
+
|
|
141
|
+
Run the full test suite with coverage report and show any failures.
|
|
142
|
+
|
|
143
|
+
Focus on the failing tests and suggest fixes.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Agents
|
|
147
|
+
|
|
148
|
+
### Agent Format
|
|
149
|
+
|
|
150
|
+
Agents are Markdown files with table frontmatter:
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
| description | mode |
|
|
154
|
+
|---|---|
|
|
155
|
+
| Agent description | subagent |
|
|
156
|
+
|
|
157
|
+
# System Prompt
|
|
158
|
+
|
|
159
|
+
Agent system prompt here...
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Frontmatter Table
|
|
163
|
+
|
|
164
|
+
| Field | Description |
|
|
165
|
+
|--------|-------------|
|
|
166
|
+
| **description** | Triggering conditions and purpose |
|
|
167
|
+
| **mode** | "primary" or "subagent" |
|
|
168
|
+
| **temperature** | 0.0-1.0 (optional) |
|
|
169
|
+
| **tools** | Tool access control (optional) |
|
|
170
|
+
| **permission** | Permission overrides (optional) |
|
|
171
|
+
|
|
172
|
+
### Agent Example
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
| description | mode |
|
|
176
|
+
|---|---|
|
|
177
|
+
| Reviews code for quality and best practices | subagent |
|
|
178
|
+
|
|
179
|
+
You are a senior code reviewer with 10+ years of experience...
|
|
180
|
+
|
|
181
|
+
## Skills
|
|
182
|
+
|
|
183
|
+
### Skill Format
|
|
184
|
+
|
|
185
|
+
Skills follow Anthropic's Agent Skills Specification (same as Claude Code):
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
skill-name/
|
|
189
|
+
├── SKILL.md (required)
|
|
190
|
+
│ ├── YAML frontmatter (required)
|
|
191
|
+
│ │ ├── name: (required)
|
|
192
|
+
│ │ └── description: (required)
|
|
193
|
+
│ └── Markdown instructions (required)
|
|
194
|
+
└── Bundled Resources (optional)
|
|
195
|
+
├── scripts/ # Executable code
|
|
196
|
+
├── references/ # Documentation
|
|
197
|
+
└── assets/ # Files used in output
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Skill Discovery
|
|
201
|
+
|
|
202
|
+
Skills are auto-discovered by the opencode-skills plugin:
|
|
203
|
+
- Scans `.opencode/skills/`, `~/.opencode/skills/`, `~/.config/opencode/skills/`
|
|
204
|
+
- Registers tools named `skills_{{skill_name}}`
|
|
205
|
+
- Validates YAML frontmatter
|
|
206
|
+
- Loads skill content on demand
|
|
207
|
+
|
|
208
|
+
### Skill Example
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
---
|
|
212
|
+
name: git-worktree
|
|
213
|
+
description: Manage Git worktrees for parallel development
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
# Git Worktree Skill
|
|
217
|
+
|
|
218
|
+
Create worktree: `git worktree add ../project-feature -b feature/name`
|
|
219
|
+
List: `git worktree list`
|
|
220
|
+
Remove: `git worktree remove ../project-feature`
|
|
221
|
+
Best practices: name clearly, clean up after merge.
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Custom Tools
|
|
225
|
+
|
|
226
|
+
### Tool Format
|
|
227
|
+
|
|
228
|
+
Custom tools are TypeScript files using the `tool()` helper:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { tool } from "@opencode-ai/plugin"
|
|
232
|
+
|
|
233
|
+
export default tool({
|
|
234
|
+
description: "Query project database",
|
|
235
|
+
args: {
|
|
236
|
+
query: tool.schema.string().describe("SQL query to execute"),
|
|
237
|
+
},
|
|
238
|
+
async execute(args) {
|
|
239
|
+
// Your tool logic here
|
|
240
|
+
return `Executed query: ${args.query}`
|
|
241
|
+
},
|
|
242
|
+
})
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Tool Schema
|
|
246
|
+
|
|
247
|
+
Use Zod schema for argument validation:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
args: {
|
|
251
|
+
name: tool.schema.string().describe("File name"),
|
|
252
|
+
count: tool.schema.number().describe("Number of items"),
|
|
253
|
+
options: tool.schema.array(tool.schema.string()).describe("Options array"),
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Tool Context
|
|
258
|
+
|
|
259
|
+
Tools receive context about current session:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
async execute(args, context) {
|
|
263
|
+
const { agent, sessionID, messageID } = context
|
|
264
|
+
console.log(`Running in ${agent} context`)
|
|
265
|
+
|
|
266
|
+
// Tool implementation
|
|
267
|
+
return result
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Multiple Tools
|
|
272
|
+
|
|
273
|
+
Export multiple tools from one file:
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
export const add = tool({ /* ... */ })
|
|
277
|
+
export const multiply = tool({ /* ... */ })
|
|
278
|
+
// Creates: math_add and math_multiply tools
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Configuration
|
|
282
|
+
|
|
283
|
+
### opencode.json
|
|
284
|
+
|
|
285
|
+
Global OpenCode configuration:
|
|
286
|
+
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"$schema": "https://opencode.ai/config.json",
|
|
290
|
+
"command": {
|
|
291
|
+
"my-command": {
|
|
292
|
+
"template": "Command prompt here",
|
|
293
|
+
"description": "Command description"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"agent": {
|
|
297
|
+
"my-agent": {
|
|
298
|
+
"prompt": "Agent system prompt",
|
|
299
|
+
"temperature": 0.3
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Plugin Configuration
|
|
306
|
+
|
|
307
|
+
Plugins can access configuration via context parameters:
|
|
308
|
+
- `project`: Current project information
|
|
309
|
+
- `client`: OpenCode SDK client
|
|
310
|
+
- `$`: Bun shell API
|
|
311
|
+
- `directory`: Current working directory
|
|
312
|
+
- `worktree`: Git worktree path
|
|
313
|
+
|
|
314
|
+
## Security Best Practices
|
|
315
|
+
|
|
316
|
+
- No hardcoded credentials in tool code
|
|
317
|
+
- Validate user inputs in tools
|
|
318
|
+
- Use environment variables for secrets
|
|
319
|
+
- Follow principle of least privilege
|
|
320
|
+
- Secure file operations in plugins
|
|
321
|
+
|
|
322
|
+
## Auto-Discovery
|
|
323
|
+
|
|
324
|
+
OpenCode automatically discovers components:
|
|
325
|
+
|
|
326
|
+
1. **Commands**: All `.md` files in `.opencode/command/`
|
|
327
|
+
2. **Agents**: All `.md` files in `.opencode/agent/`
|
|
328
|
+
3. **Tools**: All `.ts` files in `.opencode/tool/`
|
|
329
|
+
4. **Skills**: Via opencode-skills plugin
|
|
330
|
+
5. **Plugins**: All `.ts` files in `.opencode/plugin/`
|
|
331
|
+
|
|
332
|
+
## Installation
|
|
333
|
+
|
|
334
|
+
### Project-Local
|
|
335
|
+
|
|
336
|
+
Components in `.opencode/` load automatically when OpenCode starts in that directory.
|
|
337
|
+
|
|
338
|
+
### Global
|
|
339
|
+
|
|
340
|
+
Install to `~/.config/opencode/` for use across all projects:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
mkdir -p ~/.config/opencode/command
|
|
344
|
+
mkdir -p ~/.config/opencode/agent
|
|
345
|
+
mkdir -p ~/.config/opencode/tool
|
|
346
|
+
# Copy components here
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Testing
|
|
350
|
+
|
|
351
|
+
### Local Testing
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# Test with local components
|
|
355
|
+
opencode # Starts in current directory
|
|
356
|
+
|
|
357
|
+
# Test with global installation
|
|
358
|
+
opencode --reload # Reloads global components
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Validation
|
|
362
|
+
|
|
363
|
+
OpenCode provides built-in validation:
|
|
364
|
+
- Command frontmatter syntax
|
|
365
|
+
- Agent frontmatter syntax
|
|
366
|
+
- Tool TypeScript compilation
|
|
367
|
+
- Plugin TypeScript compilation
|
|
368
|
+
|
|
369
|
+
## Distribution
|
|
370
|
+
|
|
371
|
+
### npm Package
|
|
372
|
+
|
|
373
|
+
Publish as npm package for easy installation:
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"name": "@username/my-extension",
|
|
378
|
+
"version": "1.0.0",
|
|
379
|
+
"description": "OpenCode extension for...",
|
|
380
|
+
"main": "./dist/index.js",
|
|
381
|
+
"exports": {
|
|
382
|
+
".": "./dist/index.js"
|
|
383
|
+
},
|
|
384
|
+
"keywords": ["opencode", "extension", "plugin"]
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Installation
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
npm install -g @username/my-extension
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Key Differences from Claude Code
|
|
395
|
+
|
|
396
|
+
| Feature | Claude Code | OpenCode |
|
|
397
|
+
|---------|-------------|----------|
|
|
398
|
+
| **Commands** | YAML frontmatter | Table format |
|
|
399
|
+
| **Agents** | YAML frontmatter | Table format |
|
|
400
|
+
| **Skills** | Built-in | Via opencode-skills plugin |
|
|
401
|
+
| **Hooks** | hooks.json | Plugin events |
|
|
402
|
+
| **Custom Tools** | MCP servers | TypeScript tool() helper |
|
|
403
|
+
| **Manifest** | plugin.json | package.json + plugin.ts |
|
|
404
|
+
| **Auto-Discovery** | Built-in | Built-in |
|
|
405
|
+
|
|
406
|
+
Both systems provide powerful extension capabilities but use different approaches.
|