Agent-Tags
Tags in einem ///-Dokumentationskommentar ergänzen, was der Code nicht sagen kann. Alle sind optional.
<!---
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 | Was er tut |
|---|---|
@llm |
Die Zeile, die Agenten anstelle der Zusammenfassung lesen. Ohne sie erhalten sie den ersten Satz der Zusammenfassung. Beide werden auf 120 Zeichen gekürzt. |
@prefer |
Die Art, etwas zu schreiben, die Agenten wählen sollen. |
@avoid |
Eine Art der Verwendung, die Agenten nicht wählen sollen. |
@pitfall |
Ein Fehler, der leicht passiert. |
@example |
Wird angezeigt, wenn es in eine Zeile von bis zu 100 Zeichen passt. |
@agent hide |
Lässt das Symbol aus der Agenten-Doku weg. |
Der Editor zeigt @prefer, @avoid und @pitfall auch beim Hover an, sie helfen also auch Menschen. In XML schreibe dieselben Tags im <!--- ... -->-Kommentar vor dem Element.