Claude Code
弊社ではGitHub CopilotとClaudeを併用しています。Copilotはタブキーの補完に、Claudeは主に開発に使用しています。
CLAUDE.mdの管理
/initコマンドでCLAUDE.mdの初期生成ができます。CLAUDE.mdはリポジトリの構成やコマンドが変わるたびに古くなるため、定期的に/initを実行して最新の状態に更新します。
依存関係の追加やディレクトリ構成の変更など、リポジトリに大きな変更を加えた後は更新のタイミングです。古いCLAUDE.mdのままだとClaudeCodeが誤った前提で動作する原因になります。
製品の既知の問題もCLAUDE.mdに記載します。例えば特定のページが外部APIに依存していてローカルでデバッグできない場合、その事情を書いておくことでClaudeが不要な修正に取り組むのを防げます。コードから読み取れない制約や事情はCLAUDE.mdに残しておきます。
サブエージェントで起動
--agentオプションでサブエージェントを指定して起動できます。セッション全体がそのサブエージェントのシステムプロンプト・ツール制限・モデルで動作します。
claude --agent feature-dev:code-explorer
スキルの追加
skillsコマンドで外部のスキルを追加できます。以下のようなスキルを追加しています。
settings.json
https://docs.anthropic.com/ja/docs/claude-code/settings
機能が増えて設定が変わる事が多いので、GitHubのActionsで.claude/settings.template.jsonを各リポジトリに同期し、コピペし易くしています。以下は弊社の推奨設定です。
env
AgentTeamsとセッション間でのタスクの共有を有効にしています。
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1",
"CLAUDE_CODE_TASK_LIST_ID": "ここにリポジトリ名",
"CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD": "1"
}
}
enablePlugins
基本的に以下のプラグインを有効にしています。
{
"enabledPlugins": {
"claude-md-management@claude-plugins-official": true,
"context7@claude-plugins-official": true,
"document-skills@anthropic-agent-skills": true,
"feature-dev@claude-plugins-official": true,
"frontend-design@claude-plugins-official": true,
"pr-review-toolkit@claude-plugins-official": true,
"security-guidance@claude-plugins-official": true,
"typescript-lsp@claude-plugins-official": true,
"commit-commands@claude-plugins-official": true,
"superpowers@claude-plugins-official": true
}
}
enableAllProjectMcpServers
リポジトリの.mcp.jsonで定義したMCPサーバを有効にします。
{
"enableAllProjectMcpServers": true
}
hooks
ファイルの書き込み後に型チェックとテストを自動実行します。
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path | select(endswith(\".ts\") or endswith(\".tsx\"))' | xargs -r bun run check"
},
{
"type": "command",
"command": "jq -r '.tool_input.file_path | select(endswith(\".ts\") or endswith(\".tsx\"))' | xargs -r bun run test"
}
]
}
]
}
}
deny
危険な操作や使用しないパッケージマネージャを禁止しています。
{
"permissions": {
"deny": [
"Bash(sudo:*)",
"Bash(git reset:*)"
]
}
}
基本的にbunを使用している場合は、それ以外のnpmやyarnの誤動作を防ぐために禁止します。
{
"permissions": {
"deny": [
"Bash(npm:*)",
"Bash(yarn:*)"
]
}
}