$npx -y skills add AgentWorkforce/relay --skill creating-agent-skills-skillUse when creating Agent Skills packages (SKILL.md format) for Codex CLI, GitHub Copilot, or Amp - provides the agentskills.io specification with frontmatter constraints, directory structure, and validation rules
| 1 | # Creating Agent Skills |
| 2 | |
| 3 | Use when creating Agent Skills packages (SKILL.md format) for Codex CLI, GitHub Copilot, or Amp - provides the agentskills.io specification with frontmatter constraints, directory structure, and validation rules |
| 4 | |
| 5 | ### Overview |
| 6 | |
| 7 | Agent Skills is an open standard for portable AI agent capabilities. One SKILL.md file works across Codex CLI, GitHub Copilot, and Amp. |
| 8 | |
| 9 | **Official Spec:** https://agentskills.io/specification |
| 10 | |
| 11 | ### Installation Directories |
| 12 | |
| 13 | | Tool | Location | |
| 14 | | ------------------ | -------------------------------------- | |
| 15 | | **Codex CLI** | `.agents/skills/{skill-name}/SKILL.md` | |
| 16 | | **GitHub Copilot** | `.github/skills/{skill-name}/SKILL.md` | |
| 17 | | **Amp** | `.agents/skills/{skill-name}/SKILL.md` | |
| 18 | |
| 19 | ### Directory Structure |
| 20 | |
| 21 | #### ``` |
| 22 | |
| 23 | ``` |
| 24 | my-skill/ # Must match frontmatter `name` |
| 25 | ├── SKILL.md # Required - main definition |
| 26 | ├── scripts/ # Optional - executable code |
| 27 | ├── references/ # Optional - additional docs |
| 28 | └── assets/ # Optional - static resources |
| 29 | ``` |
| 30 | |
| 31 | ### Frontmatter Specification |
| 32 | |
| 33 | #### Required Fields |
| 34 | |
| 35 | ```yaml |
| 36 | --- |
| 37 | name: skill-name |
| 38 | description: What it does and when to use it |
| 39 | --- |
| 40 | ``` |
| 41 | |
| 42 | #### Optional Fields |
| 43 | |
| 44 | ```yaml |
| 45 | --- |
| 46 | name: pdf-processing |
| 47 | description: Extracts and processes PDF content. Use for document analysis and text extraction. |
| 48 | license: MIT |
| 49 | compatibility: Requires pdftotext, poppler-utils |
| 50 | allowed-tools: Bash(pdftotext:*) Read Write |
| 51 | metadata: |
| 52 | category: document-processing |
| 53 | version: 1.0.0 |
| 54 | --- |
| 55 | ``` |
| 56 | |
| 57 | ### Name Validation |
| 58 | |
| 59 | #### ``` |
| 60 | |
| 61 | ``` |
| 62 | ✅ Valid: pdf-processing, code-review, data-analysis |
| 63 | ❌ Invalid: PDF-Processing (uppercase), -pdf (leading hyphen), pdf--processing (consecutive hyphens) |
| 64 | ``` |
| 65 | |
| 66 | ### Description Best Practices |
| 67 | |
| 68 | #### ```yaml |
| 69 | |
| 70 | ```yaml |
| 71 | # ❌ BAD - Too vague |
| 72 | description: Helps with PDFs |
| 73 | |
| 74 | # ❌ BAD - Missing use cases |
| 75 | description: Extracts text from PDFs |
| 76 | |
| 77 | # ✅ GOOD - Functionality + use cases |
| 78 | description: Extracts and processes PDF content. Use for document analysis, text extraction, and form data parsing. |
| 79 | ``` |
| 80 | |
| 81 | ### Body Content |
| 82 | |
| 83 | #### Markdown instructions after frontmatter. No format restrictions, but recommended sections: |
| 84 | |
| 85 | ```markdown |
| 86 | --- |
| 87 | name: code-review |
| 88 | description: Reviews code for best practices and security issues. Use when analyzing PRs or conducting audits. |
| 89 | --- |
| 90 | |
| 91 | ## Overview |
| 92 | |
| 93 | Brief description of capabilities. |
| 94 | |
| 95 | ## Process |
| 96 | |
| 97 | 1. Step-by-step workflow |
| 98 | 2. With clear actions |
| 99 | |
| 100 | ## Guidelines |
| 101 | |
| 102 | - Bullet points for rules |
| 103 | - Best practices |
| 104 | |
| 105 | ## Examples |
| 106 | |
| 107 | Code samples showing usage. |
| 108 | ``` |
| 109 | |
| 110 | ### Progressive Disclosure |
| 111 | |
| 112 | Skills use tiered loading to optimize context: |
| 113 | |
| 114 | 1. **Metadata** (~100 tokens): `name` + `description` load at startup |
| 115 | 2. **Activation** (<5000 tokens): Full `SKILL.md` loads when selected |
| 116 | 3. **On-demand**: Supporting files load when referenced |
| 117 | |
| 118 | **Keep `SKILL.md` under 500 lines** for efficient context usage. |
| 119 | |
| 120 | ### Supporting Files |
| 121 | |
| 122 | #### scripts/ |
| 123 | |
| 124 | ```python |
| 125 | #!/usr/bin/env python3 |
| 126 | # scripts/extract.py |
| 127 | import sys |
| 128 | # Self-contained with clear dependencies |
| 129 | ``` |
| 130 | |
| 131 | ### Complete Example |
| 132 | |
| 133 | #### Type Guard |
| 134 | |
| 135 | ```typescript |
| 136 | function isUser(obj: unknown): obj is User { |
| 137 | return typeof obj === 'object' && obj !== null && 'id' in obj && 'name' in obj; |
| 138 | } |
| 139 | ``` |
| 140 | |
| 141 | ### Validation |
| 142 | |
| 143 | #### Use the validation tool: |
| 144 | |
| 145 | ```bash |
| 146 | skills-ref validate ./my-skill |
| 147 | ``` |
| 148 | |
| 149 | ### Quick Checklist |
| 150 | |
| 151 | - Frontmatter: |
| 152 | - [ ] `name` is 1-64 chars, lowercase alphanumeric + hyphens |
| 153 | - [ ] `name` matches parent directory name |
| 154 | - [ ] `description` is 1-1024 chars |
| 155 | - [ ] `description` includes functionality AND use cases |
| 156 | - Content: |
| 157 | - [ ] Under 500 lines for efficient loading |
| 158 | - [ ] Clear instructions agents can follow |
| 159 | - [ ] Examples for complex operations |
| 160 | - Structure: |
| 161 | - [ ] Directory named exactly as `name` field |
| 162 | - [ ] `SKILL.md` at directory root |
| 163 | - [ ] Supporting files in appropriate subdirectories |
| 164 | |
| 165 | ### Cross-Tool Compatibility |
| 166 | |
| 167 | #### The SKILL.md format is identical across implementations. To port: |
| 168 | |
| 169 | ```bash |
| 170 | # Codex → Copilot |
| 171 | mv .agents/skills/my-skill .github/skills/my-skill |
| 172 | |
| 173 | # Copilot → Codex/Amp |
| 174 | mv .github/skills/my-skill .agents/skills/my-skill |
| 175 | ``` |