YouTip LogoYouTip

Vs Code Skill

This tutorial will walk you through creating an Agent Skill from scratch and actually running it in VS Code + GitHub Copilot.\\\\n\\\\nWe will create a dice rolling Skill that teaches the Agent to generate random numbers via terminal commands.\\\\n\\\\n* * *\\\\n\\\\n## Preparation\\\\n\\\\n### Environment Requirements\\\\n\\\\n* Install (https://code.visualstudio.com/)\\\\n\\\\n* Install (https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)\\\\n!(https://example.com/wp-content/uploads/2026/04/6cc36f45-f6a8-4e1a-9b78-9a56a2460a6b.png)\\\\n\\\\n> This tutorial uses VS Code, but Agent Skills are an open format. The same Skill can also be used in compatible tools such as Claude Code, OpenCode, OpenAI Codex, etc.\\\\n> \\\\n> \\\\n> For more VS Code content, refer to: (https://example.com/vscode/vscode-tutorial.html).\\\\n\\\\n* * *\\\\n\\\\n## Creating Skill Directory and Files\\\\n\\\\nVS Code looks for Skills in the project's .agents/skills/ directory by default.\\\\n\\\\nFirst, create the following directory structure in your project:\\\\n\\\\n## Create Directory Structure\\\\n\\\\n# Execute in project root directory\\\\n\\\\nmkdir-p .agents/skills/roll-dice\\\\n\\\\nThen create the following file in .agents/skills/roll-dice/SKILL.md:\\\\n\\\\n## Example: Complete SKILL.md Content\\\\n\\\\n---\\\\n\\\\n name: roll-dice\\\\n\\\\n description: userandomnumbergenerategeneratorrolldice。whenuserrequestsrolldice(d6、d20 etc.οΌ‰orgeneraterandomdicepointswhenuse。\\\\n\\\\n---\\\\n\\\\n# Dice rolling method\\\\n\\\\nUse the following shell command to generate a random number between 1 and the specified number of sides:\\\\n\\\\n## macOS / Linux\\\\n\\\\n```bash\\\\n\\\\n echo $((RANDOM %+1))\\\\n\\\\n ```\\\\n\\\\n## Windows PowerShell\\\\n\\\\n```powershell\\\\n\\\\n Get-Random -Minimum 1-Maximum (+1)\\\\n\\\\n ```\\\\n\\\\n**Usage instructions:**\\\\n\\\\n Set `` Replace with the user-specified number of dice sides:\\\\n\\\\n- d6:Set `` Replace with 6\\\\n\\\\n- d20:Set `` Replace with 20\\\\n\\\\n- Other side counts follow the same pattern.\\\\n\\\\n**Output:** Just return the random result number directly, without additional explanation.\\\\n\\\\nOne file, less than 20 lines, and a complete Skill is done.\\\\n\\\\n!(https://example.com/wp-content/uploads/2026/04/113748f7-8f18-4eeb-97b1-42724b8bf495.png)\\\\n\\\\n* * *\\\\n\\\\n## File Structure Analysis\\\\n\\\\nLet's understand the function of each part of this file.\\\\n\\\\n### YAML Header (Frontmatter)\\\\n\\\\n| Field | Function | Description |\\\\n| --- | --- | --- |\\\\n| name | Unique identifier for the Skill | Must exactly match the folder name, using lowercase letters and hyphens |\\\\n| description | Trigger condition description | Tells the Agent when to use this Skill; this is the key field for the Agent's decision to activate |\\\\n\\\\n### Body (Markdown Body)\\\\n\\\\nThe body is the instruction that the Agent actually follows after activating the Skill.\\\\n\\\\nHere we tell the Agent: when the user asks to roll dice, use the operating system's random number command and pass the number of sides into the command.\\\\n\\\\nWe provide commands for both macOS/Linux and Windows platforms, and the Agent will automatically choose based on the current environment.\\\\n\\\\n* * *\\\\n\\\\n## Testing Your Skill\\\\n\\\\nAfter creating the file, verify with the following steps:\\\\n\\\\n1. Open your project in VS Code\\\\n\\\\n2. Open the Copilot Chat panel (shortcut Ctrl+Shift+I or Cmd+Shift+I), or click the button in the upper right corner:\\\\n\\\\n!(https://example.com/wp-content/uploads/2026/04/34d70eba-a6d8-42a6-b2a2-c8db13cee663.png)\\\\n\\\\n3. Select Agent mode at the bottom of the chat panel\\\\n4. Enter the /skills command and confirm that roll-dice appears in the Skill list\\\\n\\\\n!(https://example.com/wp-content/uploads/2026/04/50037cde-8856-4e94-9ae0-19c405864ffd.png)\\\\n\\\\n5. You can see the skill list has roll-dice:\\\\n\\\\n!(https://example.com/wp-content/uploads/2026/04/05bde6d6-a75e-44a2-ac0d-424439af19d6.png)\\\\n\\\\n> If you don't see roll-dice in the /skills list, please check if the file path is correct: .agents/skills/roll-dice/SKILL.md, note that SKILL.md must be uppercase.\\\\n\\\\nAfter confirming the Skill is loaded, enter in the chat:\\\\n\\\\nRoll a d20\\\\nThe Agent should automatically activate the roll-dice Skill, run the terminal command, and return a random number between 1 and 20.\\\\n\\\\n!(https://example.com/wp-content/uploads/2026/04/23fd0b3b-6f04-46ff-a25d-42daf6be2d93.png)\\\\n\\\\n* * *\\\\n\\\\n## The Underlying Process\\\\n\\\\nWhen you use this Skill in Copilot Chat, three steps occur under the hood:\\\\n\\\\n### Step One: Discovery\\\\n\\\\nWhen the chat session begins, the Agent scans the default Skill directory (.agents/skills/) and finds roll-dice.\\\\n\\\\nIt only reads the name and description, and learns "this Skill is for rolling dice."\\\\n\\\\n### Step Two: Activation\\\\n\\\\nWhen you input "Roll a d20," the Agent matches your question against the roll-dice description.\\\\n\\\\nAfter successful matching, the Agent loads the complete SKILL.md body into the context.\\\\n\\\\n### Step Three: Execution\\\\n\\\\nFollowing the instructions in the body, the Agent recognizes that you are using macOS (or Linux) and selects the bash command.\\\\n\\\\nIt replaces the 20 corresponding to d20 into the command, executes echo $((RANDOM % 20 + 1)), and returns the result to you.\\\\n\\\\n* * *\\\\n\\\\n## Troubleshooting Common Issues\\\\n\\\\n| Issue | Possible Cause | Solution |\\\\n| --- | --- | --- |\\\\n| /skills list is empty | Incorrect SKILL.md file path | Confirm the file is in the project's .agents/skills/roll-dice/ directory |\\\\n| Agent did not run command | Model tool calling reliability differences | Try switching models, or more explicitly say "help me roll a d20" |\\\\n| Command execution failed | Shell environment differences | Confirm that the $RANDOM command works normally in macOS/Linux terminal |\\\\n\\\\n* * *\\\\n\\\\n## Cross-Tool Usage Tips\\\\n\\\\nAlthough this tutorial uses VS Code, Skills can also be used in other tools:\\\\n\\\\n| Tool | Skill Storage Location |\\\\n| --- | --- |\\\\n| VS Code + Copilot | .agents/skills/ or .github/copilot/ |\\\\n| Claude Code | .claude/skills/ or ~/.claude/skills/ |\\\\n| OpenAI Codex | .codex/skills/ |\\\\n\\\\nDifferent tools may use different default directories, but the Skill format and file structure are universal.
← Opencode Oh My OpenagentSkills Description β†’