Tag per agenti
I tag in un commento di documentazione /// aggiungono ciò che il codice non può dire. Sono tutti facoltativi.
<!---
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() {
// …
}| Tag | Cosa fa |
|---|---|
@llm |
La riga che gli agenti leggono al posto del riepilogo. Senza di essa ricevono la prima frase del riepilogo. Entrambe sono troncate a 120 caratteri. |
@prefer |
Il modo di scrivere qualcosa che gli agenti dovrebbero scegliere. |
@avoid |
Un modo di usarlo che gli agenti non dovrebbero scegliere. |
@pitfall |
Un errore facile da commettere. |
@example |
Mostrato quando sta su una riga di massimo 100 caratteri. |
@agent hide |
Esclude il simbolo dalla documentazione per agenti. |
L'editor mostra @prefer, @avoid e @pitfall anche nel suggerimento al passaggio del mouse, quindi aiutano anche le persone. In XML, scrivi gli stessi tag nel commento <!--- ... --> prima dell'elemento.