Créer une nouvelle compétence

VérifiéSûr

Workflow guidé pour concevoir et structurer une nouvelle compétence IA avec questionnement adaptatif, recherche d'API et patterns d'organisation optimisés.

Spar Skills Guide Bot
DeveloppementIntermédiaire
3002/06/2026
Claude CodeCursorWindsurf
#skill-creation#workflow#meta-skill#ai-agent

Recommandé pour

Notre avis

Ce guide décrit un processus structuré pour créer une nouvelle compétence (skill) pour les agents IA, incluant la collecte des besoins, la recherche d'API, la structuration et la rédaction.

Points forts

  • Processus adaptatif qui pose des questions ciblées pour clarifier les besoins.
  • Décision entre structure simple et complexe (routeur) selon la portée.
  • Intégration de recherche d'API externe via des outils comme Context7.
  • Modèles de répertoires et fichiers précis pour une organisation claire.

Limites

  • Nécessite une compréhension préalable de la structure des skills.
  • Peut être trop procédural pour des skills très simples.
  • La qualité du résultat dépend de la précision des réponses de l'utilisateur.
Quand l'utiliser

Utilisez ce workflow lorsque vous devez créer une nouvelle compétence pour un agent IA, que ce soit simple ou complexe.

Quand l'éviter

Évitez ce workflow si vous modifiez une compétence existante ou si vous avez besoin d'une solution rapide sans structure formelle.

Analyse de sécurité

Sûr
Score qualité90/100

The skill uses bash commands only to create directories and write files under the user's OpenCode configuration path; there are no destructive operations, no data exfiltration, and no obfuscated payloads.

Aucun point d'attention détecté

Exemples

Create a code review skill
I want to create a new skill that helps me review pull requests for code style and potential bugs. It should analyze diffs and suggest improvements.
Build a deployment skill
Help me build a skill for deploying Docker containers to AWS ECS with health checks and rollback logic.
Design a documentation skill
Create a skill that generates API documentation from Python docstrings and publishes to a GitHub Pages site.

Workflow: Create a New Skill

<required_reading> Read these reference files NOW:

  1. references/recommended-structure.md
  2. references/skill-structure.md
  3. references/core-principles.md
  4. references/use-xml-tags.md </required_reading>
<process> ## Step 1: Adaptive Requirements Gathering

If user provided context (e.g., "build a skill for X"): → Analyze what's stated, what can be inferred, what's unclear → Skip to asking about genuine gaps only

If user just invoked skill without context: → Ask what they want to build

Using question

Ask 2-4 domain-specific questions based on actual gaps. Each question should:

  • Have specific options with descriptions
  • Focus on scope, complexity, outputs, boundaries
  • NOT ask things obvious from context

Example questions:

  • "What specific operations should this skill handle?" (with options based on domain)
  • "Should this also handle [related thing] or stay focused on [core thing]?"
  • "What should the user see when successful?"

Decision Gate

After initial questions, ask: "Ready to proceed with building, or would you like me to ask more questions?"

Options:

  1. Proceed to building - I have enough context
  2. Ask more questions - There are more details to clarify
  3. Let me add details - I want to provide additional context

Step 2: Research Trigger (If External API)

When external service detected, ask using question: "This involves [service name] API. Would you like me to research current endpoints and patterns before building?"

Options:

  1. Yes, research first - Fetch current documentation for accurate implementation
  2. No, proceed with general patterns - Use common patterns without specific API research

If research requested:

  • Use Context7 MCP to fetch current library documentation
  • Or use WebSearch for recent API documentation
  • Focus on 2024-2026 sources
  • Store findings for use in content generation

Step 3: Decide Structure

Simple skill (single workflow, <200 lines): → Single SKILL.md file with all content

Complex skill (multiple workflows OR domain knowledge): → Router pattern:

skill-name/
├── SKILL.md (router + principles)
├── workflows/ (procedures - FOLLOW)
├── references/ (knowledge - READ)
├── templates/ (output structures - COPY + FILL)
└── scripts/ (reusable code - EXECUTE)

Factors favoring router pattern:

  • Multiple distinct user intents (create vs debug vs ship)
  • Shared domain knowledge across workflows
  • Essential principles that must not be skipped
  • Skill likely to grow over time

Consider templates/ when:

  • Skill produces consistent output structures (plans, specs, reports)
  • Structure matters more than creative generation

Consider scripts/ when:

  • Same code runs across invocations (deploy, setup, API calls)
  • Operations are error-prone when rewritten each time

See references/recommended-structure.md for templates.

Step 4: Create Directory

mkdir -p ~/.config/opencode/skills/{skill-name}
# If complex:
mkdir -p ~/.config/opencode/skills/{skill-name}/workflows
mkdir -p ~/.config/opencode/skills/{skill-name}/references
# If needed:
mkdir -p ~/.config/opencode/skills/{skill-name}/templates  # for output structures
mkdir -p ~/.config/opencode/skills/{skill-name}/scripts    # for reusable code

Step 5: Write SKILL.md

Simple skill: Write complete skill file with:

  • YAML frontmatter (name, description)
  • <objective>
  • <quick_start>
  • Content sections with pure XML
  • <success_criteria>

Complex skill: Write router with:

  • YAML frontmatter
  • <essential_principles> (inline, unavoidable)
  • <intake> (question to ask user)
  • <routing> (maps answers to workflows)
  • <reference_index> and <workflows_index>

Step 6: Write Workflows (if complex)

For each workflow:

<required_reading>
Which references to load for this workflow
</required_reading>

<process>
Step-by-step procedure
</process>

<success_criteria>
How to know this workflow is done
</success_criteria>

Step 7: Write References (if needed)

Domain knowledge that:

  • Multiple workflows might need
  • Doesn't change based on workflow
  • Contains patterns, examples, technical details

Step 8: Validate Structure

Check:

  • [ ] YAML frontmatter valid
  • [ ] Name matches directory (lowercase-with-hyphens)
  • [ ] Description says what it does AND when to use it (third person)
  • [ ] No markdown headings (#) in body - use XML tags
  • [ ] Required tags present: objective, quick_start, success_criteria
  • [ ] All referenced files exist
  • [ ] SKILL.md under 500 lines
  • [ ] XML tags properly closed

Step 9: Create Slash Command

cat > ~/.config/opencode/commands/{skill-name}.md << 'EOF'
---
description: {Brief description}
argument-hint: [{argument hint}]
allowed-tools: Skill({skill-name})
---

Invoke the {skill-name} skill for: $ARGUMENTS
EOF

Step 10: Test

Invoke the skill and observe:

  • Does it ask the right intake question?
  • Does it load the right workflow?
  • Does the workflow load the right references?
  • Does output match expectations?

Iterate based on real usage, not assumptions. </process>

<success_criteria> Skill is complete when:

  • [ ] Requirements gathered with appropriate questions
  • [ ] API research done if external service involved
  • [ ] Directory structure correct
  • [ ] SKILL.md has valid frontmatter
  • [ ] Essential principles inline (if complex skill)
  • [ ] Intake question routes to correct workflow
  • [ ] All workflows have required_reading + process + success_criteria
  • [ ] References contain reusable domain knowledge
  • [ ] Slash command exists and works
  • [ ] Tested with real invocation </success_criteria>
Skills similaires