my-opencode 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +163 -0
- package/agents/architect.md +30 -0
- package/agents/code-reviewer.md +29 -0
- package/agents/executor.md +30 -0
- package/agents/fullstack-dev.md +53 -0
- package/agents/spec-writer.md +37 -0
- package/agents/team-lead.md +60 -0
- package/agents/tech-writer.md +30 -0
- package/agents/test-engineer.md +30 -0
- package/agents/verifier.md +33 -0
- package/bin/cli.js +272 -0
- package/opencode.json +164 -0
- package/package.json +44 -0
- package/skills/adr/SKILL.md +91 -0
- package/skills/adr/references/templates.md +100 -0
- package/skills/adr/scripts/README.md +5 -0
- package/skills/dev-flow/SKILL.md +188 -0
- package/skills/dev-flow/references/code-phase.md +72 -0
- package/skills/dev-flow/references/contract-phase.md +81 -0
- package/skills/dev-flow/references/verify-phase.md +129 -0
- package/skills/dev-flow/scripts/README.md +3 -0
- package/skills/docs-gen/SKILL.md +162 -0
- package/skills/docs-gen/references/doc-styles.md +216 -0
- package/skills/docs-gen/scripts/README.md +5 -0
- package/skills/orchestrate/SKILL.md +112 -0
- package/skills/orchestrate/references/orchestration-patterns.md +56 -0
- package/skills/pr-review/SKILL.md +110 -0
- package/skills/pr-review/references/review-dimensions.md +117 -0
- package/skills/pr-review/references/security-checklist.md +122 -0
- package/skills/pr-review/scripts/README.md +5 -0
- package/skills/test-gen/SKILL.md +143 -0
- package/skills/test-gen/references/framework-detection.md +105 -0
- package/skills/test-gen/references/test-patterns.md +260 -0
- package/skills/test-gen/scripts/README.md +5 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* my-opencode CLI
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* my-opencode init [target-dir] Install skills/agents into .opencode/
|
|
8
|
+
* my-opencode list List available skills and agents
|
|
9
|
+
* my-opencode help Show this help
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import fs from "node:fs";
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const PKG_ROOT = path.resolve(path.dirname(__filename), "..");
|
|
18
|
+
|
|
19
|
+
const SKILLS_DIR = path.join(PKG_ROOT, "skills");
|
|
20
|
+
const AGENTS_DIR = path.join(PKG_ROOT, "agents");
|
|
21
|
+
const OPENCODE_CONFIG = path.join(PKG_ROOT, "opencode.json");
|
|
22
|
+
|
|
23
|
+
const INDENT = " ";
|
|
24
|
+
|
|
25
|
+
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
26
|
+
|
|
27
|
+
function header(text) {
|
|
28
|
+
console.log(`\n\x1b[36m━━━ ${text} ━━━\x1b[0m\n`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function success(text) {
|
|
32
|
+
console.log(`\x1b[32m✓\x1b[0m ${text}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function warn(text) {
|
|
36
|
+
console.log(`\x1b[33m⚠\x1b[0m ${text}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function info(text) {
|
|
40
|
+
console.log(`\x1b[34mℹ\x1b[0m ${text}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getDirectories(dirPath) {
|
|
44
|
+
try {
|
|
45
|
+
return fs.readdirSync(dirPath, { withFileTypes: true })
|
|
46
|
+
.filter(d => d.isDirectory())
|
|
47
|
+
.map(d => d.name);
|
|
48
|
+
} catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function extractFrontmatterDescription(filePath) {
|
|
54
|
+
try {
|
|
55
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
56
|
+
const match = content.match(/^---\n([\s\S]+?)\n---/);
|
|
57
|
+
if (!match) return "";
|
|
58
|
+
const frontmatter = match[1];
|
|
59
|
+
|
|
60
|
+
// Try multi-line YAML (description: | ...)
|
|
61
|
+
const multiLine = frontmatter.match(/^description:\s*\|\s*\n((?:\s{2}.*\n?)*)/m);
|
|
62
|
+
if (multiLine) {
|
|
63
|
+
return multiLine[1]
|
|
64
|
+
.split("\n")
|
|
65
|
+
.map(l => l.replace(/^\s{2}/, "").trim())
|
|
66
|
+
.filter(l => l)
|
|
67
|
+
.join(" ");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Try single-line: description: text
|
|
71
|
+
const singleLine = frontmatter.match(/^description:\s*(.+)$/m);
|
|
72
|
+
if (singleLine) {
|
|
73
|
+
const val = singleLine[1].trim();
|
|
74
|
+
if (val && val !== "|") return val;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return "";
|
|
78
|
+
} catch {
|
|
79
|
+
return "";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getFiles(dirPath) {
|
|
84
|
+
try {
|
|
85
|
+
return fs.readdirSync(dirPath, { withFileTypes: true })
|
|
86
|
+
.filter(d => d.isFile())
|
|
87
|
+
.map(d => d.name);
|
|
88
|
+
} catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ─── Commands ───────────────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
function cmdHelp() {
|
|
96
|
+
console.log(`
|
|
97
|
+
\x1b[1mmy-opencode\x1b[0m — 高品質 opencode 開發流程 skill 與 agents 集合
|
|
98
|
+
|
|
99
|
+
\x1b[1mUSAGE\x1b[0m
|
|
100
|
+
my-opencode <command> [options]
|
|
101
|
+
|
|
102
|
+
\x1b[1mCOMMANDS\x1b[0m
|
|
103
|
+
init [target-dir] 安裝 skills/agents 到 .opencode/ 下
|
|
104
|
+
(預設: 當前目錄的 .opencode/)
|
|
105
|
+
list 列出可用的 skills 與 agents
|
|
106
|
+
help 顯示此說明
|
|
107
|
+
|
|
108
|
+
\x1b[1mEXAMPLES\x1b[0m
|
|
109
|
+
npx my-opencode init # 安裝到 .opencode/
|
|
110
|
+
npx my-opencode init ./my-project # 安裝到 ./my-project/.opencode/
|
|
111
|
+
npx my-opencode list
|
|
112
|
+
npx my-opencode help
|
|
113
|
+
`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function cmdList() {
|
|
117
|
+
header("Available Skills");
|
|
118
|
+
const skills = getDirectories(SKILLS_DIR);
|
|
119
|
+
if (skills.length === 0) {
|
|
120
|
+
warn("No skills found.");
|
|
121
|
+
} else {
|
|
122
|
+
for (const s of skills) {
|
|
123
|
+
const skillPath = path.join(SKILLS_DIR, s, "SKILL.md");
|
|
124
|
+
const desc = extractFrontmatterDescription(skillPath);
|
|
125
|
+
console.log(`${INDENT}\x1b[33m${s}\x1b[0m`);
|
|
126
|
+
if (desc) console.log(`${INDENT} ${desc}`);
|
|
127
|
+
console.log();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
header("Available Agents");
|
|
132
|
+
const agents = getFiles(AGENTS_DIR);
|
|
133
|
+
if (agents.length === 0) {
|
|
134
|
+
warn("No agents found.");
|
|
135
|
+
} else {
|
|
136
|
+
for (const a of agents) {
|
|
137
|
+
const agentPath = path.join(AGENTS_DIR, a);
|
|
138
|
+
const desc = extractFrontmatterDescription(agentPath);
|
|
139
|
+
const name = a.replace(/\.md$/, "");
|
|
140
|
+
console.log(`${INDENT}\x1b[33m${name}\x1b[0m`);
|
|
141
|
+
if (desc) console.log(`${INDENT} ${desc}`);
|
|
142
|
+
console.log();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function cmdInit(targetDir) {
|
|
148
|
+
// If no target specified, default to .opencode/ in CWD
|
|
149
|
+
const target = targetDir
|
|
150
|
+
? path.resolve(targetDir, ".opencode")
|
|
151
|
+
: path.resolve(process.cwd(), ".opencode");
|
|
152
|
+
|
|
153
|
+
header(`Installing my-opencode → ${target}`);
|
|
154
|
+
|
|
155
|
+
if (!fs.existsSync(target)) {
|
|
156
|
+
fs.mkdirSync(target, { recursive: true });
|
|
157
|
+
success(`Created .opencode/`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ── Copy skills ───────────────────────────────────────────────────────────
|
|
161
|
+
const targetSkills = path.join(target, "skills");
|
|
162
|
+
if (!fs.existsSync(targetSkills)) {
|
|
163
|
+
fs.mkdirSync(targetSkills, { recursive: true });
|
|
164
|
+
}
|
|
165
|
+
const skills = getDirectories(SKILLS_DIR);
|
|
166
|
+
let skillCount = 0;
|
|
167
|
+
for (const s of skills) {
|
|
168
|
+
const src = path.join(SKILLS_DIR, s);
|
|
169
|
+
const dst = path.join(targetSkills, s);
|
|
170
|
+
copyDirSync(src, dst);
|
|
171
|
+
skillCount++;
|
|
172
|
+
}
|
|
173
|
+
success(`Skills: ${skillCount} installed → .opencode/skills/`);
|
|
174
|
+
|
|
175
|
+
// ── Copy agents ──────────────────────────────────────────────────────────
|
|
176
|
+
const targetAgents = path.join(target, "agents");
|
|
177
|
+
if (!fs.existsSync(targetAgents)) {
|
|
178
|
+
fs.mkdirSync(targetAgents, { recursive: true });
|
|
179
|
+
}
|
|
180
|
+
const agents = getFiles(AGENTS_DIR);
|
|
181
|
+
let agentCount = 0;
|
|
182
|
+
for (const a of agents) {
|
|
183
|
+
const src = path.join(AGENTS_DIR, a);
|
|
184
|
+
const dst = path.join(targetAgents, a);
|
|
185
|
+
if (!fs.existsSync(dst)) {
|
|
186
|
+
fs.copyFileSync(src, dst);
|
|
187
|
+
agentCount++;
|
|
188
|
+
} else {
|
|
189
|
+
warn(`Skipped (already exists): agents/${a}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
success(`Agents: ${agentCount} installed → .opencode/agents/`);
|
|
193
|
+
|
|
194
|
+
// ── Generate opencode.json ──────────────────────────────────────────────
|
|
195
|
+
const targetConfig = path.join(target, "opencode.json");
|
|
196
|
+
if (!fs.existsSync(targetConfig)) {
|
|
197
|
+
try {
|
|
198
|
+
const config = JSON.parse(fs.readFileSync(OPENCODE_CONFIG, "utf-8"));
|
|
199
|
+
fs.writeFileSync(targetConfig, JSON.stringify(config, null, 2) + "\n");
|
|
200
|
+
success("Generated .opencode/opencode.json — ready to use");
|
|
201
|
+
} catch {
|
|
202
|
+
warn("Could not generate opencode.json (source config missing or invalid)");
|
|
203
|
+
}
|
|
204
|
+
} else {
|
|
205
|
+
warn("Skipped (already exists): .opencode/opencode.json");
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// ── Summary ──────────────────────────────────────────────────────────────
|
|
209
|
+
console.log();
|
|
210
|
+
header("Installation Complete");
|
|
211
|
+
info("my-opencode is ready at .opencode/");
|
|
212
|
+
console.log();
|
|
213
|
+
console.log(`${INDENT}Your project's opencode.json should reference:`);
|
|
214
|
+
console.log(`${INDENT} "instructions": [`);
|
|
215
|
+
console.log(`${INDENT} ".opencode/skills/adr/SKILL.md",`);
|
|
216
|
+
console.log(`${INDENT} ".opencode/skills/dev-flow/SKILL.md",`);
|
|
217
|
+
console.log(`${INDENT} ".opencode/skills/pr-review/SKILL.md",`);
|
|
218
|
+
console.log(`${INDENT} ".opencode/skills/test-gen/SKILL.md",`);
|
|
219
|
+
console.log(`${INDENT} ".opencode/skills/docs-gen/SKILL.md",`);
|
|
220
|
+
console.log(`${INDENT} ".opencode/skills/orchestrate/SKILL.md"`);
|
|
221
|
+
console.log(`${INDENT} ]`);
|
|
222
|
+
console.log();
|
|
223
|
+
console.log(`${INDENT}Agents and commands from .opencode/opencode.json`);
|
|
224
|
+
console.log(`${INDENT}are auto-discovered by opencode.`);
|
|
225
|
+
console.log();
|
|
226
|
+
info("Documentation: https://github.com/cfh00902455/my-opencode");
|
|
227
|
+
console.log();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ─── File Utilities ─────────────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
function copyDirSync(src, dst) {
|
|
233
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
234
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
235
|
+
for (const entry of entries) {
|
|
236
|
+
const srcPath = path.join(src, entry.name);
|
|
237
|
+
const dstPath = path.join(dst, entry.name);
|
|
238
|
+
if (entry.isDirectory()) {
|
|
239
|
+
copyDirSync(srcPath, dstPath);
|
|
240
|
+
} else if (entry.isFile()) {
|
|
241
|
+
if (!fs.existsSync(dstPath)) {
|
|
242
|
+
fs.copyFileSync(srcPath, dstPath);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// ─── Main ───────────────────────────────────────────────────────────────────
|
|
249
|
+
|
|
250
|
+
function main() {
|
|
251
|
+
const args = process.argv.slice(2);
|
|
252
|
+
const cmd = args[0] || "help";
|
|
253
|
+
|
|
254
|
+
switch (cmd) {
|
|
255
|
+
case "init":
|
|
256
|
+
case "install":
|
|
257
|
+
cmdInit(args[1]);
|
|
258
|
+
break;
|
|
259
|
+
case "list":
|
|
260
|
+
case "ls":
|
|
261
|
+
cmdList();
|
|
262
|
+
break;
|
|
263
|
+
case "help":
|
|
264
|
+
case "--help":
|
|
265
|
+
case "-h":
|
|
266
|
+
default:
|
|
267
|
+
cmdHelp();
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
main();
|
package/opencode.json
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"model": "opencode/deepseek-v4-flash-free",
|
|
4
|
+
"small_model": "opencode/nemotron-3-super-free",
|
|
5
|
+
"default_agent": "fullstack-dev",
|
|
6
|
+
"instructions": [
|
|
7
|
+
"skills/adr/SKILL.md",
|
|
8
|
+
"skills/dev-flow/SKILL.md",
|
|
9
|
+
"skills/pr-review/SKILL.md",
|
|
10
|
+
"skills/test-gen/SKILL.md",
|
|
11
|
+
"skills/docs-gen/SKILL.md",
|
|
12
|
+
"skills/orchestrate/SKILL.md"
|
|
13
|
+
],
|
|
14
|
+
"agent": {
|
|
15
|
+
"fullstack-dev": {
|
|
16
|
+
"description": "Primary development agent. Orchestrates contract-first ADR → contract → code → verify flow.",
|
|
17
|
+
"mode": "primary",
|
|
18
|
+
"prompt": "{file:agents/fullstack-dev.md}",
|
|
19
|
+
"tools": {
|
|
20
|
+
"read": true,
|
|
21
|
+
"write": true,
|
|
22
|
+
"edit": true,
|
|
23
|
+
"bash": true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"spec-writer": {
|
|
27
|
+
"description": "Analyze requirements and produce contract specifications in docs/specs/. Writes persistent contracts for parallel development.",
|
|
28
|
+
"mode": "subagent",
|
|
29
|
+
"model": "opencode/big-pickle",
|
|
30
|
+
"prompt": "{file:agents/spec-writer.md}",
|
|
31
|
+
"tools": {
|
|
32
|
+
"read": true,
|
|
33
|
+
"bash": true,
|
|
34
|
+
"write": true,
|
|
35
|
+
"edit": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"executor": {
|
|
39
|
+
"description": "Implement code changes following an approved contract. Full read/write access for coding.",
|
|
40
|
+
"mode": "subagent",
|
|
41
|
+
"prompt": "{file:agents/executor.md}",
|
|
42
|
+
"tools": {
|
|
43
|
+
"read": true,
|
|
44
|
+
"write": true,
|
|
45
|
+
"edit": true,
|
|
46
|
+
"bash": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"verifier": {
|
|
50
|
+
"description": "Run lint, typecheck, tests, and build to verify code changes. Read-only + bash.",
|
|
51
|
+
"mode": "subagent",
|
|
52
|
+
"model": "opencode/nemotron-3-super-free",
|
|
53
|
+
"prompt": "{file:agents/verifier.md}",
|
|
54
|
+
"tools": {
|
|
55
|
+
"read": true,
|
|
56
|
+
"bash": true,
|
|
57
|
+
"write": false,
|
|
58
|
+
"edit": false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"code-reviewer": {
|
|
62
|
+
"description": "Systematic code review across correctness, security, quality, testing, and style dimensions.",
|
|
63
|
+
"mode": "subagent",
|
|
64
|
+
"model": "opencode/big-pickle",
|
|
65
|
+
"prompt": "{file:agents/code-reviewer.md}",
|
|
66
|
+
"tools": {
|
|
67
|
+
"read": true,
|
|
68
|
+
"bash": true,
|
|
69
|
+
"write": false,
|
|
70
|
+
"edit": false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"test-engineer": {
|
|
74
|
+
"description": "Generate meaningful tests for source code — unit, integration, and E2E. Framework-aware.",
|
|
75
|
+
"mode": "subagent",
|
|
76
|
+
"prompt": "{file:agents/test-engineer.md}",
|
|
77
|
+
"tools": {
|
|
78
|
+
"read": true,
|
|
79
|
+
"write": true,
|
|
80
|
+
"edit": true,
|
|
81
|
+
"bash": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"tech-writer": {
|
|
85
|
+
"description": "Generate and update project documentation — code comments, API docs, README, and CHANGELOG.",
|
|
86
|
+
"mode": "subagent",
|
|
87
|
+
"prompt": "{file:agents/tech-writer.md}",
|
|
88
|
+
"tools": {
|
|
89
|
+
"read": true,
|
|
90
|
+
"write": true,
|
|
91
|
+
"edit": true,
|
|
92
|
+
"bash": true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"team-lead": {
|
|
96
|
+
"description": "Multi-agent orchestrator for complex tasks. Delegates to architect, spec-writer, executor, code-reviewer, test-engineer, verifier.",
|
|
97
|
+
"mode": "subagent",
|
|
98
|
+
"model": "opencode/big-pickle",
|
|
99
|
+
"prompt": "{file:agents/team-lead.md}",
|
|
100
|
+
"tools": {
|
|
101
|
+
"read": true,
|
|
102
|
+
"write": true,
|
|
103
|
+
"edit": true,
|
|
104
|
+
"bash": true
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"architect": {
|
|
108
|
+
"description": "Capture architecture decisions as ADR documents. Analyzes tradeoffs and records context.",
|
|
109
|
+
"mode": "subagent",
|
|
110
|
+
"model": "opencode/big-pickle",
|
|
111
|
+
"prompt": "{file:agents/architect.md}",
|
|
112
|
+
"tools": {
|
|
113
|
+
"read": true,
|
|
114
|
+
"write": true,
|
|
115
|
+
"edit": true,
|
|
116
|
+
"bash": true
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"command": {
|
|
121
|
+
"spec": {
|
|
122
|
+
"description": "Create a contract specification in docs/specs/ — source of truth for implementation",
|
|
123
|
+
"agent": "spec-writer",
|
|
124
|
+
"subtask": true,
|
|
125
|
+
"template": "Analyze the request and produce a contract specification document.\n\n$ARGUMENTS"
|
|
126
|
+
},
|
|
127
|
+
"review": {
|
|
128
|
+
"description": "Review code changes across 5 dimensions (correctness, security, quality, testing, style)",
|
|
129
|
+
"agent": "code-reviewer",
|
|
130
|
+
"subtask": true,
|
|
131
|
+
"template": "Review the current changes.\n\n$ARGUMENTS"
|
|
132
|
+
},
|
|
133
|
+
"test": {
|
|
134
|
+
"description": "Generate tests for source code — auto-detects framework and conventions",
|
|
135
|
+
"agent": "test-engineer",
|
|
136
|
+
"subtask": true,
|
|
137
|
+
"template": "Generate tests for the current code.\n\n$ARGUMENTS"
|
|
138
|
+
},
|
|
139
|
+
"docs": {
|
|
140
|
+
"description": "Generate or update documentation — code comments, README, API docs, ADRs",
|
|
141
|
+
"agent": "tech-writer",
|
|
142
|
+
"subtask": true,
|
|
143
|
+
"template": "Generate or update documentation.\n\n$ARGUMENTS"
|
|
144
|
+
},
|
|
145
|
+
"orchestrate": {
|
|
146
|
+
"description": "Coordinate multiple agents for complex, multi-domain tasks",
|
|
147
|
+
"agent": "team-lead",
|
|
148
|
+
"subtask": true,
|
|
149
|
+
"template": "Orchestrate the following complex task.\n\n$ARGUMENTS"
|
|
150
|
+
},
|
|
151
|
+
"adr": {
|
|
152
|
+
"description": "Create or update an Architecture Decision Record",
|
|
153
|
+
"agent": "architect",
|
|
154
|
+
"subtask": true,
|
|
155
|
+
"template": "Create an Architecture Decision Record.\n\n$ARGUMENTS"
|
|
156
|
+
},
|
|
157
|
+
"verify": {
|
|
158
|
+
"description": "Run lint, typecheck, tests, and build to verify changes",
|
|
159
|
+
"template": "Use the verifier agent to run the full verification suite on the current changes.\n\n$ARGUMENTS",
|
|
160
|
+
"agent": "verifier",
|
|
161
|
+
"subtask": true
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-opencode",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "高品質 opencode 開發流程 skill 與 agents 集合 — Contract-First 開發流程、ADR、PR Review、測試生成、文件生成",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"opencode",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"ai-coding",
|
|
9
|
+
"development-workflow",
|
|
10
|
+
"contract-first",
|
|
11
|
+
"adr",
|
|
12
|
+
"code-review",
|
|
13
|
+
"test-generation",
|
|
14
|
+
"documentation",
|
|
15
|
+
"agents",
|
|
16
|
+
"skills"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/cfh00902455/my-opencode#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/cfh00902455/my-opencode/issues"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "cfh00902455",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/cfh00902455/my-opencode.git"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"my-opencode": "./bin/cli.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin/",
|
|
33
|
+
"skills/",
|
|
34
|
+
"agents/",
|
|
35
|
+
"opencode.json"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
},
|
|
40
|
+
"type": "module",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adr
|
|
3
|
+
description: |
|
|
4
|
+
Capture architecture decisions as lightweight ADR documents.
|
|
5
|
+
Use when making design choices that affect project structure, technology selection,
|
|
6
|
+
or architectural direction. Also use during code review when spotting implicit decisions.
|
|
7
|
+
Triggers on: "adr", "architecture decision", "design decision", "why did we", "decision log"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Architecture Decision Records
|
|
11
|
+
|
|
12
|
+
Capture, manage, and maintain architecture decisions using Michael Nygard's lightweight ADR format.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- Choosing a technology, framework, or library
|
|
17
|
+
- Defining project structure or module boundaries
|
|
18
|
+
- Making API design decisions (REST vs GraphQL, versioning strategy)
|
|
19
|
+
- Selecting database, cache, or infrastructure
|
|
20
|
+
- Changing existing architecture decisions
|
|
21
|
+
- During code review — if a PR introduces an architectural change without an ADR, flag it
|
|
22
|
+
|
|
23
|
+
## ADR Lifecycle
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Proposed → Accepted → Deprecated → Superseded by ADR-NNN
|
|
27
|
+
↘ Reinstated
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Status | Meaning |
|
|
31
|
+
|--------|---------|
|
|
32
|
+
| Proposed | Decision suggested, under review |
|
|
33
|
+
| Accepted | Decision adopted, implementation follows |
|
|
34
|
+
| Deprecated | No longer recommended, existing usage OK |
|
|
35
|
+
| Superseded | Replaced by another ADR (link to it) |
|
|
36
|
+
| Reinstated | Previously deprecated decision revived |
|
|
37
|
+
|
|
38
|
+
## Workflow
|
|
39
|
+
|
|
40
|
+
### Step 1: Detect Decision Moment
|
|
41
|
+
|
|
42
|
+
An ADR is needed when:
|
|
43
|
+
- A decision has long-term impact on the codebase
|
|
44
|
+
- Multiple alternatives exist with meaningful tradeoffs
|
|
45
|
+
- The decision affects how other teams/modules will work
|
|
46
|
+
- You find yourself explaining "why we chose X" more than once
|
|
47
|
+
|
|
48
|
+
### Step 2: Write ADR
|
|
49
|
+
|
|
50
|
+
Use the template from `references/templates.md`. Save to `docs/adr/NNNN-title.md`.
|
|
51
|
+
|
|
52
|
+
Number sequentially: check existing files in `docs/adr/` and increment.
|
|
53
|
+
|
|
54
|
+
### Step 3: Review
|
|
55
|
+
|
|
56
|
+
Share with team for feedback. ADRs benefit from:
|
|
57
|
+
- Architecture review
|
|
58
|
+
- Cross-team input (if decision affects others)
|
|
59
|
+
- At least one other person reading it
|
|
60
|
+
|
|
61
|
+
### Step 4: Update Status
|
|
62
|
+
|
|
63
|
+
As decisions evolve:
|
|
64
|
+
- Mark `Accepted` when implementation starts
|
|
65
|
+
- Mark `Deprecated` when better alternatives emerge
|
|
66
|
+
- Mark `Superseded by ADR-NNN` when replaced
|
|
67
|
+
- Link related ADRs in both directions
|
|
68
|
+
|
|
69
|
+
## ADR Location
|
|
70
|
+
|
|
71
|
+
All ADRs live in `docs/adr/` with an index:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
docs/adr/
|
|
75
|
+
├── README.md # Index of all ADRs
|
|
76
|
+
├── 001-use-postgres.md
|
|
77
|
+
├── 002-api-versioning.md
|
|
78
|
+
└── 003-monorepo-structure.md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Keeping ADRs Alive
|
|
82
|
+
|
|
83
|
+
- **PR review hook:** If a PR changes architecture without a corresponding ADR, flag it
|
|
84
|
+
- **Regular index updates:** When superseding, update the old ADR's status and link
|
|
85
|
+
- **Not everything needs an ADR:** Bug fixes, routine feature additions, style choices → skip
|
|
86
|
+
- **But when in doubt, write one:** A 5-minute ADR saves hours of future confusion
|
|
87
|
+
|
|
88
|
+
## Related Skills
|
|
89
|
+
|
|
90
|
+
- `dev-flow` — Contract phase should reference ADRs for architectural context
|
|
91
|
+
- `pr-review` — Code review checks for missing ADRs on architectural changes
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ADR Templates
|
|
2
|
+
|
|
3
|
+
## Standard (Michael Nygard)
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
# ADR-NNN: <short title>
|
|
7
|
+
|
|
8
|
+
**Date:** YYYY-MM-DD
|
|
9
|
+
**Status:** Proposed | Accepted | Deprecated | Superseded by ADR-NNN
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
<What is the issue motivating this decision?
|
|
13
|
+
What forces are at play (technical, political, social)?
|
|
14
|
+
Mention specific constraints, requirements, or tradeoffs.>
|
|
15
|
+
|
|
16
|
+
## Decision
|
|
17
|
+
<What is the change being proposed or made?
|
|
18
|
+
Be specific — technology name, version, pattern.>
|
|
19
|
+
|
|
20
|
+
## Consequences
|
|
21
|
+
<What becomes easier or harder?
|
|
22
|
+
List positive and negative outcomes.>
|
|
23
|
+
|
|
24
|
+
## Alternatives
|
|
25
|
+
<What other options were considered, and why were they rejected?
|
|
26
|
+
Keep brief — 1-2 sentences per alternative.>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## MADR (Markdown ADR) — More Structured
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
# ADR-NNN: <short title>
|
|
35
|
+
|
|
36
|
+
**Date:** YYYY-MM-DD
|
|
37
|
+
**Status:** Proposed
|
|
38
|
+
|
|
39
|
+
## Context and Problem Statement
|
|
40
|
+
<Describe the problem in 2-3 sentences.>
|
|
41
|
+
|
|
42
|
+
## Decision Drivers
|
|
43
|
+
- <driver 1>
|
|
44
|
+
- <driver 2>
|
|
45
|
+
|
|
46
|
+
## Considered Options
|
|
47
|
+
- Option A: <summary>
|
|
48
|
+
- Option B: <summary>
|
|
49
|
+
- Option C: <summary>
|
|
50
|
+
|
|
51
|
+
## Decision Outcome
|
|
52
|
+
Chosen option: <option>, because <justification>.
|
|
53
|
+
|
|
54
|
+
## Pros and Cons of Options
|
|
55
|
+
|
|
56
|
+
### Option A
|
|
57
|
+
- Good: <point>
|
|
58
|
+
- Bad: <point>
|
|
59
|
+
|
|
60
|
+
### Option B
|
|
61
|
+
- Good: <point>
|
|
62
|
+
- Bad: <point>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Lightweight (for quick decisions, 5 min write)
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# ADR-NNN: <short title>
|
|
71
|
+
|
|
72
|
+
We chose **<decision>** over **<alternatives>** because
|
|
73
|
+
<primary reason>.
|
|
74
|
+
|
|
75
|
+
## Context
|
|
76
|
+
<1-2 sentences>
|
|
77
|
+
|
|
78
|
+
## Consequences
|
|
79
|
+
<bullet points>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## ADR Index (`docs/adr/README.md`)
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
# Architecture Decision Records
|
|
88
|
+
|
|
89
|
+
| ADR | Title | Status | Date |
|
|
90
|
+
|-----|-------|--------|------|
|
|
91
|
+
| 001 | Use PostgreSQL for primary DB | Accepted | 2026-05-01 |
|
|
92
|
+
| 002 | API versioning via URL prefix | Proposed | 2026-05-15 |
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
When superseding, update the old ADR's status and add the link:
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## Status
|
|
99
|
+
Superseded by [ADR-005: New Caching Strategy](005-new-caching.md)
|
|
100
|
+
```
|