microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
abfd03ef8b9f81e150e6d564a43b755cc910c8e6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/contributing/skills.md

521lines · modecode

1---
2title: Contributing Skills to HVE Core
3description: Requirements and standards for contributing skill packages to hve-core
4author: Microsoft
5ms.date: 2026-02-16
6ms.topic: how-to
7keywords:
8 - skills
9 - contributing
10 - ai artifacts
11estimated_reading_time: 8
12---
13
14This guide defines the requirements, standards, and best practices for contributing skill packages to the hve-core library.
15
16**⚙️ Common Standards**: See [AI Artifacts Common Standards](ai-artifacts-common.md) for shared requirements (XML blocks, markdown quality, RFC 2119, validation, testing).
17
18## What is a Skill?
19
20A **skill** is a self-contained package that provides guidance and utilities for specific tasks. Unlike agents or prompts that guide conversation flows, skills bundle documentation, and optionally executable scripts, to perform concrete operations. A skill can be purely documentation-driven (providing structured knowledge and instructions) or can include cross-platform scripts for automated task execution.
21
22## Skill vs Agent vs Prompt
23
24| Artifact | Purpose | Includes Scripts | User Interaction |
25|----------|-------------------------------|------------------|--------------------------|
26| Skill | Task execution with utilities | Optional | Minimal after invocation |
27| Agent | Conversational guidance | No | Multi-turn conversation |
28| Prompt | Single-session workflow | No | One-shot execution |
29
30## Use Cases for Skills
31
32Create a skill when you need to:
33
34* Package structured knowledge and instructions for a specific task domain
35* Bundle documentation with executable scripts for automated task execution
36* Provide cross-platform utilities (PowerShell required, bash recommended)
37* Standardize common development tasks
38* Share reusable tooling across projects
39
40## Skills Not Accepted
41
42The following skill types will likely be **rejected**:
43
44* **Duplicate Skills**: Skills that replicate functionality of existing tools or skills
45* **Missing PowerShell Scripts**: Skills that include a `scripts/` directory without a `.ps1` file (PowerShell is required; bash is recommended)
46* **Undocumented Utilities**: Scripts without comprehensive SKILL.md documentation
47* **Untested Skills**: Skills that lack unit tests or fail to achieve 80% code coverage
48
49## File Structure Requirements
50
51### Location
52
53Skill files are typically organized in a collection subdirectory by convention:
54
55```text
56.github/skills/{collection-id}/<skill-name>/
57├── SKILL.md # Main skill definition (required)
58├── scripts/ # Executable scripts (optional)
59│ ├── <action>.ps1 # PowerShell script (required)
60│ └── <action>.sh # Bash script (recommended)
61├── references/ # Additional documentation (optional)
62│ └── REFERENCE.md # Detailed technical reference
63├── assets/ # Static resources (optional)
64│ └── templates/ # Document or configuration templates
65├── examples/
66│ └── README.md # Usage examples (recommended)
67└── tests/
68 └── <action>.Tests.ps1 # Pester unit tests (required for PowerShell)
69```
70
71> [!NOTE]
72> Collections can reference artifacts from any subfolder. The `path:` field in collection YAML files
73> accepts any valid repo-relative path regardless of the artifact's parent directory.
74
75The `scripts/` directory is **optional**. When present, it **MUST** contain at least one `.ps1` file and **SHOULD** contain at least one `.sh` file for cross-platform support. Skills without scripts are valid and function as documentation-driven knowledge packages.
76
77### Naming Convention
78
79* Use lowercase kebab-case for directory names: `video-to-gif`
80* Main definition file MUST be named `SKILL.md`
81* Script names should describe their action: `convert.sh`, `validate.ps1`
82* Only recognized subdirectories are allowed: `scripts`, `references`, `assets`, `examples`, `tests` (the `tests` directory is excluded from extension and CLI outputs)
83
84## Frontmatter Requirements
85
86### Required Fields
87
88**`name`** (string, MANDATORY)
89
90* **Purpose**: Unique identifier for the skill
91* **Format**: Lowercase kebab-case matching the directory name
92* **Example**: `video-to-gif`
93
94**`description`** (string, MANDATORY)
95
96* **Purpose**: Concise explanation of skill functionality
97* **Format**: Single sentence ending with attribution
98* **Example**: `'Video-to-GIF conversion skill with FFmpeg two-pass optimization - Brought to you by microsoft/hve-core'`
99
100### Frontmatter Example
101
102```yaml
103---
104name: video-to-gif
105description: 'Video-to-GIF conversion skill with FFmpeg two-pass optimization - Brought to you by microsoft/hve-core'
106---
107```
108
109### Optional Fields
110
111**`user-invocable`** (boolean, optional)
112
113* **Purpose**: Controls visibility in the VS Code slash command menu
114* **Default**: `true`
115* **When true**: Skill appears in the `/` menu for manual invocation via `/skill-name`
116* **When false**: Skill does not appear in the `/` menu; loaded only by semantic matching or explicit `#file:` reference
117* **Use case**: Set `false` for background skills that support other workflows without direct user invocation
118
119**`disable-model-invocation`** (boolean, optional)
120
121* **Purpose**: Controls whether Copilot automatically loads the skill via semantic matching
122* **Default**: `false`
123* **When false**: Copilot loads the skill automatically when the task description semantically matches the `description` field
124* **When true**: Skill is only loaded via manual `/skill-name` slash command invocation
125* **Use case**: Set `true` for skills with high token cost or niche applicability that should not load automatically
126
127**`argument-hint`** (string, optional)
128
129* **Purpose**: Displays expected inputs in the VS Code prompt picker
130* **Format**: Brief text with required arguments first, then optional arguments
131* **Conventions**: Use `[]` for positional arguments, `key=value` for named parameters, `{option1|option2}` for enumerations, `...` for free-form text
132* **Example**: `"input=video.mp4 [--fps={5|10|15|24}] [--width=1280]"`
133
134### Invocation Control Matrix
135
136| `user-invocable` | `disable-model-invocation` | `/` Menu | Semantic Loading | Invocation Method |
137|------------------|----------------------------|----------|------------------|-----------------------------|
138| `true` (default) | `false` (default) | Yes | Yes | Automatic + manual |
139| `true` | `true` | Yes | No | Manual `/skill-name` only |
140| `false` | `false` | No | Yes | Automatic only |
141| `false` | `true` | No | No | Only via `#file:` reference |
142
143### Frontmatter Example with Optional Fields
144
145```yaml
146---
147name: pr-reference
148description: 'Generate PR reference XML files with commit history and diffs for pull request workflows - Brought to you by microsoft/hve-core'
149user-invocable: true
150disable-model-invocation: false
151argument-hint: "[--base-branch=origin/main] [--exclude-markdown]"
152---
153```
154
155This example demonstrates a skill configured for both automatic semantic loading and manual `/pr-reference` invocation, with argument hints displayed in the prompt picker.
156
157## Collection Entry Requirements
158
159All skills must have matching entries in one or more `collections/*.collection.yml` manifests. Collection entries control distribution and maturity.
160
161### Adding Your Skill to a Collection
162
163After creating your skill package, add an `items[]` entry in each target collection manifest:
164
165```yaml
166items:
167 # path can reference artifacts from any subfolder
168 - path: .github/skills/{collection-id}/my-skill
169 kind: skill
170 maturity: stable
171```
172
173### Selecting Collections for Skills
174
175Choose collections based on who uses the skill's utilities:
176
177| Skill Type | Recommended Collections |
178|----------------------|------------------------------------|
179| Media processing | `hve-core-all` |
180| Documentation tools | `hve-core-all`, `hve-core` |
181| Data processing | `hve-core-all`, `data-science` |
182| Infrastructure tools | `hve-core-all`, `coding-standards` |
183| Code generation | `hve-core-all`, `coding-standards` |
184
185For complete collection documentation, see [AI Artifacts Common Standards - Collection Manifests](ai-artifacts-common.md#collection-manifests).
186
187## SKILL.md Content Structure
188
189### Required Sections
190
191#### 1. Title (H1)
192
193Clear, descriptive heading matching skill purpose:
194
195```markdown
196# Video-to-GIF Conversion Skill
197```
198
199#### 2. Overview
200
201Explains what the skill does and its approach:
202
203```markdown
204This skill converts video files to optimized GIF animations using FFmpeg two-pass palette optimization.
205```
206
207#### 3. Prerequisites
208
209Lists installation requirements for each platform:
210
211```markdown
212## Prerequisites
213
214FFmpeg MUST be installed and available in your system PATH.
215
216### macOS
217
218\`\`\`bash
219brew install ffmpeg
220\`\`\`
221
222### Linux
223
224\`\`\`bash
225sudo apt install ffmpeg
226\`\`\`
227
228### Windows
229
230\`\`\`powershell
231choco install ffmpeg
232\`\`\`
233```
234
235#### 4. Quick Start
236
237Shows basic usage with default settings:
238
239```markdown
240## Quick Start
241
242\`\`\`bash
243./scripts/convert.sh input.mp4
244\`\`\`
245```
246
247#### 5. Parameters Reference (when scripts are included)
248
249Documents all configurable options with defaults. Include this section when the skill contains scripts with configurable parameters.
250
251```markdown
252## Parameters
253
254| Parameter | Default | Description |
255|-----------|---------|--------------|
256| --fps | 10 | Frame rate |
257| --width | 480 | Output width |
258```
259
260#### 6. Script Reference (when scripts are included)
261
262Documents both bash and PowerShell usage. Include this section when the skill contains a `scripts/` directory.
263
264```markdown
265## Script Reference
266
267### convert.sh (Bash)
268
269\`\`\`bash
270./convert.sh --input video.mp4 --fps 15
271\`\`\`
272
273### convert.ps1 (PowerShell)
274
275\`\`\`powershell
276./convert.ps1 -InputPath video.mp4 -Fps 15
277\`\`\`
278```
279
280#### 7. Troubleshooting
281
282Common issues and solutions:
283
284```markdown
285## Troubleshooting
286
287### Tool not found
288
289Verify the dependency is in your PATH...
290```
291
292#### 8. Attribution Footer
293
294Include at end of file:
295
296```markdown
297*🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers.*
298```
299
300## Script Requirements
301
302Scripts are **optional** for skills. A skill can function purely as a documentation-driven knowledge package without any scripts. When a skill includes a `scripts/` directory, a PowerShell implementation is **required** and a bash implementation is **recommended** for cross-platform support.
303
304### Bash Scripts
305
306Bash scripts **MUST**:
307
308* Use `#!/usr/bin/env bash` shebang
309* Enable strict mode: `set -euo pipefail`
310* Follow main function pattern
311* Include usage function with `--help` support
312* Check for required dependencies
313* Handle platform differences (macOS vs Linux)
314
315See [bash.instructions.md](../../.github/instructions/coding-standards/bash/bash.instructions.md) for complete standards.
316
317### PowerShell Scripts
318
319PowerShell scripts **MUST**:
320
321* Use `[CmdletBinding()]` attribute
322* Include comment-based help (`.SYNOPSIS`, `.DESCRIPTION`, `.PARAMETER`, `.EXAMPLE`)
323* Validate parameters with `[ValidateScript()]`, `[ValidateRange()]`, or `[ValidateSet()]`
324* Check for required dependencies
325* Use proper error handling
326
327## Unit Testing Requirements
328
329All skill scripts MUST include unit tests that achieve a minimum of 80% code coverage. Tests are co-located inside the skill directory to keep each skill self-contained.
330
331### Test File Location
332
333Place test files in a `tests/` subdirectory within the skill directory:
334
335```text
336.github/skills/<skill-name>/
337└── tests/
338 └── <script-name>.Tests.ps1
339```
340
341### PowerShell Tests
342
343PowerShell skill scripts require Pester 5.x tests:
344
345* Use `.Tests.ps1` suffix matching the source script name
346* Follow the same conventions as `scripts/tests/` (see [Testing Architecture](../architecture/testing.md))
347* Pester configuration is defined at `scripts/tests/pester.config.ps1`; co-located skill tests run when their `tests/` directories are included in the Pester run paths (for example via CI or explicit test invocation)
348
349Minimal example:
350
351```powershell
352Describe 'Convert-VideoToGif' {
353 It 'Validates input file exists' {
354 { ./convert.ps1 -InputPath 'nonexistent.mp4' } | Should -Throw
355 }
356}
357```
358
359### Python Tests
360
361Python skill scripts require pytest:
362
363* Use `test_<script_name>.py` naming convention
364* Place tests in the `tests/` subdirectory alongside PowerShell tests
365* Configure pytest and ruff in a `pyproject.toml` at the skill root
366
367### Packaging Note
368
369Co-located `tests/` directories are automatically excluded from the VSIX extension package. No additional contributor action is needed.
370
371## Supported Languages
372
373Skills may include scripts in any of these supported languages. Each language has specific tooling and CI expectations.
374
375| Language | Script Extension | Test Framework | Linter / Analyzer | CI Coverage |
376|------------|------------------|----------------|---------------------------------------------|--------------------|
377| Bash | `.sh` | N/A | shellcheck | Lint only |
378| PowerShell | `.ps1` | Pester 5.x | PSScriptAnalyzer | Full (lint + test) |
379| Python | `.py` | pytest | ruff (line-length=88, target-version=py311) | Planned |
380
381### Requesting New Language Support
382
383To request support for a new programming language:
384
3851. Open a [Skill Request](https://github.com/microsoft/hve-core/issues/new?template=skill-request.yml) issue
3862. Select the desired language in the Programming Language dropdown (choose "Other" if unlisted)
3873. Describe the tooling requirements: test framework, linter, CI integration needs
3884. A maintainer will evaluate feasibility and update this table when support is added
389
390## Examples Directory
391
392The `examples/` subdirectory **SHOULD** include:
393
394* Quick usage examples for common scenarios
395* Test data generation instructions
396* Quality comparison guides
397* Batch processing patterns
398
399## Path Portability
400
401Skill packages are self-contained and relocatable. The skill root directory varies by distribution context:
402
403| Context | Skill Root Example |
404|--------------------|--------------------------------------------------------------------|
405| In-repo | `.github/skills/<collection>/<skill>/` |
406| Copilot CLI plugin | `~/.copilot/installed-plugins/_direct/<plugin>/skills/<skill>/` |
407| VS Code extension | `~/.vscode/extensions/<publisher>.<ext>-<version>/skills/<skill>/` |
408| Plugin output | `plugins/<collection>/skills/<skill>/` |
409
410The `.github/` directory does not exist in any distributed context. All file references and script paths within a skill must be relative to the skill root, never repo-root-relative.
411
412* Use `./scripts/<script-name>.sh` instead of `./.github/skills/<collection>/<skill>/scripts/<script-name>.sh`
413* Use `references/<reference-name>.md` instead of `.github/skills/<collection>/<skill>/references/<reference-name>.md`
414* From files in subdirectories (such as `references/`), use `../scripts/` to reach sibling directories
415
416This rule applies to all files in the skill: SKILL.md, reference documents, assets, and code examples in documentation. Repo-root-relative paths break portability and will fail validation.
417
418## Semantic Skill Loading
419
420VS Code Copilot uses progressive disclosure to load skills efficiently. Understanding this model helps authors write effective `description` fields and helps callers invoke skills correctly.
421
422### How Skills are Discovered
423
424Copilot reads the `name` and `description` fields from all SKILL.md files at startup. This lightweight metadata (~100 tokens per skill) enables relevance matching without loading full skill content.
425
426### How Skills are Loaded
427
428When a user request or caller description semantically matches a skill's `description`:
429
4301. **Level 1 (Discovery)**: Copilot matches the task against `name` and `description` frontmatter (always loaded, ~100 tokens per skill).
4312. **Level 2 (Instructions)**: The full SKILL.md body loads into context with script usage, parameters, and troubleshooting (<5000 tokens recommended).
4323. **Level 3 (Resources)**: Scripts, examples, and references in the skill directory load on-demand during execution.
433
434### Writing Effective Descriptions
435
436The `description` field is the semantic key for automatic loading. Craft descriptions that are:
437
438* Specific enough for accurate matching (include the primary action verb and artifact type)
439* Broad enough to cover all use cases (avoid narrowing to one scenario)
440* Containing searchable terms that callers naturally use
441
442### How Callers Invoke Skills
443
444Prompts, agents, and instructions should describe the task intent rather than referencing script paths. Copilot matches task descriptions against skill `description` fields and loads the skill on-demand.
445
446Avoid hardcoded script paths, platform detection logic, or extension fallback code in caller files.
447
448For explicit invocation, use the `/skill-name` slash command in chat.
449
450## Validation Checklist
451
452Before submitting your skill, verify:
453
454### Structure
455
456* [ ] Directory at `.github/skills/<skill-name>/`
457* [ ] SKILL.md present with valid frontmatter
458* [ ] If `scripts/` directory exists: at least one `.ps1` file present (`.sh` recommended)
459* [ ] Only recognized subdirectories used (`scripts`, `references`, `assets`, `examples`, `tests`)
460* [ ] Examples README (recommended)
461
462### Frontmatter
463
464* [ ] Valid YAML between `---` delimiters
465* [ ] `name` field present and matches directory name
466* [ ] `description` field present and descriptive
467* [ ] Optional: `user-invocable` set appropriately (default `true` works for most skills)
468* [ ] Optional: `disable-model-invocation` set appropriately (default `false` works for most skills)
469* [ ] Optional: `argument-hint` provides useful input guidance if set
470
471### Scripts (when included)
472
473* [ ] `scripts/` directory contains at least one `.ps1` file
474* [ ] PowerShell script passes PSScriptAnalyzer
475* [ ] If bash scripts are included: follows bash.instructions.md
476* [ ] When both exist, scripts implement equivalent functionality
477* [ ] Help and usage documentation included
478
479### Testing
480
481* [ ] Unit tests present in `tests/` subdirectory
482* [ ] PowerShell tests use `.Tests.ps1` naming convention
483* [ ] Tests pass locally via `npm run test:ps`
484
485### Documentation
486
487* [ ] All required SKILL.md sections present
488* [ ] Prerequisites documented per platform
489* [ ] Parameters fully documented
490* [ ] Troubleshooting section included
491* [ ] Attribution footer present
492
493## Automated Validation
494
495Run these commands before submission:
496
497```bash
498npm run lint:frontmatter # Validate SKILL.md frontmatter
499npm run lint:ps # Validate PowerShell scripts (when present)
500npm run lint:md # Validate markdown formatting
501npm run validate:skills # Validate skill directory structure
502npm run test:ps # Run PowerShell unit tests
503```
504
505All checks **MUST** pass before merge.
506
507## Related Documentation
508
509* [AI Artifacts Common Standards](ai-artifacts-common.md) - Shared standards for all contributions
510* [Contributing Agents](custom-agents.md) - Agent file guidelines
511* [Contributing Prompts](prompts.md) - Prompt file guidelines
512* [Contributing Instructions](instructions.md) - Instructions file guidelines
513* [Agent Skills Specification](https://agentskills.io/specification) - Core specification for skill structure and metadata
514* [VS Code Copilot Agent Skills](https://code.visualstudio.com/docs/copilot/customization/agent-skills) - VS Code integration, progressive disclosure, and frontmatter controls
515
516---
517
518<!-- markdownlint-disable MD036 -->
519*🤖 Crafted with precision by ✨Copilot following brilliant human instruction,
520then carefully refined by our team of discerning human reviewers.*
521<!-- markdownlint-enable MD036 -->
522