Saltar al contenido
Skillpedia
Documentación40 mil · #7268

lean-comments

Qué hace

Esta herramienta ayuda a que el código de un programa se mantenga limpio y fácil de entender. Revisa si los comentarios del código son realmente necesarios y si explican el 'porqué' de las cosas, en lugar de repetir lo que el código ya dice.

Cuándo usarla

  • ✓Cuando añades comentarios nuevos al código.
  • ✓Cuando revisas comentarios existentes para asegurarte de que son útiles.
  • ✓Cuando el código es confuso y necesita una explicación clara.

Link de la skill

https://github.com/github/awesome-copilot/blob/main/skills/lean-comments/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/github/awesome-copilot/blob/main/skills/lean-comments/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Revisa los comentarios de este fragmento de código para asegurarte de que son esenciales y explican el 'porqué'.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La herramienta se pregunta si un programador experimentado perdería información importante si no estuviera el comentario. Da prioridad a eliminar los comentarios que solo repiten el código o que son obvios.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Lean Comments

Goal

Keep the smallest amount of high-value commentary necessary to make a codebase easier and safer to understand and maintain.

The default is no comment.

A comment must preserve meaningful information that a competent maintainer cannot reasonably recover from the code, names, types, signatures, structure, tests, configuration, or nearby context.

Comments are not labels, narration, decoration, declaration summaries, change logs, or substitutes for clear code.

Reader model

Write for a competent maintainer reading the repository at HEAD months later, without access to the current conversation, prompt, diff, pull request, issue discussion, review discussion, or implementation process.

Document the durable state, contract, constraint, or rationale of the code as it exists. Do not assume the reader knows what changed, what came before, or what was discussed unless that context is deliberately preserved in a reliable project source.

Authority and evidence

Use this skill as the comment-policy authority when it is active.

Use language, framework, library, or infrastructure skills to determine whether a non-obvious constraint is real, not to override this skill's necessity test.

Honor explicit current repository requirements, public API documentation requirements, tooling contracts, and generated-source rules. Do not infer a documentation requirement merely from existing comment density or precedent.

Base retained or newly written rationale on evidence from the repository, tests, configuration, official API behavior, project documentation, issue tracker, ADRs, specifications, or another reliable source.

Never invent a security reason, performance reason, business rule, compatibility requirement, API constraint, historical reason, architectural rationale, or external limitation to justify commentary.

If no supported non-obvious reason exists, remove or omit it.

Core decision rule

Before retaining or adding ordinary commentary, mentally remove it and ask:

Would a competent maintainer lose meaningful, non-obvious information if this comment did not exist?

If no, remove or omit it.

If uncertain, prefer no comment unless repository evidence demonstrates that the information matters.

If yes, retain only the minimum information necessary.

Never preserve a comment merely because it is correct, harmless, already present, grammatically polished, written as a warning, related to security or validation, related to internal or public state, or attached to an exported declaration.

The information itself must justify the comment.

Decision order

Evaluate existing and proposed commentary in this order:

  1. Delete or omit if the information is already clear without it
  2. Express through code if a tiny behavior-preserving readability improvement removes the need for it
  3. Shorten if it is necessary but contains unnecessary information or words
  4. Rewrite if it is necessary but unclear, inaccurate, stale, awkward, or inconsistent
  5. Use declaration documentation if the information belongs to the declaration's contract, semantics, or intended usage
  6. Keep unchanged only if it is already necessary, minimal, accurate, durable, and correctly styled

Always decide necessity before wording.

Do not polish an unnecessary comment or convert one into documentation.

What deserves an implementation comment

Use an implementation comment when it preserves non-obvious information such as:

  • Why intentionally surprising code exists
  • An external constraint or compatibility requirement
  • An important invariant or subtle edge case
  • A meaningful tradeoff or required workaround
  • Non-obvious coupling
  • An ordering, timing, lifecycle, concurrency, performance, or security constraint
  • A reason an apparently simpler implementation would be incorrect

Prefer comments that explain why something matters.

Comments that merely explain what the code does should normally be removed.

Remove low-value commentary

Remove comments that merely:

  • Restate or translate the code into prose
  • Narrate the next statement or obvious control flow
  • Explain an obvious guard clause, return, assignment, or branch
  • Describe an obvious fetch, validation, transformation, mapping, filtering, creation, update, or deletion
  • Repeat a declaration name, property name, type, signature, parameter, or return type
  • Label or summarize a declaration

…

Preguntas frecuentes

¿Qué es el 'código fuente'?

Es el texto escrito por los programadores que le indica a la computadora qué hacer. Es como una receta de pastel.

¿Qué son los 'comentarios' en el código?

Son notas dentro del código que los programadores usan para explicar partes difíciles o el motivo de una decisión. La computadora los ignora.

¿Por qué es importante tener buenos comentarios?

Los buenos comentarios ayudan a otros programadores (o a ti mismo en el futuro) a entender el código rápidamente, lo que facilita mantenerlo y corregir errores.

Detalles

Descripción original del autor

Audits, writes, and refines maintained first-party source-code comments and declaration-level documentation across languages. Use when adding, editing, reviewing, cleaning up, or auditing comments, doc comments, docstrings, TODO, FIXME, NOTE, suppressions, or other source commentary, including while modifying code and deciding whether a comment is warranted at all. Defaults to no comment unless it

repo: github/awesome-copilot

Popularidad

Estrellas en GitHub
40 mil
Posición en el ranking
#7268
Licencia
MIT
Actualizada
15/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas