copilot-spaces

作者: github

透過策劃的文件、程式碼和團隊指示,為對話提供專案特定背景。使用 MCP 唯讀工具列出並載入 Copilot Spaces;透過 GitHub REST API 搭配 gh api 建立、更新和刪除空間。Spaces 包含附加的儲存庫、檔案、文件及自訂指示,將 Copilot 回應奠基於實際專案知識。使用空間來回答架構與標準問題、遵循團隊慣例生成程式碼,或執行多步驟...

npx skills add https://github.com/github/awesome-copilot --skill copilot-spaces

Copilot Spaces

Use Copilot Spaces to bring curated, project-specific context into conversations. A Space is a shared collection of repositories, files, documentation, and instructions that grounds Copilot responses in your team's actual code and knowledge.

Available Tools

MCP Tools (Read-only)

ToolPurpose
mcp__github__list_copilot_spacesList all spaces accessible to the current user
mcp__github__get_copilot_spaceLoad a space's full context by owner and name

REST API via gh api (Full CRUD)

The Spaces REST API supports creating, updating, deleting spaces, and managing collaborators. The MCP server only exposes read operations, so use gh api for writes.

User Spaces:

MethodEndpointPurpose
POST/users/{username}/copilot-spacesCreate a space
GET/users/{username}/copilot-spacesList spaces
GET/users/{username}/copilot-spaces/{number}Get a space
PUT/users/{username}/copilot-spaces/{number}Update a space
DELETE/users/{username}/copilot-spaces/{number}Delete a space

Organization Spaces: Same pattern under /orgs/{org}/copilot-spaces/...

Collaborators: Add, list, update, and remove collaborators at .../collaborators

Scope requirements: PAT needs read:user for reads, user for writes. Add with gh auth refresh -h github.com -s user.

Note: This API is functional but not yet in the public REST API docs. It may require the copilot_spaces_api feature flag.

When to Use Spaces

  • User mentions "Copilot space" or asks to "load a space"
  • User wants answers grounded in specific project docs, code, or standards
  • User asks "what spaces are available?" or "find a space for X"
  • User needs onboarding context, architecture docs, or team-specific guidance
  • User wants to follow a structured workflow defined in a Space (templates, checklists, multi-step processes)

Workflow

1. Discover Spaces

When a user asks what spaces are available or you need to find the right space:

Call mcp__github__list_copilot_spaces

This returns all spaces the user can access, each with a name and owner_login. Present relevant matches to the user.

To filter for a specific user's spaces, match owner_login against the username (e.g., "show me my spaces").

2. Load a Space

When a user names a specific space or you've identified the right one:

Call mcp__github__get_copilot_space with:
  owner: "org-or-user"    (the owner_login from the list)
  name: "Space Name"      (exact space name, case-sensitive)

This returns the space's full content: attached documentation, code context, custom instructions, and any other curated materials. Use this context to inform your responses.

3. Follow the Breadcrumbs

Space content often references external resources: GitHub issues, dashboards, repos, discussions, or other tools. Proactively fetch these using other MCP tools to gather complete context. For example:

  • A space references an initiative tracking issue. Use issue_read to get the latest comments.
  • A space links to a project board. Use project tools to check current status.
  • A space mentions a repo's masterplan. Use get_file_contents to read it.

4. Answer or Execute

Once loaded, use the space content based on what it contains:

If the space contains reference material (docs, code, standards):

  • Answer questions about the project's architecture, patterns, or standards
  • Generate code that follows the team's conventions
  • Debug issues using project-specific knowledge

If the space contains workflow instructions (templates, step-by-step processes):

  • Follow the workflow as defined, step by step
  • Gather data from the sources the workflow specifies
  • Produce output in the format the workflow defines
  • Show progress after each step so the user can steer

5. Manage Spaces (via gh api)

When a user wants to create, update, or delete a space, use gh api. First, find the space number from the list endpoint.

Update a space's instructions:

gh api users/{username}/copilot-spaces/{number} \
  -X PUT \
  -f general_instructions="New instructions here"

Update name, description, or instructions together:

gh api users/{username}/copilot-spaces/{number} \
  -X PUT \
  -f name="Updated Name" \
  -f description="Updated description" \
  -f general_instructions="Updated instructions"

Create a new space:

gh api users/{username}/copilot-spaces \
  -X POST \
  -f name="My New Space" \
  -f general_instructions="Help me with..." \
  -f visibility="private"

Attach resources (replaces entire resource list):

{
  "resources_attributes": [
    { "resource_type": "free_text", "metadata": { "name": "Notes", "text": "Content here" } },
    { "resource_type": "github_issue", "metadata": { "repository_id": 12345, "number": 42 } },
    { "resource_type": "github_file", "metadata": { "repository_id": 12345, "file_path": "docs/guide.md" } }
  ]
}

Delete a space:

gh api users/{username}/copilot-spaces/{number} -X DELETE

Updatable fields: name, description, general_instructions, icon_type, icon_color, visibility ("private"/"public"), base_role ("no_access"/"reader"), resources_attributes

Examples

Example 1: User Asks for a Space

User: "Load the Accessibility copilot space"

Action:

  1. Call mcp__github__get_copilot_space with owner "github", name "Accessibility"
  2. Use the returned context to answer questions about accessibility standards, MAS grades, compliance processes, etc.

Example 2: User Wants to Find Spaces

User: "What copilot spaces are available for our team?"

Action:

  1. Call mcp__github__list_copilot_spaces
  2. Filter/present spaces relevant to the user's org or interests
  3. Offer to load any space they're interested in

Example 3: Context-Grounded Question

User: "Using the security space, what's our policy on secret scanning?"

Action:

  1. Call mcp__github__get_copilot_space with the appropriate owner and name
  2. Find the relevant policy in the space content
  3. Answer based on the actual internal documentation

Example 4: Space as a Workflow Engine

User: "Write my weekly update using the PM Weekly Updates space"

Action:

  1. Call mcp__github__get_copilot_space to load the space. It contains a template format and step-by-step instructions.
  2. Follow the space's workflow: pull data from attached initiative issues, gather metrics, draft each section.
  3. Fetch external resources referenced by the space (tracking issues, dashboards) using other MCP tools.
  4. Show the draft after each section so the user can review and fill in gaps.
  5. Produce the final output in the format the space defines.

Example 5: Update Space Instructions Programmatically

User: "Update my PM Weekly Updates space to include a new writing guideline"

Action:

  1. Call mcp__github__list_copilot_spaces and find the space number (e.g., 19).
  2. Call mcp__github__get_copilot_space to read current instructions.
  3. Modify the instructions text as requested.
  4. Push the update:
gh api users/labudis/copilot-spaces/19 -X PUT -f general_instructions="updated instructions..."

Tips

  • Space names are case-sensitive. Use the exact name from list_copilot_spaces.
  • Spaces can be owned by users or organizations. Always provide both owner and name.
  • Space content can be large (20KB+). If returned as a temp file, use grep or view_range to find relevant sections rather than reading everything at once.
  • If a space isn't found, suggest listing available spaces to find the right name.
  • Spaces auto-update as underlying repos change, so the context is always current.
  • Some spaces contain custom instructions that should guide your behavior (coding standards, preferred patterns, workflows). Treat these as directives, not suggestions.
  • Write operations (gh api for create/update/delete) require the user PAT scope. If you get a 404 on write operations, run gh auth refresh -h github.com -s user.
  • Resource updates replace the entire array. To add a resource, include all existing resources plus the new one. To remove one, include { "id": 123, "_destroy": true } in the array.

來自 github 的更多技能

console-rendering
github
在 Go 中使用基於結構體標籤的控制台渲染系統的說明
official
acquire-codebase-knowledge
github
當使用者明確要求對現有程式碼庫進行映射、文件化或入門引導時,使用此技能。觸發詞如「映射此程式碼庫」、「文件化…」等提示。
official
acreadiness-assess
github
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc…
official
acreadiness-generate-instructions
github
透過 AgentRC 指令命令生成量身打造的 AI 代理指令檔案。產生 .github/copilot-instructions.md(預設,建議用於 VS Code 中的 Copilot…
official
acreadiness-policy
github
幫助使用者選取、撰寫或套用 AgentRC 政策。政策可透過停用不相關的檢查、覆寫影響/等級、設定…來自訂整備度評分。
official
add-educational-comments
github
為程式碼檔案添加教育性註解,將其轉化為有效的學習資源。根據三個可設定的知識層級(初學者、中級、進階)調整解釋深度與語氣。若未提供檔案,會自動請求提供,並以編號清單對應以便快速選取。僅透過教育性註解將檔案擴充最多125%(嚴格上限:400行新註解;超過1,000行的檔案上限為300行)。保留檔案編碼、縮排風格、語法正確性及……
official
adobe-illustrator-scripting
github
使用 ExtendScript (JavaScript/JSX) 編寫、除錯及最佳化 Adobe Illustrator 自動化腳本。適用於建立或修改操控…的腳本時。
official
agent-governance
github
宣告式政策、意圖分類與稽核軌跡,用於控制AI代理工具存取與行為。可組合的治理政策定義允許/封鎖的工具、內容過濾器、速率限制與核准要求——以配置而非程式碼形式儲存。語意意圖分類在工具執行前,透過基於模式的訊號偵測危險提示(資料外洩、權限提升、提示注入)。工具層級治理裝飾器在函式層級強制執行政策……
official