tylervovan

Agent Docs

知识管理v1.0.0
作者:tylervovan更新于 2026-05-11agent-docs
#Docs#Documentation#Rag

据 AlphaMoat 统计,截至 2026-09,Agent Docs 累计下载 4,061 次、获 4 个星标,在全部 5,078 个 AI 技能中排名第 2,500 位,在「知识管理」分类(442 个)中排名第 232 位。

累计安装
130
累计下载
4,061
星标
4
全站排名
#2,500
全站前 50% · 「知识管理」前 53%
平台累计安装累计下载星标评论
ClawHub ↗1304,0614-

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

该技能介绍如何组织 SKILL.md、README、API 文档和索引,强调分层上下文、按主题分块、压缩检索索引,并前置安全约束。生成的 AGENTS.md、llms.txt、CI 片段或安全规则可能不准确、过时或范围过宽;采纳前应逐项审核。若采用外部检索,应使用域名白名单、人工复核并审计请求。

资料发布于 2026-10-29

可以用来做什么

  • 需要编写面向 agent 的项目文档、API 指南或检索索引的开发者和技术写作者。

什么时候用

  • 将文档建议视为草稿;在提交到项目之前核验命令、路径、安全规则和来源。外部检索需限制允许域名并保留审核。

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

为一个项目规划 agent 可读文档的结构,并列出采纳前的核验步骤;不要编写或修改文件。

月度数据趋势

累计下载4,061
3,3803,7464,1112026-06 · 累计下载 3,4302026-09 · 累计下载 4,06126-0626-09
星标4
3452026-06 · 星标 42026-09 · 星标 426-0626-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,061—4
2026-063,430—4

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

4.5 KB · ClawHub v1.0.0
---
name: agent-docs
description: Create documentation optimized for AI agent consumption. Use when writing SKILL.md files, README files, API docs, or any documentation that will be read by LLMs in context windows. Helps structure content for RAG retrieval, token efficiency, and the Hybrid Context Hierarchy.
---

# Agent Docs

Write documentation that AI agents can efficiently consume. Based on Vercel benchmarks and industry standards (AGENTS.md, llms.txt, CLAUDE.md).

## The Hybrid Context Hierarchy
展开全部(共 169 行)

Three-layer architecture for optimal agent performance:

### Layer 1: Constitution (Inline)
**Always in context.** 2,000–4,000 tokens max.

```markdown
# AGENTS.md
> Context: Next.js 16 | Tailwind | Supabase

## 🚨 CRITICAL
- NO SECRETS in output
- Use `app/` directory ONLY

## 📚 DOCS INDEX (use read_file)
- Auth: `docs/auth/llms.txt`
- DB: `docs/db/schema.md`
```

**Include:**
- Security rules, architecture constraints
- Build/test/lint commands (top for primacy bias)
- Documentation map (where to find more)

### Layer 2: Reference Library (Local Retrieval)
**Fetched on demand.** 1K–5K token chunks.

- Framework-specific guides
- Detailed style guides
- API schemas

### Layer 3: Research Assistant (External)
**Gated by allow-lists.** Edge cases only.

- Latest library updates
- Stack Overflow for obscure errors
- Third-party llms.txt

## Why This Works

**Vercel Benchmark (2026):**
| Approach | Pass Rate |
|----------|-----------|
| Tool-based retrieval | 53% |
| Retrieval + prompting | 79% |
| **Inline AGENTS.md** | **100%** |

**Root cause:** Meta-cognitive failure. Agents don't know what they don't know—they assume training data is sufficient. Inline docs bypass this entirely.

## Core Principles

### 1. Compressed Index > Full Docs

An 8KB compressed index outperforms a 40KB full dump.

**Compress to:**
- File paths (where code lives)
- Function signatures (names + types only)
- Negative constraints ("Do NOT use X")

### 2. Structure for Chunking

RAG systems split at headers. Each section must be self-contained:

```markdown
## Database Setup          ← Chunk boundary

Prerequisites: PostgreSQL 14+

1. Create database...
```

**Rules:**
- Front-load key info (chunkers truncate)
- Descriptive headers (agents search by header text)

### 3. Inline Over Links

Agents can't autonomously browse. Each link = tool call + latency + potential failure.

| Approach | Token Load | Agent Success |
|----------|------------|---------------|
| Full inline | ~12K | ✅ High |
| Links only | ~2K | ❌ Requires fetching |
| Hybrid | ~4K base | ✅ Best of both |

### 4. The "Lost in the Middle" Problem

LLMs have U-shaped attention:
- **Strong:** Start of context (primacy)
- **Strong:** End of context (recency)
- **Weak:** Middle of context

**Solution:** Put critical rules at TOP of AGENTS.md. Governance first, details later.

### 5. Signal-to-Noise Ratio

Strip everything that isn't essential:
- No "Welcome to..." preambles
- No marketing text
- No changelogs in core docs

Formats like llms.txt and AGENTS.md mechanically increase SNR.

## llms.txt Standard

Machine-readable doc index for agents:

```markdown
# Project Name

> One-line project description.

## Authentication

- [Setup](docs/auth/setup.md): Environment vars and init
- [Server](docs/auth/server.md): Cookie handling

## Database

- [Schema](docs/db/schema.md): Full Prisma schema
```

**Location:** `/llms.txt` at domain root
**Companion:** `/llms-full.txt` — full concatenated docs, HTML stripped

## Security Considerations

### Inline = Trusted
AGENTS.md is part of your codebase. Controlled, version-pinned.

### External = Attack Surface
- Indirect prompt injection via hidden text
- SSRF risks if agents can browse freely
- Dependency on external uptime

**Mitigation:** Domain allow-lists, human-in-the-loop for external retrieval.

## Anti-Patterns

1. **Pasting 50 pages** — triggers "Lost in the Middle"
2. **"See external docs"** — agents can't browse autonomously
3. **Generic advice** — "Write clean code" (use specific constraints)
4. **TOC-only docs** — indexes without content
5. **Trusting retrieval alone** — 53% vs 100% pass rate

## Advanced Patterns

For detailed guidance on RAG optimization, multi-framework docs, and API templates, see [references/advanced-patterns.md](references/advanced-patterns.md).

## Validation Checklist

- [ ] Critical governance at TOP of doc
- [ ] Total inline context under 4K tokens
- [ ] Each H2 section self-contained
- [ ] No external links without inline summary
- [ ] Negative constraints explicit ("Do NOT...")
- [ ] File paths and signatures, not full code

「知识管理」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。