AgentSkillsCN

copilot

将任务需求转化为 GitHub Copilot CLI 命令。由 copilot-driver 代理调用,通过 Copilot 执行编码任务。

SKILL.md
--- frontmatter
name: copilot
description: Translates task requirements into GitHub Copilot CLI commands. Used by copilot-driver agent to execute coding tasks via Copilot.

GitHub Copilot CLI Skill Guide

Baseline Rules

Always apply these for programmatic (non-interactive) execution:

  • -p "<prompt>" — required for single-command execution
  • --allow-all-paths — required when creating or editing files

Command Templates

New Task (read-only)

bash
copilot -p "<prompt>"

New Task (with file edits)

bash
copilot -p "<prompt>" --allow-all-paths

New Task (with URL access)

bash
copilot -p "<prompt>" --allow-all-paths --allow-all-urls

Resume Session

bash
copilot --continue

Note: Session inherits its original model and permissions. Use -p "<prompt>" with --continue if providing a new prompt.

Permission Modes

Task TypeFlagsNotes
Analysis, review, Q&A(none)Read-only by default
Create or edit files--allow-all-pathsStandard for most coding tasks
Access specific URL--allow-url <domain>e.g., --allow-url github.com
Access any URL--allow-all-urlsConfirm with user first

Model Selection

When the calling agent specifies requirements, translate to flags:

RequirementFlagNotes
Default / balanced--model claude-sonnet-4.5Standard coding tasks (1x cost)
Fast / cheap--model claude-haiku-4.5Quick, straightforward tasks (0.33x cost)
Complex / high-quality--model claude-opus-4.5Multi-step problems, nuanced reasoning (3x cost)
OpenAI--model gpt-5.2-codexOpenAI's code model (1x cost)
Google--model gemini-3-proGoogle's model (1x cost)

If not specified, use default: claude-sonnet-4.5.

File References

Reference files in prompts using @ syntax:

bash
copilot -p "Explain @src/config/settings.ts"

Interpreting Results

Success indicators

  • Copilot reports files created/modified
  • Output describes completed actions matching the request
  • No error messages or stack traces

Failure indicators

  • Non-zero exit code
  • Error messages in output
  • "I cannot" or "I'm unable to" language
  • Partial completion ("I've started but...")

Scope creep indicators

  • Mentions of "I also..." or "While I was at it..."
  • Changes to files not mentioned in the original request
  • Added features, tests, or documentation not requested

Redirection indicators

  • Output describes different work than requested
  • "Instead of X, I did Y..."
  • Solving a different problem than specified

After Completion

Report to user: "You can resume this Copilot session by saying 'copilot continue'."

Error Handling

  • If command exits non-zero: stop and report the error
  • If output contains warnings: summarize and ask how to proceed
  • Before --allow-all-urls: confirm with user unless pre-authorized

Reference

Built-in Sub-Agents

Copilot automatically delegates to internal sub-agents (not configurable via flags):

Sub-agentUsed for
exploreFast codebase exploration and Q&A
taskExecuting commands (tests, builds, installs)
general-purposeComplex multi-step tasks
code-reviewReviewing code changes

Interactive Mode Commands

For interactive sessions (not programmatic), these slash commands are available:

CommandFunction
/modelSelect AI model
/agentSelect custom agent
/delegate [prompt]Hand off to GitHub Copilot coding agent
/contextView token usage
/compactCompress conversation history