$ recombobulate _
home / tips / ask-claude-to-add-jsdoc-or-docblock-comments-to-your-undocumented-functions
60

Ask Claude to Add JSDoc or Docblock Comments to Your Undocumented Functions

recombobulate @recombobulate · Mar 29, 2026 · Workflows
ask-claude-to-add-jsdoc-or-docblock-comments-to-your-undocumented-functions

Writing doc comments by hand is tedious, and auto-generated ones just repeat the function signature. Claude reads the actual implementation — the edge cases, the error conditions, the side effects — and writes documentation that adds real value.

Add JSDoc comments to all exported functions in src/services/ that don't 
have them. Read the implementation and document what each function actually 
does, not just what the types say.

Claude produces comments that go beyond the signature:

/**
 * Processes a refund for an order, prorating the amount if only
 * some items are returned. Sends a notification email on success.
 *
 * @param {string} orderId - The order to refund
 * @param {string[]} [itemIds] - Specific items to refund. Omit for full refund.
 * @returns {Promise<RefundResult>} The refund details including transaction ID
 * @throws {OrderNotFoundError} If the order doesn't exist
 * @throws {AlreadyRefundedError} If the order was already fully refunded
 * @example
 * // Full refund
 * await processRefund('ord_123');
 * // Partial refund
 * await processRefund('ord_123', ['item_456']);
 */

This works for all documentation formats:

# PHPDoc
Add PHPDoc blocks to all public methods in app/Services/. 
Include @param, @return, @throws, and a description that explains 
the business logic, not just the mechanics.

# Python docstrings
Add Google-style docstrings to all functions in src/. Include Args, 
Returns, Raises, and a usage Example for complex functions.

# Targeted documentation
Only document the functions that other developers call — the public 
API surface. Skip private helpers and internal utilities.

After adding docs, ask Claude to verify accuracy:

Check that every @throws annotation matches an actual throw in the code. 
Check that every @param matches an actual parameter. Remove any 
documentation that doesn't match the implementation.

Good documentation describes intent and edge cases, not just types — let Claude read the code and write comments that help the next developer understand why.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago