Files
holocron/plugins/kyberforge/skills/skill-author/SKILL.md
Defame1297 7ec34dd0de fix(kyberforge): improve skill-author based on spec validation and audit
- Add name field format constraints (1-64 chars, hyphens rules)
- Add output format template pattern to ## Patterns
- Add scope design note before prerequisites checklist
- Add reference depth rule (one level deep)
- Restore Placement table to README
- Trim script rules to 2 inline + full contract in references/scripts.md
- Add script contract section to references/scripts.md (error messages,
  dry-run/confirm pairing, output size, idempotency, exit codes)
- Update Step 5 headings to "Validate and close" in both flows
- Remove "Performs best when preceded by grill session" from description
- Condense Include/Exclude block to single forwarding sentence
- Fix README Files table: add README.md row, update scripts.md description

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016z2ZFYHQCex8yZAMVMTZzZ
2026-06-24 19:18:50 +00:00

232 lines
10 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: skill-author
description: >
Use when the user wants to create a new skill from scratch ("write a skill
for X", "build a skill that does Y", "create a SKILL.md for Z"), or improve
an existing one ("improve this skill", "fix based on feedback", "apply these
audit findings", "update based on grill output"). Also use when the user
provides inline feedback about a skill's behavior and wants it applied, or
when a grill session, eval run, or audit has produced findings the user wants
acted on — even if they don't say "improve" explicitly. Authors and refines
skills following the agentskills.io specification. Do not use for read-only review — use
/skill-audit instead. Do not use to author agent definition files.
allowed-tools: Bash Read Write Edit
metadata:
category: factory
---
## Gotchas
- Patching per symptom is the default failure mode. Three eval failures may all trace to one missing instruction — always identify the root cause before editing.
- Do not create new scripts unless a signal explicitly calls for it. Writing scripts from scratch requires transcript analysis that is out of scope here; flag the opportunity as a suggestion instead.
## Route
Determine which flow to follow before touching the filesystem:
- **No skill directory at the target path** → follow **Creating a new skill**
- **Directory exists + at least one improvement signal present** → follow **Improving an existing skill**
- **Directory exists + no signals present** → ask: "No improvement signals found. Did you mean to create a new skill, or do you have feedback to apply?"
Signals include: grill session output, `/skill-audit` findings (PASS/FAIL punch list), inline user feedback, session context describing what went wrong.
## Creating a new skill
### Prerequisites
Run `/grill-me` on the skill's design and research the target domain first.
Share those outputs in this conversation: grill context, research docs, examples, constraints.
Design for one coherent user intent — skills too narrow force multiple loads per task; too broad are hard to activate precisely.
**Before touching the filesystem, verify you have:**
- [ ] A clear purpose — what specific task will this skill handle?
- [ ] Trigger scenarios — when should an agent activate it, including indirect cases?
- [ ] Skill name (kebab-case) and destination path
If any are missing, stop and ask the user before proceeding.
**Requires `/skill-audit`** — used in Step 5 for final validation. Both skills ship in the kyberforge plugin and are co-installed. If `/skill-audit` is unavailable, stop and ask the user to install the kyberforge plugin before continuing.
### Step 1 — Scaffold
Run the copy script with the skill name and destination directory:
```bash
bash scripts/new-skill.sh <skill-name> <destination-dir>
```
Examples:
```bash
bash scripts/new-skill.sh my-tool ~/.agents/skills/
bash scripts/new-skill.sh data-analyzer plugins/myplugin/skills/
```
This creates `<destination-dir>/<skill-name>/` with annotated templates ready to fill in.
If the destination is inside a plugin directory (path contains a `plugin.json`), read `references/deployment-modes.md` before adding any file references to SKILL.md.
### Step 2 — Fill in SKILL.md
Open `<destination-dir>/<skill-name>/SKILL.md`. Replace every `FILL IN:` placeholder.
#### Frontmatter
**`name`** — already set by the scaffold script. Must exactly match the directory name. Format: 1–64 characters, lowercase letters/numbers/hyphens only, no leading, trailing, or consecutive hyphens (`--`).
**`description`** — carries the entire triggering burden. Rules:
- Imperative: "Use when..." not "This skill..."
- Focus on user intent, not implementation — describe what the user is trying to achieve, not the skill's internal mechanics
- Specific about capabilities ("parses and validates OpenAPI specs", not "helps with APIs")
- Include indirect triggers: "even if the user doesn't mention X explicitly"
- Add "Do not use when..." only if a near-miss skill exists that could steal activations
- Hard limit: 1024 characters — count before finalizing
**Optional fields** — uncomment and fill in or remove entirely:
- `license` — include when distributing the skill externally
- `compatibility` — include if the skill requires specific tools, runtimes, or network access
- `metadata` — key-value map; use `author`, `version`, `category`
- `allowed-tools` — space-separated pre-approved tools; reduces permission prompts
#### Body — include only what the agent lacks
Rename the placeholder section heading to one that fits the skill's structure — `## Step 1`, `## Workflow`, `## Instructions`, etc.
Follow body discipline: one default per decision point, no menus, gotchas near the top. Ask of every sentence: "Would the agent get this wrong without it?" Cut anything that answers "no."
#### Patterns
**Gotchas** — highest value; place near the top:
```markdown
## Gotchas
- <Fact that defies a reasonable assumption>
- <Non-obvious naming discrepancy or hidden constraint>
```
**Default with escape hatch** (not a menu):
```markdown
Use <X> for <task>. For <edge case>, use <Y> instead.
```
**Prescriptive sequence** (when order is critical or fragile):
```markdown
Run exactly:
\`\`\`bash
<command>
\`\`\`
Do not modify flags.
```
**Checklist** (multi-step workflows):
```markdown
- [ ] Step 1: ...
- [ ] Step 2: ...
```
**Conditional reference** (progressive disclosure — load only when needed):
```markdown
If <condition>, read `references/<file>.md`.
```
**Output format template** (when the skill produces structured output):
```markdown
Output format:
\`\`\`
<field>: <value>
<field>: <value>
\`\`\`
```
For longer templates, place in `assets/<name>.md` and reference conditionally.
#### Size budget
Keep `SKILL.md` under 500 lines and 5,000 tokens. When approaching the limit:
- Move reference material to `references/<topic>.md` and load it conditionally
- Bundle repeated executable logic into `scripts/` rather than reinventing each run
### Step 3 — Add scripts (if needed)
Place executable scripts in `scripts/`. Two critical rules:
- **No interactive prompts** — agents run non-interactive; blocking on TTY input hangs indefinitely. Accept all input via flags, env vars, or stdin.
- **Expose `--help`** — concise usage output; keep it short (it enters the agent's context)
For the full script contract (self-contained deps, structured output, idempotency, exit codes, dry-run, error messages, output size), read `references/scripts.md`.
If no scripts are needed, delete `scripts/README.md` and the `scripts/` directory.
### Step 4 — Add references, assets, and tests (if needed)
**`references/`** — additional documentation loaded on demand. One topic per file.
Reference conditionally from SKILL.md: `If <condition>, read references/<file>.md`.
Keep reference chains one level deep — a reference file that references another reference file is rarely loaded correctly.
**`assets/`** — static resources: templates, schemas, lookup tables.
Reference by relative path from SKILL.md.
**`tests/`** — test files for scripts in `scripts/`. Use when scripts are complex
enough to break silently. Test infrastructure (`.bats`, `*_test.*`) belongs here,
not in `scripts/`. See `tests/README.md` for setup instructions.
If not needed, delete the placeholder READMEs and their directories.
### Step 5 — Validate and close
Run `/skill-audit` on `<destination-dir>/<skill-name>`.
All FAIL findings must be resolved before the skill is considered done.
## Improving an existing skill
### Step 1 — Verify inputs
Confirm the skill directory path exists and that at least one improvement signal is present in the conversation or a referenced file.
If the skill dir is missing, ask for it. If no signals are present, stop: "This skill applies existing signals to a skill. For a blind review without signals, use `/skill-audit` instead."
Signals can come from anywhere in the conversation or referenced files:
- Grill session output (most common predecessor in the factory sequence)
- `/skill-audit` findings (PASS/FAIL/SUGGESTION punch list)
- Human feedback (feedback.json, inline in conversation, PR or issue comments)
- Session context describing what went wrong
### Step 2 — Gather and group signals
Read the current skill files (SKILL.md and any files in scripts/, references/, assets/, tests/). Then collect all signals from the conversation and any file paths the user has referenced.
Group signals by **root cause**, not symptom. Ask: "What single gap in the skill causes this cluster of failures?" One root cause → one fix. Do not make a separate edit for each symptom.
```text
Example:
- Session context: output format is wrong on every run
- Audit finding: no output template defined
- User feedback: "I always have to ask it to format the output"
→ Root cause: SKILL.md has no output format specification → one fix: add an output template
```
### Step 3 — Announce planned changes
Before editing, state:
- Which root causes were identified and what evidence supports each
- Which files will be changed and what will change in each
Then proceed — edits are reversible via git, no approval checkpoint needed.
### Step 4 — Apply changes
Edit any file in the skill directory that the signals point to: SKILL.md, scripts/, references/, assets/, tests/, README.md.
**Generalize, don't patch.** Find the underlying gap, not the specific example that failed. A fix scoped only to the test cases you've seen will overfit and perform worse on new inputs.
**Keep it lean.** Remove instructions that aren't pulling their weight. For every sentence you add, ask: "Would the agent get this wrong without it?" A shorter, focused skill consistently outperforms an exhaustive one.
**Explain the why.** Reasoning-based instructions outperform rigid directives. If you find yourself writing a rule in all caps (ALWAYS/NEVER), reframe it: explain why the behavior matters so the agent can apply judgment in edge cases.
If a signal points to a script or reference file, edit that file directly rather than adding a workaround in SKILL.md.
**On scripts**: Fix and edit existing scripts freely when signals point to them.
### Step 5 — Validate and close
Run `/skill-audit` on the skill directory. Resolve any FAIL findings before considering the improvement complete.