@moskala/oneagent-templates 0.2.6 → 0.3.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/README.md +203 -0
- package/package.json +1 -1
- package/src/index.ts +13 -16
- package/src/templates/default/template.yml +34 -1
- package/src/templates/react/template.yml +48 -4
- package/src/templates/react-native/template.yml +59 -1
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Creating oneagent templates
|
|
2
|
+
|
|
3
|
+
This guide explains how to build a custom oneagent template that others can use.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Repository structure
|
|
8
|
+
|
|
9
|
+
Template files must live at the **root** of the repository:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
your-template/ ← GitHub repo root
|
|
13
|
+
template.yml # required
|
|
14
|
+
instructions.md # required
|
|
15
|
+
rules/ # optional
|
|
16
|
+
rule-name.md
|
|
17
|
+
another-rule.md
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Install with:
|
|
21
|
+
```sh
|
|
22
|
+
npx oneagent init --template https://github.com/your-org/your-template
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Templates inside a subdirectory
|
|
26
|
+
|
|
27
|
+
If you want to keep the template in a subdirectory (e.g. in a monorepo), put the files there and point to it using a GitHub tree URL:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
your-repo/
|
|
31
|
+
packages/
|
|
32
|
+
my-template/
|
|
33
|
+
template.yml
|
|
34
|
+
instructions.md
|
|
35
|
+
rules/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npx oneagent init --template https://github.com/your-org/your-repo/tree/main/packages/my-template
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Pointing to a specific branch
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npx oneagent init --template https://github.com/your-org/your-template/tree/next
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## `template.yml`
|
|
51
|
+
|
|
52
|
+
The manifest file. `name` and `description` are required; everything else is optional.
|
|
53
|
+
|
|
54
|
+
```yaml
|
|
55
|
+
name: my-template
|
|
56
|
+
description: Short description shown in the interactive picker
|
|
57
|
+
|
|
58
|
+
skills:
|
|
59
|
+
- repo: https://github.com/vercel-labs/skills
|
|
60
|
+
skill: vercel-react-best-practices
|
|
61
|
+
- repo: https://github.com/vercel-labs/skills
|
|
62
|
+
skill: vercel-composition-patterns
|
|
63
|
+
|
|
64
|
+
plugins:
|
|
65
|
+
- target: claude
|
|
66
|
+
id: typescript-lsp@claude-plugins-official
|
|
67
|
+
- target: cursor
|
|
68
|
+
id: vercel
|
|
69
|
+
- target: copilot
|
|
70
|
+
id: some-plugin@some-marketplace
|
|
71
|
+
- target: opencode
|
|
72
|
+
id: opencode-wakatime
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `name`
|
|
76
|
+
|
|
77
|
+
Identifier shown in logs and the setup summary. Use lowercase, hyphenated.
|
|
78
|
+
|
|
79
|
+
### `description`
|
|
80
|
+
|
|
81
|
+
One-line description shown in the interactive template picker.
|
|
82
|
+
|
|
83
|
+
### `skills`
|
|
84
|
+
|
|
85
|
+
Skills to install. Each entry specifies a GitHub repository and the skill name within it — matching the `npx skills add <repo> --skill <name>` command.
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
skills:
|
|
89
|
+
- repo: https://github.com/vercel-labs/skills
|
|
90
|
+
skill: vercel-react-best-practices
|
|
91
|
+
- repo: https://github.com/remotion-dev/skills
|
|
92
|
+
skill: remotion-best-practices
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Installed after symlinks are set up, so they land in `.oneagent/skills/` and get distributed to all configured agents automatically.
|
|
96
|
+
|
|
97
|
+
### `plugins`
|
|
98
|
+
|
|
99
|
+
Agent plugins to install. Each entry has:
|
|
100
|
+
|
|
101
|
+
| Field | Description |
|
|
102
|
+
|-------|-------------|
|
|
103
|
+
| `target` | Which agent to install the plugin for |
|
|
104
|
+
| `id` | Plugin identifier as expected by that agent's install command |
|
|
105
|
+
|
|
106
|
+
How each target installs:
|
|
107
|
+
|
|
108
|
+
| Target | Method | Notes |
|
|
109
|
+
|--------|--------|-------|
|
|
110
|
+
| `claude` | `claude plugin install <id>` | Via Claude Code CLI |
|
|
111
|
+
| `copilot` | `copilot plugin install <id>` | Via GitHub Copilot CLI |
|
|
112
|
+
| `opencode` | Added to `"plugin"` array in `opencode.json` | Config-based |
|
|
113
|
+
| `cursor` | Not automated | User sees: `Run in Cursor chat: /add-plugin <id>` |
|
|
114
|
+
| `windsurf` | Not supported yet | Skipped silently |
|
|
115
|
+
|
|
116
|
+
Only plugins for agents the user selected during `init` are installed.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## `instructions.md`
|
|
121
|
+
|
|
122
|
+
The main AI instructions file. Written to `.oneagent/instructions.md` and distributed to all configured agents.
|
|
123
|
+
|
|
124
|
+
Write it as if you're explaining the project to an AI assistant — stack, conventions, what to avoid.
|
|
125
|
+
|
|
126
|
+
```md
|
|
127
|
+
# Project Instructions
|
|
128
|
+
|
|
129
|
+
This is a TypeScript monorepo using pnpm workspaces.
|
|
130
|
+
|
|
131
|
+
## Stack
|
|
132
|
+
|
|
133
|
+
- Node.js 20, TypeScript 5
|
|
134
|
+
- Fastify for the API
|
|
135
|
+
- Drizzle ORM with PostgreSQL
|
|
136
|
+
|
|
137
|
+
## Conventions
|
|
138
|
+
|
|
139
|
+
- No floating promises — always handle async errors explicitly
|
|
140
|
+
- Use `zod` for validation at API boundaries
|
|
141
|
+
- Tests live next to source files as `*.test.ts`
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## `rules/` directory
|
|
147
|
+
|
|
148
|
+
Optional. Each `.md` file becomes a rule in `.oneagent/rules/` and is distributed to all agents that support rules (Claude Code, Cursor, Windsurf, etc.).
|
|
149
|
+
|
|
150
|
+
### Minimal rule
|
|
151
|
+
|
|
152
|
+
```md
|
|
153
|
+
# No console.log in production
|
|
154
|
+
|
|
155
|
+
Remove all `console.log` calls before committing. Use a structured logger instead.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Rule with frontmatter
|
|
159
|
+
|
|
160
|
+
```md
|
|
161
|
+
---
|
|
162
|
+
applyTo: "**/*.ts"
|
|
163
|
+
---
|
|
164
|
+
# TypeScript conventions
|
|
165
|
+
|
|
166
|
+
- Never use `any` — use `unknown` and narrow the type explicitly
|
|
167
|
+
- Prefer `type` over `interface` for object shapes
|
|
168
|
+
- Always annotate function return types
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`applyTo` is a glob that scopes the rule to specific files. Omit it to apply the rule globally.
|
|
172
|
+
|
|
173
|
+
### File naming
|
|
174
|
+
|
|
175
|
+
Rule files are named after their filename (without `.md`). Use lowercase, hyphenated names:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
rules/
|
|
179
|
+
no-console.md
|
|
180
|
+
typescript-conventions.md
|
|
181
|
+
commit-style.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Minimal example
|
|
187
|
+
|
|
188
|
+
The smallest valid template is two files:
|
|
189
|
+
|
|
190
|
+
`template.yml`:
|
|
191
|
+
```yaml
|
|
192
|
+
name: my-template
|
|
193
|
+
description: My team's standard setup
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`instructions.md`:
|
|
197
|
+
```md
|
|
198
|
+
# Project Instructions
|
|
199
|
+
|
|
200
|
+
Follow the team coding standards documented in Notion.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Skills, plugins, and rules are all optional.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fs from "fs/promises";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
|
-
import { type TemplatePlugin, type TemplateDefinition,
|
|
4
|
+
import { type TemplatePlugin, type TemplateDefinition, parseTemplateYaml } from "@moskala/oneagent-core";
|
|
5
5
|
|
|
6
6
|
export type { TemplatePlugin, TemplateDefinition };
|
|
7
7
|
|
|
@@ -19,21 +19,7 @@ async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefiniti
|
|
|
19
19
|
fs.readFile(path.join(templateDir, "instructions.md"), "utf-8"),
|
|
20
20
|
]);
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
const descMatch = yamlText.match(/^description:\s*(.+)$/m);
|
|
24
|
-
const description = descMatch?.[1]?.trim() ?? "";
|
|
25
|
-
|
|
26
|
-
const skills: string[] = [];
|
|
27
|
-
const skillsBlockMatch = yamlText.match(/^skills:\s*\n((?: - .+\n?)*)/m);
|
|
28
|
-
if (skillsBlockMatch) {
|
|
29
|
-
const lines = skillsBlockMatch[1]!.split("\n").filter(Boolean);
|
|
30
|
-
for (const line of lines) {
|
|
31
|
-
const skill = line.replace(/^\s*-\s*/, "").trim();
|
|
32
|
-
if (skill) skills.push(skill);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const plugins = parsePluginsFromYaml(yamlText);
|
|
22
|
+
const { description, skills, plugins } = parseTemplateYaml(yamlText, name);
|
|
37
23
|
|
|
38
24
|
const rulesDir = path.join(templateDir, "rules");
|
|
39
25
|
let rules: Array<{ name: string; content: string }> = [];
|
|
@@ -60,3 +46,14 @@ export async function resolveBuiltinTemplate(name: string): Promise<TemplateDefi
|
|
|
60
46
|
}
|
|
61
47
|
|
|
62
48
|
export const BUILTIN_TEMPLATE_NAMES: readonly string[] = TEMPLATE_NAMES;
|
|
49
|
+
|
|
50
|
+
export interface BuiltinTemplateMeta {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const BUILTIN_TEMPLATE_META: BuiltinTemplateMeta[] = [
|
|
56
|
+
{ name: "default", description: "General programming starter" },
|
|
57
|
+
{ name: "react", description: "React / Next.js project starter" },
|
|
58
|
+
{ name: "react-native", description: "React Native / Expo project starter" },
|
|
59
|
+
];
|
|
@@ -1,3 +1,36 @@
|
|
|
1
1
|
name: default
|
|
2
2
|
description: General programming starter
|
|
3
|
-
skills:
|
|
3
|
+
skills:
|
|
4
|
+
- repo: https://github.com/vercel-labs/skills
|
|
5
|
+
skill: find-skills
|
|
6
|
+
- repo: https://github.com/anthropics/skills
|
|
7
|
+
skill: skill-creator
|
|
8
|
+
- repo: https://github.com/github/awesome-copilot
|
|
9
|
+
skill: conventional-commit
|
|
10
|
+
- repo: https://github.com/oldwinter/skills
|
|
11
|
+
skill: github-cli
|
|
12
|
+
- repo: https://github.com/supercent-io/skills-template
|
|
13
|
+
skill: code-review
|
|
14
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
15
|
+
skill: web-design-guidelines
|
|
16
|
+
- repo: https://github.com/coreyhaines31/marketingskills
|
|
17
|
+
skill: copywriting
|
|
18
|
+
plugins:
|
|
19
|
+
- target: claude
|
|
20
|
+
id: context7@claude-plugins-official
|
|
21
|
+
- target: claude
|
|
22
|
+
id: superpowers@claude-plugins-official
|
|
23
|
+
- target: claude
|
|
24
|
+
id: code-simplifier@claude-plugins-official
|
|
25
|
+
- target: claude
|
|
26
|
+
id: security-guidance@claude-plugins-official
|
|
27
|
+
- target: claude
|
|
28
|
+
id: claude-md-management@claude-plugins-official
|
|
29
|
+
- target: opencode
|
|
30
|
+
id: oh-my-opencode
|
|
31
|
+
- target: opencode
|
|
32
|
+
id: "@plannotator/opencode"
|
|
33
|
+
- target: opencode
|
|
34
|
+
id: "@openspoon/subtask2"
|
|
35
|
+
- target: opencode
|
|
36
|
+
id: micode
|
|
@@ -1,10 +1,54 @@
|
|
|
1
1
|
name: react
|
|
2
2
|
description: React / Next.js project starter
|
|
3
3
|
skills:
|
|
4
|
-
- vercel-labs/
|
|
5
|
-
|
|
4
|
+
- repo: https://github.com/vercel-labs/skills
|
|
5
|
+
skill: find-skills
|
|
6
|
+
- repo: https://github.com/anthropics/skills
|
|
7
|
+
skill: skill-creator
|
|
8
|
+
- repo: https://github.com/github/awesome-copilot
|
|
9
|
+
skill: conventional-commit
|
|
10
|
+
- repo: https://github.com/oldwinter/skills
|
|
11
|
+
skill: github-cli
|
|
12
|
+
- repo: https://github.com/supercent-io/skills-template
|
|
13
|
+
skill: code-review
|
|
14
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
15
|
+
skill: web-design-guidelines
|
|
16
|
+
- repo: https://github.com/coreyhaines31/marketingskills
|
|
17
|
+
skill: copywriting
|
|
18
|
+
- repo: https://github.com/anthropics/skills
|
|
19
|
+
skill: frontend-design
|
|
20
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
21
|
+
skill: vercel-react-best-practices
|
|
22
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
23
|
+
skill: vercel-composition-patterns
|
|
24
|
+
- repo: https://github.com/obra/superpowers
|
|
25
|
+
skill: brainstorming
|
|
26
|
+
- repo: https://github.com/coreyhaines31/marketingskills
|
|
27
|
+
skill: seo-audit
|
|
28
|
+
- repo: https://github.com/vercel-labs/next-skills
|
|
29
|
+
skill: next-best-practices
|
|
30
|
+
- repo: https://github.com/wshobson/agents
|
|
31
|
+
skill: react-state-management
|
|
6
32
|
plugins:
|
|
33
|
+
- target: claude
|
|
34
|
+
id: context7@claude-plugins-official
|
|
35
|
+
- target: claude
|
|
36
|
+
id: superpowers@claude-plugins-official
|
|
37
|
+
- target: claude
|
|
38
|
+
id: code-simplifier@claude-plugins-official
|
|
39
|
+
- target: claude
|
|
40
|
+
id: security-guidance@claude-plugins-official
|
|
41
|
+
- target: claude
|
|
42
|
+
id: claude-md-management@claude-plugins-official
|
|
43
|
+
- target: claude
|
|
44
|
+
id: frontend-design@claude-plugins-official
|
|
7
45
|
- target: claude
|
|
8
46
|
id: typescript-lsp@claude-plugins-official
|
|
9
|
-
- target:
|
|
10
|
-
id:
|
|
47
|
+
- target: opencode
|
|
48
|
+
id: oh-my-opencode
|
|
49
|
+
- target: opencode
|
|
50
|
+
id: "@plannotator/opencode"
|
|
51
|
+
- target: opencode
|
|
52
|
+
id: "@openspoon/subtask2"
|
|
53
|
+
- target: opencode
|
|
54
|
+
id: micode
|
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
name: react-native
|
|
2
2
|
description: React Native / Expo project starter
|
|
3
|
-
skills:
|
|
3
|
+
skills:
|
|
4
|
+
- repo: https://github.com/vercel-labs/skills
|
|
5
|
+
skill: find-skills
|
|
6
|
+
- repo: https://github.com/anthropics/skills
|
|
7
|
+
skill: skill-creator
|
|
8
|
+
- repo: https://github.com/github/awesome-copilot
|
|
9
|
+
skill: conventional-commit
|
|
10
|
+
- repo: https://github.com/oldwinter/skills
|
|
11
|
+
skill: github-cli
|
|
12
|
+
- repo: https://github.com/supercent-io/skills-template
|
|
13
|
+
skill: code-review
|
|
14
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
15
|
+
skill: web-design-guidelines
|
|
16
|
+
- repo: https://github.com/coreyhaines31/marketingskills
|
|
17
|
+
skill: copywriting
|
|
18
|
+
- repo: https://github.com/anthropics/skills
|
|
19
|
+
skill: frontend-design
|
|
20
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
21
|
+
skill: vercel-react-best-practices
|
|
22
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
23
|
+
skill: vercel-composition-patterns
|
|
24
|
+
- repo: https://github.com/obra/superpowers
|
|
25
|
+
skill: brainstorming
|
|
26
|
+
- repo: https://github.com/coreyhaines31/marketingskills
|
|
27
|
+
skill: seo-audit
|
|
28
|
+
- repo: https://github.com/vercel-labs/next-skills
|
|
29
|
+
skill: next-best-practices
|
|
30
|
+
- repo: https://github.com/wshobson/agents
|
|
31
|
+
skill: react-state-management
|
|
32
|
+
- repo: https://github.com/vercel-labs/agent-skills
|
|
33
|
+
skill: vercel-react-native-skills
|
|
34
|
+
- repo: https://github.com/callstackincubator/agent-skills
|
|
35
|
+
skill: react-native-best-practices
|
|
36
|
+
- repo: https://github.com/callstackincubator/agent-skills
|
|
37
|
+
skill: upgrading-react-native
|
|
38
|
+
- repo: https://github.com/expo/skills
|
|
39
|
+
skill: upgrading-expo
|
|
40
|
+
- repo: https://github.com/conorluddy/ios-simulator-skill
|
|
41
|
+
skill: ios-simulator-skill
|
|
4
42
|
plugins:
|
|
43
|
+
- target: claude
|
|
44
|
+
id: context7@claude-plugins-official
|
|
45
|
+
- target: claude
|
|
46
|
+
id: superpowers@claude-plugins-official
|
|
47
|
+
- target: claude
|
|
48
|
+
id: code-simplifier@claude-plugins-official
|
|
49
|
+
- target: claude
|
|
50
|
+
id: security-guidance@claude-plugins-official
|
|
51
|
+
- target: claude
|
|
52
|
+
id: claude-md-management@claude-plugins-official
|
|
53
|
+
- target: claude
|
|
54
|
+
id: frontend-design@claude-plugins-official
|
|
5
55
|
- target: claude
|
|
6
56
|
id: typescript-lsp@claude-plugins-official
|
|
57
|
+
- target: opencode
|
|
58
|
+
id: oh-my-opencode
|
|
59
|
+
- target: opencode
|
|
60
|
+
id: "@plannotator/opencode"
|
|
61
|
+
- target: opencode
|
|
62
|
+
id: "@openspoon/subtask2"
|
|
63
|
+
- target: opencode
|
|
64
|
+
id: micode
|