Logo di Doc Comments

Doc Comments

Organizzazione
modem-dev
doc-comments

Usa questa skill ogni volta che scrivi o modifichi commenti Rust `//`, `///` o `//!` in Biome, inclusi quelli aggiunti incidentalmente e la documentazione rustdoc per gli utenti finali all'interno delle dichiarazioni lint/assist. Per la documentazione rustdoc di lint/assist, carica anche lint-rule-development per i requisiti sui contenuti. Non usarla per la gestione del formatter dei commenti nel codice degli utenti.

Add to TypingMind

Panoramica

Pubblicato damodem-dev
Repositoryossrules
Nome della skilldoc-comments
Stelle
65
Fork
2
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da modem-dev su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Doc Comments in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/modem-dev/ossrules/tree/main/public/files/biomejs/.claude/skills/doc-comments
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/modem-dev/ossrules.git /tmp/ossrules
mkdir -p .claude/skills
cp -r /tmp/ossrules/public/files/biomejs/.claude/skills/doc-comments .claude/skills/doc-comments
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Doc Comments in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Doc Comments non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Doc Comments non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Purpose

Developer-facing comments and doc comments in this repository are read by contributors, months or years after they were written, with none of the context you have right now. This skill defines who that reader is, what each kind of comment is for, and which patterns are banned.

Scope boundary: rustdoc inside declare_lint_rule! / declare_assist_rule! blocks is end-user documentation generated into the website. Load this skill for comment hygiene, but use lint-rule-development for the audience, content structure, examples, and option documentation. Its content rules take precedence for those blocks.

The Reader

For developer-facing comments, write for a Biome contributor who is competent in Rust but has no access to your current context: not this conversation, not the pull request, not the issue, not the diff. They see only the repository at HEAD.

Two consequences follow directly:

  1. Never narrate change history. Words like "now", "previously", "no longer", "the new approach" are meaningless at HEAD, where only one approach exists. State how the code works, not how it came to be.
  2. Never address the reviewer. A comment that argues your change is correct ("this properly handles X") belongs in the PR description, not in the source. The comment must justify the code as it stands, permanently.

Three Kinds of Documentation, Three Different Jobs

KindJobContains
//! module docsExplanationWhy the module exists, core concepts and terminology, how the pieces relate, design rationale
/// item docsReferenceThe contract: behavior, inputs and outputs, invariants, panics, errors. Neutral and factual
// inline commentsRationaleOnly what the code cannot say: constraints, workarounds (with issue links), non-obvious coupling, why the obvious alternative is wrong

Do not mix the jobs. Implementation details do not belong in /// docs — put them as // comments inside the body. The contract does not belong scattered across inline comments — put it on the item.

The Deletion Test

Before writing any comment, ask: does this state something the reader cannot recover from the code itself?

  • If the information is already carried by names, types, or structure, do not write the comment. If the name fails to carry it, improve the name.
  • Information that legitimately needs a comment: an invariant, a rationale, a coupling to code elsewhere, a workaround with a link, surprising behavior of a dependency, a term of art the module defines.

When editing later, the same test applies in reverse: a comment that no longer passes it should be deleted, not left to rot.

Behavior Documentation

Write documentation for a human reader, not as a translation of the implementation.

  • Start with a plain-language description of what the function returns or accomplishes.
  • Use short or medium-length sentences. Keep one main idea per sentence.
  • Avoid internal jargon. If a technical term is necessary, explain what it means in the same paragraph.
  • Describe business-logic caveats that can surprise callers. Examples include fallback behavior, work limits, ambiguous results, overload ordering, and conditions that return None, Unknown, or an indeterminate result.
  • Do not describe implementation details unless callers need them to understand the behavior.

Add an example when the behavior depends on relationships that the function signature cannot show clearly. Common cases include:

  • overload selection;
  • mapping arguments to optional or rest parameters;
  • following imports or re-exports across files;
  • fallback behavior for ambiguous or incomplete information;
  • a result whose meaning is not obvious from its type.

Introduce the example before the code block. State what the example demonstrates and what result is expected.

Keep snippets minimal and self-contained.

Module documentation should describe a durable concept or design reason. Do not list individual functions or queries merely to summarize the file. Such lists become stale as items are added or renamed. If the module has no durable concept to explain, use a brief one-line description.

Banned Patterns

Narrating the next line. Delete these on sight:

rust
// Increment the generation counter
generation += 1;

Change-history narration. Rewrite as present-tense rationale:

rust
// BAD: We now intern types instead of cloning them.
// GOOD: Interning avoids cloning these types on every lookup.

Reviewer-addressed justification. Move the argument to the PR:

rust
// BAD: This correctly handles the overload case from the bug report.
// GOOD: Overloads are matched by arity before parameter types, so a
//       partial-arity call cannot select the wrong candidate.

Restated rustdoc. A /// doc that rewords the item name says nothing:

rust
// BAD:
/// Handles the type inference.
fn infer_types(...)

// GOOD:
/// Infers the type of `expr` in the scope of `module`, returning
/// `TypeData::Unknown` when the expression references an unresolved import.
fn infer_types(...)

Vague hedging. "Some cases", "various reasons", "handles edge cases", "etc." — either name them or drop the sentence.

Ad-hoc section banners (// ----- helpers -----, // ==== TYPES ====). For grouping in long files, use the region comment pattern below instead.

Region Comments

Long files group related items with paired region markers:

rust
// #region FILE-LEVEL METHODS
...
// #endregion

This is an established convention across the codebase (biome_service, biome_module_graph, biome_rowan, the parsers). The Workspace trait in crates/biome_service/src/workspace.rs uses it to group its methods (PROJECT-LEVEL METHODS, FILE-LEVEL METHODS, SEARCH-RELATED METHODS). Editors fold on these markers, which is the point: they exist for navigation, not documentation.

Rules:

  • Every // #region has a matching // #endregion. An unpaired marker breaks editor folding silently.
  • The name states what the group contains. It can be a plain label (Shared helpers) or anchored to a function (#region parse_thematic_break_parts) when the region holds one entry point and its private support code.
  • Use regions only where they earn their keep: files or impl/trait blocks long enough that folding helps. A file that fits on two screens does not need them.
  • A region name is organization, not documentation. It never substitutes for rustdoc on the items inside it.

Editing Existing Code

  • Preserve existing doc comments. If your change alters behavior, extend or correct the specific prose — never replace it with generic text. Deleting hard-won context is worse than leaving a comment slightly stale.
  • Match the surrounding density. A heavily documented module deserves the same level on new items; do not blanket a sparse module with comments.

Exemplar

The //! module docs at the top of crates/biome_service/src/workspace.rs show the target register. They define a term the rest of the module depends on ("open documents") and give its meaning in both the LSP and CLI contexts; they explain a design decision the signatures alone would make confusing (the workspace is stateful, yet every method takes &self, because the trait must be thread-safe and caching happens internally); and they state the error philosophy once, at the top, instead of repeating it on every method. Everything is present tense; nothing mentions how the design evolved or defends a change.

Self-Check Before Finishing

After completing any task that touched comments, re-read only the comments in your diff, in isolation from the code changes:

  1. Does each one pass the deletion test?
  2. Does any reference the conversation, the change itself, or the reviewer?
  3. Would a reader without access to the diff understand each one?

Fix or delete what fails. Deletion is the default; a missing comment is cheaper than a misleading one.

References

  • Diátaxis — the framework behind the explanation / reference / rationale split above.
  • lint-rule-development — for rule rustdoc, which is end-user documentation.

Domande frequenti

Cosa fa la skill IA Doc Comments?

Usa questa skill ogni volta che scrivi o modifichi commenti Rust `//`, `///` o `//!` in Biome, inclusi quelli aggiunti incidentalmente e la documentazione rustdoc per gli utenti finali all'interno delle dichiarazioni lint/assist. Per la documentazione rustdoc di lint/assist, carica anche lint-rule-development per i requisiti sui contenuti. Non usarla per la gestione del formatter dei commenti nel codice degli utenti.

Perché usare Doc Comments su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Doc Comments è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Doc Comments in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/modem-dev/ossrules/tree/main/public/files/biomejs/.claude/skills/doc-comments. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Doc Comments?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Doc Comments?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Doc Comments: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Doc Comments è gratuita?

Sì. È pubblicata su GitHub da modem-dev con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇