← 返回 Skills 市场
erergb

Auto Doc Index

作者 ERerGB · GitHub ↗ · v1.2.0
cross-platform ✓ 安全检测通过
389
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install auto-doc-index
功能描述
Auto-generate document index tables (ADR, RFC, Pitfall, etc.) from file frontmatter. In real-world testing, hand-maintained indexes had a 62% error rate — ti...
使用说明 (SKILL.md)

Auto Doc Index — Derived Indexes from Frontmatter

Replaces hand-maintained index tables in README.md with auto-generated tables derived from structured frontmatter in individual doc files.

Why This Matters — Real Evidence

In a real project with 13 ADR files, comparing hand-maintained index vs auto-generated index revealed 8 discrepancies (62% error rate):

Issue Type Example Count
Title truncated "activate none" vs actual "activate none by default" 2
Status fabricated Index said "Decided" but file said "Accepted" 3
Date invented Index showed "2026-01-28" but file had no Date field 1
Metadata lost "(revised 2026-01-28)" stripped from status 1
Case "normalized" decided silently changed to Decided 4

These aren't hypothetical risks — they were already present and invisible in a well-maintained project. Hand-editing creates a false sense of correctness while the index silently diverges from its source files.

When to Use

  • Setting up a new documentation directory (ADR, RFC, Pitfall, Design Doc, etc.)
  • Adding a new document to an existing indexed directory
  • Onboarding a project that has hand-maintained doc indexes showing signs of drift
  • Resolving recurring merge conflicts in shared README.md index tables
  • Migrating from hand-maintained indexes to auto-generated ones

Boundaries

  • This skill generates index tables only — it does not create or modify the content of individual documents.
  • The generator script replaces content only between \x3C!-- INDEX:START --> and \x3C!-- INDEX:END --> markers. All other README.md content is preserved verbatim.
  • Do NOT use this for indexes that require editorial curation (e.g., "recommended reading order"). Auto-generation is for factual, exhaustive catalogs.
  • Do NOT introduce YAML frontmatter parsing libraries — the regex-based approach is intentional to keep the script zero-dependency.
  • This skill targets file-system-based documentation. It does not apply to wiki-style or database-backed doc systems.

Problem

A hand-maintained index in README.md is shared mutable state — every new document requires editing the same file, same table, often the same diff hunk. In multi-agent or multi-contributor workflows this creates:

  • Silent data loss: titles get shortened, statuses get "corrected"
  • Merge conflicts: semantically independent changes collide in the same hunk
  • Stale indexes: contributors forget to update, nobody notices
  • Normalization illusion: edits look "cleaner" but diverge from source

Solution

Each document is self-describing via frontmatter. A generator script scans the directory, parses frontmatter, and injects the index table between \x3C!-- INDEX:START --> / \x3C!-- INDEX:END --> markers in README.md.

Write ops become N:N (each file independent). Index becomes a stateless pure function.

Setup Steps

1. Define frontmatter convention

Choose a frontmatter format for your doc type. Two common patterns:

Pattern A — Inline metadata (ADR/RFC style):

# ADR-001: Title Here

Status: Decided
Date: 2026-01-28

## Context
...

Pattern B — Bold-field metadata (Pitfall/Postmortem style):

# PIT-001: Title Here

**Date:** 2026-01-28
**Area:** engine
**Severity:** high
**Status:** resolved

2. Add markers to README.md

Wrap the existing index table (or create a placeholder) with markers:

## Index

\x3C!-- INDEX:START -->
| ADR | Title | Status | Date |
|-----|-------|--------|------|
\x3C!-- INDEX:END -->

## Other Sections (preserved)
...

Content outside markers is never touched by the generator.

3. Create the generator script

Copy template/generate-doc-index.ts from this skill's template directory, or generate a new one following the pattern below.

Core architecture (zero external dependencies):

// 1. Scan directory for matching files (e.g. /^\d{3}-.*\.md$/)
// 2. Parse frontmatter from each file (regex-based, no YAML lib needed)
// 3. Sort entries by ID/number
// 4. Generate markdown table string
// 5. Inject between \x3C!-- INDEX:START --> and \x3C!-- INDEX:END --> markers

See template/generate-doc-index.ts for a working implementation that handles both Pattern A and Pattern B.

4. Run the generator

npx tsx scripts/generate-doc-index.ts all

5. Update documentation governance

Add to your project's AGENTS.md or CONTRIBUTING.md:

Rule: Never hand-edit the index table between \x3C!-- INDEX:START/END --> markers. To add a new document, create the .md file with proper frontmatter, then run the generator.

Workflow Comparison

OLD: Write doc → Hand-edit README.md index → Conflict risk
NEW: Write doc → Run generator → Idempotent rebuild, zero conflicts

Adding a New Doc Type

To support a new document category (e.g. RFCs, Design Docs):

  1. Define the frontmatter convention
  2. Add a parser function (regex for title, status, date, etc.)
  3. Add a table generator function (column layout)
  4. Add \x3C!-- INDEX:START/END --> markers to the README.md
  5. Register in the script's main() dispatcher

Anti-patterns

  • Do NOT use YAML frontmatter libraries — regex is sufficient and avoids deps.
  • Do NOT generate the entire README.md — only the index section. Preserve manually-written intro, templates, and notes via the marker pattern.
  • Do NOT require contributors to run the generator before committing. Run it in CI or as a pre-commit hook for enforcement.

Checklist

- [ ] Frontmatter convention defined for each doc type
- [ ] README.md has \x3C!-- INDEX:START --> and \x3C!-- INDEX:END --> markers
- [ ] Generator script created and tested
- [ ] Documentation governance updated (AGENTS.md / CONTRIBUTING.md)
- [ ] (Optional) Pre-commit hook or CI step added
安全使用建议
This skill appears to do what it says: generate index tables from per-file frontmatter and inject them between explicit markers in README.md. Before using it: (1) back up your README.md (or run in a branch/CI) so you can inspect diffs the first time it runs, (2) add the required <!-- INDEX:START/END --> markers in the intended README, (3) ensure the script's DOC_ROOT matches where your docs live (the template expects ../doc relative to the script), (4) be aware the parser is regex-based — it may mis-handle unusual frontmatter formats — review generated output for correctness, and (5) running with `npx tsx` will fetch a runtime from npm at execution time, so if you prefer no network fetch, compile/transpile the script or run with an existing local Node toolchain. If you need broader guarantees (e.g., CI-only execution), integrate the generator into CI or pre-commit hooks and require reviewers to inspect the generated changes.
功能分析
Type: OpenClaw Skill Name: auto-doc-index Version: 1.2.0 The skill bundle is benign. Its purpose is to auto-generate documentation index tables, which is clearly stated and consistently implemented across `SKILL.md` and `template/generate-doc-index.ts`. The `SKILL.md` file contains no prompt injection attempts against the AI agent. The core script (`template/generate-doc-index.ts`) uses Node.js `fs` module for file operations (reading markdown files, writing to `README.md`) within a defined and limited scope (`doc/adr`, `doc/pitfall` directories). It does not perform network calls, execute arbitrary commands, access sensitive system files, or implement persistence mechanisms. While a minor markdown injection vulnerability could exist if document titles or statuses contain unescaped markdown table syntax, this is a data formatting flaw, not evidence of malicious intent or a high-risk system compromise.
能力评估
Purpose & Capability
Name and description (auto-generate index tables from frontmatter) match the included template script and SKILL.md. The script only reads markdown files in a project doc tree and writes README.md index sections; no unrelated services, credentials, or binaries are requested.
Instruction Scope
SKILL.md instructs copying the included TypeScript template and running it to regenerate index sections between <!-- INDEX:START --> and <!-- INDEX:END --> markers. The runtime instructions and the script are consistent: they only read files under the doc/adr and doc/pitfall directories and write the README.md files in those directories. Note: the script uses regex-based parsing (no YAML lib) by design and uses a DOC_ROOT of join(__dirname, '..', 'doc'), so consumers must place the script or adjust paths appropriately. There is no instruction to read unrelated files, environment variables, or send data externally.
Install Mechanism
This is instruction-only (no install spec). The template is included as source code (TypeScript). There are no external downloads or install steps in the skill itself. Practical usage advice in README suggests running via `npx tsx`, which will pull a runtime from npm at execution time — not part of a packaged install but something users should be aware of.
Credentials
The skill declares no required environment variables or credentials and the script does not read any environment variables or config paths. The level of access requested (filesystem read of doc files and write to README.md in the targeted directories) is proportionate to the stated purpose.
Persistence & Privilege
always is false and the skill does not request permanent system presence or modify other skills or global agent settings. The default ability for the agent to invoke the skill autonomously is not problematic here and is typical for skills.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install auto-doc-index
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /auto-doc-index 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.0
Open-source release with multi-agent format translations (Cursor MDC, Windsurf, GitHub Copilot), SkillKit validation Grade B (88/100), When to Use triggers, Boundaries, GitHub repo: github.com/ERerGB/auto-doc-index
v1.1.0
Add real-world value evidence: 62% error rate in hand-maintained indexes (8/13 entries had silent drift — truncated titles, fabricated statuses, invented dates). Updated description and Problem section with concrete data.
v1.0.0
Initial release: marker-based index generation from frontmatter for ADR, Pitfall, RFC, and other doc types. Zero deps.
元数据
Slug auto-doc-index
版本 1.2.0
许可证
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Auto Doc Index 是什么?

Auto-generate document index tables (ADR, RFC, Pitfall, etc.) from file frontmatter. In real-world testing, hand-maintained indexes had a 62% error rate — ti... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 389 次。

如何安装 Auto Doc Index?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install auto-doc-index」即可一键安装,无需额外配置。

Auto Doc Index 是免费的吗?

是的,Auto Doc Index 完全免费(开源免费),可自由下载、安装和使用。

Auto Doc Index 支持哪些平台?

Auto Doc Index 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Auto Doc Index?

由 ERerGB(@erergb)开发并维护,当前版本 v1.2.0。

💬 留言讨论