Теги агентов
Теги в документирующем комментарии /// добавляют то, что код не может сказать сам. Все они необязательны.
<!---
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 символов. |
@agent hide |
Исключает символ из документации для агентов. |
Редактор показывает @prefer, @avoid и @pitfall и при наведении, поэтому они полезны и людям. В XML пишите те же теги в комментарии <!--- ... --> перед элементом.