Hoc comments

From openreachtech/hora-skills-ort-core · View interactive version

Hoc comments is an AI agent skill from the GitHub repository openreachtech/hora-skills-ort-core. Comment-writing conventions — what a comment says (the why, never a restatement, no annotation but `NOTE:`), where an inline comment stands (above the code, at a line end only to keep a format), where a long comment breaks (at a clause, never at a column), the form of a multi-line block, and lines c

How to use this skill

Skill file

Shared: Comments

Conventions related to comment writing. Applies across JSDoc, block comments (/* */) and inline comments (//).

Language

the default it gives every comment — English, in source, in the tests generated under tests/

and in the code examples of a document or a skill — which holds wherever no instruction, and no

language code in the file's name, has settled it first.

What a comment says

A comment carries what the code cannot say for itself — above all, why. Where the code makes

a choice a reader would question, the comment stating the reason is the one that has to be

there, and it is the one most often missing.

not, and it is one more thing to keep in step with that line.

change corrects it; a comment describing code that is no longer there misleads more than no

comment would.

block keeps only the question of whether it still matters.

issue is seen by whoever plans the work, carries its own discussion, and is closed when the work

lands, while an annotation in the code waits for someone to happen to read that line. NOTE:

is the one left, because it points out something about the code as it stands, not work left to

do.

explains the code as it stands — see /hoc-dependency-defect.

An inline comment stands on the line above

An inline comment goes on a line of its own, above the code it describes. It is put at the

end of a line only where moving it there keeps the code's format from breaking:

would sit between two elements and break the run of one element per line.

written as the value alone, so the option keeps the layout it has everywhere else.

// OK: the default noted at the end of the line, the option keeping its layout
'max-len': [
  'error',
  {
    code: 120, // 80
  },
],

A comment naming a group stands before the group

end of its first element.

// OK: each group named on the line before it, a blank line between groups,
// and a remark on one element kept at the end of its line
const invalidDates = [
  // Days that do not exist
  '2026-02-30',
  '2026-04-31',

  // Strings that are not dates
  'tomorrow', // a word a person would type
  '',
]

A long comment breaks where its sentence does

Where a comment runs to more than one line, break it at a point the sentence itself offers —

after a comma, at a conjunction, between two sentences. A column count such as 80 is not the

criterion: filling each line to a margin breaks wherever the word count happens to land.

// NG: filled to the margin, so the line ends mid-clause
/**
 * A fragment already on the path contributes nothing, which is what stops a
 * cyclic document from being walked forever.
 */

// OK: the break falls after the comma, where the clause does
/**
 * A fragment already on the path contributes nothing,
 * which is what stops a cyclic document from being walked forever.
 */

the comment can be read down the left edge; broken at a column, a line ends on stops a and

carries no meaning of its own.

// lines alike.

A block comment that runs to several lines takes at least three

A block comment written over more than one line takes three lines at the least: the opening

marker on a line of its own, the text, and the closing marker on a line of its own. Every line

between the two markers keeps its leading *.

// NG: two lines, with the text sharing a line with each marker
/* Retries are spaced exponentially,
   so a struggling server is given room to recover. */

// NG: the leading * dropped from the lines between the markers
/**
   Retries are spaced exponentially,
   so a struggling server is given room to recover.
 */

// OK: three lines or more, every line between the markers marked
/**
 * Retries are spaced exponentially,
 * so a struggling server is given room to recover.
 */

closing marker of one runs straight into the opening marker of the next.

// NG: two blocks with nothing between them
/**
 * @typedef {*} BooleanLike
 */
/**
 * @typedef {*} NumberLike
 */

// OK: a blank line between the two
/**
 * @typedef {*} BooleanLike
 */

/**
 * @typedef {*} NumberLike
 */

Lines are commented out with `//`, never with a block comment

Where several lines are commented out, each takes its own //. A block comment is not used

for it: /* */ does not nest, so a block wrapped around code that already holds a block comment

ends at that comment's */, and the rest of the code runs again.

// NG: the block ends early, at the */ of the JSDoc inside it
/*
/**
 * @returns {number}
 */
computeDelay () { ... }
*/

// OK: one // per line
// /**
//  * @returns {number}
//  */
// computeDelay () { ... }

carries no commented-out code at all, as "What a comment says" above holds.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.