コマンド
繰り返しのタスク用にカスタムコマンドを作成します。
カスタムコマンドを使用すると、セッション中にそのコマンドを実行したときに実行するプロンプトを指定できます。
/my-command
カスタムコマンドは、/init、/undo、/redo、/help などの組み込みコマンドに加えて使用できます。詳細はこちら。
コマンドファイルの作成
commands/ ディレクトリにマークダウンファイルを作成して、カスタムコマンドを定義します。
.dropstone/commands/test.md を作成します:
---
description: Run tests with coverage
agent: build
model: dropstone/dropstone-pro
---
Run the full test suite with coverage report and show any failures.
Focus on the failing tests and suggest fixes.
フロントマターがコマンドのプロパティを定義します。コンテンツがテンプレートになります。
コマンド名の前に / を入力してコマンドを使用します。
/test
設定
Dropstone の設定または commands/ ディレクトリにマークダウンファイルを作成することで、カスタムコマンドを追加できます。
JSON
Dropstone の config で command オプションを使用します:
{
"$schema": "https://dropstone.io/schema/config.json",
"command": {
// This becomes the name of the command
"test": {
// This is the prompt that will be sent to the LLM
"template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes.",
// Shown as the description in the slash command palette
"description": "Run tests with coverage",
"agent": "build",
"model": "dropstone/dropstone-pro"
}
}
}
これで、任意のセッションからこのコマンドを実行できます:
/test
マークダウン
マークダウンファイルを使用してコマンドを定義することもできます。以下の場所に配置します:
- グローバル:
~/.config/dropstone/commands/ - プロジェクトごと:
.dropstone/commands/
---
description: Run tests with coverage
agent: build
model: dropstone/dropstone-pro
---
Run the full test suite with coverage report and show any failures.
Focus on the failing tests and suggest fixes.
マークダウンファイル名がコマンド名になります。たとえば、test.md を使用すると、次のコマンドを実行できます:
/test
プロンプト設定
カスタムコマンドのプロンプトは、いくつかの特別なプレースホルダーと構文をサポートしています。
引数
$ARGUMENTS プレースホルダーを使用して、コマンドに引数を渡します。
---
description: Create a new component
---
Create a new React component named $ARGUMENTS with TypeScript support.
Include proper typing and basic structure.
引数を指定してコマンドを実行します:
/component Button
すると、$ARGUMENTS が Button に置き換えられます。
位置パラメータを使用して個々の引数にアクセスすることもできます:
$1- 最初の引数$2- 2番目の引数$3- 3番目の引数- 以降も同様...
たとえば:
---
description: Create a new file with content
---
Create a file named $1 in the directory $2
with the following content: $3
コマンドを実行します:
/create-file config.json src "{ \"key\": \"value\" }"
これにより、以下が置き換えられます:
$1がconfig.jsonに$2がsrcに$3が{ "key": "value" }に
シェル出力
!command を使用して、シェルコマンドの出力をプロンプトに挿入します。
たとえば、テストカバレッジを分析するカスタムコマンドを作成する場合:
---
description: Analyze test coverage
---
Here are the current test results:
!`npm test`
Based on these results, suggest improvements to increase coverage.
または、最近の変更をレビューする場合:
---
description: Review recent changes
---
Recent git commits:
!`git log --oneline -10`
Review these changes and suggest any improvements.
コマンドはプロジェクトのルートディレクトリで実行され、その出力がプロンプトの一部になります。
ファイル参照
@ の後にファイル名を続けて、コマンドにファイルを含めます。
---
description: Review component
---
Review the component in @src/components/Button.tsx.
Check for performance issues and suggest improvements.
ファイルの内容は自動的にプロンプトに含まれます。
オプション
設定オプションについて詳しく見ていきましょう。
テンプレート
template オプションは、コマンドが実行されたときに LLM に送信されるプロンプトを定義します。
{
"command": {
"test": {
"template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes."
}
}
}
これは必須の設定オプションです。
説明
description オプションを使用して、コマンドが何を行うかの簡単な説明を提供します。
{
"command": {
"test": {
"description": "Run tests with coverage"
}
}
}
これはスラッシュコマンドパレットでコマンドの横に表示されます。
エージェント
agent 設定を使用して、このコマンドを実行する エージェント をオプションで指定します。
これが サブエージェント の場合、コマンドはデフォルトでサブエージェント呼び出しをトリガーします。
この動作を無効にするには、subtask を false に設定します。
{
"command": {
"review": {
"agent": "plan"
}
}
}
これはオプションの設定オプションです。指定しない場合、現在のエージェントがデフォルトになります。
サブタスク
subtask ブール値を使用して、コマンドが サブエージェント 呼び出しをトリガーするように強制します。
これは、コマンドがプライマリコンテキストを汚染しないようにしたい場合に便利で、エージェント 設定で mode が primary に設定されている場合でも、エージェントがサブエージェントとして動作することを強制します。
{
"command": {
"analyze": {
"subtask": true
}
}
}
これはオプションの設定オプションです。
モデル
model 設定を使用して、このコマンドのデフォルトモデルを上書きします。
{
"command": {
"analyze": {
"model": "dropstone/dropstone-pro"
}
}
}
これはオプションの設定オプションです。
組み込み
Dropstone には、/init、/undo、/redo、/help などのいくつかの組み込みコマンドが含まれています。詳細はこちら。
組み込みの /review コマンドは、多段階のレビュー(ファインダーアングル、独立検証、その後の上限付きの検出結果リスト)を実行します。その深さは review.effort で制御できます。
Note
カスタムコマンドは組み込みコマンドを上書きできます。組み込みコマンドと同じ名前のカスタムコマンドを定義すると、カスタムコマンドが優先されます。