Skip to content

Instantly share code, notes, and snippets.

@esafwan
Created March 23, 2026 23:04
Show Gist options
  • Select an option

  • Save esafwan/76d8982e501a40ab52419b05a92f3ba0 to your computer and use it in GitHub Desktop.

Select an option

Save esafwan/76d8982e501a40ab52419b05a92f3ba0 to your computer and use it in GitHub Desktop.
Skill Extaction Via Agent

We need to improve our skills and create a directory for it.

The Skill System — How It Actually Works

A skill is a self-contained instruction packet that teaches the agent how to do a specific type of task. It's not code. It's not a library. It's a markdown file that gets injected into the LLM context when the agent detects it needs that capability.Think of it as: a senior engineer's runbook, written for a junior engineer who has access to a terminal.

Dir Structure:

project-root/
├── skills/
│   ├── REGISTRY.md              ← master index (agent reads this first)
│   │
│   ├── pdf-generation/
│   │   ├── SKILL.md             ← the skill itself
│   │   └── examples/            ← optional: sample inputs/outputs
│   │       ├── sample-input.md
│   │       └── expected-output.pdf
│   │
│   ├── mermaid-rendering/
│   │   ├── SKILL.md
│   │   └── templates/
│   │       └── diagram-wrapper.html
│   │
│   ├── code-scaffolding/
│   │   ├── SKILL.md
│   │   └── templates/
│   │       ├── node-project/
│   │       │   ├── package.json
│   │       │   └── tsconfig.json
│   │       └── python-project/
│   │           └── pyproject.toml
│   │
│   ├── api-integration/
│   │   └── SKILL.md
│   │
│   └── data-processing/
│       ├── SKILL.md
│       └── examples/
│           └── csv-to-json.md

REGISTRY.md — The Master Index

This is the first file the agent reads when it needs to decide which skills to load. It must be scannable in under 500 tokens.

# Skill Registry

## How to use this registry
1. Read the task description
2. Match against skill triggers below
3. Load the SKILL.md for each matched skill
4. Follow the skill instructions exactly

## Available Skills

| Skill | Directory | Triggers |
|---|---|---|
| PDF Generation | `pdf-generation/` | pdf, report, document, export, print |
| Mermaid Rendering | `mermaid-rendering/` | mermaid, diagram, flowchart, sequence diagram, graph |
| Code Scaffolding | `code-scaffolding/` | new project, scaffold, boilerplate, setup, init |
| API Integration | `api-integration/` | api, endpoint, fetch, request, webhook |
| Data Processing | `data-processing/` | csv, json, transform, parse, clean, aggregate |

## Skill Loading Rules
- Load 1-3 skills maximum per task
- If skills conflict, the more specific skill wins
- Skills can reference other skills by name — load those too
- If no skill matches, proceed with general reasoning

How you can create this in this project: This is the meta-skill — for you to analyze this existing codebase and extract skills from it. Here's the way you'd add it to our system:

## Skill Extraction Mode

When the user says "extract skills from this project" or "create skills for this codebase":

1. **Scan the project structure**
   - Read the root directory
   - Identify languages, frameworks, build tools
   - Read package.json / pyproject.toml / Makefile

2. **Identify repeatable patterns**
   For each of these categories, check if the project does it:
   - Build / compile
   - Test
   - Deploy
   - Generate artifacts (PDFs, images, reports)
   - Data transformation
   - API calls
   - Database operations

3. **For each pattern found, create a skill**
   - Create `skills/[skill-name]/SKILL.md` following the SKILL.md template exactly
   - Extract real commands from the project (not generic ones)
   - Extract real file paths and patterns
   - Include actual error messages from the project's logs/history if available
   - Write 2-3 strategies based on what the project actually uses

4. **Update REGISTRY.md**
   - Add the new skill to the table
   - Set triggers based on the actual project vocabulary

5. **Validate**
   - Each SKILL.md must have: Purpose, Triggers, at least 2 Strategies, Validation
   - No strategy should reference tools not available in the environment
   - Templates must use the project's actual dependencies

Remember:

Key Design Principles

Skills are context, not code. They get injected into the LLM prompt, not imported into a runtime. They're written in markdown because LLMs reason better from natural language instructions than from API docs. Strategies are ordered by reliability, not preference. Strategy 1 isn't "best" — it's "most likely to work." The ordering encodes operational experience. Failure signals are explicit. Don't just say "if it fails." Say exactly what the error looks like: npm ERR! code E404 or "output file is 0 bytes." The LLM needs pattern-matching material. Skills are composable. A PDF generation task might load mermaid-rendering + pdf-generation. The REGISTRY enables this through the "Related Skills" field. Keep skills under 800 tokens each. If a skill is longer, it's doing too much — split it. Context window space is your budget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment