Skip to content

Commit f016e45

Browse files
authored
Merge pull request #91 from kompassdev/feature/skill-commands
Add skill authoring commands
2 parents 70d14b1 + 450ebf4 commit f016e45

22 files changed

Lines changed: 708 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Kompass keeps AI coding agents on course with token-efficient, composable workfl
1818

1919
## Bundled Surface
2020

21-
- Commands cover direct work (`/ask`, `/commit`, `/merge`), orchestration (`/dev`, `/ship`, `/todo`), ticket planning/sync, and PR review/shipping flows.
21+
- Commands cover direct work (`/ask`, `/commit`, `/merge`, `/skill/create`, `/skill/optimize`), orchestration (`/dev`, `/ship`, `/todo`), ticket planning/sync, and PR review/shipping flows.
2222
- Agents are intentionally narrow: `worker` is generic, `planner` is no-edit planning, `navigator` owns multi-step orchestration, and `reviewer` is a no-edit review specialist.
2323
- Structured tools keep workflows grounded in repo and GitHub state: `changes_load`, `command_expansion` (resolve a slash command and return the expanded prompt for immediate delegation), `pr_load`, `pr_sync`, `ticket_load`, `ticket_sync`.
2424
- Reusable command-template components live in `packages/core/components/` and are documented in the components reference.

kompass.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"pr/fix": { "enabled": true },
2323
"pr/review": { "enabled": true },
2424
"review": { "enabled": true },
25+
"skill/create": { "enabled": true },
26+
"skill/optimize": { "enabled": true },
2527
"ship": { "enabled": true },
2628
"rmslop": { "enabled": true },
2729
"todo": { "enabled": true },
@@ -55,6 +57,7 @@
5557
"dev-flow": { "enabled": true },
5658
"load-pr": { "enabled": true },
5759
"load-ticket": { "enabled": true },
60+
"skill-authoring": { "enabled": true },
5861
"summarize-changes": { "enabled": true },
5962
},
6063

kompass.schema.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
"review": {
6666
"$ref": "#/$defs/commandConfig"
6767
},
68+
"skill/create": {
69+
"$ref": "#/$defs/commandConfig"
70+
},
71+
"skill/optimize": {
72+
"$ref": "#/$defs/commandConfig"
73+
},
6874
"ship": {
6975
"$ref": "#/$defs/commandConfig"
7076
},
@@ -105,6 +111,8 @@
105111
"pr/fix",
106112
"pr/review",
107113
"review",
114+
"skill/create",
115+
"skill/optimize",
108116
"ship",
109117
"rmslop",
110118
"todo",
@@ -133,6 +141,8 @@
133141
"pr/fix",
134142
"pr/review",
135143
"review",
144+
"skill/create",
145+
"skill/optimize",
136146
"ship",
137147
"rmslop",
138148
"todo",
@@ -223,22 +233,25 @@
223233
"load-ticket": {
224234
"$ref": "#/$defs/componentConfig"
225235
},
236+
"skill-authoring": {
237+
"$ref": "#/$defs/componentConfig"
238+
},
226239
"summarize-changes": {
227240
"$ref": "#/$defs/componentConfig"
228241
},
229242
"enabled": {
230243
"type": "array",
231244
"items": {
232245
"type": "string",
233-
"enum": ["change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "summarize-changes"]
246+
"enum": ["change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "skill-authoring", "summarize-changes"]
234247
},
235248
"uniqueItems": true,
236249
"deprecated": true
237250
},
238251
"paths": {
239252
"type": "object",
240253
"propertyNames": {
241-
"enum": ["change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "summarize-changes"]
254+
"enum": ["change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "skill-authoring", "summarize-changes"]
242255
},
243256
"additionalProperties": {
244257
"type": "string"

packages/core/commands/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ export const commandDefinitions: Record<string, CommandDefinition> = {
6868
agent: "reviewer",
6969
templatePath: "commands/review.md",
7070
},
71+
"skill/create": {
72+
description: "Create a focused Agent Skill from repo context",
73+
agent: "worker",
74+
templatePath: "commands/skill/create.md",
75+
},
76+
"skill/optimize": {
77+
description: "Improve an existing Agent Skill from real feedback",
78+
agent: "worker",
79+
templatePath: "commands/skill/optimize.md",
80+
},
7181
ship: {
7282
description: "Ship branch work through commit and PR creation",
7383
agent: "navigator",
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
## Goal
2+
3+
Create a new Agent Skill from project context and user direction, producing a focused `SKILL.md` and only the supporting files that materially improve the skill.
4+
5+
## Additional Context
6+
7+
- Favor creation over revision: create the smallest correct first version of the skill from the gathered context
8+
- Only add support files during creation when they clearly improve execution on day one
9+
10+
## Workflow
11+
12+
### Arguments
13+
14+
<arguments>
15+
$ARGUMENTS
16+
</arguments>
17+
18+
### Interpret Arguments
19+
20+
- If `<arguments>` contains a clear skill request, store it as `<skill-request>`
21+
- If `<arguments>` contains an explicit skill name, slug, or desired folder name, store it as `<requested-name>`
22+
- If `<arguments>` includes supporting context such as file paths, URLs, ticket references, or existing examples, store them as `<context-sources>`
23+
- If `<arguments>` includes constraints, audience, tools, or notes, store them as `<additional-context>`
24+
- If `<skill-request>` is still missing, derive it from the conversation
25+
- If the request still cannot be determined, STOP and report that skill direction is required
26+
27+
### Load Starting Context
28+
29+
- Inspect the repository for existing skills, skill roots, and nearby conventions before creating anything
30+
- If the repo already uses one clear skill root, store it as `<skill-root>`
31+
- Otherwise, store `.agents/skills` as `<skill-root>`
32+
- Read only the relevant existing skills, docs, scripts, and project artifacts needed to ground the new skill
33+
- If an existing skill already covers the same scope and the request does not clearly justify a separate skill, STOP and report the overlap instead of creating a duplicate
34+
35+
<%~ include("@skill-authoring", { mode: "create" }) %>
36+
37+
### Output
38+
39+
If skill direction is missing, display:
40+
```
41+
Skill direction required
42+
43+
Provide the skill goal, workflow, or domain so the skill can be created.
44+
45+
No additional steps are required.
46+
```
47+
48+
If an existing skill already covers the scope, display:
49+
```
50+
Skill already exists for this scope
51+
52+
Existing skill: <existing-skill-path>
53+
Reason: <overlap-reason>
54+
55+
No additional steps are required.
56+
```
57+
58+
When the skill is created, display:
59+
```
60+
Created skill: <skill-name>
61+
62+
Path: <skill-dir>/SKILL.md
63+
Files:
64+
<file-lines>
65+
66+
Validation:
67+
<validation-results>
68+
69+
No additional steps are required.
70+
```
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
## Goal
2+
3+
Improve an existing Agent Skill so it triggers more reliably, stays lean, and produces better outputs for the intended workflow.
4+
5+
## Additional Context
6+
7+
- Favor targeted iteration over full rewrites; keep what already works and change only the parts blocking activation or execution quality
8+
- Prefer optimization grounded in real prompts, evals, reviewer feedback, transcripts, or repeated failures over speculative cleanup
9+
10+
## Workflow
11+
12+
### Arguments
13+
14+
<arguments>
15+
$ARGUMENTS
16+
</arguments>
17+
18+
### Interpret Arguments
19+
20+
- If `<arguments>` contains a skill path, folder, slug, or `SKILL.md` reference, store it as `<skill-ref>`
21+
- If `<arguments>` includes an optimization focus such as triggering, output quality, evals, or excess complexity, store it as `<optimization-focus>`
22+
- If `<arguments>` includes evidence such as prompts, failing cases, reviewer feedback, transcripts, or related files, store it as `<optimization-inputs>`
23+
- If `<arguments>` includes constraints, audience, tools, or notes, store them as `<additional-context>`
24+
- If `<skill-ref>` is still missing, derive it from the conversation
25+
- If the target skill still cannot be determined, STOP and report that a skill reference is required
26+
27+
### Load Skill Context
28+
29+
- Resolve `<skill-ref>` to the target skill directory and store it as `<skill-dir>`
30+
- Confirm `<skill-dir>/SKILL.md` exists; if not, STOP and report that the skill could not be found
31+
- Read the current `SKILL.md`
32+
- Read only the support files that materially affect the optimization focus, such as `references/`, `scripts/`, `assets/`, `evals/`, or nearby docs
33+
- If optimization evidence was provided through `<optimization-inputs>`, load and use it as source context
34+
35+
### Reapply Skill Workflow
36+
37+
- Identify the smallest set of changes that will improve `<optimization-focus>` without rewriting working parts of the skill
38+
- If the skill already matches the requested focus and no meaningful improvement is justified, STOP and report that no changes are needed
39+
40+
<%~ include("@skill-authoring", { mode: "optimize" }) %>
41+
42+
### Output
43+
44+
If the target skill cannot be determined, display:
45+
```
46+
Skill reference required
47+
48+
Provide the skill path, folder, slug, or `SKILL.md` target to optimize.
49+
50+
No additional steps are required.
51+
```
52+
53+
If the target skill cannot be found, display:
54+
```
55+
Skill not found
56+
57+
Target: <skill-ref>
58+
59+
No additional steps are required.
60+
```
61+
62+
If no meaningful optimization is needed, display:
63+
```
64+
No skill changes needed
65+
66+
Skill: <skill-dir>
67+
Reason: <no-change-reason>
68+
69+
No additional steps are required.
70+
```
71+
72+
When the skill is optimized, display:
73+
```
74+
Optimized skill: <skill-dir>
75+
76+
Updated files:
77+
<file-lines>
78+
79+
Validation:
80+
<validation-results>
81+
82+
No additional steps are required.
83+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
### Shared Skill Workflow
2+
3+
#### Load Related Context
4+
5+
- Read only the code, skills, scripts, docs, evals, and conversation context that materially affect this skill
6+
- Ground decisions in project-specific patterns, successful examples, and repeated corrections rather than generic advice
7+
- Use related skills to understand naming, boundaries, and overlap when they are relevant
8+
- If optimizing an existing skill, treat the current skill and its support files as the source of truth before changing anything
9+
10+
#### Design The Skill
11+
12+
- Keep the skill to one coherent reusable job; narrow broad requests to the most reusable unit
13+
- Prefer the smallest correct shape: start with `SKILL.md`, then add support files only when they materially help
14+
<% if (it.mode === "create") { -%>
15+
- Derive `<skill-name>` by preferring `<requested-name>` when it is valid; otherwise create a lowercase hyphenated name that matches the intended folder name and satisfies the Agent Skills naming rules
16+
- Store the target directory as `<skill-dir>` = `<skill-root>/<skill-name>`
17+
<% } else { -%>
18+
- Preserve the existing skill name and directory unless the user explicitly asked for a rename or move
19+
- Store the working skill name as `<skill-name>` and keep `<skill-dir>` as the target directory
20+
<% } -%>
21+
- Write the `description` as an imperative trigger instruction focused on user intent, such as `Use this skill when...`
22+
- Prefer one clear default approach; mention alternatives only as explicit escape hatches
23+
- Include gotchas, validation loops, examples, or output templates only when they materially improve execution
24+
- Keep `SKILL.md` concise; move heavy detail to `references/`, `scripts/`, `assets/`, or `evals/` with explicit load conditions
25+
26+
#### Write The Skill
27+
28+
- Create or update `<skill-dir>/SKILL.md`
29+
- Keep frontmatter minimal: use `name` and `description`, and add optional fields only when they are justified
30+
- Write concrete procedures and defaults instead of generic declarations
31+
- Avoid empty directories, placeholder files, and speculative assets
32+
- Store the changed file list as `<file-lines>` with one bullet per file path
33+
34+
#### Validate The Skill
35+
36+
- Confirm the directory name matches the skill name in frontmatter
37+
- Confirm the frontmatter is valid and the description remains within the Agent Skills limits
38+
- Confirm file references are relative to the skill root and point to real files
39+
- If scripts or eval helpers were added or updated, run the most relevant available validation for those files
40+
- Store the resulting validation summary as `<validation-results>`

packages/core/kompass.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"pr/fix": { "enabled": true },
2323
"pr/review": { "enabled": true },
2424
"review": { "enabled": true },
25+
"skill/create": { "enabled": true },
26+
"skill/optimize": { "enabled": true },
2527
"ship": { "enabled": true },
2628
"rmslop": { "enabled": true },
2729
"todo": { "enabled": true },
@@ -55,6 +57,7 @@
5557
"dev-flow": { "enabled": true },
5658
"load-pr": { "enabled": true },
5759
"load-ticket": { "enabled": true },
60+
"skill-authoring": { "enabled": true },
5861
"summarize-changes": { "enabled": true },
5962
},
6063

packages/core/lib/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export const DEFAULT_COMMAND_NAMES = [
3333
"pr/fix",
3434
"pr/review",
3535
"review",
36+
"skill/create",
37+
"skill/optimize",
3638
"ship",
3739
"rmslop",
3840
"todo",
@@ -52,6 +54,7 @@ export const DEFAULT_COMPONENT_NAMES = [
5254
"dev-flow",
5355
"load-pr",
5456
"load-ticket",
57+
"skill-authoring",
5558
"summarize-changes",
5659
] as const;
5760

@@ -97,6 +100,8 @@ export interface KompassConfig {
97100
"pr/fix"?: CommandConfig;
98101
"pr/review"?: CommandConfig;
99102
review?: CommandConfig;
103+
"skill/create"?: CommandConfig;
104+
"skill/optimize"?: CommandConfig;
100105
ship?: CommandConfig;
101106
rmslop?: CommandConfig;
102107
todo?: CommandConfig;
@@ -130,6 +135,7 @@ export interface KompassConfig {
130135
"dev-flow"?: ComponentConfig;
131136
"load-pr"?: ComponentConfig;
132137
"load-ticket"?: ComponentConfig;
138+
"skill-authoring"?: ComponentConfig;
133139
"summarize-changes"?: ComponentConfig;
134140
enabled?: string[];
135141
paths?: Record<string, string>;
@@ -443,6 +449,7 @@ const defaultComponentPaths: Record<string, string> = {
443449
"dev-flow": "components/dev-flow.md",
444450
"load-pr": "components/load-pr.md",
445451
"load-ticket": "components/load-ticket.md",
452+
"skill-authoring": "components/skill-authoring.md",
446453
"summarize-changes": "components/summarize-changes.md",
447454
};
448455

0 commit comments

Comments
 (0)