Agent Skills
エージェントスキルとはエージェントに知識や能力を与えるためのフォーマットです。
人間の知識や経験をスキル(skill)としてエージェントに適合させるということです。
ディレクトリ構造
スキルのディレクトリを作成し配下にSKILL.mdを作成します。
その他のディレクトリやファイルは自由に作成が可能です。
# https://agentskills.io/specification#directory-structure
skill-name/
├── SKILL.md # Required: metadata + instructions
├── scripts/ # Optional: executable code
├── references/ # Optional: documentation
├── assets/ # Optional: templates, resources
└── ... # Any additional files or directories
SKILL.md フォーマット
SKILL.mdにはYAML frontmatterとスキルの内容を記載する必要があります。
必須
namedescription
任意
licensecompatibilitymetadataallowed-tools
例:
---
name: git-commit
description: Stage source code and create commits with validated commit messages. Use when users ask to commit changes, create commits, stage and commit files, or save changes to git. Enforces commit message format with lowercase prefix (build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test) and lowercase message start.
---
# Git Commit
Stage source code changes and create commits following strict commit message format rules.
## Commit Message Format
**Required format:** `<prefix>: <message>`
**Rules:**
- Prefix must be lowercase
- Message must start with lowercase letter
- Prefix and message separated by colon and space
**Valid prefixes:**
- `build`
- `chore`
- `ci`
- `docs`
- `feat`
- `fix`
- `perf`
- `refactor`
- `revert`
- `style`
- `test`
## Examples
**Valid:**
```bash
fix: some message
feat: add new feature
docs: update readme
```
**Invalid:**
```bash
Fix: some message # prefix not lowercase
fix: SomeMessage # message not lowercase
foo: some message # invalid prefix
fix:some message # missing space after colon
: some message # prefix empty
fix: # message empty
```
## Workflow
### 1. Check current status
```bash
git status
```
### 2. Stage files
```bash
# Stage specific files
git add <file1> <file2>
# Stage all changes
git add .
```
### 3. Create commit
```bash
git commit -m "<prefix>: <message>"
```
## Tips
- **Small commits:** Stage related files in small chunks after completing a task
- **Clear messages:** Be specific about what changed and why
- **Choose correct prefix:** Match the prefix to the type of change
- **Validate first:** Always validate commit message format before committing
スキルの読み込みについて
スキルは必要に応じて段階的に読み込まれていきます。
3段階に分かれています。
- https://platform.claude.com/docs/ja/agents-and-tools/agent-skills/overview
- https://agentskills.io/what-are-skills#how-skills-work
1. メタデータの読み込み
SKILL.mdのYAML frontmatterは常に読み込まれます。
---
name: git-commit
description: Stage source code and create commits with validated commit messages. Use when users ask to commit changes, create commits, stage and commit files, or save changes to git. Enforces commit message format with lowercase prefix (build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test) and lowercase message start.
---
2. 本文の読み込み
SKILL.mdの本文を読み込みます。
3. リソースの読み込みとコードの実行
必要に応じてリソースを読み込みとコードの実行を行います。
その他
読み込まれたスキルコンテンツはcompactionされないようになっています。
同じセッション内に沢山のスキルを使用していくとコンテキストの圧迫につながります。