TechSummary 2025-07-31
· 閱讀時間約 25 分鐘
Onboarding your AI peer programmer: Setting up GitHub Copilot coding agent for success 🚀
- GitHub Copilot 提供兩種代理功能:
coding agent
(自主,生成 PR) 與agent mode
(互動式,即時執行多步驟任務)。 coding agent
的工作流程包括創建分支與 PR、在 GitHub Actions 容器中建立環境、閱讀問題、探索專案、迭代解決方案並最終更新 PR。- 可透過自訂 GitHub Actions workflow 檔案(例如
.github/workflows/copilot-setup-steps.yml
)來配置 Copilot 的執行環境,確保其能存取所需的工具和服務。name: "Copilot Setup Steps"
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
cache: "pip"
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Install SQLite
run: sudo apt update && sudo apt install sqlite3 - 撰寫清晰明確的 Issue 與提示對 Copilot 成功生成高品質 PR 至關重要,應包含問題陳述、重現步驟、相關歷史、建議方法等。
- 透過優化專案結構(README、代碼註釋、良好命名)和自訂指令文件(
copilot-instructions.md
或<file-name>.instructions.md
)來提供 Copilot 上下文資訊和組織規範。# Classic arcade
This project hosts a classic arcade, themed after the 1980s 8-bit games.
## Standard player flow
1. Player opens app and sees list of games.
2. Player selects game to play.
3. Player sees a splash screen with the message "Insert quarter".
4. Player presses space to start game and plays game
6. After game ends, the "Game over" message is displayed.
7. The player score is checked against high scores. If the score is in top 10, user is prompted for their initials (3 initials).
8. High scores are displayed, and an option to return to the main menu to start over again.
## Frameworks
- Python `arcade` library is used for the arcade itself
- SQLite is used to store all scores
## Coding guidelines
- All games must inherit from `BaseGame`
- Python code should follow PEP8 practices, including docstrings and type hints
## Project structure
- `data`: Stores data abstraction layer and SQLite database
- `games`: Stores collection of games and `BaseGame`
- `app`: Stores core app components including menuing system - 可利用 Model Context Protocol (MCP) 擴展 Copilot 的上下文和工具,例如透過 Azure MCP server 支持 Bicep 程式碼生成。
{
"mcpServers": {
"AzureBicep": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@azure/mcp@latest",
"server",
"start",
"--namespace",
"bicepschema",
"--read-only"
]
}
}
} - Copilot
coding agent
內建防火牆,可限制對核心服務的存取,以管理數據外洩風險;遠端 MCP server 或網路資源存取需更新允許列表。