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.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +115 -0
  3. package/dist/.claude-plugin/agents/agent-creator.md +206 -0
  4. package/dist/.claude-plugin/agents/ai_engineer.md +187 -0
  5. package/dist/.claude-plugin/agents/api_builder_enhanced.md +82 -0
  6. package/dist/.claude-plugin/agents/architect-advisor.md +88 -0
  7. package/dist/.claude-plugin/agents/backend_architect.md +88 -0
  8. package/dist/.claude-plugin/agents/code_reviewer.md +208 -0
  9. package/dist/.claude-plugin/agents/command-creator.md +331 -0
  10. package/dist/.claude-plugin/agents/cost_optimizer.md +284 -0
  11. package/dist/.claude-plugin/agents/database_optimizer.md +175 -0
  12. package/dist/.claude-plugin/agents/deployment_engineer.md +186 -0
  13. package/dist/.claude-plugin/agents/docs-writer.md +99 -0
  14. package/dist/.claude-plugin/agents/documentation_specialist.md +212 -0
  15. package/dist/.claude-plugin/agents/frontend-reviewer.md +51 -0
  16. package/dist/.claude-plugin/agents/full_stack_developer.md +391 -0
  17. package/dist/.claude-plugin/agents/infrastructure_builder.md +77 -0
  18. package/dist/.claude-plugin/agents/java-pro.md +182 -0
  19. package/dist/.claude-plugin/agents/ml_engineer.md +176 -0
  20. package/dist/.claude-plugin/agents/monitoring_expert.md +79 -0
  21. package/dist/.claude-plugin/agents/performance_engineer.md +193 -0
  22. package/dist/.claude-plugin/agents/plugin-validator.md +378 -0
  23. package/dist/.claude-plugin/agents/prompt-optimizer.md +63 -0
  24. package/dist/.claude-plugin/agents/security_scanner.md +332 -0
  25. package/dist/.claude-plugin/agents/seo-specialist.md +73 -0
  26. package/dist/.claude-plugin/agents/skill-creator.md +311 -0
  27. package/dist/.claude-plugin/agents/test-docs-writer-2.md +46 -0
  28. package/dist/.claude-plugin/agents/test-docs-writer-usage.md +40 -0
  29. package/dist/.claude-plugin/agents/test-docs-writer.md +98 -0
  30. package/dist/.claude-plugin/agents/test_generator.md +260 -0
  31. package/dist/.claude-plugin/agents/tool-creator.md +474 -0
  32. package/dist/.claude-plugin/commands/compound.md +26 -0
  33. package/dist/.claude-plugin/commands/context.md +318 -0
  34. package/dist/.claude-plugin/commands/create-agent.md +48 -0
  35. package/dist/.claude-plugin/commands/create-command.md +48 -0
  36. package/dist/.claude-plugin/commands/create-plugin.md +400 -0
  37. package/dist/.claude-plugin/commands/create-skill.md +48 -0
  38. package/dist/.claude-plugin/commands/create-tool.md +53 -0
  39. package/dist/.claude-plugin/commands/deploy.md +35 -0
  40. package/dist/.claude-plugin/commands/optimize.md +79 -0
  41. package/dist/.claude-plugin/commands/plan.md +215 -0
  42. package/dist/.claude-plugin/commands/recursive-init.md +217 -0
  43. package/dist/.claude-plugin/commands/research.md +199 -0
  44. package/dist/.claude-plugin/commands/review.md +73 -0
  45. package/dist/.claude-plugin/commands/seo.md +40 -0
  46. package/dist/.claude-plugin/commands/work.md +460 -0
  47. package/dist/.claude-plugin/hooks.json +15 -0
  48. package/dist/.claude-plugin/marketplace.json +54 -0
  49. package/dist/.claude-plugin/plugin.json +24 -0
  50. package/dist/.claude-plugin/skills/AGENTS.md +37 -0
  51. package/dist/.claude-plugin/skills/devops/coolify-deploy/SKILL.md +8 -0
  52. package/dist/.claude-plugin/skills/devops/git-worktree/SKILL.md +11 -0
  53. package/dist/.claude-plugin/skills/plugin-dev/SKILL.md +322 -0
  54. package/dist/.claude-plugin/skills/plugin-dev/references/agent-format.md +248 -0
  55. package/dist/.claude-plugin/skills/plugin-dev/references/claude-code-plugins.md +372 -0
  56. package/dist/.claude-plugin/skills/plugin-dev/references/command-format.md +312 -0
  57. package/dist/.claude-plugin/skills/plugin-dev/references/opencode-plugins.md +406 -0
  58. package/dist/.claude-plugin/skills/plugin-dev/references/opencode-tools.md +470 -0
  59. package/dist/.claude-plugin/skills/plugin-dev/references/skill-format.md +328 -0
  60. package/dist/.claude-plugin/skills/prompting/incentive-prompting/SKILL.md +162 -0
  61. package/dist/.claude-plugin/skills/research/comprehensive-research/SKILL.md +343 -0
  62. package/dist/.opencode/agent/ai-eng/ai-innovation/ai_engineer.md +186 -0
  63. package/dist/.opencode/agent/ai-eng/ai-innovation/ml_engineer.md +175 -0
  64. package/dist/.opencode/agent/ai-eng/ai-innovation/prompt-optimizer.md +62 -0
  65. package/dist/.opencode/agent/ai-eng/business-analytics/seo-specialist.md +72 -0
  66. package/dist/.opencode/agent/ai-eng/development/api_builder_enhanced.md +81 -0
  67. package/dist/.opencode/agent/ai-eng/development/architect-advisor.md +87 -0
  68. package/dist/.opencode/agent/ai-eng/development/backend_architect.md +87 -0
  69. package/dist/.opencode/agent/ai-eng/development/database_optimizer.md +174 -0
  70. package/dist/.opencode/agent/ai-eng/development/docs-writer.md +98 -0
  71. package/dist/.opencode/agent/ai-eng/development/documentation_specialist.md +211 -0
  72. package/dist/.opencode/agent/ai-eng/development/frontend-reviewer.md +50 -0
  73. package/dist/.opencode/agent/ai-eng/development/full_stack_developer.md +390 -0
  74. package/dist/.opencode/agent/ai-eng/development/java-pro.md +181 -0
  75. package/dist/.opencode/agent/ai-eng/development/test-docs-writer-2.md +45 -0
  76. package/dist/.opencode/agent/ai-eng/development/test-docs-writer-usage.md +39 -0
  77. package/dist/.opencode/agent/ai-eng/development/test-docs-writer.md +97 -0
  78. package/dist/.opencode/agent/ai-eng/meta/agent-creator.md +208 -0
  79. package/dist/.opencode/agent/ai-eng/meta/command-creator.md +333 -0
  80. package/dist/.opencode/agent/ai-eng/meta/skill-creator.md +313 -0
  81. package/dist/.opencode/agent/ai-eng/meta/tool-creator.md +476 -0
  82. package/dist/.opencode/agent/ai-eng/operations/cost_optimizer.md +283 -0
  83. package/dist/.opencode/agent/ai-eng/operations/deployment_engineer.md +185 -0
  84. package/dist/.opencode/agent/ai-eng/operations/infrastructure_builder.md +76 -0
  85. package/dist/.opencode/agent/ai-eng/operations/monitoring_expert.md +78 -0
  86. package/dist/.opencode/agent/ai-eng/quality-testing/code_reviewer.md +207 -0
  87. package/dist/.opencode/agent/ai-eng/quality-testing/performance_engineer.md +192 -0
  88. package/dist/.opencode/agent/ai-eng/quality-testing/plugin-validator.md +380 -0
  89. package/dist/.opencode/agent/ai-eng/quality-testing/security_scanner.md +331 -0
  90. package/dist/.opencode/agent/ai-eng/quality-testing/test_generator.md +259 -0
  91. package/dist/.opencode/command/ai-eng/compound.md +26 -0
  92. package/dist/.opencode/command/ai-eng/context.md +318 -0
  93. package/dist/.opencode/command/ai-eng/create-agent.md +48 -0
  94. package/dist/.opencode/command/ai-eng/create-command.md +48 -0
  95. package/dist/.opencode/command/ai-eng/create-plugin.md +400 -0
  96. package/dist/.opencode/command/ai-eng/create-skill.md +48 -0
  97. package/dist/.opencode/command/ai-eng/create-tool.md +53 -0
  98. package/dist/.opencode/command/ai-eng/deploy.md +35 -0
  99. package/dist/.opencode/command/ai-eng/optimize.md +79 -0
  100. package/dist/.opencode/command/ai-eng/plan.md +215 -0
  101. package/dist/.opencode/command/ai-eng/recursive-init.md +217 -0
  102. package/dist/.opencode/command/ai-eng/research.md +199 -0
  103. package/dist/.opencode/command/ai-eng/review.md +73 -0
  104. package/dist/.opencode/command/ai-eng/seo.md +40 -0
  105. package/dist/.opencode/command/ai-eng/work.md +460 -0
  106. package/dist/.opencode/opencode.jsonc +8 -0
  107. package/dist/.opencode/plugin/ai-eng-system.ts +10 -0
  108. package/dist/index.d.ts +3 -0
  109. package/dist/index.js +13 -0
  110. package/dist/skills/AGENTS.md +37 -0
  111. package/dist/skills/devops/coolify-deploy/SKILL.md +8 -0
  112. package/dist/skills/devops/git-worktree/SKILL.md +11 -0
  113. package/dist/skills/plugin-dev/SKILL.md +322 -0
  114. package/dist/skills/plugin-dev/references/agent-format.md +248 -0
  115. package/dist/skills/plugin-dev/references/claude-code-plugins.md +372 -0
  116. package/dist/skills/plugin-dev/references/command-format.md +312 -0
  117. package/dist/skills/plugin-dev/references/opencode-plugins.md +406 -0
  118. package/dist/skills/plugin-dev/references/opencode-tools.md +470 -0
  119. package/dist/skills/plugin-dev/references/skill-format.md +328 -0
  120. package/dist/skills/prompting/incentive-prompting/SKILL.md +162 -0
  121. package/dist/skills/research/comprehensive-research/SKILL.md +343 -0
  122. 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.