Skip to the content.

Skill Gen

Scope guard: This skill is not available in LITE scope projects. LITE scope does not support skills or knowledge bundles. If the target project’s AGENTS.md contains agentfs-scope: lite, refuse with a clear message.

Create new skills, modify and improve existing ones with built-in AgentFS conventions. Operates in three modes: simple (quick scaffold), advanced (full eval/iterate/optimize loop using upstream Anthropic skill-creator), and skill check (audit existing skills against seven quality principles). Default mode is simple; use advanced when requesting “thorough”, “with evals”, or “production quality”. Skill Check runs automatically after every creation or update (Post-Creation Checklist).

This is a proxy skill that operates in three modes:

Mode When What Happens
Simple (default) Quick utility skills, SOPs, small workflows Scaffold + write + AgentFS post-creation checklist
Advanced “advanced”, “thorough”, “with evals”, “production quality” Full upstream eval/iterate/optimize loop + AgentFS checklist
Skill Check “check skill”, “skill check”, “audit skill” Audit existing skill against seven quality principles

Mode Selection

Detect mode from user’s language:

When in doubt, ask: “Do you want a quick skill scaffold, or a thorough process with test cases and evaluation?”


Skill Design Principles

Before creating any skill, understand the three foundational principles that govern skill architecture. These apply to both Simple and Advanced modes.

Non-Interactive Scripts

Scripts under scripts/ MUST be non-interactive — they MUST NOT use read, select, interactive prompts, or any mechanism that blocks waiting for stdin. All inputs MUST be accepted via CLI arguments, environment variables, or input files.

Agent-as-Orchestrator

Skills implement a three-layer separation of concerns:

Layer Responsibility Interactive?
SKILL.md Defines the process — steps, decision points, gates N/A (blueprint)
Agent Orchestrates flow, mediates user interaction, feeds data between steps ✅ Conversationally
Scripts Execute deterministic, repeatable actions ❌ Never

The agent handles ambiguous inputs, clarifications, approvals, and error explanations. Scripts handle validation, API calls, and data transformations. SKILL.md is the contract between them.

Rule of thumb: Loose steps → write instructions; fragile steps → write code. When logic is approximate and benefits from model judgment, describe it in SKILL.md prose. When logic is precise, fragile, or must be consistent across runs, implement it as a script.

Corollary — lower the cognitive bar for model callers:

Business Process Modeling

Skills can model multi-step processes with human interaction points. Interactivity belongs in the agent ↔ user conversation, not in script execution. A process skill defines:

Privilege Gate pattern:

Some steps require sudo or system-level access. The agent cannot execute these directly. Mark them in SKILL.md with the 🔒 icon and prescribe the exact interaction:

### Step N — Description (🔒 Privilege Gate)

This step requires `sudo`. The agent cannot execute this directly.

**Agent action:** Present the command to the user and request
manual execution. Wait for confirmation before proceeding.

` ` `bash
sudo dnf install -y example-package
` ` `

**Gate condition:** User confirms completion.
**Verification:** Run `scripts/verify.sh` to confirm.

Scripts that detect missing privileges MUST exit with code 3 (see Error Contract below) and print a human-readable message with the exact command to run:

if ! sudo -n true 2>/dev/null; then
  echo "🔒 Privilege gate: this operation requires sudo."
  echo "   Run manually:"
  echo "     sudo dnf install -y example-package"
  exit 3
fi

This preserves all guardrails — scripts stay idempotent (Guardrail #6), the SKILL.md is the process documentation, each script is independently testable, and the same scripts can be reused by other skills or automated jobs with pre-known inputs.


Simple Mode

Step 1 — Capture Intent

Understand what the skill should do. The current conversation may already contain the workflow to capture. Extract:

  1. What should this skill enable the agent to do?
  2. What are the steps involved?
  3. What inputs does it accept?
  4. What does success look like?
  5. Are there scripts to generate or reference docs to include?

Anti-pattern: Generic Mush. Do NOT instruct the agent to do things it already knows from base training (standard error handling, basic input validation, common patterns). A skill’s value comes from domain expertise the model cannot access on its own.

Sources of real expertise:

Gotchas section. Include a “Gotchas” or “Known Issues” section in SKILL.md capturing environment-specific anomalies, historical corrections, and non-obvious behaviors discovered during development or usage. This is often the highest-value section in a skill — hard-won factual knowledge that prevents the agent from repeating past mistakes.

Step 2 — Determine Scope

Scope governs discovery and context loading, not what the skill operates on. A skill managing system infrastructure can live at PROJECT scope if only one project needs to discover it. USER-scope skill signals load into every session on the machine; PROJECT-scope signals load only when working in that project.

Criterion → USER → PROJECT
Every session on this machine needs this skill ✅  
Skill is tied to a specific project or workflow   ✅
Proven reusable across multiple projects ✅  
Signals would be noise in unrelated sessions   ✅

Default: PROJECT (./.agents/skills/<skill-name>/). Promote to USER (~/.agents/skills/<skill-name>/) when cross-project demand is demonstrated. Starting at PROJECT avoids signal phrase bloat in unrelated sessions.

USER scope when explicit: user says “user skill”, “shared skill”, “global skill”, or the skill clearly serves every session (e.g., skill-gen, agentfs-setup, agentfs-eval).

Step 3 — Create Directory Structure

SKILL_DIR="$HOME/.agents/skills/<skill-name>"  # or ./.agents/skills/ for PROJECT
mkdir -p "$SKILL_DIR/scripts"
# mkdir -p "$SKILL_DIR/references"  # only if needed

Step 4 — Write SKILL.md

Generate a SKILL.md with this exact structure:

---
name: <skill-name>
description: >
  <signal phrase 1>, <signal phrase 2>, <signal phrase 3>,
  <signal phrase 4>, <signal phrase 5>
argument-hint: "<usage hint>"
compatibility: "<requirements, if any>"
metadata:
  author: agentfs
  version: "1.0.0"
  tags: [<relevant-tags>]
user-invocable: true
disable-model-invocation: false
---

# <Title>

<Opening paragraph — human-readable explanation of what this skill does,
why it exists, and when to use it. This is the hydrated context that
the signal-phrase description cannot convey.>

## Prerequisites

- <List of requirements>

## Steps

1. **Step name**
   Description and commands.

2. **Step name**
   Description and commands.

## Gotchas

- <Environment-specific anomalies, historical corrections,
  non-obvious behaviors discovered during development or usage>

## Verification

- [ ] <How to confirm success>

## Changelog

> See [CHANGELOG.md](/agentfs/skills/skill-gen/CHANGELOG.html) for version history.

Description as signal phrases:

The description field contains signal phrases — the trigger phrases the LLM uses to match user intent to this skill. It is loaded into every session via the built-in skills listing, making it the only metadata always in the agent’s context.

Opening paragraph:

Since the description field contains signal phrases (not prose), the SKILL.md body MUST include a hydrated opening paragraph immediately after the # Title heading. This paragraph provides the rich human-readable context: what the skill does, why it exists, and when to use it.

Writing guidance:

Step 5 — Write Scripts (if applicable)

Generate executable scripts under scripts/:

Error Contract — exit codes:

Exit Code Meaning Agent Behavior
0 Success Continue to next step
1 Failure Read stdout. Match against Troubleshooting table. If match → follow prescribed fix. If no match → present full output to user, do NOT improvise recovery.
2 Usage error Fix invocation (wrong args). Retry once. If still exit 2 → stop and ask user.
3 Privilege gate Present the script’s output (contains the manual command) to user. Wait for confirmation. Then proceed to verification.

Exit codes 0–3 are reserved across all skills. Scripts MUST NOT use these codes for other meanings.

SKILL.md error handling obligations:

Every skill with scripts MUST include:

  1. Idempotency declaration per script — mark each script as idempotent (safe to retry) or not in an Error Handling table
  2. Recovery path per workflow step — what to do on exit 1
  3. Troubleshooting table — known failure modes with symptom → cause → fix columns
## Error Handling

| Script | Idempotent | On Failure |
|--------|:----------:|------------|
| `setup.sh` | ✅ | Safe to retry. Restores backup on validation failure. |
| `teardown.sh` | ✅ | Safe to retry. Partial teardown is cleanable. |
| `verify.sh` | ✅ (read-only) | Never modifies state. Report failing checks. |

## Troubleshooting

| Symptom | Cause | Fix |
|---------|-------|-----|
| exit 1 + "port in use" | Another process on port | `ss -tlnp \| grep PORT`, kill or use `--port` |
| exit 1 + "backup restored" | JSON validation failed | Check upstream API; re-run |
#!/usr/bin/env bash
# <script-name>.sh — <one-line description>
# Usage: bash <script-name>.sh [args]
set -euo pipefail
# ... implementation ...

Script Comment Separation of Concerns

Comments in scripts under scripts/ serve exactly one purpose: explain how the code works internally — algorithms, edge cases, non-obvious implementation logic.

Comments MUST NOT:

The owning SKILL.md is the single source of truth for how a script is called, what inputs it expects, and what outputs it produces. Script comments complement the SKILL prose with implementation detail — they never substitute for it or contradict it.

Why this matters: Scripts are frequently called by skills other than their owner (cross-skill execution). When the calling skill provides no input format guidance, the agent falls back to reading script comments. If those comments prescribe conventions that belong in SKILL.md prose, the agent may follow stale or inconsistent guidance — because the comment was never updated when the SKILL prose changed, or because the owning skill never formally adopted the convention the comment describes.

Cross-skill execution priority order: When executing a script owned by a different skill, the agent resolves input conventions in this order:

  1. Calling skill’s prose — if it specifies the format, use it
  2. Existing output patterns — check the target file/resource for established conventions
  3. Owning skill’s prose — load the owning SKILL.md if needed
  4. Script comments — last resort, implementation hints only

Step 6 — AgentFS Post-Creation Checklist

MUST complete ALL of these after creating/updating the skill:

⛔ GATE — Principle waiver requires explicit permission. If you believe a principle (P4 Spec/Tests, P5 Security, P6 Context Economy, P7 Error Contract) does not apply to this skill, you MUST:

  1. State your reasoning clearly to the user
  2. Get explicit confirmation before omitting the section
  3. Log the waiver in the skill’s CHANGELOG.md entry

Do NOT silently skip. A rationalization in your own reasoning is not a substitute for user confirmation.


Advanced Mode

Advanced mode uses the full Anthropic skill-creator workflow: draft → test → evaluate → iterate → optimize.

Step 1 — Fetch Upstream

Ensure the upstream skill-creator is cached locally:

bash ~/.agents/skills/skill-gen/scripts/fetch-upstream.sh

This downloads the complete Anthropic skill-creator file structure into ~/.agents/skills/skill-gen/.cache/upstream/.

Step 2 — Load Upstream Instructions

Load the full upstream SKILL.md for detailed instructions:

load_skill(name: "skill-gen/.cache/upstream/SKILL.md")

Step 3 — Follow Upstream Workflow

Follow the upstream instructions for the full lifecycle:

  1. Capture intent — interview the user
  2. Write SKILL.md draft — using upstream’s writing guide
  3. Create test cases — 2-3 realistic test prompts
  4. Run tests — execute and collect results
  5. Evaluate — qualitative (user review) + quantitative (assertions)
  6. Iterate — improve based on feedback, repeat
  7. Optimize description — triggering accuracy loop (if available)

Agent Compatibility Notes for Upstream

The upstream skill-creator was written for Claude Code. When using with a different agent, apply these adaptations:

Upstream Feature Claude Code Goose / Other Agents
Subagents spawn subagent Use Goose orchestrator extension if available, otherwise run test cases sequentially
claude -p CLI Native Skip description optimization (run_eval.py, run_loop.py, improve_description.py). These scripts hardcode claude -p.
.claude/commands/ Native skill discovery Not applicable — skills discovered via .agents/skills/
Browser viewer open <file> Use --static <path> flag to generate HTML file, then open manually or with xdg-open
Cowork Claude-specific Not applicable
present_files tool Claude-specific Not applicable — skip packaging step

What works everywhere:

Step 4 — AgentFS Post-Creation Checklist

Same as Simple Mode Step 6 — apply the AgentFS post-creation checklist after the upstream workflow completes. The upstream does NOT handle AgentFS conventions (scoping, indexing, logging), so this step is essential.


Updating an Existing Skill

For both modes:

  1. Read the existing SKILL.md first
  2. Preserve the original name field — do not rename
  3. Add a new changelog entry to CHANGELOG.md (do not remove existing entries)
  4. In advanced mode, use the existing skill as the baseline for comparison in the eval loop
  5. Run the AgentFS Post-Creation Checklist (Step 6 / Step 4)

Skill Check Mode

Audit one or more skills against seven quality principles. Skill Check runs automatically as part of the Post-Creation Checklist after every skill creation or update. It can also be triggered independently for periodic audits.

When to run independently:

Trigger phrases: “skill check”, “scan skill”, “check skill”, “audit skill”, “verify skill quality”

Seven Principles

Principle 1 — Accuracy, Consistency & Testability (Code-First)

Skills are procedural memory — prescriptive SOPs verified by execution, auditable traces, and deterministic outcomes. Prefer and leverage deterministic scripts and code as the primary vehicle for accuracy (no ambiguity), consistency (same inputs → same outputs), conciseness (denser than prose), and testability (independently executable). Natural language serves as orchestration glue — connecting, contextualizing, and sequencing the deterministic pieces. Declarative, methodological, and philosophical content belongs in knowledge bundles, not skills.

Inline code boundary: Code in SKILL.md serves two distinct roles:

Rule of thumb: If the agent would bash -c it during execution, it should be a script. If it shows the user what something looks like or provides a manual alternative, it stays inline.

Check for:

Principle 2 — Autonomous & Currency

Skill MUST NOT rely on current session history. It must function in a fresh NEW session without glitches. No obsolete scripts, code, instructions, or content.

Check for:

Principle 3 — Traceable & Well-Formatted

No redundant, conflicting, or obsolete instructions or scripts. Historical content must be distilled to knowledge bundles with links from the skill’s changelog.

Check for:

Principle 4 — Verifiable Specification & Test

A description of purpose is not sufficient. The skill MUST have a list of verifiable specification items that clearly and concisely prescribe what the skill can do. Associated with each spec item are testcases — preferably deterministic scripts/code, or at minimum unambiguous instructions with expected results.

Check for:

Example Specification section:

## Specification

| ID | Capability | Verifiable By |
|:--:|-----------|---------------|
| S1 | List all model containers on both hosts | `scripts/list.sh` outputs status table |
| S2 | Start model by alias on correct host/port | `scripts/start.sh g350m` → HTTP 200 on port 10000 |
| S3 | Stop model by alias | `scripts/stop.sh g350m` → container status Exited |

## Tests

| Test | Spec | Command | Expected Result |
|:----:|:----:|---------|----------------|
| T1 | S1 | `scripts/list.sh` | Table showing 5 models with status |
| T2 | S2 | `scripts/start.sh g350m && scripts/test.sh g350m` | HTTP 200, model=granite-4.0-350m |
| T3 | S3 | `scripts/stop.sh g350m && scripts/status.sh g350m` | Container Exited |

Principle 5 — Security & Trust Boundary

Skills execute local scripts that can read the filesystem, access API keys, and make network calls. Treat third-party skills as external software dependencies. Author-created skills must also minimize their attack surface.

Check for:

Principle 6 — Context Economy

SKILL.md is loaded into the agent’s context window in full on every load_skill call. Every line consumed is context budget spent. SKILL.md MUST contain what the agent needs to execute the skill. Supporting material that the agent does NOT need during execution belongs in references/.

The separation rule:

Belongs in SKILL.md Belongs in references/
Workflow steps the agent executes Design rationale / DSD
Decision points and branching logic Architecture context
Spec and Test tables (S1–Sn, T1–Tn) Extended troubleshooting
Gotchas that affect execution Research findings
Prerequisites checklist Investigation notes
Signal routing table API reference / protocol details
Privilege gates and interaction points Migration plans
Error Handling and Troubleshooting tables Evaluation data

Standard reference files:

File Purpose When to create
references/design-spec.md Design decisions, constraints, threat model Complex skills with non-obvious tradeoffs
references/troubleshooting.md Extended diagnostics When Troubleshooting table exceeds ~10 rows
references/architecture.md System architecture, data flow Skills integrating multiple external systems

The agent loads reference files on demand via load_skill(name: "skill-name/references/file.md"). SKILL.md MUST include a ## References section linking to these files when the references/ directory exists.

Soft threshold: 300 lines triggers a two-step audit:

  1. Can content move to references/ without degrading execution quality? If yes, extract. If no, leave it.
  2. If SKILL.md is still large after step 1, is this a skill scope problem? If yes, decompose into smaller skills. If neither applies, the size is justified and the audit documents why.

There is no hard maximum. Size is a warning signal, not a rule.

Check for:

Principle 7 — Error Contract

Scripts communicate outcomes to the agent through exit codes and structured diagnostic output. The agent’s response to failures MUST be prescribed by the skill, not improvised. The three-party contract (script → SKILL.md → agent) ensures deterministic error handling.

Script obligations:

SKILL.md obligations:

Agent obligations (enforced by SKILL.md prose):

Exit Code Agent Behavior
0 Continue to next step
1 Read stdout. Match against Troubleshooting table. If match → follow prescribed fix. If no match → present full output to user, do NOT improvise.
2 Fix invocation. Retry once. If still 2 → ask user.
3 Present script output (contains manual command) to user. Wait for confirmation. Proceed to verification.
Other Present full output to user. Do NOT retry without approval.

Check for:

Skill Check Procedure

  1. Load the target skill — load_skill(name: "<skill-name>")
  2. Read all supporting files — scripts, references, templates
  3. Apply Principle 1 — verify scripts exist and match SKILL.md; flag inline-only operations as 🔴 critical; flag could-be-script prose as 🟡; flag non-procedural content for knowledge extraction
  4. Apply Principle 2 — check for session dependencies, obsolete references; verify scripts are self-contained
  5. Apply Principle 3 — scan for redundancy, conflicts, obsolete content; check Markdown rendering
  6. Apply Principle 4 — verify Specification and Tests sections exist; check spec coverage and test determinism
  7. Apply Principle 5 — audit scripts for scope overreach, secret handling, unexpected network calls, and prompt injection
  8. Apply Principle 6 — check SKILL.md line count; if >300 lines, apply two-step audit (extract to references → decompose skill); verify ## References section if references/ directory exists
  9. Apply Principle 7 — verify exit codes are semantic (0/1/2/3); verify Error Handling table exists; verify Troubleshooting table exists; verify privilege gates use exit 3 with human-readable output; verify no improvised recovery paths
  10. Report findings — table of issues with severity (🔴 critical, 🟡 warning, 🟢 info) and recommended fix
  11. Fix — apply fixes with user approval; version bump; changelog

Report Format

## Skill Check Report: <skill-name>

| # | Principle | Severity | Finding | Fix |
|:-:|:---------:|:--------:|---------|-----|
| 1 | P1 Accuracy | 🔴 | ... | ... |
| 2 | P4 Spec/Test | 🟡 | ... | ... |
| 3 | P5 Security | 🟡 | ... | ... |

Upstream Source

Item Value
Repository anthropics/skills
Path skills/skill-creator/
License See LICENSE.txt in cached upstream
Cache location ~/.agents/skills/skill-gen/.cache/upstream/
Cache refresh Every 7 days, or fetch-upstream.sh --force

Changelog

See CHANGELOG.md for version history.