Install command
Provided
Automatically generates or updates project documentation when session ends.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
0/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens, permissions & scopes.
#!/usr/bin/env bash
echo "📚 Starting documentation generation..." >&2
# Create docs directory if it doesn't exist
mkdir -p ./docs
# Generate timestamp for session
SESSION_DATE=$(date +"%Y-%m-%d")
SESSION_TIME=$(date +"%H:%M:%S")
TIMESTAMP="$SESSION_DATE $SESSION_TIME"
# Count modified files if in git repo
MODIFIED_COUNT=0
if command -v git &> /dev/null && git rev-parse --git-dir > /dev/null 2>&1; then
MODIFIED_COUNT=$(git diff --name-only 2>/dev/null | wc -l | xargs)
fi
echo "📊 Session summary: $MODIFIED_COUNT files modified" >&2
# JavaScript/TypeScript projects
if [ -f "package.json" ]; then
echo "🟡 JavaScript/TypeScript project detected" >&2
# Try TypeDoc first for TypeScript projects
if ls *.ts src/**/*.ts 2>/dev/null | head -1 > /dev/null; then
if command -v npx &> /dev/null && npx typedoc --version &> /dev/null 2>&1; then
echo "📝 Generating TypeDoc documentation..." >&2
npx typedoc --out ./docs/api src 2>/dev/null && echo "✅ TypeDoc documentation generated" >&2
else
echo "💡 Install TypeDoc for better TypeScript docs: npm install -g typedoc" >&2
fi
fi
# Try JSDoc for JavaScript projects
if [ -f "jsdoc.json" ] || [ -f "jsdoc.conf.json" ]; then
if command -v npx &> /dev/null && npx jsdoc --version &> /dev/null 2>&1; then
echo "📝 Generating JSDoc documentation..." >&2
npx jsdoc -c jsdoc.json 2>/dev/null || npx jsdoc -c jsdoc.conf.json 2>/dev/null
[ $? -eq 0 ] && echo "✅ JSDoc documentation generated" >&2
fi
fi
# Try documentation.js as fallback
if command -v npx &> /dev/null; then
if npx documentation --version &> /dev/null 2>&1; then
echo "📝 Generating documentation.js docs..." >&2
npx documentation build './src/**/*.js' -f md -o ./docs/api.md 2>/dev/null
[ $? -eq 0 ] && echo "✅ Documentation.js docs generated" >&2
fi
fi
fi
# Python projects
if [ -f "setup.py" ] || [ -f "pyproject.toml" ] || [ -f "requirements.txt" ]; then
echo "🐍 Python project detected" >&2
# Try pdoc for simple API docs
if command -v pdoc &> /dev/null; then
echo "📝 Generating pdoc documentation..." >&2
pdoc --html --output-dir ./docs . 2>/dev/null && echo "✅ pdoc documentation generated" >&2
elif command -v python &> /dev/null; then
if python -c "import pdoc" 2>/dev/null; then
echo "📝 Generating pdoc documentation..." >&2
python -m pdoc --html --output-dir ./docs . 2>/dev/null && echo "✅ pdoc documentation generated" >&2
fi
fi
# Try Sphinx for comprehensive docs
if [ -f "docs/conf.py" ]; then
if command -v sphinx-build &> /dev/null; then
echo "📝 Building Sphinx documentation..." >&2
sphinx-build -b html docs ./docs/_build 2>/dev/null && echo "✅ Sphinx documentation built" >&2
fi
elif command -v sphinx-quickstart &> /dev/null; then
echo "📝 Setting up Sphinx documentation..." >&2
PROJECT_NAME=$(basename "$(pwd)")
sphinx-quickstart -q -p "$PROJECT_NAME" -a "Claude" --ext-autodoc --makefile docs 2>/dev/null
[ $? -eq 0 ] && echo "✅ Sphinx project initialized in docs/" >&2
fi
fi
# Go projects
if [ -f "go.mod" ]; then
echo "🐹 Go project detected" >&2
if command -v go &> /dev/null; then
echo "📝 Generating Go documentation..." >&2
go doc -all > ./docs/api.txt 2>/dev/null && echo "✅ Go documentation generated" >&2
# Try godoc if available
if command -v godoc &> /dev/null; then
echo "💡 Run 'godoc -http=:6060' to serve documentation locally" >&2
fi
fi
fi
# Rust projects
if [ -f "Cargo.toml" ]; then
echo "🦀 Rust project detected" >&2
if command -v cargo &> /dev/null; then
echo "📝 Generating Rust documentation..." >&2
cargo doc --no-deps --target-dir ./docs/rust 2>/dev/null && echo "✅ Rust documentation generated" >&2
fi
fi
# Update CHANGELOG.md
echo "📝 Updating changelog..." >&2
CHANGELOG_ENTRY="## Session $SESSION_DATE at $SESSION_TIME\n\n- Files modified: $MODIFIED_COUNT\n- Documentation updated automatically\n- Session completed\n\n"
if [ -f "CHANGELOG.md" ]; then
# Prepend to existing changelog
echo -e "$CHANGELOG_ENTRY$(cat CHANGELOG.md)" > CHANGELOG.md.tmp && mv CHANGELOG.md.tmp CHANGELOG.md
else
# Create new changelog
echo -e "# Changelog\n\n$CHANGELOG_ENTRY" > CHANGELOG.md
fi
echo "✅ Changelog updated" >&2
# Generate or update README.md if it doesn't exist
if [ ! -f "README.md" ]; then
echo "📝 Creating basic README.md..." >&2
PROJECT_NAME=$(basename "$(pwd)")
cat > README.md << EOF
# $PROJECT_NAME
Project documentation generated automatically.
## Documentation
API documentation can be found in the \`docs/\` directory.
## Last Updated
$TIMESTAMP
EOF
echo "✅ README.md created" >&2
fi
# Create documentation index
echo "📋 Creating documentation index..." >&2
cat > ./docs/index.md << EOF
# Project Documentation
Generated on: $TIMESTAMP
## Available Documentation
EOF
# List available documentation files
find ./docs -name "*.md" -o -name "*.html" -o -name "index.html" 2>/dev/null | while read -r file; do
echo "- [$(basename "$file")]($(basename "$file"))" >> ./docs/index.md
done
echo "" >&2
echo "📚 Documentation generation completed!" >&2
echo "📁 Check the ./docs/ directory for generated documentation" >&2
echo "📋 Documentation index available at ./docs/index.md" >&2
exit 0{
"hooks": {
"stop": {
"script": "./.claude/hooks/documentation-auto-generator-on-stop.sh"
}
}
}.claude/settings.local.json~/.claude/settings.json.claude/settings.json{
"hooks": {
"stop": {
"script": "./.claude/hooks/documentation-auto-generator-on-stop.sh"
}
}
}
#!/usr/bin/env bash
echo "📚 Starting documentation generation..." >&2
# Create docs directory if it doesn't exist
mkdir -p ./docs
# Generate timestamp for session
SESSION_DATE=$(date +"%Y-%m-%d")
SESSION_TIME=$(date +"%H:%M:%S")
TIMESTAMP="$SESSION_DATE $SESSION_TIME"
# Count modified files if in git repo
MODIFIED_COUNT=0
if command -v git &> /dev/null && git rev-parse --git-dir > /dev/null 2>&1; then
MODIFIED_COUNT=$(git diff --name-only 2>/dev/null | wc -l | xargs)
fi
echo "📊 Session summary: $MODIFIED_COUNT files modified" >&2
# JavaScript/TypeScript projects
if [ -f "package.json" ]; then
echo "🟡 JavaScript/TypeScript project detected" >&2
# Try TypeDoc first for TypeScript projects
if ls *.ts src/**/*.ts 2>/dev/null | head -1 > /dev/null; then
if command -v npx &> /dev/null && npx typedoc --version &> /dev/null 2>&1; then
echo "📝 Generating TypeDoc documentation..." >&2
npx typedoc --out ./docs/api src 2>/dev/null && echo "✅ TypeDoc documentation generated" >&2
else
echo "💡 Install TypeDoc for better TypeScript docs: npm install -g typedoc" >&2
fi
fi
# Try JSDoc for JavaScript projects
if [ -f "jsdoc.json" ] || [ -f "jsdoc.conf.json" ]; then
if command -v npx &> /dev/null && npx jsdoc --version &> /dev/null 2>&1; then
echo "📝 Generating JSDoc documentation..." >&2
npx jsdoc -c jsdoc.json 2>/dev/null || npx jsdoc -c jsdoc.conf.json 2>/dev/null
[ $? -eq 0 ] && echo "✅ JSDoc documentation generated" >&2
fi
fi
# Try documentation.js as fallback
if command -v npx &> /dev/null; then
if npx documentation --version &> /dev/null 2>&1; then
echo "📝 Generating documentation.js docs..." >&2
npx documentation build './src/**/*.js' -f md -o ./docs/api.md 2>/dev/null
[ $? -eq 0 ] && echo "✅ Documentation.js docs generated" >&2
fi
fi
fi
# Python projects
if [ -f "setup.py" ] || [ -f "pyproject.toml" ] || [ -f "requirements.txt" ]; then
echo "🐍 Python project detected" >&2
# Try pdoc for simple API docs
if command -v pdoc &> /dev/null; then
echo "📝 Generating pdoc documentation..." >&2
pdoc --html --output-dir ./docs . 2>/dev/null && echo "✅ pdoc documentation generated" >&2
elif command -v python &> /dev/null; then
if python -c "import pdoc" 2>/dev/null; then
echo "📝 Generating pdoc documentation..." >&2
python -m pdoc --html --output-dir ./docs . 2>/dev/null && echo "✅ pdoc documentation generated" >&2
fi
fi
# Try Sphinx for comprehensive docs
if [ -f "docs/conf.py" ]; then
if command -v sphinx-build &> /dev/null; then
echo "📝 Building Sphinx documentation..." >&2
sphinx-build -b html docs ./docs/_build 2>/dev/null && echo "✅ Sphinx documentation built" >&2
fi
elif command -v sphinx-quickstart &> /dev/null; then
echo "📝 Setting up Sphinx documentation..." >&2
PROJECT_NAME=$(basename "$(pwd)")
sphinx-quickstart -q -p "$PROJECT_NAME" -a "Claude" --ext-autodoc --makefile docs 2>/dev/null
[ $? -eq 0 ] && echo "✅ Sphinx project initialized in docs/" >&2
fi
fi
# Go projects
if [ -f "go.mod" ]; then
echo "🐹 Go project detected" >&2
if command -v go &> /dev/null; then
echo "📝 Generating Go documentation..." >&2
go doc -all > ./docs/api.txt 2>/dev/null && echo "✅ Go documentation generated" >&2
# Try godoc if available
if command -v godoc &> /dev/null; then
echo "💡 Run 'godoc -http=:6060' to serve documentation locally" >&2
fi
fi
fi
# Rust projects
if [ -f "Cargo.toml" ]; then
echo "🦀 Rust project detected" >&2
if command -v cargo &> /dev/null; then
echo "📝 Generating Rust documentation..." >&2
cargo doc --no-deps --target-dir ./docs/rust 2>/dev/null && echo "✅ Rust documentation generated" >&2
fi
fi
# Update CHANGELOG.md
echo "📝 Updating changelog..." >&2
CHANGELOG_ENTRY="## Session $SESSION_DATE at $SESSION_TIME\n\n- Files modified: $MODIFIED_COUNT\n- Documentation updated automatically\n- Session completed\n\n"
if [ -f "CHANGELOG.md" ]; then
# Prepend to existing changelog
echo -e "$CHANGELOG_ENTRY$(cat CHANGELOG.md)" > CHANGELOG.md.tmp && mv CHANGELOG.md.tmp CHANGELOG.md
else
# Create new changelog
echo -e "# Changelog\n\n$CHANGELOG_ENTRY" > CHANGELOG.md
fi
echo "✅ Changelog updated" >&2
# Generate or update README.md if it doesn't exist
if [ ! -f "README.md" ]; then
echo "📝 Creating basic README.md..." >&2
PROJECT_NAME=$(basename "$(pwd)")
cat > README.md << EOF
# $PROJECT_NAME
Project documentation generated automatically.
## Documentation
API documentation can be found in the \`docs/\` directory.
## Last Updated
$TIMESTAMP
EOF
echo "✅ README.md created" >&2
fi
# Create documentation index
echo "📋 Creating documentation index..." >&2
cat > ./docs/index.md << EOF
# Project Documentation
Generated on: $TIMESTAMP
## Available Documentation
EOF
# List available documentation files
find ./docs -name "*.md" -o -name "*.html" -o -name "index.html" 2>/dev/null | while read -r file; do
echo "- [$(basename "$file")]($(basename "$file"))" >> ./docs/index.md
done
echo "" >&2
echo "📚 Documentation generation completed!" >&2
echo "📁 Check the ./docs/ directory for generated documentation" >&2
echo "📋 Documentation index available at ./docs/index.md" >&2
exit 0
Complete hook script that performs automatic documentation generation when session ends
#!/usr/bin/env bash
echo "Starting documentation generation..." >&2
mkdir -p ./docs
SESSION_DATE=$(date +"%Y-%m-%d")
SESSION_TIME=$(date +"%H:%M:%S")
MODIFIED_COUNT=0
if command -v git &> /dev/null && git rev-parse --git-dir > /dev/null 2>&1; then
MODIFIED_COUNT=$(git diff --name-only 2>/dev/null | wc -l | xargs)
fi
echo "Session summary: $MODIFIED_COUNT files modified" >&2
if [ -f "package.json" ]; then
if ls *.ts src/**/*.ts 2>/dev/null | head -1 > /dev/null; then
if command -v npx &> /dev/null && npx typedoc --version &> /dev/null 2>&1; then
echo "Generating TypeDoc documentation..." >&2
npx typedoc --out ./docs/api src 2>/dev/null && echo "TypeDoc documentation generated" >&2
fi
fi
fi
echo "Documentation generation completed!" >&2
exit 0
Enhanced hook script using TypeDoc 0.26.0+ with entry points and configuration options
#!/usr/bin/env bash
INPUT=$(cat)
if [ -f "package.json" ]; then
if ls *.ts src/**/*.ts 2>/dev/null | head -1 > /dev/null; then
if command -v npx &> /dev/null && npx typedoc --version &> /dev/null 2>&1; then
echo "Generating TypeDoc documentation..." >&2
npx typedoc --entryPoints "./src/index.ts" --out ./docs/api --readme README.md --excludePrivate --excludeInternal 2>/dev/null && echo "TypeDoc documentation generated" >&2
fi
fi
fi
exit 0
Enhanced hook script using pdoc 14.0+ for Python project documentation generation
#!/usr/bin/env bash
if [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then
if command -v pdoc &> /dev/null; then
echo "Generating pdoc documentation..." >&2
pdoc --html --output-dir ./docs . 2>/dev/null && echo "pdoc documentation generated" >&2
elif command -v python &> /dev/null; then
if python -c "import pdoc" 2>/dev/null; then
echo "Generating pdoc documentation..." >&2
python -m pdoc --html --output-dir ./docs . 2>/dev/null && echo "pdoc documentation generated" >&2
fi
fi
fi
exit 0
Enhanced hook script for automatic changelog updates with session summaries and file modification tracking
#!/usr/bin/env bash
SESSION_DATE=$(date +"%Y-%m-%d")
SESSION_TIME=$(date +"%H:%M:%S")
MODIFIED_COUNT=0
if command -v git &> /dev/null && git rev-parse --git-dir > /dev/null 2>&1; then
MODIFIED_COUNT=$(git diff --name-only 2>/dev/null | wc -l | xargs)
fi
CHANGELOG_ENTRY="## Session $SESSION_DATE at $SESSION_TIME\n\n- Files modified: $MODIFIED_COUNT\n- Documentation updated automatically\n- Session completed\n\n"
if [ -f "CHANGELOG.md" ]; then
echo -e "$CHANGELOG_ENTRY$(cat CHANGELOG.md)" > CHANGELOG.md.tmp && mv CHANGELOG.md.tmp CHANGELOG.md
else
echo -e "# Changelog\n\n$CHANGELOG_ENTRY" > CHANGELOG.md
fi
echo "Changelog updated" >&2
exit 0
Create tsconfig.json with explicit include paths or add 'entryPoints' to typedoc.json config. Use 'npx typedoc --entryPoints src/index.ts' to specify entry point directly in command. Verify TypeScript project structure and ensure entry points exist. Check TypeDoc version is 0.26.0+ for latest features.
Implement changelog rotation by keeping only last 50 entries or use date-based sections. Archive old entries to CHANGELOG.archive.md when main file exceeds size threshold like 10KB. Use date-based grouping to consolidate multiple sessions per day. Consider using semantic versioning for changelog organization.
Check documentation tool exit codes and stderr output for generation failures. Ensure write permissions on docs directory and verify sufficient disk space for generated HTML and asset files. Verify documentation generator is installed and accessible. Check for errors in documentation generator output.
Add project root to PYTHONPATH in hook script: 'export PYTHONPATH="${PYTHONPATH}:$(pwd)"'. Install project dependencies in documentation build environment before running sphinx-build command. Verify Sphinx version is 7.0+ for latest features. Check sphinx configuration in docs/conf.py.
Move heavy documentation builds to separate CI job instead of stop hook. Use lightweight generators like pdoc 14.0+ for stop hook, reserving Sphinx or comprehensive builds for scheduled documentation updates. Set timeout limits for documentation generation. Consider incremental documentation updates.
Verify JSDoc version is 4.0.0+ and project dependencies are installed. Check jsdoc.json configuration file exists and is valid. Ensure source files are accessible and paths in configuration are correct. Install missing npm dependencies: npm install.
Verify pdoc version is 14.0+ and Python environment is correct. Check Python package structure and ensure init.py files exist. Verify module imports work correctly: python -c 'import your_module'. Use --html flag for HTML output: pdoc --html --output-dir ./docs .
Configure hook to use only one documentation generator per project type. Check project type detection logic and ensure appropriate generator is selected. Use conditional logic to prevent multiple generators from running. Verify documentation output directories are separate for each generator.
Show that Doc Auto Generator is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/hooks/documentation-auto-generator-on-stop)Doc Auto Generator side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Automatically generates or updates project documentation when session ends. Open dossier | Automatically generates and updates project documentation from code comments, README files, and API definitions. This PostToolUse hook provides real-time documentation generation when code files are modified, supporting multiple programming languages and documentation formats. Open dossier | PostToolUse hook that extracts JSDoc and pydoc comments from modified API endpoint files and generates OpenAPI 3.1.0-compatible YAML documentation on every save. Open dossier | Automatically commits all changes with a summary when Claude Code session ends. Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | hooks | hooks | hooks | hooks |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-09-19 | 2025-09-16 | 2025-09-19 | 2025-09-19 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically after write/edit tool use and may invoke local documentation generators such as npx jsdoc, jsdoc2md, typedoc, pdoc, pydoc, go doc, or cargo doc. Can write generated documentation under ./docs and may be slow on large source files or projects with expensive documentation tooling. | ✓Runs automatically after write or edit tool calls on route, controller, and API files. Invokes npx swagger-jsdoc or npx jsdoc to generate docs; executes python -m pydoc for Python files. Writes generated documentation files to ./docs/api/ in the project directory. | ✓Runs automatically at session end and stages all unignored repository changes with git add -A. Creates a local commit when changes are present unless SKIP_AUTO_COMMIT=true is set. Only warns on sensitive-looking filenames and does not block the commit by default. |
| Privacy notes | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Reads modified source, README, Markdown, and package metadata files to count comments, links, functions, classes, and documentation sections. Generated documentation may include source comments, API details, project names, and README content from the local workspace. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Reads git status, branch name, staged diff statistics, and changed file names to build the commit message. Can commit newly created or modified local files, including private work, when they are not excluded by .gitignore. Commit metadata uses the locally configured git user name and email. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | | | | |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Set autoMode.hard_deny rules to block risky actions in auto mode.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.