---
title: "Generate Markdown tables of contents before publishing docs or README updates"
description: "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."
verification: "security_reviewed"
source: "https://github.com/thlorenz/doctoc"
author: "Thorsten Lorenz"
category:
  - "Content Writing & SEO"
framework:
  - "Multi-Framework"
tool_ecosystem:
  github_repo: "thlorenz/doctoc"
  github_stars: 4432
---

# 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

Choose whichever fits your setup:

1. Copy this skill folder into your local skills directory.
2. Clone the repo and symlink or copy the skill into your agent workspace.
3. Add the repo as a git submodule if you manage shared skills centrally.
4. Install it through your internal provisioning or packaging workflow.
5. Download the folder directly from GitHub and place it in your skills collection.

Install command or upstream instructions:

```
npm install -g doctoc
```

## 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/)
