Logo di Self Documented Code

Self Documented Code

Community
marekkirejczyk
self-documented-code

Rename everything in a scope (a repository, a PR, a directory, a concept) so each name explains itself and each concept has one name, keep comments only for what code cannot say, and update the project's glossary to match. Semantics, lint and tests stay intact.

Panoramica

Pubblicato damarekkirejczyk
Repositoryskills
Nome della skillself-documented-code
Stelle
157
Fork
1
File inclusi
1
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.

  • File inclusi: 1

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da marekkirejczyk su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Self Documented Code 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/marekkirejczyk/skills/tree/main/skills/self-documented-code
  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/marekkirejczyk/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/self-documented-code .claude/skills/self-documented-code
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Self Documented Code 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 Self Documented Code 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 Self Documented Code 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à.

Self-documented code

Rename the code in a scope so that every name says what it means and the same thing has the same name everywhere, and leave comments only for what the code cannot say. Arguments: $ARGUMENTS. If your agent does not fill that in, take them from the user's message.

The scope is what the user names: the repository, a PR or branch (only the names and comments that PR adds or changes, plus whatever must change with them), a directory, a file, a module, or a concept ("everything about payments"). With no scope given, use the whole repository.

Run from start to finish without asking for approval. The one stop is a failing baseline (rule 2).

Goal

A reader who sees only a name, at the place it is used, knows what it holds or does, without opening its definition or reading a comment.

You are done when all four hold:

  1. Every name is self-explanatory. Every variable, parameter, function, method, class, type, field, constant, file and test helper in scope has been reviewed, and renamed if it falls short of the naming standard.
  2. Every concept has one name. Across the scope, one concept has one term, and one term means one concept.
  3. Every comment earns its place. Each comment left in scope meets the comment standard.
  4. Every project dictionary matches the code. Each glossary or word list the project keeps uses the final terms (see Dictionaries).

Rules

These hold after every round. A round that breaks one is undone.

  1. Semantics stay the same. Same answers, errors, writes and calls, in the same order. Change only names, comments and dictionaries: logic, control flow, parameter order and the formatting of unrelated code stay as they are.
  2. Lint, type checks, build and tests pass, using the project's own commands. They must pass before you start: if they fail, stop and report it.
  3. Tests change only in names and comments. Their assertions, expected values and logic stay exactly as they are.
  4. External contracts keep their names. That covers anything code outside this repository depends on, or that is stored or sent: published package exports, public API routes and fields, database tables and columns, serialized keys, event names, environment variables, config keys, CLI flags, and names required by a framework or interface you don't own. Report a bad name of this kind and leave it.
  5. Every reference moves with its name. Use the language server's or compiler's rename where there is one. Then search for what tools can't see: strings, reflection, dynamic lookups, templates, mocks, docs, comments, scripts and CI config.
  6. Stay in scope. A rename may spread beyond the scope only when the code would otherwise break, and the report lists it. Dictionaries are updated wherever they live.

Naming standard

A name is good when:

  • It states meaning, not type or mechanics: unpaidInvoices, not list or invoiceArray.
  • It uses the domain's words, and the language's own conventions for case and idiom.
  • Its abbreviations are universal in the domain or language (id, url, i as the index of a short loop). Spell out the rest.
  • It carries its unit or qualifier when that matters: timeoutSeconds, priceInPence, isExpired, hasPaid.
  • A function says what it does and returns: a verb phrase for an action, a noun or question for a query. A function with a side effect sounds like one.
  • Its length tracks how far it travels: short in a three-line lambda, full for an export. Drop words the context already gives (order.orderId → order.id).
  • Every word carries meaning. data, info, manager, helper, util, temp, foo and a 2 suffix go, unless the word truly is the meaning.
  • It is true. It describes all of what the code does today.

A name that already meets the standard stays: rename for meaning, never for taste.

Comment standard

Code says what happens. A comment exists only for what a reader could not work out from well-named code:

  • Why this and not the obvious alternative: a decision, a trade-off, an approach that was tried and failed.
  • A non-trivial fact the code can't show: a vendor's undocumented behaviour, a workaround and its cause, an ordering constraint, a performance or security reason, a link to the issue or spec behind it.

Delete every other comment: one that narrates the code, restates a name or signature, labels a section, or holds dead code. Before deleting one, check whether it says something the code doesn't. If it does, move that into a name, or keep only that part as a why comment. Correct any comment you keep that the code contradicts.

New comments are rare: write one only for something you learned that a name cannot carry and this standard calls for.

Linter and compiler directives, licence headers, and doc comments that generate published documentation stay as they are.

Dictionaries

A dictionary is any place the project defines its words: GLOSSARY.md, a domain or ubiquitous-language doc, a terms section in the docs, a spell-check word list (cspell, codespell). Search for them before the vocabulary step. A project with none stays with none.

A dictionary's term is the default for its concept. When you choose a different one, or split or merge terms, change the entry in the same round as the rename: the new term, an accurate definition, the retired word gone. Add an entry for each domain concept the dictionary should have but lacks. Historical records such as ADRs and changelogs keep the words of their time.

Method

  1. Baseline. On a new branch, run lint, type checks, build and tests, and record the results. Done when all pass.
  2. Vocabulary. Read the scope and the dictionaries, and write a table: each concept, the names it has today, the one term it will use. Include each term with several meanings, and how it splits. Done when every name in scope maps to a row or is marked as already good.
  3. Rename in rounds. One concept or one module per round, outermost names first, with its dictionary entries. After each round run the checks, then commit. If a check goes red, undo the round and take a smaller step. Leave the branch unpushed. Done when every row of the table is applied.
  4. Comments. Now that the names are done, apply the comment standard across the scope, in a round of its own, so the new names can replace what the comments said.
  5. Sweep. Go through the scope once more, file by file, against both standards. Done when you have opened every file in scope, no old term from the table remains in the code or the dictionaries, and all checks pass.

When a name reveals a problem

A name that can't be made honest usually means the code does two things or is wrong. Leave the code as it is, give it the most accurate name you can, and report it.

Report

  • The vocabulary table, the number of names reviewed and renamed, and the number of comments deleted, rewritten and kept.
  • The dictionary entries changed, added and removed, or that the project has no dictionary.
  • Check results before and after.
  • Renames that went beyond the scope.
  • External names left alone that should change, with where they are defined.
  • Code the naming exposed as misleading, buggy or doing too much.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Self Documented Code?

Rename everything in a scope (a repository, a PR, a directory, a concept) so each name explains itself and each concept has one name, keep comments only for what code cannot say, and update the project's glossary to match. Semantics, lint and tests stay intact.

Perché usare Self Documented Code su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Self Documented Code è 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 Self Documented Code in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/marekkirejczyk/skills/tree/main/skills/self-documented-code. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Self Documented Code?

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 Self Documented Code?

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

La skill IA Self Documented Code è gratuita?

Sì. È pubblicata su GitHub da marekkirejczyk 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 👇