ME

method-shorthand-jsdoc

Uses method shorthand in return objects to ensure JSDoc comments remain visible when consumers hover over methods.

Install

mkdir -p .claude/skills/method-shorthand-jsdoc && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4061" && unzip -o skill.zip -d .claude/skills/method-shorthand-jsdoc && rm skill.zip

Installs to .claude/skills/method-shorthand-jsdoc

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Method shorthand in return objects for JSDoc preservation. Use when factory functions have internal helpers that should expose docs, or hovering over returned methods shows no JSDoc.
182 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • →Preserve JSDoc comments on factory methods
  • →Expose documentation through shorthand syntax
  • →Improve IDE hover visibility for factory outputs
  • →Restructure internal helper functions
  • →Ensure consumer-facing documentation accuracy

How it works

It refactors factory pattern code by migrating internal helper functions directly into the returned object property definitions.

Inputs & outputs

You give it
Factory function code
You get back
Refactored function with method shorthand

When to use method-shorthand-jsdoc

  • →Refactor factory functions for JSDoc visibility
  • →Document internal helpers in returned objects
  • →Fix missing documentation on factory method calls
  • →Improve developer experience with IDE hover documentation

About method-shorthand-jsdoc

Guides developers in restructuring factory functions. By moving helper functions into the return object using shorthand syntax, it ensures that JSDoc documentation is properly captured by IDEs.

Move helper functions into return objects using method shorthand for proper JSDoc preservation. Use when factory functions have internal helpers that should expose documentation to consumers, or when hovering over returned methods shows no JSDoc.

When not to use it

  • →Simple functions without JSDoc
  • →Performance-critical loops where object creation overhead matters

Limitations

  • →Requires minor refactoring of legacy code
  • →Limited by how specific IDEs parse shorthand methods
  • →Requires explicit JSDoc tags to be effective

How it compares

Focuses on IDE documentation preservation, not just functionality or pattern optimization.

Compared to similar skills

method-shorthand-jsdoc side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
method-shorthand-jsdoc (this skill)15moNo flagsIntermediate
schema-markup1010moNo flagsIntermediate
coding-standards75moReviewIntermediate
antfu66moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry