agentleFS
opendatahub-ioopendatahub-io/docs-skills/skills/redhat-docs-toc/SKILL.md

redhat-docs-toc

Skill4 starsChanged 4 months agoApache-2.0View on GitHub

Extract distinct article URLs from Red Hat documentation table of contents pages. Parse the TOC navigation to find all separate documentation articles. Useful for crawling and processing multi-page Red Hat documentation.

  • Installs packages

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Filter Duplicates: Remove duplicate URLs and section anchors

    line 16
  2. Distinctive:

    Automated Testing: Verify all documentation pages are accessible

    line 140
  3. Distinctive:

    No rate limiting by default (respect Red Hat's robots.txt)

    line 147
  4. Very specific:

    Only works with Red Hat documentation pages that use <nav id="toc"> structure

    line 151

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Red Hat Docs TOC Extractor Skill

This skill extracts distinct article URLs from Red Hat documentation table of contents (TOC) pages. It parses the navigation element to find all separate documentation articles, making it easy to process or download entire documentation sections.

Capabilities

  • Extract Article URLs: Find all distinct article pages from a docs index
  • Parse TOC Navigation: Locate and parse <nav id="toc"> elements
  • Filter Duplicates: Remove duplicate URLs and section anchors
  • Sort Results: Return alphabetically sorted article URLs
  • JSON Output: Structured output with article count and URLs

Usage

The skill uses a Python script that downloads and parses Red Hat docs pages.

Basic Usage

Extract article URLs from a docs index:

uv run --script ${CLAUDE_SKILL_DIR}/scripts/toc_extractor.py --url "https://docs.redhat.com/en/documentation/product/version/html/guide/index"

Save to file:

uv run --script ${CLAUDE_SKILL_DIR}/scripts/toc_extractor.py --url "https://docs.redhat.com/..." --output articles.json

List format output:

uv run --script ${CLAUDE_SKILL_DIR}/scripts/toc_extractor.py --url "https://docs.redhat.com/..." --format list

Command Line Options

  • --url URL: The Red Hat docs URL to extract TOC from (required)
  • --output FILE: Save output to file instead of stdout
  • --format {json,list}: Output format (default: json)

Output Formats

JSON (default):

{
  "source_url": "https://docs.redhat.com/...",
  "article_count": 3,
  "articles": [
    "https://docs.redhat.com/.../article1",
    "https://docs.redhat.com/.../article2",
    "https://docs.redhat.com/.../article3"
  ]
}

List:

https://docs.redhat.com/.../article1
https://docs.redhat.com/.../article2
https://docs.redhat.com/.../article3

Examples

OpenShift Lightspeed Configure Documentation

# Extract all articles from the Configure guide
uv run --script ${CLAUDE_SKILL_DIR}/scripts/toc_extractor.py \
  --url "https://docs.redhat.com/en/documentation/red_hat_openshift_lightspeed/1.0/html/configure/index"

Output:

{
  "source_url": "https://docs.redhat.com/en/documentation/red_hat_openshift_lightspeed/1.0/html/configure/index",
  "article_count": 3,
  "articles": [
    "https://docs.redhat.com/en/documentation/red_hat_openshift_lightspeed/1.0/html/configure/legal-notice",
    "https://docs.redhat.com/en/documentation/red_hat_openshift_lightspeed/1.0/html/configure/ols-configuring-openshift-lightspeed",
    "https://docs.redhat.com/en/documentation/red_hat_openshift_lightspeed/1.0/html/configure/olsconfig-api"
  ]
}

Combined with Article Extractor

Extract TOC URLs then download each article:

# Step 1: Extract article URLs
uv run --script ${CLAUDE_SKILL_DIR}/scripts/toc_extractor.py \
  --url "https://docs.redhat.com/.../configure/index" \
  --format list > /tmp/articles.txt

# Step 2: Download each article
while read url; do
  filename=$(basename "$url").md
  uv run --script ${CLAUDE_PLUGIN_ROOT}/skills/article-extractor/scripts/article_extractor.py \
    --url "$url" \
    --format markdown \
    --output "$filename"
done < /tmp/articles.txt

Dependencies

This skill requires the following Python packages:

  • requests: For downloading HTML content
  • beautifulsoup4: For parsing HTML

Install dependencies:

python3 -m pip install requests beautifulsoup4

How It Works

  1. Download Page: Fetches the HTML from the provided Red Hat docs URL
  2. Locate TOC: Finds the <nav id="toc" class="table-of-contents"> element
  3. Extract Links: Parses all <a> tags within the TOC
  4. Filter URLs:
    • Removes anchor-only links (#section)
    • Removes section fragments (page#section → page)
    • Skips index pages
    • Converts relative to absolute URLs
  5. Deduplicate: Removes duplicate URLs
  6. Sort: Returns alphabetically sorted list

Use Cases

  1. Documentation Crawling: Get all article URLs for batch processing
  2. Documentation Archival: Download entire documentation sections
  3. Content Analysis: Analyze documentation structure and organization
  4. Automated Testing: Verify all documentation pages are accessible
  5. Documentation Migration: Extract content for migration to different platforms

Performance

  • Single page extraction: ~1-3 seconds depending on network
  • Memory efficient: streams HTML parsing
  • No rate limiting by default (respect Red Hat's robots.txt)

Limitations

  • Only works with Red Hat documentation pages that use <nav id="toc"> structure
  • Requires the page to be publicly accessible (no authentication support)
  • Returns only distinct article pages (not subsections within articles)
  • Depends on Red Hat's documentation HTML structure

TOC Structure

Red Hat documentation uses a consistent TOC structure:

<nav id="toc" class="table-of-contents" aria-label="Table of contents">
  <ol id="toc-list">
    <li class="item chapter">
      <a class="link" href="/path/to/article">Article Title</a>
    </li>
    <li class="item chapter">
      <details>
        <summary>Chapter Title</summary>
        <ol class="sub-nav">
          <li class="item sub-chapter">
            <a class="link" href="/path/to/subarticle">Subarticle</a>
          </li>
        </ol>
      </details>
    </li>
  </ol>
</nav>

The script extracts all href attributes from links and filters for distinct article pages.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.