askill
documenting-with-claude-md

documenting-with-claude-mdSafety 100Repository

Hierarchical machine-readable documentation - root CLAUDE.md with module index, per-module CLAUDE.md for significant modules

0 stars
1.2k downloads
Updated 1/13/2026

Package Files

Loading files...
SKILL.md

Documenting with CLAUDE.md

Purpose

Machine-first documentation that loads automatically with code. Two-level hierarchy: root overview + per-module context.

Not for human browsing - for instant AI understanding.

Templates

Root CLAUDE.md (required):

# Project Name

## Purpose
What this does and why it exists

## Architecture Overview
High-level design, key patterns

## Module Index
- `src/auth/` - Authentication (see src/auth/CLAUDE.md)
- `src/api/` - REST API (see src/api/CLAUDE.md)

## Tech Stack
- Language/framework
- Key dependencies

## Development
See ~/.claude/CLAUDE.md for standard workflow

Module CLAUDE.md (significant modules only):

# Module: Authentication

## Purpose
Handles user authentication and sessions

## Responsibilities
- User login/logout
- Token generation/validation
- Session management

## Key Files
- `auth_service.py` - Core logic
- `token_handler.py` - JWT operations

## Dependencies
- **Uses:** db, utils
- **Used by:** api

## Public Interface
- `authenticate(email, password) -> Token`
- `validate_token(token) -> User`

## Architecture Decisions
- JWT for stateless auth (no session storage)
- 24-hour token expiry

When to Create

Significant modules (3+ files, distinct domain):

  • Create module CLAUDE.md
  • Add to root module index
  • Update when responsibilities/interface change

Don't create for:

  • Single-file directories
  • Test directories
  • Utility folders (<3 simple files)

Code Comments

Comment the "why" not the "what":

# ❌ Bad (obvious)
if user_type == "premium":
    return total * 0.2  # Return 20% discount

# ✅ Good (explains rationale)
if user_type == "premium":
    return total * 0.2  # 20% incentivizes membership

Always comment:

  • Non-obvious algorithms
  • Performance/security decisions
  • Bug workarounds
  • Business logic rationale

Usage Patterns

New module: Create module CLAUDE.md from template, add to root module index, keep updated as code evolves.

Existing code: Start with root CLAUDE.md and module index, then add CLAUDE.md for significant modules along with docstrings and comments.

Maintenance

Keep current:

  • Update module CLAUDE.md when responsibilities change
  • Update root index when modules added/removed
  • Update docstrings when signatures change
  • Outdated docs worse than no docs

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

91/100Analyzed 2/20/2026

High-quality skill about hierarchical CLAUDE.md documentation. Provides clear templates for root and module-level documentation, specific criteria for when to create per-module docs, and guidance on effective code comments. Well-structured with good actionability. Located in proper skills folder indicating reusability. Tags are somewhat generic but don't detract from the practical value.

100
92
85
88
90

Metadata

Licenseunknown
Version-
Updated1/13/2026
Publisherbryonjacob

Tags

apigithub-actionsllmsecuritytesting