skills/cli-agents/copilot-invoke-once/SKILL.md
Programmatically invoke GitHub Copilot CLI via the `copilot` command (headless `-p`, `--silent`, `--stream on|off`, `--resume`/`--continue`) to automate tasks like producing code review notes for specific files/dirs, investigating an issue, or drafting an implementation plan. Use when you need scriptable, non-interactive Copilot runs with optional streaming progress and session continuation.
npx skillsauth add igamenovoer/magic-context copilot-invoke-onceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
One-shot (script-friendly final response with a high-reasoning preset):
skill_dir=".codex/skills/copilot-invoke-once"
tmp_cfg="$(python3 "$skill_dir/scripts/compose_config.py" --preset "$skill_dir/presets/reasoning-high.json")"
trap 'rm -rf "$tmp_cfg"' EXIT
copilot --config-dir "$tmp_cfg" -p "Summarize this repo" --yolo --no-ask-user --silent --stream on
reasoning_effort), so always generate a temporary config directory per invocation and run Copilot with --config-dir <temp-dir>.scripts/compose_config.py (this skill) to compose:
~/.copilot/config.json (or --base-config-dir)presets/*.json--overlay-file and/or --overlay-jsonconfig.json entries from the base config dir into the temp dir (for example mcp-config.json, session state) so behavior/auth remains consistent.rm -rf "$tmp_cfg").Preset overlays live in presets/:
presets/reasoning-high.jsonpresets/reasoning-medium.jsonpresets/reasoning-low.jsonDefault behavior: use presets/reasoning-high.json unless the user explicitly requests a different reasoning level or a custom overlay.
If the user provides a Copilot wrapper command (drop-in replacement for copilot that sets preset env vars), use it by substituting it for copilot in all examples and invocations.
PATH (executable or .sh script)./abs/path/to/copilot-wrapper).copilot flags used here (-p, --silent, --stream, --continue, --resume, --model, and permission flags).bash -lc '<alias> ...') so it resolves correctly.--yolo (equivalent to --allow-all-tools --allow-all-paths --allow-all-urls) and --no-ask-user.--allow-all-tools (and env var COPILOT_ALLOW_ALL=true) only covers tool approvals. It does not automatically allow all paths or URLs, so --yolo/--allow-all is the simplest true "most power" mode.--allow-tool, --allow-url, --add-dir) and remove --yolo.Streaming progress (heartbeat on stdout):
copilot --config-dir "$tmp_cfg" -p "Explain recursion with examples" --yolo --no-ask-user --silent --stream on
Continue a multi-turn session:
copilot --config-dir "$tmp_cfg" -p "Start a review of src/" --yolo --no-ask-user --silent --stream on
copilot --config-dir "$tmp_cfg" -p "Continue the same review and focus on tests/" --continue --yolo --no-ask-user --silent --stream on
Resume by explicit session ID:
copilot --config-dir "$tmp_cfg" -p "Continue that review" --resume "<session-id>" --yolo --no-ask-user --silent --stream on
--stream on so stdout emits a steady progress heartbeat while Copilot is still working.--model <model> (preferred for deterministic automation).COPILOT_MODEL=<model> (overridden by --model).copilot and use /model to select a model (may persist in ~/.copilot/config.json).copilot --model <model> choice.copilot --help and reading the --model choices, or by using interactive /model).--silent --stream on and capture stdout, but only display minimal heartbeat info while it runs.--stream on and consume stdout continuously.--continue (latest session) or --resume <session-id> (deterministic target), still with --stream on for heartbeats.session_id, always use --resume <session_id> for the next Copilot call.--continue.session_id and does not request continuation, determine from context whether to continue or start fresh. If unclear, start a new session.--allow-tool, --allow-url, --add-dir) and remove --yolo/--allow-all.stdout as the machine channel and stderr as diagnostics./research command (it gathers information from GitHub and the web and produces a report with citations).tavily-mcp and/or exa) in ~/.copilot/mcp-config.json.tavily-mcp is present in ~/.copilot/mcp-config.json.-p mode, do not claim citations unless Copilot actually provided them.src/ and tests/ and summarize issues."Ensure the command can authenticate in your environment (for example: copilot login or a configured token).
references/howto-control-github-copilot-cli-programmatically.mdscripts/compose_config.pypresets/data-ai
Create readable Mermaid diagrams inside Markdown files. Use for flowcharts and sequence diagrams that must render cleanly in common Markdown renderers (e.g., GitHub) without horizontal scrolling. Covers fenced mermaid blocks, init/theme styling, label wrapping with <br/>, and sequenceDiagram layout rules (short IDs, wrapped labels, don’t break identifiers).
development
Manual invocation only; use only when the user explicitly requests `make-program-tutorial` by exact name, OR when the user asks to use a skill to create an SDK/API/library tutorial. Create a clear, reproducible, step-by-step tutorial for a specific API/SDK/library (or a set of functions/classes), with runnable examples, expected outputs, and basic troubleshooting.
testing
Use when the user wants to create a self-hosted, offline-installable Conda channel (mirror) containing a specific subset of packages using Pixi.
tools
Guides the agent to setup a new or existing Pixi environment for compiling C++ and CUDA code. It ensures the correct compilers, toolkits, and CMake configurations are in place for a robust user-space build.