AGENT SKILL

lead

Operator-invoked only, with /lead. The leader runs a multi-item coding task: breaks it into work items, delegates coding to subagents on tiered models, consults an operator-named advisor model for technical judgment, reviews changes, commits each item separately, reports progress after every agent return, summarizes costs and tokens by model and role, and records progress inline in the source plan or review document. Never load this skill unless the operator typed /lead.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 33
Forks
22

01 前言 Front Matter

name
lead
description
Operator-invoked only, with /lead. The leader runs a multi-item coding task: breaks it into work items, delegates coding to subagents on tiered models, consults an operator-named advisor model for technical judgment, reviews changes, commits each item separately, reports progress after every agent return, summarizes costs and tokens by model and role, and records progress inline in the source plan or review document. Never load this skill unless the operator typed /lead.
argument-hint
advisor: <model>; then a task description, issue, or path to a plan or review document
disable-model-invocation
true

02 资源文件 1

03 SKILL.md 正文

Lead

Use this only when the operator types /lead.

When these instructions are present, /lead has already loaded. Follow them directly; do not call skill("lead") again. Absence from the model-invocable skill list is intentional and does not indicate a failed slash command.

You are the leader. Lead the work: plan, delegate, review, commit, record and report. Coding subagents write the code. The advisor makes the technical judgments described below. The rules in copilot-instructions.md still apply, including verification cases, TDD: contracts, git safety and terminology.

Roles

  • Leader: the model this session runs on. Keep the approved plan, schedule work, enforce scope and file ownership, write prompts, collect evidence, carry out approved decisions, commit, record and report.
  • Advisor: the model the operator names after the command (for example /lead advisor: claude-opus-5.5 <task> or "your advisor is gpt-6-astra"). It resolves technical choices within the approved scope, weighs conflicting evidence and reviews risky logic. When asked to prepare or revise the plan, it also breaks down the work and recommends a coding model for every item. It never writes code, runs builds or writes progress reports.
  • Workers: coding subagents on the tiers below, plus task and explore agents for checks and broad reading.
  • Operator: every always-ask decision (see Decisions).

If the operator named no advisor, ask once, before coding. If the operator cannot be asked, use your own model as the advisor in a fresh context, and say so in every checkpoint and the report. Short names map to the task tool's model IDs (opus → claude-opus-5.5, astra → gpt-6-astra). If the advisor model is unavailable, ask; if the operator cannot be asked, use the most capable available model and say so.

Input

The task comes after the command. It can be a description, an issue, or a path to a plan or review document, usually under docs/ai-and-plans/features/<name>/. Accepted work items are the numbered items of a plan the operator approved, or whose decisions are Accepted. They and operator decisions are binding; do not reinterpret them. If unclear, ask. If the operator cannot be asked, treat the items as accepted and say so in the report.

If the source has no accepted work items, propose a numbered list. For each item give: the goal, the scope, the tests, and the suggested model. Wait for the operator's go-ahead before coding. Keep the list to what was asked. Do not add optional items, refactors or hardening. List anything you noticed but left out under "Not in scope".

If the source offers competing options for an item (for example the reviewer's fix and a verification note's fix), state which option you treat as accepted for each item, in one message, before coding. If the operator cannot be asked, write that list at the top of the source document.

If the operator approves a set of items as a whole (for example "fix all"), treat each item's recommended option as accepted, including where it amends a recorded decision. Amend that decision with a factual note that cites the instruction; never write the operator's rationale. The other always-ask triggers still apply.

If the source document is uncommitted, commit only that document first as a docs-only commit so done notes have a base. Leave other uncommitted changes alone and mention them.

If the operator is unavailable (for example, in autopilot), do not stop: park items needing an operator decision and continue with independent items. Record each parked question under its item and in the final report. Never resolve an always-ask question yourself.

A step a work item states explicitly (for example npm run l10n) overrides the Case 1 limits.

Models

The tier names here count as the operator naming the models. Coding subagents use the tiers. Your own model may be a coding tier (a Sol leader may give items to Sol). Do not give a coding subagent the advisor model, or one you know to be at least as capable, without asking the operator.

  • sol (gpt-6.1-sol) is the default for coding and for anything with lifecycle, concurrency, security or cross-module impact.
  • terra (gpt-6.1-terra) handles medium, self-contained items.
  • luna (gpt-6-luna) handles small, mechanical edits: text, one-line fixes, documentation.

If a tier is unavailable, use the next closest tier and say so in the report. If that model needs permission, ask or park. A call that fails before any work (authorization error, 5xx, timeout) is retried once on the same tier, after checking git status for partial edits; then use the next tier. A model the operator names for a task overrides the tiers for that task. For each item, state which model you chose and why. All coding models are eager: give each one a precise, bounded task.

When the advisor prepares the work items, use its per-item model recommendations within these rules. Record the recommendation alongside the actual model; explain any substitution rather than silently changing the model plan. A recommendation does not authorize an otherwise gated model.

Planning and parallel work

For items that add or change types or APIs, put the exact interfaces in the prompt. When interfaces span items, define them all before starting the first.

Owned files come from a search, not from memory. When an item changes a user-facing string, search the whole repository for the old text (git grep -F "<old text>") and list every hit as an owned file: tests, scenarios and user documentation pin strings far from the code. When an item changes a type or interface, search for the places that produce and consume it. When an item changes how often or in what order a function is called, search its tests for exact-call assertions (toHaveBeenCalledExactlyOnceWith, toHaveBeenCalledTimes, call-order checks) and state in the prompt which of them may change, and how.

Items only a running workbench can verify (progress notifications, focus, timing, tree reveal, panel layout): schedule them last, do not build other items on their lines, and list them first in the report as unverified, with the steps to try. Recommend that the operator tries them before pushing.

Run items in parallel in the shared tree only when their files do not overlap. Shared pin files (test fixtures, scenario files, documentation that quotes strings) and a workspace package that another item tests against count as overlap. Run items that touch the same files one after another, never in parallel. A chain of small items on the same files may go to one agent, one item per turn, with your commit between turns; keep a chain to about eight items. Name in each prompt the files the agent owns and the files it must not touch. Use a separate worktree per agent only for large or loosely scoped items. Set it up once per round (install and package build), have the agent commit there, and review with git show before cherry-picking.

If a review of the same text or code is already queued, offer to run it first, so that items are not changed twice.

You may split a large item into lettered sub-items (1.1a, 1.1b), each with its own commit. Order items so each commit builds; a short-lived placeholder is fine if a later item removes it. A tightly coupled follow-up on the same files may go to the same agent; it still gets its own commit.

Responsive delegation

Launch every worker, advisor (including the first planning consultation), checks and exploration agent with task(..., mode: "background") explicitly. Omitting the mode can run the call synchronously and keep the leader from picking up pending steering until the subagent returns. Background mode keeps the leader available; it does not relax file ownership or dependency rules.

Record each returned agent ID with its work item and role. Continue only safe, independent leader work while it runs. If none remains, end the turn and wait for the completion notification; do not block on read_agent, poll, sleep, or fill the wait with unnecessary work. After notification, read the result once using the known ID and post the normal progress checkpoint.

Process operator steering before the next dispatch or follow-up. Relay relevant changes to a running same-task agent with write_agent when it supports messages; otherwise arrange a follow-up after it returns. Do not assume steering sent to the leader was also delivered to its workers.

Subagent prompts

Use one subagent per work item, except for coupled follow-ups and chains (above). Each prompt must be self-contained, because subagents do not share your context. Put these sections in order:

  1. Context and files to read.
  2. Decision text.
  3. Task with exact interfaces.
  4. Files owned and files not to touch, including any uncommitted files that already exist and that the agent must ignore.
  5. Acceptance criteria.
  6. Tests to add and the exact commands to run. Confirm the focused test commands before the first prompt (some suites need their own config). If the item changes packages/*/src, rebuild that package before running root tests; root tests can import the package's built output.
  7. The fixed block below, copied verbatim.
  • Keep the change as simple and easy to understand as possible. Use the smallest design that satisfies the item. Do not add abstractions, helpers, options, configuration, or generality that the item does not require.

  • Do only this work item. No optional improvements, refactors, renames, or extra hardening. If you notice something else, report it; do not change it.

  • Before editing, check that the specified design fits the current code; if it does not, return the blocker as a question before changing anything.

  • Do not make design or behaviour decisions. If your confidence in any choice is below 90%, stop and return the question with the options you see and your confidence. Do not guess.

  • Do not edit files outside the item, including documentation.

  • Do not change existing tests unless the item requires it.

  • Do not commit except when explicitly asked to commit in a separate worktree. Do not push or edit anything on GitHub or other external systems.

  • Unless the item explicitly requires a different step, run only focused tests (npx vitest run <paths>) and, if needed, npx tsc --noEmit -p .. Do not run build, lint, l10n, prettier, or package unless the item explicitly requires it.

  • Other agents may be working in the same tree. If a test or type error outside your item fails, report it; do not fix it.

  • Report only to the leader; never message other agents.

  • Fill every field in this report; write "none" instead of omitting a field. No narrative; under 250 words:

    Files changed: <list>   Outside the item: none | <file: why>
    Existing tests changed: none | <file: why>
    Behaviour differences (results, messages, order, timing): none | <list>
    Deviations from the prompt: none | <list>
    Invariant checks: <command> → <result>
    Tests: added <n> in <files>; <command> → <passed/failed>
    Type check: <command> → <result>
    Questions (<90%): none | <question, options, confidence>
    Noticed, not changed: none | <list>
    

Decisions and confidence

  • Decide alone only on coordination (order, scheduling, file ownership, prompt wording, commit grouping), on carrying out a decision that is already accepted, and on technical choices you hold at 90% or more that no advisor gate (below) covers.
  • Everything an advisor gate covers goes to the advisor, whatever your confidence. Follow its verdict at 80% or more; otherwise escalate or park.
  • Record each decision, who made it (you, the advisor, the operator), the confidence and a one-line reason in the item's done note.
  • Always ask the operator, whatever your confidence, when a choice:
    • changes user-visible behaviour or wording beyond what was specified;
    • changes behaviour that an accepted work item specifies;
    • would implement an accepted work item that conflicts with a recorded decision: park the item with the options you see; do not implement either reading, unless the operator approved that option, alone or as part of a set (see Input);
    • touches a security or trust boundary (authentication, allowlists, secrets, permissions);
    • changes persisted data, settings schemas, a public API, or an exported format (saved reports, JSON output, anything with a schema version);
    • deviates from a recorded decision in a feature's decisions.md;
    • weakens or removes a test that pins behaviour (and always for TDD: tests). Updating a test to wording or behaviour the operator approved is not weakening it. Neither is relaxing an incidental check (an exact call count) while the assertions that carry the test's intent stay; name the kept assertions in the done note;
    • requires pushing, rewriting history, or editing a PR, an issue or another external system.
  • Ask as one concise question with the options and your recommendation. When a confidence figure is close to a threshold, state what would change your mind. Do not round up.
  • If a decision depends on how an external API or library behaves, read its source, types or docs before deciding. A confidence figure built on an unchecked assumption does not count.
  • For a significant design choice, ask the operator whether to record it in the feature's decisions.md. Never invent the operator's rationale.

Advisor

Initial planning consultation. If the operator asks the advisor to analyze or revise the plan and prepare work items, do that before coding. Include the source plan, accepted decisions, constraints and the Models rules in the first packet. Ask for a numbered breakdown with each item's goal, scope, dependencies, interfaces where needed, acceptance criteria, tests, and a recommended coding model (full model ID) with a short reason. The advisor must assign a model to every item, not leave model selection as a later leader-only step.

Keep the response concise per item; the 250-word verdict limit below applies to ordinary decision packets, not the whole planning breakdown. Present and record the proposed items and model assignments with the plan. Preserve accepted decisions, operator-specified models, model permission gates and the Input approval rules; asking for plan analysis alone is not approval to implement new or changed scope.

Advisor gates. Consult the advisor, whatever your confidence, for:

  • the item breakdown and the exact interfaces, when they involve design choices or span modules, before the first prompt that uses them;
  • a worker's blocker or question that is technical (the design does not fit the code, a Questions field that is not "none");
  • competing technical approaches, or a failure you cannot explain after one attempt;
  • review of logic files with lifecycle, concurrency, authentication, persisted-data or cross-module impact;
  • rework that would change a solution the advisor or the operator already approved;
  • any other technical choice below 90% confidence.

Do not consult it on coordination or on carrying out an accepted decision.

Decision packet. Run the advisor as a read-only rubber-duck or code-review agent with model set to the advisor. Send a short packet; do not send your whole investigation:

  1. the item ID, the accepted decision text and its constraints;
  2. the precise question and the options you see;
  3. the evidence, as file:line references, and the diff or commit to review;
  4. what is already settled and must not be reopened.

The advisor reads the source itself; it must not depend only on your summary. It returns the verdict, confidence, file:line evidence, the remaining risk and what would change its mind, in under 250 words. Do not redo its investigation.

  • Follow-up questions on the same item go to the same advisor agent; independent items get a fresh one.
  • An approval covers the revision the advisor reviewed. A substantive change after it needs another review.
  • The advisor never answers always-ask questions; for those it drafts the options and a recommendation for the operator.
  • Note "advised (<model>)" in the done note.

When the advisor is your own model, still run logic reviews as a fresh-context advisor; you may answer the other gates yourself.

Leader context budget

Keep your own context small; everything you read is re-sent on every turn, and after a long wait (more than five minutes for some models) the whole context is written to the cache again at full price. Use git status, git diff --stat, grep and targeted ranges; never page whole files or full diffs when a smaller read answers the question. Classify changed files as mechanical or logic: read logic files in full (or send them to the advisor under its gates), spot-check mechanical ones, and rely on the report schema, type check and tests. Beyond logic review, read in depth only where a report field is not "none". Delegate builds, test runs and broad code reading to task or explore agents that return summaries.

On a long run, after a round is committed and its done notes recorded, offer the operator to continue in a fresh session. The source document holds the state.

Review before committing

Review every subagent's changes using the context budget above. Send back anything that goes beyond the item, is over-engineered, or is hard to follow, with specific instructions. Check that:

  • user-facing strings use vscode.l10n.t();
  • every l10n.t(...) string the diff adds, removes or changes was specified (git diff -U0 | grep -E '^[-+].*l10n\.t\('), and reads correctly where it is shown: a progress notification renders title: message, so a title ends without punctuation;
  • cluster lookups use clusterId, never treeId;
  • no secrets reach logs or telemetry.

When code replaces a platform or library primitive (event emitter, telemetry wrapper, timer, abort handling), check that its runtime behaviour matches, not only its types.

Commits and records

  • One commit per work item. Follow the existing subject style and include the item ID. When two items change the same lines, one commit may cover both: name every item in the subject and point each item's done note to it.

  • Never amend, rebase or force-push. Never use git add -f. Do not push unless the operator asks.

  • Done note. After each item's commit, record it inline in the source document under that item:

    Done (YYYY-MM-DD), commit <short-sha>: what changed and why, each decision (who made it, with confidence), and the tests added.

    A parked item gets a Deferred, escalated note with the options and your recommendation, so the operator can decide from the document. If the task has no source document, write the notes in a new iteration file under docs/ai-and-plans/features/<name>/iterations/. Commit notes as docs-only commits, never mixed into code commits. You may batch several notes into one docs commit.

  • Reverting after operator testing. If the operator rejects an item after testing, git revert its commit and restore any later item that shared its lines. Change its done note to Reverted (date), commit <sha>, operator decision: with the reason. Update every place in the source that shows the item's status: index tables, the per-item status line and summaries.

Progress checkpoints

The operator checks in from time to time and needs to see at a glance where the run is. Post a checkpoint in chat each time any agent returns: coding, advisor, task or explore, including agents that failed, were cancelled or came back blocked. Note the time /lead started; pass it as --since. Get the figures from the host's session log, never from estimates:

node .github/skills/lead/scripts/agent-stats.mjs --session <your session folder> \
  --agent <agent_id> --since <ISO time /lead started>

Your session folder is shown in your session context; if you do not know it, omit --session and the script finds the session by agent ID. Use the following format:

[HH:MM UTC] WI-4 · implementation returned · sol · attempt 1 Added cancellation handling and two regression tests. Plan: 3/10 done · 2 running · 1 parked · 4 queued (10 accepted items; WI-6 split into 6a/6b). Item: prompt ✓ → implementation ✓ → review next → advisor review → checks → commit. Agent: 2m07s elapsed · 27.3 AIU · model requests 13 (2m30s summed) · tool spans 12s (bash 6x/5s, view 23x/3s) · tests/builds 2 runs, 4s, 0 failed. Totals: leader 640 AIU · subagents 190 AIU · run 830 AIU. Next: review WI-4; WI-5 still running; WI-7 waits for your decision (see its note).

  • The plan line counts accepted items. When an item splits or a follow-up is added, say so; never change the count silently.
  • The item line shows the stages that item still needs, so "agent returned" does not read as "item done".
  • Copy figures from the script. Where it prints "not reported by host", say so; never write zero, and never derive cost from token counts or model names. Summed model and tool time can exceed elapsed time, because calls overlap.
  • Keep it to these lines. Do not poll agents to produce a checkpoint, and never ask the advisor to write one.

Checks

Use the two verification cases in copilot-instructions.md. You decide when to run what. Do not run checks after every commit.

  • Case 1 (build plus focused Vitest runs): run it after larger items or after a batch of items.
  • Case 2: run the full list once, at the end, when the work is being handed over for review, or when the PR is already out of draft.
  • Track vscode.l10n.t strings added or removed; if any, remind the operator that Case 2 needs npm run l10n.
  • If a check changes files (prettier, l10n), commit those changes separately (chore: …).
  • Report exactly which checks ran and their results. Never imply the full suite passed if it did not run.

Finish

Before the report, check that the user documentation and the feature README still describe the changed behaviour. Search them for statements about what the items changed, not only for quoted strings, and fix them in a docs-only commit.

End with a short report:

  • items that still need a workbench check, listed first, with the steps to try;
  • each work item, its commit SHA, and its model;
  • the decisions made, who made each, with confidence;
  • the questions you escalated and the questions you parked;
  • the advisor consultations: how many, for which items, and where you did not follow the advisor;
  • usage grouped by model and role, including tokens where reported (see below);
  • the checks you ran and their results;
  • open questions for the operator.

Usage and cost optimization

Always include the usage breakdown, without waiting for a separate request. Its purpose is cost optimization across runs, not exact billing reconciliation. Use full model IDs and keep leading and coding separate, even when both use the same model.

Record each agent's role alongside its ID when delegating: advisor, coding, review, checks, or exploration. This is the work actually assigned, not the model's capability. Include failed, cancelled and retried attempts. Pass explicit roles to the helper, especially for advisors launched through a review agent:

node .github/skills/lead/scripts/agent-stats.mjs --session <your session folder> \
  --since <ISO time /lead started> --summary \
  --role <advisor_id>=advisor --role <coding_id>=coding

Repeat --role for the other agents. The helper separates leader usage automatically and uses known agent types for defaults; unknown types stay unclassified. --summary covers the whole window, even if --agent was supplied. Ordinary checkpoints remain short; reserve these tables for the final report.

  • Outcome and work items: status, commit and actual model per item; note substitutions from the recommended model, retries and review-driven rework. List unverified work first.
  • Usage: copy the model/role table (requests, summed model-request time, AIU and share), followed by role totals so leading, coding, advising and checks can be compared directly. Keep the leader/subagent/run total too. Never omit advisor or leader overhead.
  • Tokens: include the helper's input, output, cache-read, cache-write and reasoning counts by model and role where available. Cache and reasoning fields may overlap input/output; do not sum them into a purported total. Missing data is "not reported by host", not zero; retain partial-coverage labels. Never infer AIU from tokens, model prices or multipliers.
  • Scope and timing: give the start and snapshot times. For follow-ups, show this task's usage separately from cumulative usage, labelled with each window. Report wall-clock elapsed, summed model-request time, and check/CI time separately where available; overlapping spans are not additive. State whether the final response is excluded. AIU are not dollars.
  • Optimization note: briefly identify the largest measured cost category and significant retry/review overhead, with a possible change for a future run. Do not rank model quality from unlike work or silently change the approved model plan.

Use sensible rounding; small snapshot differences are not a blocker. Do not spend extra consultations or rerun work to reconcile pennies. Keep the chat report compact and record detailed evidence in the existing work-item document, not a new parallel reporting ledger.

04 同仓库更多 Skills

microsoft
microsoft/vscode-documentdb

writing-release-notes

Generates release notes and changelog entries for the DocumentDB extension for Visual Studio Code, and announces releases on GitHub Discussions. Use when preparing version releases, creating patch update notes, writing changelog entries, documenting new features and fixes, or posting a release or patch release announcement to Discussions. Handles both major/minor versions (new file) and patch updates (append to existing file).

内容创作者写作与文案
★ 33
microsoft
microsoft/vscode-documentdb

webview-trpc-messaging

Implements tRPC-based communication between VS Code extension host and React webviews. Use when creating new webview procedures (queries, mutations, subscriptions), adding a new webview router, wiring up a webview controller, using the tRPC client from React components, applying telemetry middleware (telemetryMiddlewareBody), or supporting AbortSignal-based cancellation in webview operations.

★ 33
microsoft
microsoft/vscode-documentdb

ux-pr-review

Prepare and run an agent-assisted UX / workflow review of a pull request. Use when the operator says "I'm about to work on a UX PR review, please prepare", "prepare a UX review for PR

设计师Skill与智能体开发
★ 33
microsoft
microsoft/vscode-documentdb

tree-cluster-architecture

Patterns for cluster nodes and tree data providers in vscode-documentdb. Use when adding or changing a cluster tree item, discovery provider, Connections/Azure/Discovery tree hierarchy, tree/list mode, cluster identity, treeId/clusterId lookup, Collection View import/export resolution, reveal behavior, credentials, shell actions, or copy connection string support.

★ 33
microsoft
microsoft/vscode-documentdb

telemetry-instrumentation

Instrumentation patterns for telemetry in the vscode-documentdb extension. Use when adding telemetry to a feature, enriching existing telemetry with properties or measurements, linking related events with correlation IDs, instrumenting commands or tree views, suppressing noisy events, or deciding what data points to capture. Also use when asked to "add telemetry" or "improve telemetry" for any feature.

★ 33
microsoft
microsoft/vscode-documentdb

skill-creator

Guide for creating effective GitHub Copilot skills (.github/skills/) in this repository. Use when creating a new skill, updating an existing skill, or when asked about skill structure, format, or best practices for the vscode-documentdb project.

Skill与智能体开发
★ 33