code-comments

Generate co-located code comments and documentation for TypeScript, Swift, and Python.

42|11|Updated Dec 26, 2025
One-click install
npx skills add https://github.com/petekp/claude-code-setup --skill code-comments-petekp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-comments
Source: https://github.com/petekp/claude-code-setup/tree/main/skills/code-comments
Command: npx skills add https://github.com/petekp/claude-code-setup --skill code-comments-petekp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you write and maintain clear, effective code comments and documentation that live directly alongside the code they describe, preventing documentation drift and improving code understandability for both humans and AI.

Core Features & Use Cases

  • Co-located Documentation: Encourages comments and documentation to be placed directly within code files (file headers, function docs, inline explanations).
  • "Why" Focused: Guides users to explain the reasoning behind code decisions, not just what the code does.
  • Multi-Audience: Optimized for future developers, teammates, and AI coding assistants.
  • Use Case: When writing a complex function, use this Skill to generate a clear documentation block explaining its purpose, parameters, return values, and any non-obvious design choices.

Quick Start

Use the code-comments skill to write a file header for a new TypeScript utility file.

Frequently Asked Questions about code-comments

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write co-located code comments that explain the why behind my logic?

Co-located code comments should directly accompany the logic they describe, focusing on the reasoning behind decisions rather than restating what the code does. This Skill generates file headers, function documentation, and inline explanations to clarify non-obvious design choices for humans and AI assistants.

What is the best way to document a complex TypeScript function for future developers?

The best way to document a complex TypeScript function is generating a clear documentation block explaining its purpose, parameters, return values, and any non-obvious design choices. This Skill provides specific language patterns for TypeScript to ensure multi-audience readability.

Does this code documentation approach work with Swift and Python?

Yes, this code documentation approach works with Swift and Python. It supports multiple programming languages by applying specific documentation patterns for each, ensuring file headers and function docs remain consistent across different software development stacks.

Can AI coding assistants use inline code comments effectively?

Yes, AI coding assistants use inline code comments effectively when they explain the reasoning behind code decisions. This Skill optimizes multi-audience documentation so that both future teammates and AI tools can understand architectural notes and non-obvious logic within the codebase.

When do I need to generate architectural notes in my code files?

You need to generate architectural notes in your code files when making non-obvious design decisions that affect the broader system. This Skill helps write these notes as co-located documentation to prevent documentation drift and improve understandability for future developers.

How do I prevent documentation drift when maintaining software projects?

To prevent documentation drift, you should co-locate comments and documentation directly within the code files they describe. This Skill generates clear file headers and inline explanations that live alongside the code, ensuring documentation stays synchronized with the implementation.