Command Palette

Search for a command to run...

Назад к скиллам
скилл № 56175

hoc-jsdoc

JSDoc writing conventions shared by backend and frontend. Use when writing or reviewing JSDoc, the type a tag carries included, in plain JavaScript or in Vue…

БесплатноБез исполняемых скриптов
openreachtechот openreachtech★ 17 звёзд на GitHub

Установить hoc-jsdoc в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Shared: JSDoc

Summarizes JSDoc writing conventions. All typing is JSDoc — no TypeScript syntax, no .ts files — so always annotate types with JSDoc.

The rules in this body apply to every JavaScript file, backend and frontend alike.

How the jsdoc-plugin rules actually in effect under this project's ESLint map to each of this skill's conventions is summarized in eslint-jsdoc-rules.md. If you write JSDoc as this skill prescribes, npm run lint produces no jsdoc-related errors. Note that lint also enforces such points as: function declarations and methods must have JSDoc (empty constructors are not exempt), each @param requires a type and a name, and a function that returns a value needs @returns (with a type). This skill goes one step further and requires @returns even when nothing is returned ({void}).

Write object types with named parameters

  • Do not use {object}.
  • Write objects as an inline type literal, explicitly listing each property as a named parameter.

Example:

// NG
/**
 * @param {object} params - Parameters.
 * @param {string} params.alpha - Alpha.
 */

// OK
/**
 * @param {{
 *   alpha: string
 * }} params - Parameters.
 */

Name a single object argument params

  • For a method that takes a single object argument, name the parameter params unless there is a special reason not to.
// OK
/**
 * @param {{
 *   alpha: string
 * }} params - Parameters.
 */

Always write @returns

  • Every function and method gets @returns, even one that returns nothing.
  • For a function that returns nothing, write @returns {void} (@returns {Promise<void>} when it is async). Never omit the tag.
  • Lint (jsdoc/require-returns) only demands @returns when a value is actually returned, so this skill is stricter than lint here (see eslint-jsdoc-rules.md). The reason is that "returns nothing" should be stated, not inferred from the absence of a tag.
// NG: returns nothing, so @returns is omitted
/**
 * @param {{
 *   message: string
 * }} params - Parameters.
 */

// OK
/**
 * @param {{
 *   message: string
 * }} params - Parameters.
 * @returns {void}
 */

Attach a description to @returns

  • Attach not just a type but also a description to @returns.
  • The sole exception is @returns {void} / @returns {Promise<void>}. There is no returned value to describe, so the type stands on its own.
  • Do not put a hyphen between the type and the description. The leading - is a @param convention (jsdoc/require-hyphen-before-param-description) and does not apply to @returns.
  • Lint (jsdoc/require-returns-description) is off and does not force a description, but this skill always attaches one for QA reasons (see eslint-jsdoc-rules.md).
// NG: no description
/**
 * @returns {string}
 */

// NG: a hyphen before the description
/**
 * @returns {string} - Default characters to pick from.
 */

// OK
/**
 * @returns {string} Default characters to pick from.
 */

Add @public to entry points

  • Add @public to the JSDoc of any method that serves as an entry point accessed from outside.
/**
 * Generate a random text of the given length.
 *
 * @param {{
 *   length: number
 * }} params - Parameters.
 * @returns {string | null} Generated random text, or null if it cannot be generated.
 * @public
 */
generate ({
  length,
}) {
  // ...
}

Write array types as Array<T>

  • Trailing-[] array notation such as string[] is prohibited. Always write it as Array<string>.
  • Reason: writing something like { alpha: number, beta: string }[] causes confusion for the reader.
// NG
/**
 * @param {string[]} values - Values.
 */

// OK
/**
 * @param {Array<string>} values - Values.
 */

Avoid vague types; write the most specific type you can

  • Vague types such as object / Object / any / * are not used unless clearly necessary.
  • Investigate the type and write it as a type literal with the most detailed properties possible, or as a concrete type name.
  • Make generics concrete as far as possible. Do not leave the element type vague as Array<object>; write Array<UserEntity> instead.
// NG: vague element type and return type
/**
 * @param {{
 *   users?: Array<object>
 * }} params - Parameters.
 * @returns {object} Users and their total count.
 */

// OK: investigate and write the detailed type
/**
 * @param {{
 *   users?: Array<UserEntity>
 * }} params - Parameters.
 * @returns {{
 *   users: Array<UserEntity>
 *   total: number
 * }} Users and their total count.
 */

object / Object is prohibited; use Record<string, *>

  • object / Object is prohibited regardless of the reason.
  • Reason: object is dangerous in that it tolerates ambiguity including null. Even when you are for
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/eslint-jsdoc-rules.md
  • references/import-expression.md
  • references/import-tag.md

FAQ

Что делает скилл hoc-jsdoc?

JSDoc writing conventions shared by backend and frontend. Use when writing or reviewing JSDoc, the type a tag carries included, in plain JavaScript or in Vue. Use it also when clearing a type error a checker such as `tsc` reports: the error is cleared by writing the annotation, and which annotations may be written is decided here. Reading what the checker reported belongs to the type-errors convention.

Как установить скилл hoc-jsdoc?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hoc-jsdoc запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить hoc-jsdoc с