Agent skill

Code Comments

by portabletext in portabletext/editor

How to write and review code comments in the Portable Text Editor monorepo.

MITAuto-check passedDevelopment

Install Code Comments

skills CLI
$ npx skills add portabletext/editor --skill code-comments -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install portabletext/editor code-comments --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/portabletext/editor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/code-comments .claude/skills/code-comments && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
code-comments
GitHub stars
280
Token cost
~1.1k tokens
SKILL.md length
606 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

How to write and review code comments in the Portable Text Editor monorepo.

  • Works in 4 steps: The code. A name, an extracted helper,… → The test. Structure that an assertion… → The commit body. Diagnosis,… → …
  • Writing code comments
  • SKILL.md covers The bar, The rules, JSDoc is consumer documentation and Not comments: machine-read…
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Code Comments is an agent skill from portabletext/editor. How to write and review code comments in the Portable Text Editor monorepo. Use when writing code comments or judging comment quality. Covers the why-only rule, JSDoc-as-consumer-docs, and untouchable directives.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Technical documentation. The repository describes itself as: The Standalone Portable Text Editor. The licence is MIT.

When your agent uses it

  • Writing code comments
  • Judging comment quality

Example prompts

  • “/code-comments”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. The code. A name, an extracted helper, or a stronger assertion often removes the need. If the mechanism can be named, name it.
  2. The test. Structure that an assertion defends needs no prose: deleting the "mysterious" line makes the pinned expectation fail, and the…
  3. The commit body. Diagnosis, justification, comparison with what the code used to do: all diff-relative narrative lives there.
  4. Docs/skills. A house pattern gets documented once, where it is defined, never re-explained at every use site. The same comment appearing N…

What it can do on your machine

Read from SKILL.md and the folder at commit 60a494b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Code Comments loads about 1.1k tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 606 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~57
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from portabletext/editor at commit 60a494b, republished under its MIT licence (© portabletext). 606 words, ~1,084 tokens.

Download SKILL.mdSave it as .claude/skills/code-comments/SKILL.md (or your agent's skills folder).
name
code-comments
description
How to write and review code comments in the Portable Text Editor monorepo. Use when writing code comments or judging comment quality. Covers the why-only rule, JSDoc-as-consumer-docs, and untouchable directives.

PTE code comments

The bar

A comment is a failure of every better channel. Before writing one, check where the information actually belongs:

  1. The code. A name, an extracted helper, or a stronger assertion often removes the need. If the mechanism can be named, name it.
  2. The test. Structure that an assertion defends needs no prose: deleting the "mysterious" line makes the pinned expectation fail, and the failure explains the line better than a comment would.
  3. The commit body. Diagnosis, justification, comparison with what the code used to do: all diff-relative narrative lives there.
  4. Docs/skills. A house pattern gets documented once, where it is defined, never re-explained at every use site. The same comment appearing N times is a pattern that wants a name, not N comments.

What remains after those four channels is the legitimate comment: the fact a competent reader cannot recover from the code and would act wrongly without: a browser quirk, a spec constraint, a deliberate-looking-accidental choice, an invariant the code relies on but does not check. "Explains why" is necessary but not sufficient; comprehension speed alone does not earn one. The test is concrete: what wrong action does this comment prevent? No answer, no comment.

The rules

  • Delete comments that restate the code. // increment the counter above counter++ is noise. So is any comment a rename would make redundant.
  • Never reference ticket IDs (Linear, Jira, anything) in code comments. The codebase stands on its own; a ticket system is invisible to external contributors, dies on migrations, and the commit that introduced the line already links the context. Name the CONDITION instead of the ticket: "once merge is a first-class operation, this becomes a correction", not "TICKET-123 promotes merge...". Same rule as commits, branches, and PRs.
  • Comments describe the present, never the diff. A comment that argues for the new code against code that is no longer there ("Deterministic negative assert: ...", deterministic relative to a deleted sleep) is commit-body material wearing a comment's clothes. The tell: a label or contrast that only means something to someone who saw the old version.
  • Comments for an if statement go inside the if statement, not above it.
  • Use backticks around code identifiers: `markDefs`, not markDefs.
  • Rewrites are dense one-liners where possible: present tense, mechanism not narrative, no "we need to" preamble. "Chrome collapses the selection on blur; restore it before applying" beats three sentences of story.
  • A comment that mixes a real why with restated what gets rewritten down to the why, then re-tested against the bar: the residue must still prevent a wrong action, or it goes too.
Show full SKILL.md (172 more words)Show less

JSDoc is consumer documentation

JSDoc on exported symbols (especially @public) is rendered by typedoc onto portabletext.org. It is not a code comment; it is the docs site. Different bar entirely:

  • The why-only rule does not apply. Describe behavior at the surface the consumer sees, not internal mechanism.
  • Deleting or trimming it changes the published docs, so removal is an API-documentation decision, never comment cleanup. When it is wrong, improve it.
  • @example blocks are valuable; keep and fix them rather than remove.
  • @deprecated tags and their migration pointers are API surface: consumers and tooling act on them. Keep them accurate.

Not comments: machine-read directives

Some things look like comments but are instructions to tools, and editing or deleting them changes behavior (suppressed errors resurface, coverage changes, formatting shifts). The rules above do not apply to:

  • Directives: @ts-expect-error, @ts-ignore, oxlint-disable, oxlint-disable-next-line, eslint-disable, prettier-ignore, /// <reference, v8 ignore, c8 ignore, istanbul ignore
  • keep-in-sync pointers: they pin deliberate duplication across packages (see the writing-tests skill), and deleting one silently breaks the contract that keeps the copies aligned

© portabletext, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/code-comments of portabletext/editor.

Open the folder on GitHubat commit 60a494b

Compare with similar skills

Code Comments next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Code Comments compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Code Comments this skillportabletext/editor280—~1.1kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design44k1 repos~7.5kAutomated safety check: PassMIT
Simple Englishmoeru-ai/airi50k2 repos~4.6kAutomated safety check: PassMIT
Get API Docs with chubandrewyng/context-hub14k2 repos~775Automated safety check: PassMIT
Doc SyncJetBrains/ideavim10k2 repos~2.6kAutomated safety check: PassMIT
Mailspring App ScreenshotsFoundry376/Mailspring18k—~1.4kAutomated safety check: PassGPL-3.0

Similar skills

  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    44k GitHub starsUsed in 1 repo~7.5k tokens
    DevelopmentAuto-check passed
  • Simple English

    moeru-ai/airi

    Write or rewrite technical text with the rules of ASD-STE100 Simplified Technical English so it is clear, unambiguous, and free of AI slop.

    50k GitHub starsUsed in 2 repos~4.6k tokens
    DevelopmentAuto-check passed
  • Get API Docs with chub

    andrewyng/context-hub

    Fetches current documentation for third-party APIs and SDKs with the chub CLI before the agent writes code against them, instead of relying on remembered API shapes.

    14k GitHub starsUsed in 2 repos~775 tokens
    DevelopmentAuto-check passed
  • Doc Sync

    JetBrains/ideavim

    Official

    Keeps IdeaVim documentation in sync with code changes. An agent skill from JetBrains/ideavim.

    10k GitHub starsUsed in 2 repos~2.6k tokens
    DevelopmentAuto-check passed
  • Mailspring App Screenshots

    Foundry376/Mailspring

    Captures screenshots of the running Mailspring dev app for docs, PRs or visual checks by launching it with a debugging port, driving the UI and clipping to an element.

    18k GitHub stars~1.4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated 5 days ago
    DevelopmentAuto-check: notes

More from portabletext/editor

All 10 skills in this repo
  • Product Copy Assistant

    portabletext/editor

    Write clear, concise, accessible product copy for interfaces, docs, and system messages.

    280 GitHub stars~635 tokensUpdated yesterday
    Auto-check passed
  • Changesets

    portabletext/editor

    How to write changesets in the Portable Text Editor monorepo.

    280 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed
  • Commits

    portabletext/editor

    How to write commit messages in the Portable Text Editor monorepo.

    280 GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed
  • Next Branch

    portabletext/editor

    How the next prerelease branch for the upcoming editor major works in the Portable Text Editor monorepo.

    280 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Backporting

    portabletext/editor

    How to backport a fix from main to a maintenance branch (editor-v6.x, editor-v7.x) in the Portable Text Editor monorepo.

    280 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Portable Text

    portabletext/editor

    Work with Portable Text, a JSON-based specification for structured block content.

    280 GitHub stars~656 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Code Comments

What does Code Comments do?

How to write and review code comments in the Portable Text Editor monorepo. Code Comments is an agent skill from portabletext/editor. How to write and review code comments in the Portable Text Editor monorepo.

When should I use Code Comments?

Code Comments fits situations like: writing code comments; judging comment quality.

How do I install Code Comments in Claude Code?

Run `npx skills add portabletext/editor --skill code-comments -a claude-code`. Or copy the skill folder (.agents/skills/code-comments in portabletext/editor) into .claude/skills/code-comments in your project. Claude Code loads it when a task matches its description.

How do I install Code Comments in Codex?

Run `npx skills add portabletext/editor --skill code-comments -a codex`. Or copy the skill folder (.agents/skills/code-comments in portabletext/editor) into .agents/skills/code-comments in your project. Codex loads it when a task matches its description.

Can I use Code Comments in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add portabletext/editor --skill code-comments -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/code-comments, .gemini/skills/code-comments, .github/skills/code-comments and .opencode/skills/code-comments in your project.

What does Code Comments need to run?

SKILL.md names no scripts, command-line tools or credentials: Code Comments is instructions for the agent only.

Does Code Comments access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Code Comments safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Code Comments use?

Code Comments is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Code Comments use?

About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Code Comments?

Skills that share tags, products or a category with Code Comments: Diagram Design (cathrynlavery/diagram-design, 44k stars), Simple English (moeru-ai/airi, 50k stars), Get API Docs with chub (andrewyng/context-hub, 14k stars) and Doc Sync (JetBrains/ideavim, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Code Comments?

portabletext (a GitHub organization) maintains it in portabletext/editor, which has 280 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 6, 2026.

Source: portabletext/editor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.