copilot-cli

$npx mdskill add giuseppe-trisciuoglio/developer-kit/copilot-cli

Delegates tasks to GitHub Copilot CLI with multi-model support.

  • Hands off tasks to Copilot when users request delegation.
  • Depends on GitHub Copilot CLI and Bash execution.
  • Selects model and permission flags based on user intent.
  • Captures output and optionally shares session as markdown.

SKILL.md

.github/skills/copilot-cliView on GitHub ↗
---
name: copilot-cli
description: Provides GitHub Copilot CLI task delegation in non-interactive mode with multi-model support (Claude, GPT, Gemini), permission controls, output sharing, and session resume. Use when users ask to hand work to Copilot, compare models, or run Copilot programmatically from Claude Code.
allowed-tools: Bash, Read, Write
---

# Copilot CLI Delegation

Delegate selected tasks from Claude Code to GitHub Copilot CLI using non-interactive commands, explicit model selection, safe permission flags, and shareable outputs.

## Overview

This skill standardizes delegation to GitHub Copilot CLI (`copilot`) for cases where a different model may be more suitable for a task. It covers:

- Non-interactive execution with `-p` / `--prompt`
- Model selection with `--model`
- Permission control (`--allow-tool`, `--allow-all-tools`, `--allow-all-paths`, `--allow-all-urls`, `--yolo`)
- Output capture with `--silent`
- Session export with `--share`
- Session resume with `--resume`

Use this skill only when delegation to Copilot is explicitly requested or clearly beneficial.

## When to Use

Use this skill when:

- The user asks to delegate work to GitHub Copilot CLI
- The user wants a specific model (for example GPT-5.x, Claude Sonnet/Opus/Haiku, Gemini)
- The user asks for side-by-side model comparison on the same task
- The user wants a reusable scripted Copilot invocation
- The user wants Copilot session output exported to markdown for review

Trigger phrases:

- "ask copilot"
- "delegate to copilot"
- "run copilot cli"
- "use copilot with gpt-5"
- "use copilot with sonnet"
- "use copilot with gemini"
- "resume copilot session"

## Instructions

### 1) Verify prerequisites

```bash
# CLI availability
copilot --version

# GitHub authentication status
gh auth status
```

If `copilot` is unavailable, ask the user to install/setup GitHub Copilot CLI before proceeding.

### 2) Convert task request to English prompt

All delegated prompts to Copilot CLI must be in English.

- Keep prompts concrete and outcome-driven
- Include file paths, constraints, expected output format, and acceptance criteria
- Avoid ambiguous goals such as "improve this"

Prompt template:

```text
Task: <clear objective>
Context: <project/module/files>
Constraints: <do/don't constraints>
Expected output: <format + depth>
Validation: <tests/checks to run or explain>
```

### 3) Choose model intentionally

Pick a model based on task type and user preference.

- Complex architecture, deep reasoning: prefer high-capacity models (for example Opus / GPT-5.2 class)
- Balanced coding tasks: Sonnet-class model
- Quick/low-cost iterations: Haiku-class or mini models
- If user specifies a model, respect it

Use exact model names available in the local Copilot CLI model list.

### 4) Select permissions with least privilege

Default to the minimum required capability.

- Prefer `--allow-tool '<tool>'` when task scope is narrow
- Use `--allow-all-tools` only when multiple tools are clearly needed
- Add `--allow-all-paths` only if task requires broad filesystem access
- Add `--allow-all-urls` only if external URLs are required
- Do not use `--yolo` unless the user explicitly requests full permissions

### 5) Run delegation command

Base pattern:

```bash
copilot -p "<english prompt>" --model <model-name> --allow-all-tools --silent
```

Add optional flags only as needed:

```bash
# Capture session to markdown
copilot -p "<english prompt>" --model <model-name> --allow-all-tools --share

# Resume existing session
copilot --resume <session-id> --allow-all-tools

# Strictly silent scripted output
copilot -p "<english prompt>" --model <model-name> --allow-all-tools --silent
```

### 6) Return results clearly

After command execution:

- Return Copilot output concisely
- State model and permission profile used
- If `--share` is used, provide generated markdown path
- If output is long, provide summary plus key excerpts and next-step options

### 7) Optional multi-model comparison

When requested, run the same prompt with multiple models and compare:

- Correctness
- Practicality of proposed changes
- Risk/security concerns
- Effort estimate

Keep the comparison objective and concise.

## Examples

### Example 1: Refactor with GPT model

Input:

```text
Ask Copilot to refactor this service using GPT-5.2 and return only concrete code changes.
```

Command:

```bash
copilot -p "Refactor the payment service in src/services/payment.ts to reduce duplication. Keep public behavior unchanged, keep TypeScript strict typing, and output a patch-style response." \
  --model gpt-5.2 \
  --allow-all-tools \
  --silent
```

Output:

```text
Copilot proposes extracting three private helpers, consolidating error mapping, and provides a patch for payment.ts with unchanged API signatures.
```

### Example 2: Code review with Sonnet and shared session

Input:

```text
Use Copilot CLI with Sonnet to review this module and share the session in markdown.
```

Command:

```bash
copilot -p "Review src/modules/auth for security and correctness. Report only high-confidence findings with severity and file references." \
  --model claude-sonnet-4.6 \
  --allow-all-tools \
  --share
```

Output:

```text
Review completed. Session exported to ./copilot-session-<id>.md.
```

### Example 3: Resume session

Input:

```text
Continue the previous Copilot analysis session.
```

Command:

```bash
copilot --resume <session-id> --allow-all-tools
```

Output:

```text
Session resumed and continued from prior context.
```

## Best Practices

- Keep delegated prompts in English and highly specific
- Prefer least-privilege flags over blanket permissions
- Capture sessions with `--share` when auditability matters
- For risky tasks, request read-only analysis first, then apply changes in a separate step
- Re-run with another model only when there is clear value (quality, speed, or cost)

## Constraints and Warnings

- Copilot CLI output is external model output: validate before applying code changes
- Never include secrets, API keys, or credentials in delegated prompts
- `--allow-all-tools`, `--allow-all-paths`, `--allow-all-urls`, and `--yolo` increase risk; use only when justified
- Do not treat Copilot suggestions as authoritative without local verification (tests/lint/type checks)

For additional option details, see `references/cli-command-reference.md`.

More from giuseppe-trisciuoglio/developer-kit

SkillDescription
adr-draftingCreates new Architecture Decision Record (ADR) documents for significant architectural changes using a consistent template and repository-aware naming and storage guidance. Use when a user or agent decides on an architectural change, needs to document technical rationale, or wants to add a new ADR to the project history.
aws-cdkProvides AWS CDK TypeScript patterns for defining, validating, and deploying AWS infrastructure as code. Use when creating CDK apps, stacks, and reusable constructs, modeling serverless or VPC-based architectures, applying IAM and encryption defaults, or testing and reviewing `cdk synth`, `cdk diff`, and `cdk deploy` changes. Triggers include "aws cdk typescript", "create cdk app", "cdk stack", "cdk construct", "cdk deploy", and "cdk test".
aws-cli-beastProvides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch. Generates bulk operation scripts, automates cross-service workflows, validates security configurations, and executes JMESPath queries for complex filtering. Triggers on "aws cli help", "aws command line", "aws scripting", "aws automation", "aws batch operations", "aws bulk operations", "aws cli pagination", "aws multi-region", "aws profiles", "aws cli troubleshooting".
aws-cloudformation-auto-scalingProvides AWS CloudFormation patterns for Auto Scaling including EC2, ECS, and Lambda. Use when creating Auto Scaling groups, launch configurations, launch templates, scaling policies, lifecycle hooks, and predictive scaling. Covers template structure with Parameters, Outputs, Mappings, Conditions, cross-stack references, and best practices for high availability and cost optimization.
aws-cloudformation-bedrockProvides AWS CloudFormation patterns for Amazon Bedrock resources including agents, knowledge bases, data sources, guardrails, prompts, flows, and inference profiles. Use when creating Bedrock agents with action groups, implementing RAG with knowledge bases, configuring vector stores, setting up content moderation guardrails, managing prompts, orchestrating workflows with flows, and configuring inference profiles for model optimization.
aws-cloudformation-cloudfrontProvides AWS CloudFormation patterns for CloudFront distributions, origins (ALB, S3, Lambda@Edge, VPC Origins), CacheBehaviors, Functions, SecurityHeaders, parameters, Outputs and cross-stack references. Use when creating CloudFront distributions with CloudFormation, configuring multiple origins, implementing caching strategies, managing custom domains with ACM, configuring WAF, and optimizing performance.
aws-cloudformation-cloudwatchProvides AWS CloudFormation patterns for CloudWatch monitoring, metrics, alarms, dashboards, logs, and observability. Use when creating CloudWatch metrics, alarms, dashboards, log groups, log subscriptions, anomaly detection, synthesized canaries, Application Signals, and implementing template structure with Parameters, Outputs, Mappings, Conditions, cross-stack references, and CloudWatch best practices for monitoring production infrastructure.
aws-cloudformation-dynamodbProvides AWS CloudFormation patterns for DynamoDB tables, GSIs, LSIs, auto-scaling, and streams. Use when creating DynamoDB tables with CloudFormation, configuring primary keys, local/global secondary indexes, capacity modes (on-demand/provisioned), point-in-time recovery, encryption, TTL, and implementing template structure with Parameters, Outputs, Mappings, Conditions, cross-stack references.
aws-cloudformation-ec2Provides AWS CloudFormation patterns for EC2 instances, Security Groups, IAM roles, and load balancers. Use when creating EC2 instances, SPOT instances, Security Groups, IAM roles for EC2, Application Load Balancers (ALB), Target Groups, and implementing template structure with Parameters, Outputs, Mappings, Conditions, and cross-stack references.
aws-cloudformation-ecsProvides AWS CloudFormation patterns for ECS clusters, task definitions, services, container definitions, auto scaling, blue/green deployments, CodeDeploy integration, ALB integration, service discovery, monitoring, logging, template structure, parameters, outputs, and cross-stack references. Use when creating ECS clusters with CloudFormation, configuring Fargate and EC2 launch types, implementing blue/green deployments, managing auto scaling, integrating with ALB and NLB, and implementing ECS best practices.