docs(add-copilot-project-skill): pivot to GitHub-native .github/skills layout
Drops the dual-surface "skills/ + .github/prompts/" framing in favour of the Copilot cloud agent's documented .github/skills/<name>/SKILL.md autodiscovery with description-matching routing. - replace .github/prompts/ mirror with .github/instructions/*.instructions.md path-scoped auto-apply - AGENTS.md becomes the single source of style; copilot-instructions.md reduced to a redirect + skills-menu for discoverability - add frontmatter spec table (name/description/license/allowed-tools) - restate handoff rationale as cloud-agent per-turn routing
This commit is contained in:
parent
d96506c523
commit
51ae52709d
@ -1,21 +1,24 @@
|
||||
---
|
||||
name: add-copilot-project-skill
|
||||
description: Scaffold a project-specific skill set that guides contributors through a repo's repeatable, error-prone extension tasks — consumed by GitHub Copilot, authored in the Claude Code SKILLS structure, single-sourced from the repo's own docs, and backed by a mechanical validator. Tuned for config-driven pipelines (e.g. R `{targets}` projects). Use when the user says "add copilot project skills", "turn our onboarding/extension workflow into skills", "guide contributors to add datasets/modules/targets/chapters", "make a Copilot skill set for this repo", "/add-copilot-project-skill".
|
||||
description: Scaffold a project-specific skill set that guides contributors through a repo's repeatable, error-prone extension tasks — consumed by the GitHub Copilot cloud coding agent via the official .github/skills/ format, single-sourced from the repo's own docs, and backed by a mechanical validator. Tuned for config-driven pipelines (e.g. R `{targets}` projects). Use when the user says "add copilot project skills", "turn our onboarding/extension workflow into skills", "guide contributors to add datasets/modules/targets/chapters", "make a Copilot skill set for this repo", "/add-copilot-project-skill".
|
||||
---
|
||||
|
||||
# add-copilot-project-skill
|
||||
|
||||
Build a set of *project* skills that live in the repo and lower the error rate
|
||||
on its recurring extension tasks (add a data source, a module, a pipeline node,
|
||||
a report section). The skills are authored once in the **Claude Code SKILLS
|
||||
structure** and surfaced to **GitHub Copilot** via prompt files — one body, two
|
||||
front doors, no drift.
|
||||
a report section). The skills follow the **GitHub Copilot cloud coding agent
|
||||
skill format** ([docs](https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/add-skills)):
|
||||
`.github/skills/<name>/SKILL.md`, autodiscovered, routed by description
|
||||
matching — no slash-invocation step required.
|
||||
|
||||
## When to use
|
||||
- A repo has a repeatable, multi-step extension task with silent failure modes
|
||||
(something declared but not registered; a name that must match in two places).
|
||||
- The team uses GitHub Copilot and wants guided, in-repo workflows.
|
||||
- The user wants Claude Code SKILLS conventions but Copilot as the consumer.
|
||||
- The team uses GitHub Copilot's cloud agent (issue assignment / `@copilot` in
|
||||
PR comments) and wants guided, in-repo workflows.
|
||||
- The user wants the SKILLS authoring conventions (frontmatter, "Use when"
|
||||
trigger, ≤100-line progressive-disclosure body) targeting Copilot.
|
||||
|
||||
## Process
|
||||
1. **Interview the repo, not just the user.** Read the existing contributor
|
||||
@ -30,35 +33,49 @@ front doors, no drift.
|
||||
the invariants, scoped to changed files, tuned to pass clean on the main
|
||||
branch. Details + the AST-parsing and severity rules in
|
||||
[project-validator.md](project-validator.md).
|
||||
3. **Write the always-on conventions** — `AGENTS.md` and
|
||||
`.github/copilot-instructions.md` carry the house style so every suggestion
|
||||
inherits it without a skill being invoked. Templates in
|
||||
3. **Write the always-on conventions** — `AGENTS.md` carries the house style.
|
||||
`.github/copilot-instructions.md` is a thin redirect to `AGENTS.md` plus a
|
||||
**skills menu** that names each skill with its trigger phrases (improves
|
||||
discoverability beyond description matching alone). Templates in
|
||||
[skill-templates.md](skill-templates.md).
|
||||
4. **Author the leaf skills** (one per artifact task) and **parent skills** (one
|
||||
per composite/modality). Each is a thin, conversation-style stub: interview
|
||||
first, point at **live repo files** as the example (zero drift), end at the
|
||||
validator, then **hand off to the next skill by name and pause** — Copilot
|
||||
cannot auto-invoke a sub-prompt, so never auto-chain. Layout, the
|
||||
Claude↔Copilot mapping, and the handoff rule are in
|
||||
per composite/modality) at `.github/skills/<name>/SKILL.md`. Each is a thin,
|
||||
conversation-style stub: interview first, point at **live repo files** as
|
||||
the example (zero drift), end at the validator, then **hand off to the next
|
||||
skill by name and pause** — the cloud agent decides per turn whether to load
|
||||
a sibling skill, so never auto-chain. Layout and the handoff rule are in
|
||||
[layout-and-surfaces.md](layout-and-surfaces.md).
|
||||
5. **Mirror each skill to `.github/prompts/<name>.prompt.md`** — a stub that
|
||||
points back to its canonical `SKILL.md` so the two cannot drift.
|
||||
5. **Add path-scoped instructions** at `.github/instructions/<name>.instructions.md`
|
||||
with `applyTo:` globs. These auto-load when a contributor opens a matching
|
||||
file, surfacing the relevant skill's name and the project-specific gotchas
|
||||
without requiring an explicit prompt.
|
||||
6. **Verify**: run `just validate` on a clean tree (expect zero errors); confirm
|
||||
every path a skill cites actually exists; deliberately break one invariant
|
||||
and confirm the validator catches it, then revert.
|
||||
and confirm the validator catches it, then revert. Assign a test issue to
|
||||
Copilot that should match one skill's `description:` and confirm the
|
||||
agent's plan paraphrases lines from that `SKILL.md`.
|
||||
|
||||
## Output / done criteria
|
||||
- `skills/<name>/SKILL.md` (canonical) + `.github/prompts/<name>.prompt.md`
|
||||
(mirror) for each task; `AGENTS.md` + `.github/copilot-instructions.md`;
|
||||
a working `scripts/validate_extension.*` wired as `just validate`.
|
||||
- `.github/skills/<name>/SKILL.md` for each task (canonical, autodiscovered);
|
||||
`.github/instructions/<name>.instructions.md` for each editable surface;
|
||||
`AGENTS.md` (canonical house style); `.github/copilot-instructions.md` (thin
|
||||
redirect + skills menu); a working `scripts/validate_extension.*` wired as
|
||||
`just validate`.
|
||||
- Validator passes clean on the main branch and fires on an injected break.
|
||||
- Skills reference live files, interview first, and hand off explicitly.
|
||||
- The cloud agent loads the matching skill when given a trigger-phrase prompt.
|
||||
|
||||
## Guardrails
|
||||
- **Single-source.** The procedure lives in the repo's `docs/`; `SKILL.md` and
|
||||
`.prompt.md` are stubs that link to it. Never copy a procedure into both.
|
||||
- **No auto-chaining.** Parents guide; they don't silently run children.
|
||||
- **Single-source.** The procedure lives in the repo's `docs/`; `SKILL.md`
|
||||
bodies are stubs that link to it. `AGENTS.md` is the single source of style;
|
||||
never duplicate its content into `copilot-instructions.md`.
|
||||
- **No auto-chaining.** Parents guide; they don't silently run children. The
|
||||
cloud agent's description matcher routes per turn — name the next skill and
|
||||
let the user (or the agent's own next decision) re-enter.
|
||||
- **Validator must pass clean first.** Tune severities to the existing tree, or
|
||||
contributors learn to ignore it. Don't invent invariants the repo doesn't hold.
|
||||
- **Description matching is the discovery surface.** Lead each `description:`
|
||||
with "Use when the user says ..." trigger phrases. Two skills sharing a
|
||||
trigger collide; sharpen the differentiators.
|
||||
- This skill produces *another repo's* skills — keep its own SKILL.md generic;
|
||||
the worked specifics belong in the target repo's docs and live examples.
|
||||
|
||||
@ -1,52 +1,56 @@
|
||||
# Layout, surfaces, and the handoff rule
|
||||
|
||||
How the dual-surface, single-source skill set is arranged in a target repo.
|
||||
How the GitHub-native skill set is arranged in a target repo.
|
||||
|
||||
## File layout
|
||||
|
||||
```
|
||||
docs/ canonical procedures (the body — extend, don't duplicate)
|
||||
AGENTS.md always-on house conventions
|
||||
skills/<name>/SKILL.md canonical skill, Claude Code SKILLS structure
|
||||
AGENTS.md always-on house conventions (the single source)
|
||||
.github/
|
||||
copilot-instructions.md always-on conventions, Copilot-wide
|
||||
prompts/<name>.prompt.md Copilot front door (/name in Copilot Chat)
|
||||
copilot-instructions.md thin redirect to AGENTS.md + skills menu
|
||||
skills/<name>/SKILL.md canonical skill — autodiscovered by GitHub cloud agent
|
||||
instructions/<name>.instructions.md path-scoped auto-apply rules (applyTo glob)
|
||||
scripts/validate_extension.* the mechanical checkpoint (just validate)
|
||||
```
|
||||
|
||||
The real procedure stays in `docs/`. `SKILL.md` and `.prompt.md` are **stubs**:
|
||||
a trigger line, a short decision tree, the checklist, and links into `docs/`
|
||||
plus the live example files. One canonical body, two front doors.
|
||||
The real procedure stays in `docs/`. Each `SKILL.md` is a **stub**: a trigger
|
||||
description, a short decision tree, the checklist, and links into `docs/` plus
|
||||
the live example files. One canonical body per topic, no mirrors.
|
||||
|
||||
## Claude Code SKILLS structure → Copilot mapping
|
||||
## Why this layout
|
||||
|
||||
| SKILLS convention | Copilot surface |
|
||||
|---|---|
|
||||
| `skills/<name>/SKILL.md` (`/name`) | `.github/prompts/<name>.prompt.md` (`/name`) |
|
||||
| project memory / conventions | `.github/copilot-instructions.md` (always on) |
|
||||
| auto-trigger by `description` | `.github/instructions/*.instructions.md` with `applyTo:` globs |
|
||||
| supporting topic files | shared `docs/*.md` referenced by both |
|
||||
The GitHub Copilot cloud coding agent autodiscovers any `SKILL.md` under
|
||||
`.github/skills/` and decides which to load based on description matching
|
||||
against the user's prompt. Recognised alternates: `.claude/skills/` and
|
||||
`.agents/skills/` (same semantics, different consumer expectations).
|
||||
|
||||
The canonical skill is authored in the SKILLS structure (frontmatter, "Use
|
||||
when" trigger, ≤100-line body); the `.prompt.md` mirror points back to it so the
|
||||
two cannot drift. (If the team also runs Claude Code, symlink or copy
|
||||
`skills/<name>` into `.claude/skills/<name>` to make it `/`-invocable there too.)
|
||||
`AGENTS.md` is the cross-tool always-on standard (also read by Cursor, Codex,
|
||||
Cline, and Claude Code). `.github/copilot-instructions.md` exists as a
|
||||
Copilot-documented path; in this layout it's a thin redirect to `AGENTS.md`
|
||||
with a discoverability menu of the skills — content lives in one place.
|
||||
|
||||
`.github/instructions/*.instructions.md` is a separate mechanism: each file
|
||||
auto-applies when an editor file matches its `applyTo:` glob. They reference
|
||||
the matching skill by name, so a contributor editing a config file gets the
|
||||
relevant skill surfaced without having to ask.
|
||||
|
||||
## Two axes of skills
|
||||
|
||||
- **Leaf skills** — one per *artifact* a contributor edits (a config, a module,
|
||||
a pipeline node, a report section). Standalone-invocable.
|
||||
a pipeline node, a report section). Each is independently triggerable by its
|
||||
own description phrases.
|
||||
- **Parent skills** — one per *composite* task, sliced by the dimension the
|
||||
contributor actually thinks in (e.g. data modality: single-cell / bulk /
|
||||
spatial). A parent interviews, then walks the leaves.
|
||||
|
||||
## The handoff rule (why no auto-chaining)
|
||||
|
||||
A Copilot `.prompt.md` **cannot programmatically invoke another prompt** — the
|
||||
user types `/next-skill` themselves. So parents must use **guided handoff**:
|
||||
complete one stage, run the validator, then name the exact next skill and
|
||||
**pause**. Author Claude `SKILL.md` parents the same way, for parity and so the
|
||||
contributor stays in the loop and learns the sequence. Never bury the chain.
|
||||
The cloud agent loads skills **per turn**, not in a chain. A parent skill that
|
||||
silently runs five children produces one wall of output the contributor can't
|
||||
intervene in. So parents use **guided handoff**: complete one stage, run the
|
||||
validator, then name the exact next skill and **pause**. The agent's next turn
|
||||
re-routes via description matching — explicit, observable, debuggable.
|
||||
|
||||
## Skill anatomy (leaf or parent)
|
||||
|
||||
@ -57,3 +61,15 @@ contributor stays in the loop and learns the sequence. Never bury the chain.
|
||||
3. **Do the edits** — the minimal set, in the repo's house style.
|
||||
4. **Validate** — end at `just validate --changed`; interpret its errors.
|
||||
5. **Hand off** — name the next skill (or declare done) and stop.
|
||||
|
||||
## Frontmatter spec (matches GitHub's docs)
|
||||
|
||||
| Field | Requirement | Notes |
|
||||
|---|---|---|
|
||||
| `name:` | required | Lowercase, hyphen-separated; matches the directory name |
|
||||
| `description:` | required | What it does AND when to use it (trigger phrases) — drives the cloud agent's matching |
|
||||
| `license:` | optional | If the skill is shareable across repos |
|
||||
| `allowed-tools:` | optional | Pre-approves named tools (`bash`, `shell`) — security risk; use only on read-only skills like `validate-*` |
|
||||
|
||||
Companion files in the same skill directory (R scripts, JSON templates,
|
||||
reference snippets) are autodiscovered alongside the SKILL.md.
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
Copy-paste starting points. Keep them thin — the procedure lives in `docs/`.
|
||||
|
||||
## Canonical leaf skill — `skills/<name>/SKILL.md`
|
||||
## Canonical leaf skill — `.github/skills/<name>/SKILL.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: <verb-noun>
|
||||
description: <one line on what it does>. Use when the user says "<trigger>", "/<verb-noun>", or <situation>.
|
||||
description: <one line on what it does>. Use when the user says "<trigger phrase>", "<alternate phrasing>", "<situation cue>", or <situation>.
|
||||
---
|
||||
|
||||
# <verb-noun>
|
||||
@ -26,15 +26,20 @@ Full procedure: **`docs/<relevant-doc>.md`**. Live example to copy:
|
||||
|
||||
## Finish
|
||||
- Run **`just validate --changed`**; interpret <relevant error codes>.
|
||||
- Hand off: "Next, run `/<next-skill>`." Then stop.
|
||||
- Hand off: "Next, ask for `<next-skill>`." Then stop.
|
||||
```
|
||||
|
||||
Frontmatter notes: lowercase-hyphenated `name:` must match the directory name.
|
||||
The `description:` is the *only* discovery surface — lead with action-verb
|
||||
trigger phrases ("Use when the user says...") so the cloud agent's matcher
|
||||
fires reliably.
|
||||
|
||||
## Parent (composite) skill
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: <add-X-thing>
|
||||
description: End-to-end guide to <composite task>. Use when ... Orchestrates the leaf skills by guided handoff.
|
||||
description: End-to-end guide to <composite task>. Use when the user says "<trigger>", "<alternate>", or <situation>. Orchestrates the leaf skills by guided handoff.
|
||||
---
|
||||
|
||||
# <add-X-thing> (orchestrator)
|
||||
@ -47,37 +52,64 @@ leaf skill, and **pause** — do not auto-run the chain. Canonical example:
|
||||
<the few facts to establish before any stage>
|
||||
|
||||
## Stage sequence (hand off one at a time)
|
||||
1. `/leaf-a`
|
||||
2. `/leaf-b`
|
||||
1. `<leaf-a>` — <what it produces>
|
||||
2. `<leaf-b>` — <what it produces>
|
||||
3. ...
|
||||
|
||||
## Checkpoints
|
||||
Run `just validate --changed` after stages <n>; resolve errors before continuing.
|
||||
```
|
||||
|
||||
## Copilot mirror — `.github/prompts/<name>.prompt.md`
|
||||
## Path-scoped instructions — `.github/instructions/<surface>.instructions.md`
|
||||
|
||||
```markdown
|
||||
---
|
||||
mode: agent
|
||||
description: <same one-liner as the SKILL.md>.
|
||||
applyTo: "<directory>/**/*.<ext>"
|
||||
description: <one-line surface summary>
|
||||
---
|
||||
|
||||
Follow the canonical procedure in [`skills/<name>/SKILL.md`](../../skills/<name>/SKILL.md) — read it now — applying [`copilot-instructions.md`](../copilot-instructions.md).
|
||||
When editing files under `<directory>/`, you're touching <artifact>.
|
||||
|
||||
<2–4 line compressed recap of the steps + the live example path.>
|
||||
|
||||
Finish with `just validate --changed`, then <next skill or done>.
|
||||
- **Adding <X>?** Use the `<skill-name>` skill ("<trigger phrase>",
|
||||
"<alternate>").
|
||||
- <one specific gotcha unique to this surface, naming the validator code
|
||||
that catches it>
|
||||
- <one house-style rule that matters here>
|
||||
- Run `just validate --changed` before committing.
|
||||
```
|
||||
|
||||
Relative paths from `.github/prompts/`: `../../skills/...`, `../../docs/...`,
|
||||
`../copilot-instructions.md`.
|
||||
These don't replace `AGENTS.md` (always-on house style) — they surface
|
||||
**surface-specific** reminders that name the relevant skill.
|
||||
|
||||
## Always-on conventions — `AGENTS.md` and `.github/copilot-instructions.md`
|
||||
## Always-on conventions — `AGENTS.md`
|
||||
|
||||
Same content, two files. Cover: the language style rules (imports, extraction,
|
||||
iteration), the directory/naming layout, the one-token-everywhere convention
|
||||
(prefix = cache group = log tag, or your repo's equivalent), the most common
|
||||
pipeline mistakes, the "run `just validate --changed` before finishing" rule,
|
||||
and commit conventions. Keep `copilot-instructions.md` self-contained enough to
|
||||
stand alone; have it link to `AGENTS.md` and `docs/` for depth.
|
||||
`AGENTS.md` is the single source of style. Cover: language style rules
|
||||
(imports, extraction, iteration), directory/naming layout, the one-token-
|
||||
everywhere convention (prefix = cache group = log tag, or your repo's
|
||||
equivalent), the most common pipeline mistakes, the "run `just validate
|
||||
--changed` before finishing" rule, and commit conventions.
|
||||
|
||||
End AGENTS.md with a small table pointing at `.github/skills/` and
|
||||
`.github/instructions/` so any agent reading AGENTS.md learns where the
|
||||
operational skills live.
|
||||
|
||||
## Copilot redirect + skills menu — `.github/copilot-instructions.md`
|
||||
|
||||
This file exists for Copilot-tier surfaces that prefer the documented path.
|
||||
Body: one sentence redirecting to `AGENTS.md`, then a discoverability table:
|
||||
|
||||
```markdown
|
||||
# GitHub Copilot instructions — <project name>
|
||||
|
||||
House style and conventions: **[`AGENTS.md`](../AGENTS.md)**.
|
||||
|
||||
## Skills (auto-triggered by description matching)
|
||||
|
||||
| Skill | Triggers on prompts like |
|
||||
|---|---|
|
||||
| [`add-X`](skills/add-X/SKILL.md) | "<trigger>", "<alternate>" |
|
||||
| ... | ... |
|
||||
```
|
||||
|
||||
Belt-and-braces: even if description matching misses, the menu surfaces the
|
||||
skill names always-on.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user