# Generate Markdown tables of contents before publishing docs or README updates

> Runs DocToc to insert or refresh navigable tables of contents inside Markdown files after headings already exist. Use it when an agent is preparing README or docs updates and needs reliable intra-document navigation, not when it is generating the documentation itself.

- Skill: `agentskillexchange/generate-markdown-tables-of-contents-before-publishing-docs-` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/generate-markdown-tables-of-contents-before-publishing-docs-`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/generate-markdown-tables-of-contents-before-publishing-docs-/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/generate-markdown-tables-of-contents-before-publishing-docs-

---


# Generate Markdown tables of contents before publishing docs or README updates

Runs DocToc to insert or refresh navigable tables of contents inside Markdown files after headings already exist. Use it when an agent is preparing README or docs updates and needs reliable intra-document navigation, not when it is generating the documentation itself.

## Prerequisites

Node.js, npm, command line

## Installation

Use the upstream install or setup path that matches your environment:
- npm install -g doctoc

Requirements and caveats from upstream:
- # DocToc [![Node.js CI](https://github.com/thlorenz/doctoc/actions/workflows/node.js.yml/badge.svg)](https://github.com/thlorenz/doctoc/actions/workflows/node.js.yml)
- [Docker image](#docker-image)
- ### Docker image

Basic usage or getting-started notes:
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Usage](#usage)
- [Example](#example)

- Source: https://github.com/thlorenz/doctoc
- Extracted from upstream docs: https://raw.githubusercontent.com/thlorenz/doctoc/HEAD/README.md

## Documentation

- https://github.com/thlorenz/doctoc#readme

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/generate-markdown-tables-of-contents-before-publishing-docs-or-readme-updates/)

