エージェントタグ
/// ドキュメントコメント内のタグは、コードだけでは表せない情報を追加します。すべて省略可能です。
<!---
Adds a task and saves the list.
@llm Append a task and save; returns the new list.
@prefer @add_task($tasks, title: 'x') over $tasks->push(), which doesn't save.
@avoid Calling it in a loop: it saves each time. Build the list, then call @save_tasks once.
@pitfall title is trimmed, and an empty title throws Validation.
@example @add_task($tasks, title: 'Buy milk')
-->
<fn name="add_task" params="tasks: list, title: string">
<!-- … -->
</fn>
<!---
Only for the tests.
@agent hide
-->
<fn name="reset_store">
<!-- … -->
</fn>/// Adds a task and saves the list.
/// @llm Append a task and save; returns the new list.
/// @prefer @add_task($tasks, title: 'x') over $tasks->push(), which doesn't save.
/// @avoid Calling it in a loop: it saves each time. Build the list, then call @save_tasks once.
/// @pitfall title is trimmed, and an empty title throws Validation.
/// @example @add_task($tasks, title: 'Buy milk')
fn add_task(tasks: list, title: string) {
// …
}
/// Only for the tests.
/// @agent hide
fn reset_store() {
// …
}| タグ | 機能 |
|---|---|
@llm |
エージェントが要約の代わりに読む行。指定がない場合、エージェントは要約の最初の文を受け取ります。どちらも 120 文字までに切り詰められます。 |
@prefer |
エージェントに選んでほしい使い方。 |
@avoid |
エージェントに選んでほしくない使い方。 |
@pitfall |
間違えやすいミス。 |
@example |
100 文字以内の 1 行に収まる場合に表示されます。 |
@agent hide |
シンボルをエージェント向けドキュメントから除外します。 |
エディタはホバー表示でも @prefer、@avoid、@pitfall を表示するため、人間にも役立ちます。XML では、要素の前の <!--- ... --> コメントに同じタグを書いてください。