Open3
Amazon Q Developerでカスタム処理を実行させる方法

カスタムスラッシュコマンドはないので、カスタムエージェントを利用する

定義を作成する方法
マニュアルに従い、以下のコマンドで作成すると、プロジェクトレベルではなく、グローバルレベルに設定ファイルが作成される。
コマンド
$ /agent create --name my-agent
$ /agent list
* q_cli_default
video-update
~/.aws/amazonq/cli-agents/video-update.json
{
"$schema": "https://raw.githubusercontent.com/aws/amazon-q-developer-cli/refs/heads/main/schemas/agent-v1.json",
"name": "video-update",
"description": "イベントファイルのyoutubeを更新する",
"prompt": null,
"mcpServers": {},
"tools": [
"*"
],
"toolAliases": {},
"allowedTools": [
"fs_read"
],
"resources": [
"file://AmazonQ.md",
"file://README.md",
"file://.amazonq/rules/**/*.md"
],
"hooks": {},
"toolsSettings": {},
"useLegacyMcpJson": true
}
カスタムエージェントファイルの場所
- グローバルカスタムエージェント
- ~/.aws/amazonq/cli-agents/{agent-name}.json
- プロジェクトレベルのカスタムエージェント
- .amazonq/cli-agents/{agent-name}.json
作成のステップ
- まずはchat内で指示を出しながら目的の処理を実行させる
- うまくいったら「 .amazonq/cli-agents/に今の処理を実行するカスターエージェントを作成してください。作成方法はマニュアルを参照してください」

処理を実行する方法
マニュアルには /agent use [name]
とあるが実際は使えない。
> /agent help
Agents allow you to organize and manage different sets of context files for different projects or tasks.
Notes
• Launch q chat with a specific agent with --agent
• Construct an agent under ~/.aws/amazonq/cli-agents/ (accessible globally) or cwd/.aws/amazonq/cli-agents (accessible in workspace)
• See example config under global directory
• Set default agent to assume with settings by running "q settings chat.defaultAgent agent_name"
• Each agent maintains its own set of context and customizations
Manage agents
Usage: /agent <COMMAND>
Commands:
list List all available agents
create Create a new agent with the specified name
generate Generate an agent configuration using AI
schema Show agent config schema
set-default Define a default agent to use when q chat launches
swap Swap to a new agent at runtime
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
チャットを起動するときに指定する必要がある
## agentの確認
qchat agent
## 指定したAgentで起動
q chat --agent <エージェント名>