Dynamic context injection in Skills (`!command` placeholder)
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
### Feature request for product/service
GitHub Copilot CLI
### Describe the request
Add **dynamic context injection** to Agent Skills (`SKILL.md`) in GitHub Copilot CLI.
I’m proposing the !`<command>` command placeholder inside the skill body. When the skill is invoked, Copilot CLI would run the shell command locally **before** sending the skill content to the model, then replace the placeholder with the command’s stdout.
That would let skills combine live data + instructions in a single turn, instead of asking the agent to make a separate shell call at runtime.
### Example
```md
---
name: summarize-changes
description: Summarize uncommitted changes and flag risks
---
## Current changes
!`git diff HEAD`
## Instructions
Summarize the changes above in 2–3 bullets and list risks.
If the diff is empty, say there are no uncommitted changes.
```
### Why this matters
Today, skills that depend on live state usually have to tell the agent to run shell commands itself during the interaction. That is slower, uses extra tokens, and is less reliable — the agent may skip the command, choose the wrong one, or reason from stale file context instead of actual output.
With injection, repeatable workflows like PR review, commit summaries, and pre-merge checks become self-bootstrapping: the skill gathers facts first, then the model reasons over them.
### Use cases
- Branch / PR review: `!`git diff master...HEAD``, `!`gh pr diff``
- Commit helper: `!`git diff --staged``
- Pre-ship checks: test output, lint output, or other command results
### Suggested safeguards
- Respect existing shell-execution policies / hooks
- Make command injection opt-in per skill and/or configurable globally
- Cap or truncate large stdout
- Surface command failures clearly when the injected command fails
### Prior art
Claude Code already ships this pattern as part of the Agent Skills standard extension: https://code.claude.com/docs/en/skills#inject-dynamic-context
貢獻指南
研究方向
首先追蹤 GitHub Copilot CLI 中 Agent Skills (SKILL.md) 的呼叫,以及現有的 shell 執行政策或 hook。查看連結的 Claude Code 動態內容文件,了解提議的預留位置行為,並確定安全防護、輸出限制和命令失敗應如何運作。完成的標準是:skill 能夠在其內容傳送給模型之前,從本機 stdout 展開 !`command`,並具備所述的政策保護。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- shell
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100