つばろぐ

主に C#, .NET, Azure の備忘録です。たまに日記。

エージェントを使った開発のためのテンプレートリポジトリを作った

流れが変わるとすぐ陳腐化しそうですが、エージェントを使った開発のための GitHub テンプレートリポジトリを作りました。

github.com

構成要素

テンプレートはこのような構成になっています。他に必要なファイルはリポジトリ作成後に追加してください。

swe-template/
|-- .devcontainer/
|   |-- devcontainer.json
|   `-- postCreateCommand.sh         # コンテナ作成後のセットアップコマンドを定義
|-- .github/
|   |-- agents/                      # カスタムエージェント定義
|   |   |-- impl.agent.md            # TDD ベースで実装を進めるエージェント定義
|   |   |-- issue.agent.md           # 要件整理と Issue 作成・更新を行うエージェント定義
|   |   |-- orchestrator.agent.md    # サブエージェントに指示を行うエージェント定義
|   |   |-- plan.agent.md            # リポジトリ調査と実装計画策定を行うエージェント定義
|   |   |-- pr.agent.md              # 実装済み変更から PR を作成するエージェント定義
|   |   `-- review.agent.md          # 実装内容を批判的にレビューするエージェント定義
|   |-- copilot-instructions.md
|   `-- dependabot.yml
|-- docs/
|-- .editorconfig
|-- .gitattributes
|-- .gitignore
|-- AGENTS.md                        # エージェント構成と参照先をまとめたガイド
|-- LICENSE
`-- README.md

Dev Container の構成

devcontainer.json には、GitHub Copilot CLI を使うことを前提とした開発環境の構成を定義しています。

  • プログラミング言語
    • .NET 10
    • Node.js
    • Python 3
  • ツール
    • GitHub CLI
    • GitHub Copilot CLI
    • Azure CLI
    • PowerShell 7

参考リンク

AZ-500に合格しました

AZ-500 (Microsoft Azure Security Technology) に合格し、Azure Security Engineer Associate の認定を取得しました。

learn.microsoft.com

学習ガイドに沿って、ひたすら練習問題をこなしました。

learn.microsoft.com

合格したはいいものの、先日この認定の廃止が発表されてしまいました。
2026年8月31日をもって廃止され、後継は SC-500 (Cloud and AI Security Engineer Associate) になるようです。

techcommunity.microsoft.com

結構勉強に時間を割きましたが、得点はギリギリでした。
Microsoft Sentinel や Privileged Identity Management (PIM) など、普段馴染みの少ないセキュリティ関連のサービスの問題が多かった印象です。

GitHub Copilot CLIのオプション一覧 (ver 1.0.24)

GitHub Copilot CLI のオプションが多すぎてわかりづらいので、整理してみました。索引のようなものとしてお使いください。
CLI のバージョンが上がれば記事も更新します。

確認したバージョン

copilot --version
GitHub Copilot CLI 1.0.24.
Run 'copilot update' to check for updates.

CLI のヘルプ

copilot --help
Usage: copilot [options] [command]

GitHub Copilot CLI - An AI-powered coding assistant.

Start an interactive session to chat with Copilot, or use -p/--prompt for
non-interactive scripting. Copilot can edit files, run shell commands, search
your codebase, and more — all with configurable permissions.

Run `copilot <command> --help` for details on any subcommand.

Options:
  --effort, --reasoning-effort <level>  Set the reasoning effort level (choices:
                                        "low", "medium", "high", "xhigh")
  --acp                                 Start as Agent Client Protocol server
  --add-dir <directory>                 Add a directory to the allowed list for
                                        file access (can be used multiple times)
  --add-github-mcp-tool <tool>          Add a tool to enable for the GitHub MCP
                                        server instead of the default CLI subset
                                        (can be used multiple times). Use "*"
                                        for all tools.
  --add-github-mcp-toolset <toolset>    Add a toolset to enable for the GitHub
                                        MCP server instead of the default CLI
                                        subset (can be used multiple times). Use
                                        "all" for all toolsets.
  --additional-mcp-config <json>        Additional MCP servers configuration as
                                        JSON string or file path (prefix with @)
                                        (can be used multiple times; augments
                                        config from ~/.copilot/mcp-config.json
                                        for this session)
  --agent <agent>                       Specify a custom agent to use
  --allow-all                           Enable all permissions (equivalent to
                                        --allow-all-tools --allow-all-paths
                                        --allow-all-urls)
  --allow-all-paths                     Disable file path verification and allow
                                        access to any path
  --allow-all-tools                     Allow all tools to run automatically
                                        without confirmation; required for
                                        non-interactive mode (env:
                                        COPILOT_ALLOW_ALL)
  --allow-all-urls                      Allow access to all URLs without
                                        confirmation
  --allow-tool[=tools...]               Tools the CLI has permission to use;
                                        will not prompt for permission
  --allow-url[=urls...]                 Allow access to specific URLs or domains
  --autopilot                           Start in autopilot mode
  --available-tools[=tools...]          Only these tools will be available to
                                        the model
  --banner                              Show the startup banner
  --bash-env[=value]                    Enable BASH_ENV support for bash shells
                                        (on|off)
  --config-dir <directory>              Set the configuration directory
                                        (default: ~/.copilot)
  --continue                            Resume the most recent session
  --deny-tool[=tools...]                Tools the CLI does not have permission
                                        to use; will not prompt for permission
  --deny-url[=urls...]                  Deny access to specific URLs or domains,
                                        takes precedence over --allow-url
  --disable-builtin-mcps                Disable all built-in MCP servers
                                        (currently: github-mcp-server)
  --disable-mcp-server <server-name>    Disable a specific MCP server (can be
                                        used multiple times)
  --disallow-temp-dir                   Prevent automatic access to the system
                                        temporary directory
  --enable-all-github-mcp-tools         Enable all GitHub MCP server tools
                                        instead of the default CLI subset.
                                        Overrides --add-github-mcp-toolset and
                                        --add-github-mcp-tool options.
  --enable-reasoning-summaries          Request reasoning summaries for OpenAI
                                        models
  --excluded-tools[=tools...]           These tools will not be available to the
                                        model
  --experimental                        Enable experimental features
  -h, --help                            display help for command
  -i, --interactive <prompt>            Start interactive mode and automatically
                                        execute this prompt
  --log-dir <directory>                 Set log file directory (default:
                                        ~/.copilot/logs/)
  --log-level <level>                   Set the log level (choices: "none",
                                        "error", "warning", "info", "debug",
                                        "all", "default")
  --max-autopilot-continues <count>     Maximum number of continuation messages
                                        in autopilot mode (default: unlimited)
  --mode <mode>                         Set the initial agent mode (choices:
                                        "interactive", "plan", "autopilot")
  --model <model>                       Set the AI model to use
  --mouse[=value]                       Enable mouse support in alt screen mode
                                        (on|off)
  --no-ask-user                         Disable the ask_user tool (agent works
                                        autonomously without asking questions)
  --no-auto-update                      Disable downloading CLI update
                                        automatically (disabled by default in CI
                                        environments)
  --no-bash-env                         Disable BASH_ENV support for bash shells
  --no-color                            Disable all color output
  --no-custom-instructions              Disable loading of custom instructions
                                        from AGENTS.md and related files
  --no-experimental                     Disable experimental features
  --no-mouse                            Disable mouse support in alt screen mode
  --output-format <format>              Output format: 'text' (default) or
                                        'json' (JSONL, one JSON object per line)
                                        (choices: "text", "json")
  -p, --prompt <text>                   Execute a prompt in non-interactive mode
                                        (exits after completion)
  --plain-diff                          Disable rich diff rendering (syntax
                                        highlighting via diff tool specified by
                                        git config)
  --plan                                Start in plan mode
  --plugin-dir <directory>              Load a plugin from a local directory
                                        (can be used multiple times)
  --resume[=sessionId]                  Resume from a previous session
                                        (optionally specify session ID or task
                                        ID)
  -s, --silent                          Output only the agent response (no
                                        stats), useful for scripting with -p
  --screen-reader                       Enable screen reader optimizations
  --secret-env-vars[=vars...]           Environment variable names whose values
                                        are stripped from shell and MCP server
                                        environments and redacted from output
                                        (e.g.,
                                        --secret-env-vars=MY_KEY,OTHER_KEY)
  --share[=path]                        Share session to markdown file after
                                        completion in non-interactive mode
                                        (default: ./copilot-session-<id>.md)
  --share-gist                          Share session to a secret GitHub gist
                                        after completion in non-interactive mode
  --stream <mode>                       Enable or disable streaming mode
                                        (choices: "on", "off")
  -v, --version                         show version information
  --yolo                                Enable all permissions (equivalent to
                                        --allow-all-tools --allow-all-paths
                                        --allow-all-urls)

Commands:
  help [topic]                          Display help information
  init                                  Initialize Copilot instructions
  login [options]                       Authenticate with Copilot
  mcp                                   Manage MCP servers
  plugin                                Manage plugins
  update                                Download the latest version
  version                               Display version information

Help Topics:
  commands     Interactive Mode Commands
  config       Configuration Settings
  environment  Environment Variables
  logging      Logging
  monitoring   Monitoring with OpenTelemetry
  permissions  Permissions
  providers    Custom Model Providers (BYOK)

Examples:
  # Start interactive mode
  $ copilot

  # Start interactive mode and automatically execute a prompt
  $ copilot -i "Fix the bug in main.js"

  # Execute a prompt in non-interactive mode (exits after completion)
  $ copilot -p "Fix the bug in main.js" --allow-all-tools

  # Enable all permissions with a single flag
  $ copilot -p "Fix the bug in main.js" --allow-all
  $ copilot -p "Fix the bug in main.js" --yolo

  # Start with a specific model
  $ copilot --model gpt-5.2

  # Resume the most recent session
  $ copilot --continue

  # Resume a previous session using session picker
  $ copilot --resume

  # Resume a specific session by ID
  $ copilot --resume=<session-id>

  # Start a new session with a specific UUID
  $ copilot --resume=0cb916db-26aa-40f2-86b5-1ba81b225fd2

  # Resume with auto-approval
  $ copilot --allow-all-tools --resume

  # Allow access to additional directory
  $ copilot --add-dir /home/user/projects

  # Allow multiple directories
  $ copilot --add-dir ~/workspace --add-dir /tmp

  # Disable path verification (allow access to any path)
  $ copilot --allow-all-paths

  # Allow all git commands except git push
  $ copilot --allow-tool='shell(git:*)' --deny-tool='shell(git push)'

  # Allow all file editing
  $ copilot --allow-tool='write'

  # Allow all but one specific tool from MCP server with name "MyMCP"
  $ copilot --deny-tool='MyMCP(denied_tool)' --allow-tool='MyMCP'

  # Allow GitHub API access (defaults to HTTPS)
  $ copilot --allow-url=github.com

  # Deny access to specific domain over HTTPS
  $ copilot --deny-url=https://malicious-site.com
  $ copilot --deny-url=malicious-site.com

  # Allow all URLs without confirmation
  $ copilot --allow-all-urls

  # Initialize Copilot instructions for a repository
  $ copilot init

Learn More:
  Use `copilot <command> --help` for more information about a command.
  Read the documentation at https://docs.github.com/copilot/how-tos/copilot-cli

オプションの日本語訳

オプション 説明(日本語)
--effort, --reasoning-effort 推論の労力レベルを設定(選択肢: "low", "medium", "high", "xhigh")
--acp Agent Client Protocol サーバーとして起動
--add-dir ファイルアクセスの許可リストにディレクトリを追加(複数指定可)
--add-github-mcp-tool デフォルトのCLIサブセットの代わりに、GitHub MCP サーバーで有効にするツールを追加(複数指定可)。"*" は全ツールを意味する
--add-github-mcp-toolset GitHub MCP サーバーで有効にするツールセットを追加(複数指定可)。"all" は全ツールセットを意味する
--additional-mcp-config 追加のMCPサーバー設定をJSON文字列またはファイルパス(@で始める)で指定(複数指定可)。このセッションでは ~/.copilot/mcp-config.json の設定を補完
--agent 使用するカスタムエージェントを指定
--allow-all すべての権限を有効化(--allow-all-tools --allow-all-paths --allow-all-urls と同等)
--allow-all-paths ファイルパス検証を無効にし、任意のパスへのアクセスを許可
--allow-all-tools 確認なしで全ツールの自動実行を許可;非対話モードで必須(環境変数: COPILOT_ALLOW_ALL)
--allow-all-urls 確認なしで全てのURLへのアクセスを許可
--allow-tool[=tools...] CLIが使用を許可するツール(複数指定可)。許可プロンプトは表示されない
--allow-url[=urls...] 特定のURLまたはドメインへのアクセスを許可(複数指定可)
--autopilot オートパイロットモードで開始
--available-tools[=tools...] モデルが利用可能なツールをこれらに限定
--banner 起動バナーを表示
--bash-env[=value] bashシェルでの BASH_ENV サポートを有効化(on|off)
--config-dir 設定ディレクトリを指定(デフォルト: ~/.copilot)
--continue 直近のセッションを再開
--deny-tool[=tools...] CLIが使用を許可しないツール(複数指定可)。許可プロンプトは表示されない
--deny-url[=urls...] 特定のURL/ドメインへのアクセスを拒否。--allow-url より優先される
--disable-builtin-mcps 組み込みのMCPサーバーを全て無効化(現在: github-mcp-server)
--disable-mcp-server <server-name> 特定のMCPサーバーを無効化(複数指定可)
--disallow-temp-dir システム一時ディレクトリへの自動アクセスを禁止
--enable-all-github-mcp-tools デフォルトのCLIサブセットの代わりに全てのGitHub MCPツールを有効化。--add-github-mcp-toolset / --add-github-mcp-tool を上書き
--enable-reasoning-summaries OpenAIモデル向けに推論要約を要求
--excluded-tools[=tools...] モデルが利用できないツールを指定
--experimental 実験的機能を有効化
-h, --help コマンドのヘルプを表示
-i, --interactive 対話モードを開始し、このプロンプトを自動実行
--log-dir ログファイルの保存ディレクトリを設定(デフォルト: ~/.copilot/logs/)
--log-level ログレベルを設定(選択肢: "none", "error", "warning", "info", "debug", "all", "default")
--max-autopilot-continues オートパイロットでの継続メッセージ最大数(デフォルト: 無制限)
--mode 初期エージェントモードを設定(選択肢: "interactive", "plan", "autopilot")
--model 使用するAIモデルを指定
--mouse[=value] alt画面モードでマウスサポートを有効化(on|off)
--no-ask-user ask_user ツールを無効化(エージェントが質問せず自律動作)
--no-auto-update CLIの自動アップデートダウンロードを無効化(CI環境ではデフォルトで無効)
--no-bash-env bashシェルの BASH_ENV サポートを無効化
--no-color カラー出力を無効化
--no-custom-instructions AGENTS.md 等からのカスタム指示の読み込みを無効化
--no-experimental 実験的機能を無効化
--no-mouse alt画面モードでのマウスサポートを無効化
--output-format 出力形式を指定: 'text'(デフォルト)または 'json'(JSONL、1行1つのJSONオブジェクト)(選択肢: "text", "json")
-p, --prompt 非対話モードでプロンプトを実行(完了後に終了)
--plain-diff リッチな差分表示(構文ハイライト等)を無効化
--plan プランモードで開始
--plugin-dir ローカルディレクトリからプラグインを読み込む(複数指定可)
--resume[=sessionId] 以前のセッションから再開(オプションでセッションID/タスクID指定可)
-s, --silent エージェント応答のみ出力(統計等は表示しない)。-p と併用してスクリプト実行に便利
--screen-reader スクリーンリーダー向け最適化を有効化
--secret-env-vars[=vars...] シェルやMCPサーバー環境から値を除去し、出力でマスクする環境変数名(例: --secret-env-vars=MY_KEY,OTHER_KEY)
--share[=path] 非対話モード完了後、セッションをMarkdownファイルに保存(デフォルト: ./copilot-session-.md)
--share-gist 非対話モード完了後、セッションを非公開GitHub Gistに共有
--stream ストリーミングモードの有効/無効(選択肢: "on", "off")
-v, --version バージョン情報を表示
--yolo すべての権限を有効化(--allow-all-tools --allow-all-paths --allow-all-urls と同等)

公式ドキュメント

docs.github.com

プロンプト

この表も Copilot CLI に作ってもらいました。このときのプロンプトはこちら。 PowerShell で実行しています。

$copilotOptions = copilot --help
copilot --model gpt-5-mini --prompt "次の文字列はGitHub Copilot CLIのヘルプです。オプションの説明文を日本語に訳し、表形式で出力してください: $($copilotOptions)" | clip