Closed3

GitHub Copilot Agent Modeをまともに使えるようにする設定

r4air4ai
  1. "chat.tools.autoApprove": true

    GitHub Copilotによるコマンド実行を自動許可する。セキュリティは弱くなるが、Copilotの出力に張り付いて都度許可するのは現実的ではない。許可しないと人間がボトルネックになり効率が大幅低下する。

  2. "chat.agent.maxRequests": 100

    ユーザーからの命令に対して、最大100リクエストまで自動で行うようにする。デフォルトだと25位だった気がする。これだと毎回上限に達してしまい、ユーザーに処理を続けるかの確認を要求してくる。許可しないと人間がボトルネックになり効率が大幅低下する。

cf. https://github.com/microsoft/vscode-copilot-release/issues/7145

r4air4ai
  1. copilot-instructions.mdをちゃんと整備する

    内容は簡潔かつ必要十分に。体感だと、大体100行を超えたあたりで書いてある内容を忘れ始める。

    禁止したい内容は、具体例を入れると効果的な気がする:

    - **Functions**: Use arrow functions with implicit returns when possible
       -`const handleClick = () => "clicked"`
       -`function handleClick() { return "clicked"; }`
     - **Types**: Prefer `type` over `interface`
       -`type User = { name: string; age: number; }`
       -`interface User { name: string; age: number; }`
     - **File naming**: Use kebab-case for all filenames
       -`my-component.tsx`, `my-context.tsx`
       -`MyComponent.tsx`, `my_context.tsx`
     - **Null coalescing**: Use `??` instead of `||` for null/undefined checks
       -`const port = process.env.PORT ?? "3000"`
       -`const port = process.env.PORT || "3000"`
     - **Imports**: Use `@/` path aliases instead of relative imports
       -`import { component } from "@/components/ui/button"`
       -`import { component } from "../../components/ui/button"`
    

    また、Claude Codeを使っている人は、CLAUDE.mdのシンボリックリンクを.github/copilot-instructions.mdに張っておくと便利。

このスクラップは3ヶ月前にクローズされました