Guide de Création de Compétence

VérifiéSûr

Guide structuré pour créer un nouveau skill de codage IA à partir de zéro, avec la structure des répertoires, le frontmatter et les bonnes pratiques. Utile pour construire un fichier SKILL.md réutilisable et bien organisé.

Spar Skills Guide Bot
DeveloppementDébutant
6002/06/2026
Claude CodeCursorWindsurfCopilotCodex
#skill-creation#template#guide#frontmatter#best-practices

Recommandé pour

Notre avis

Ce guide fournit une méthodologie structurée pour créer une nouvelle compétence (skill) à partir de zéro, incluant la structure des fichiers, le frontmatter YAML et les bonnes pratiques.

Points forts

  • Approche pas à pas claire et complète
  • Modèle de SKILL.md prêt à l'emploi
  • Explication détaillée des répertoires et fichiers optionnels
  • Conseils sur le frontmatter et la documentation

Limites

  • Ne couvre pas la création de scripts ou de contenu avancé
  • Pas d'exemple de skill complet en dehors du template
  • Peut être trop générique pour des cas d'utilisation très spécifiques
Quand l'utiliser

Utilisez ce guide lorsque vous devez créer une nouvelle compétence pour un agent IA et souhaitez suivre une structure standardisée.

Quand l'éviter

Évitez ce guide si vous modifiez une compétence existante ou si vous n'avez pas besoin d'une structure formelle avec frontmatter.

Analyse de sécurité

Sûr
Score qualité90/100

This skill is a documentation template that provides guidance on creating third-party AI skills. It contains no executable code, destructive instructions, or security risks. It includes best practices and security guidelines, but does not perform any actions.

Aucun point d'attention détecté

Exemples

Create a new skill from template
I need to create a new skill called 'code-review' for my AI agent. Walk me through the process using the skill creation guide template, including frontmatter and directory structure.
Generate SKILL.md for a testing skill
Help me build a skill for automated testing. Generate the SKILL.md file with proper frontmatter and step-by-step instructions following the skill creation guide.
Explain skill structure
What is the recommended directory structure for a skill? Explain the purpose of each folder (references, scripts, assets) and show me how to set up a new skill.

Skill Creation Guide Template

This guide provides a structured approach for building a new skill from scratch, including proper structure, frontmatter, and best practices.

Overview

Creating a skill involves defining its purpose, structuring the files correctly, writing clear instructions, and ensuring the skill is safe and useful. This guide walks through each step of the creation process.

Skill Details

Before creating a skill, define:

  • Name: A clear, descriptive identifier (lowercase, hyphenated)
  • Description: A concise explanation of what the skill does
  • Purpose: The problems this skill solves
  • Target Users: Who will benefit from this skill

Directory Structure

Create the following structure for your skill:

skill-name/
  SKILL.md           # Main skill file (required)
  references/        # Reference documentation (optional)
  scripts/           # Executable scripts (optional)
  assets/            # Images, data files (optional)

Directory Descriptions

| Directory | Purpose | Contents | |-----------|---------|----------| | SKILL.md | Main entry point | Instructions, examples, metadata | | references/ | Supporting docs | Detailed guides, API references | | scripts/ | Automation | Shell scripts, Python scripts | | assets/ | Static files | Images, templates, data files |

Step 1: Create the SKILL.md

The SKILL.md file is the heart of your skill. It must have YAML frontmatter followed by markdown content.

SKILL.md Template

---
name: skill-name
description: A brief description of what this skill does
version: 1.0.0
author: your-name
license: MIT
---

# Skill Name

Brief description of what this skill does.

## Overview

Describe the skill's purpose, capabilities, and when it should be used. This section helps users quickly understand if this skill is relevant to their needs.

## Usage

### When to Use This Skill

- Scenario 1 where this skill is helpful
- Scenario 2 where this skill is helpful
- Specific problems it solves

### Prerequisites

- Required tool or dependency
- Required knowledge or setup
- Any system requirements

## Instructions

### Step 1: [First Step Title]

Describe the first step in using this skill. Be specific and actionable.

### Step 2: [Second Step Title]

Continue with subsequent steps. Include code examples where helpful.

```bash
# Example command
example-command --flag value

Examples

Example 1: [Basic Usage]

Show a simple, common use case:

# Code or command example
example here

Expected output:

# What the user should see
output here

Example 2: [Advanced Usage]

Show a more complex scenario:

# More advanced example
complex example here

References

Link to reference documentation:

Scripts

Document available scripts:

Notes

Any additional notes, warnings, or tips:

  • Important consideration 1
  • Warning about common mistake
  • Tip for better results

### Frontmatter Requirements

| Field | Required | Description |
|-------|----------|-------------|
| `name` | Yes | Skill identifier (lowercase, hyphenated) |
| `description` | Yes | Brief description (1-2 sentences) |
| `version` | No | Semantic version (e.g., 1.0.0) |
| `author` | No | Creator's name or handle |
| `license` | No | License type (e.g., MIT, Apache-2.0) |

## Step 2: Add Reference Documentation (Optional)

Create files in the `references/` directory for detailed information.

### Reference File Guidelines

- Use markdown format (.md)
- One topic per file
- Include practical examples
- Link from SKILL.md

### Example Reference Structure

references/ api-reference.md # API documentation configuration.md # Configuration options troubleshooting.md # Common issues and solutions advanced-usage.md # Advanced patterns


### Reference Template

```markdown
# [Topic Name]

## Overview
Brief introduction to this topic.

## Details

### [Subtopic 1]
Detailed explanation...

### [Subtopic 2]
Detailed explanation...

## Examples

### Example 1
```code
example

See Also

  • Links to related references

## Step 3: Create Scripts (Optional)

Create executable scripts in the `scripts/` directory for automation.

### Script Requirements

1. **Shebang Line**: Start with appropriate interpreter
   ```bash
   #!/bin/bash
   # or
   #!/usr/bin/env python3
  1. Help/Usage: Include help information

    if [[ "$1" == "-h" || "$1" == "--help" ]]; then
        echo "Usage: script-name.sh [options] <args>"
        echo "Description of what the script does"
        exit 0
    fi
    
  2. Input Validation: Validate all inputs

    if [[ -z "$1" ]]; then
        echo "Error: Missing required argument"
        exit 1
    fi
    
  3. Error Handling: Handle errors gracefully

    set -euo pipefail  # Exit on error, undefined var, pipe failure
    

Script Security Guidelines

| Do | Don't | |----|-------| | Validate all inputs | Use eval with user input | | Quote variables | Hardcode secrets | | Use full paths | Ignore error codes | | Limit file access | Write outside skill directory | | Log actions | Trust external input |

Example Script Template

#!/bin/bash
# Script: script-name.sh
# Description: What this script does
# Usage: script-name.sh [options] <required-arg>

set -euo pipefail

# Configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Help function
show_help() {
    cat << EOF
Usage: $(basename "$0") [options] <required-arg>

Description:
    What this script does in detail.

Arguments:
    required-arg    Description of the argument

Options:
    -h, --help      Show this help message
    -v, --verbose   Enable verbose output

Examples:
    $(basename "$0") example-value
    $(basename "$0") -v example-value
EOF
}

# Parse arguments
VERBOSE=false
while [[ $# -gt 0 ]]; do
    case "$1" in
        -h|--help)
            show_help
            exit 0
            ;;
        -v|--verbose)
            VERBOSE=true
            shift
            ;;
        *)
            break
            ;;
    esac
done

# Validate required argument
if [[ $# -lt 1 ]]; then
    echo "Error: Missing required argument" >&2
    show_help
    exit 1
fi

ARG="$1"

# Main logic
main() {
    if $VERBOSE; then
        echo "Processing: $ARG"
    fi

    # Your code here
    echo "Result for: $ARG"
}

main

Step 4: Add Assets (Optional)

Add supporting files to the assets/ directory:

  • Images: Diagrams, screenshots for documentation
  • Templates: Starter files users can copy
  • Data Files: JSON schemas, configuration examples
  • Other: Any static files the skill needs

Asset Organization

assets/
  images/
    diagram.png
    screenshot.png
  templates/
    config-template.yaml
    starter-file.txt
  data/
    schema.json

Step 5: Test the Skill

Before publishing, verify your skill works correctly.

Testing Checklist

SKILL.md Validation

  • [ ] Frontmatter parses correctly (valid YAML)
  • [ ] Name and description are present
  • [ ] All internal links work
  • [ ] Code blocks are properly formatted
  • [ ] Instructions are clear and complete

Script Testing

  • [ ] Scripts execute without errors
  • [ ] Help flag works (-h, --help)
  • [ ] Invalid input is handled gracefully
  • [ ] Edge cases are handled
  • [ ] Output matches documentation

Reference Validation

  • [ ] All referenced files exist
  • [ ] Links from SKILL.md work
  • [ ] Content is accurate and helpful

Discovery Testing

  • [ ] Skill appears in skill list
  • [ ] Description is displayed correctly
  • [ ] Skill can be activated

Step 6: Final Validation

Complete final validation before release.

Validation Checklist

  • [ ] Valid YAML frontmatter with name and description
  • [ ] Clear instructions for use
  • [ ] All scripts documented
  • [ ] Examples provided where helpful
  • [ ] No broken internal links
  • [ ] Scripts handle errors gracefully
  • [ ] No hardcoded secrets or credentials
  • [ ] Appropriate license declared

Skill Locations

Skills can be installed in these locations:

| Location | Scope | Priority | |----------|-------|----------| | ./.claude/skills/ | Project | Highest | | ~/.claude/skills/ | User | High | | ~/.codex/skills/ | User (Codex) | Medium | | ~/.cursor/skills/ | User (Cursor) | Medium |

Installation Commands

# Project-level installation
mkdir -p ./.claude/skills/skill-name
cp -r skill-name/* ./.claude/skills/skill-name/

# User-level installation
mkdir -p ~/.claude/skills/skill-name
cp -r skill-name/* ~/.claude/skills/skill-name/

Best Practices

Writing Quality

  • Be Concise: Don't over-explain simple concepts
  • Be Complete: Cover all necessary steps
  • Be Practical: Include real-world examples
  • Be Consistent: Use consistent formatting and terminology

Maintenance

  • Version Updates: Increment version for changes
  • Changelog: Document what changed
  • Compatibility: Note breaking changes
  • Testing: Re-test after updates

Security

  • Review Scripts: Audit all script code
  • Minimal Permissions: Request only what's needed
  • No Secrets: Never include credentials
  • Safe Defaults: Default to safe behavior

Creation Workflow Summary

1. PLAN
   ├── Define purpose
   ├── Identify use cases
   └── Plan structure

2. CREATE
   ├── Write SKILL.md
   ├── Add references
   └── Create scripts

3. TEST
   ├── Validate SKILL.md
   ├── Test scripts
   └── Verify links

4. VALIDATE
   ├── Complete checklist
   ├── Security review
   └── Documentation review

5. INSTALL
   ├── Choose location
   └── Copy files
Skills similaires