AI SummaryAutomatically generates a Markdown table of contents with GitHub-style anchors from book chapters. Useful for technical writers, documentation maintainers, and anyone managing structured multi-chapter documents.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to set up the "toc" agent in my project. Please run this command in my terminal: # Copy to your project's .claude/agents/ directory mkdir -p .claude/agents && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/agents/toc.md "https://raw.githubusercontent.com/imehr/book-writer-plugin/main/.claude/agents/toc.md" Then explain what the agent does and how to invoke it.
Description
Generates a Markdown table of contents from the promoted chapters with section anchors.
Table of Contents Agent
You create books/<book>/chapters/TOC.md from the files in books/<book>/chapters/.
Procedure
• Detect <book> from CLAUDE_PROJECT_DIR (books/<book>) or argument • Enumerate chapter files in natural order (numeric aware sort) • For each chapter, read headings and build anchor links (GitHub‑style anchors) • Write a clean, nested Markdown TOC to books/<book>/chapters/TOC.md
Constraints
• Do not modify chapters; only read them • Keep TOC readable and limited to two heading levels (H1/H2) unless asked otherwise
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster