翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
例
このセクションでは、一般的な開発ワークフローとユースケースのカスタムエージェント設定の実例を示します。
AWS スペシャリストカスタムエージェント
このカスタムエージェントは、AWS インフラストラクチャの管理および開発タスク用に最適化されています。関連するドキュメントを含めながら、AWS ツールへの事前承認されたアクセスを提供します。
例 AWS スペシャリストカスタムエージェント設定
{ "description": "Specialized custom agent for AWS infrastructure and development tasks", "tools": [ "fs_read", "fs_write", "execute_bash", "use_aws" ], "allowedTools": [ "fs_read", "use_aws" ], "toolsSettings": { "use_aws": { "allowedServices": [ "s3", "lambda", "cloudformation", "ec2", "iam", "logs" ] }, "fs_write": { "allowedPaths": [ "infrastructure/**", "scripts/**", "*.yaml", "*.yml", "*.json" ] } }, "resources": [ "file://README.md", "file://infrastructure/**/*.yaml", "file://infrastructure/**/*.yml", "file://docs/aws-setup.md", "file://scripts/deploy.sh" ], "hooks": { "agentSpawn": [ { "command": "aws sts get-caller-identity", "timeout_ms": 10000, "cache_ttl_seconds": 300 } ] } }
このカスタムエージェントのユースケース:
-
CloudFormation スタックのデプロイ
-
S3 バケットと Lambda 関数の管理
-
AWS サービスの問題のトラブルシューティング
-
Infrastructure as Code の確認と更新
開発ワークフローのカスタムエージェント
このカスタムエージェントは、コードレビュー、テスト、Git オペレーションなどの一般的なソフトウェア開発タスク用に設計されています。
例 開発ワークフローのカスタムエージェント設定
{ "description": "General development workflow custom agent with Git integration", "mcpServers": { "git": { "command": "git-mcp-server", "args": [], "timeout": 30000 } }, "tools": [ "fs_read", "fs_write", "execute_bash", "@git" ], "allowedTools": [ "fs_read", "@git/git_status", "@git/git_log", "@git/git_diff" ], "toolAliases": { "@git/git_status": "status", "@git/git_log": "log", "@git/git_diff": "diff" }, "toolsSettings": { "fs_write": { "allowedPaths": [ "src/**", "tests/**", "docs/**", "*.md", "*.json", "package.json", "requirements.txt" ] } }, "resources": [ "file://README.md", "file://CONTRIBUTING.md", "file://docs/**/*.md", "file://package.json", "file://requirements.txt" ], "hooks": { "agentSpawn": [ { "command": "git status --porcelain", "timeout_ms": 5000 }, { "command": "git branch --show-current", "timeout_ms": 3000 } ] } }
このカスタムエージェントのユースケース:
-
コードのレビューと分析
-
テストの記述と更新
-
Git ワークフロー管理
-
ドキュメントの更新
-
依存関係管理
コードレビューカスタムエージェント
このカスタムエージェントは、コード品質、セキュリティ、ベストプラクティスを分析するために最適化されたツールとコンテキストを使用して、コードレビュータスクに特に焦点を当てています。
例 コードレビューのカスタムエージェント設定
{ "description": "Specialized custom agent for code review and quality analysis", "tools": [ "fs_read", "execute_bash" ], "allowedTools": [ "fs_read", "execute_bash" ], "toolsSettings": { "execute_bash": { "allowedCommands": [ "grep", "find", "wc", "head", "tail", "cat", "diff", "git diff", "git log", "eslint", "pylint", "rubocop" ] } }, "resources": [ "file://CONTRIBUTING.md", "file://docs/coding-standards.md", "file://docs/security-guidelines.md", "file://.eslintrc.json", "file://.pylintrc", "file://pyproject.toml" ], "hooks": { "agentSpawn": [ { "command": "git diff --name-only HEAD~1", "timeout_ms": 5000, "max_output_size": 2048 } ], "userPromptSubmit": [ { "command": "find . -name '*.py' -o -name '*.js' -o -name '*.ts' | wc -l", "timeout_ms": 3000, "cache_ttl_seconds": 60 } ] } }
このカスタムエージェントのユースケース:
-
コード品質のプルリクエストの確認
-
セキュリティの脆弱性を特定する
-
コーディング標準への準拠の確認
-
コードの複雑さと保守性の分析
-
改善の提案とリファクタリングの機会
プロジェクト固有のカスタムエージェント
この例では、プロジェクト固有のツール、ドキュメント、ビルドプロセスなど、特定のプロジェクトに合わせたカスタムエージェントを作成する方法を示します。
例 プロジェクト固有のカスタムエージェント設定
{ "description": "Custom agent for the mobile app backend project", "mcpServers": { "docker": { "command": "docker-mcp-server", "args": ["--socket", "/var/run/docker.sock"] }, "database": { "command": "postgres-mcp-server", "args": ["--connection", "postgresql://localhost:5432/myapp"], "env": { "PGPASSWORD": "$DATABASE_PASSWORD" } } }, "tools": [ "fs_read", "fs_write", "execute_bash", "@docker", "@database" ], "allowedTools": [ "fs_read", "@docker/docker_ps", "@docker/docker_logs", "@database/query_read_only" ], "toolAliases": { "@docker/docker_ps": "containers", "@docker/docker_logs": "logs", "@database/query_read_only": "query" }, "toolsSettings": { "fs_write": { "allowedPaths": [ "src/**", "tests/**", "migrations/**", "docker-compose.yml", "Dockerfile", "requirements.txt" ] }, "execute_bash": { "allowedCommands": [ "npm test", "npm run build", "python manage.py test", "docker-compose up", "docker-compose down" ] } }, "resources": [ "file://README.md", "file://docs/api-documentation.md", "file://docs/database-schema.md", "file://docker-compose.yml", "file://requirements.txt", "file://src/config/settings.py" ], "hooks": { "agentSpawn": [ { "command": "docker-compose ps", "timeout_ms": 10000, "cache_ttl_seconds": 30 }, { "command": "git status --porcelain", "timeout_ms": 5000 } ] } }
このカスタムエージェントのユースケース:
-
Docker コンテナとサービスの管理
-
データベースクエリと移行の実行
-
アプリケーションの構築とテスト
-
本番稼働に関する問題のデバッグ
-
API ドキュメントの更新
効果的なカスタムエージェントを作成するためのヒント
-
シンプルな開始 - 基本的なツール設定から開始し、必要に応じて複雑さを追加します
-
わかりやすい名前を使用する - 目的を明確に示すカスタムエージェント名を選択する
-
関連するコンテキストを含める - プロジェクトドキュメントと設定ファイルをリソースに追加する
-
安全なツールの事前承認 - allowedTools に頻繁に使用される低リスクのツールを含める
-
動的コンテキストにフックを使用する - コマンドフックを使用して現在のシステム状態を含める
-
ツールの範囲を制限する - toolsSettings を使用して、関連するパスとサービスへのツールアクセスを制限する
-
徹底的にテストする - カスタムエージェント設定が期待どおりに動作することを確認する
-
カスタムエージェントを文書化する - チームメンバーがカスタムエージェントの目的を理解できるように、明確な説明を使用します。