Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

optimize-agent-docs优化 Agent 文档

Agent Skill

用于辅助文档、README、Markdown、说明文和内容稿件的整理与改写。它适合让 Agent 提炼结构、补齐章节、统一术语、检查链接或把零散材料整理成可读文档。使用时应保留项目已有事实、命令和路径,不要把未确认的信息写成确定结论;涉及对外文案时,还需要控制语气,避免过度营销或夸大能力。

总安装

509

周安装

21

GitHub Stars

4

下载量

166
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:optimize-agent-docs(优化 Agent 文档)
来源仓库:https://github.com/petekp/agent-skills
仓库路径:skills/optimize-agent-docs
安装命令:
npx skills add https://github.com/petekp/agent-skills --skill optimize-agent-docs
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/petekp/agent-skills --skill optimize-agent-docs

简介

用于辅助文档、README、Markdown、说明文和内容稿件的整理与改写,适合提炼结构、补齐章节、统一术语或生成可读内容。

  • 适用于项目说明、用户指南与技术博客撰写等文档生产场景。
  • 可自动对齐目录层级、修复链接断裂与补充示例代码。
  • 安装命令:npx skills add https://github.com/petekp/agent-skills --skill optimize-agent-docs;需保留原始事实与路径信息。
  • 对外文案应避免过度承诺,防止夸大能力引发预期落差。

SKILL.md

Agent Knowledge Optimizer

Transform accumulated documentation into a retrieval-optimized knowledge system.

Core Principle

File organization is a human concern. Agents don't browse—they search and load. Optimize for:

  • Discovery: What knowledge exists?
  • Relevance: Is it needed for this task?
  • Efficiency: What's the minimum to load?

Workflow

Phase 1: Knowledge Extraction

Inventory all agent documentation:

# Find all agent doc sources
find . -maxdepth 2 -name "*.md" -path "*/.claude/*" -o \
       -name "*.md" -path "*/.codex/*" -o \
       -name "*.md" -path "*/.cursor/*" -o \
       -name "CLAUDE.md" -o -name "AGENTS.md" -o -name "INSTRUCTIONS.md"

For each file, extract:

  • Discrete facts (single pieces of actionable information)
  • Instructions (procedures, rules, constraints)
  • Context triggers (when is this knowledge needed?)

Phase 2: Chunk Analysis

Break content into retrieval units—the smallest self-contained piece of information that makes sense alone.

Good chunk:

## Adding API Endpoints
1. Create handler in src/handlers/
2. Register route in src/routes.rs
3. Add OpenAPI spec to docs/api.yaml

Bad chunk (too coupled):

See the API section for endpoint patterns, but first read the auth docs,
which reference the middleware guide...

Score each chunk:

  • Self-contained? Can agent act on this without loading more?
  • Task-specific? Clear when this is needed?
  • Information-dense? High signal per token?

Phase 3: Build Knowledge Manifest

Generate .claude/KNOWLEDGE.md—a lightweight index the agent reads first:

# Knowledge Manifest

## Task → Knowledge Map

| When working on... | Load | Key terms |
|-------------------|------|-----------|
| API endpoints | references/api.md | route, handler, endpoint |
| Authentication | references/auth.md | token, session, login |
| Database changes | references/schema.md | migration, model, query |
| Testing | references/testing.md | spec, fixture, mock |
| Deployment | references/deploy.md | release, staging, prod |

## Quick Reference

### Build Commands
- `npm run dev` — Start dev server (port 3000)
- `npm test` — Run test suite
- `npm run build` — Production build

### Key Paths
- Handlers: `src/handlers/`
- Routes: `src/routes.ts`
- Tests: `tests/`

### Critical Rules
- Never commit .env files
- All PRs require tests
- Use conventional commits

The manifest contains:

  1. Task→Knowledge map: What to load for what context
  2. Quick reference: High-frequency facts (no file loading needed)
  3. Critical rules: Must-know constraints (always relevant)

Phase 4: Compile Optimized Artifacts

Transform verbose source docs into dense, agent-optimized versions.

Compression techniques:

Source (verbose)Compiled (dense)
"When you want to add a new endpoint, you should first create a handler function..."New endpoint: handler → route → spec
Long prose paragraphsStructured tables
Repeated informationSingle source of truth
Examples with explanationJust the pattern

Output structure:

.claude/
├── CLAUDE.md              # Human-readable, can stay verbose
├── KNOWLEDGE.md           # Agent manifest (generated)
└── compiled/              # Agent-optimized versions (generated)
    ├── api.md             # Dense API reference
    ├── patterns.md        # Code patterns as templates
    └── rules.md           # All constraints in one place

Phase 5: Generate Retrieval Hints

Add grep-friendly markers throughout compiled docs:

<!-- @task:new-endpoint @load:api,routes -->
## Adding Endpoints

<!-- @task:fix-auth @load:auth,middleware -->
## Authentication Flow

<!-- @task:write-test @load:testing -->
## Test Patterns

These markers enable:

# Find relevant sections for a task
grep -l "@task:new-endpoint" .claude/compiled/*.md

Phase 6: Validation

Test the optimized system:

  1. Coverage check: Every fact from source exists in compiled output
  2. Retrieval test: Can common tasks be served with minimal loading?
  3. Density check: Compiled versions smaller than sources?
# Compare sizes
wc -l .claude/references/*.md    # Source
wc -l .claude/compiled/*.md       # Compiled (should be smaller)

Manifest Format

The KNOWLEDGE.md manifest follows this structure:

# Knowledge Manifest
<!-- Auto-generated. Source: .claude/references/, CLAUDE.md -->

## Task Context Map
<!-- What to load based on current work -->

| Context | Load | Search |
|---------|------|--------|
| [task description] | [file path] | [grep terms] |

## Always-Loaded Facts
<!-- High-frequency, never needs file lookup -->

### Commands
[Most-used commands as a table]

### Paths
[Key directories and their purposes]

### Rules
[Critical constraints that always apply]

## Chunk Index
<!-- What exists and where -->

| Topic | Location | Lines | Summary |
|-------|----------|-------|---------|
| [topic] | [file:line-range] | [count] | [one-line summary] |

Information Density Principles

Convert Prose to Structure

Before:

"The authentication system uses JWT tokens stored in httpOnly cookies. When a user logs in, the server validates credentials against the database, generates a token with a 24-hour expiry, and sets it as a cookie..."

After:

## Auth Flow
- Method: JWT in httpOnly cookie
- Expiry: 24h
- Flow: credentials → DB validate → token → cookie

Eliminate Redundancy

If the same information appears in multiple places, create one canonical source and reference it:

## Token Handling
See: [Auth Flow](#auth-flow) — tokens section

Prefer Tables Over Lists

Before:

- The API endpoint for users is /api/users
- The API endpoint for posts is /api/posts
- The API endpoint for comments is /api/comments

After:

| Resource | Endpoint |
|----------|----------|
| Users | /api/users |
| Posts | /api/posts |
| Comments | /api/comments |

Use Patterns Over Examples

Before:

To create a user handler:

export async function createUser(req, res) { const { name, email } = req.body; const user = await db.users.create({ name, email }); res.json(user); }


After:

Handler pattern: export async function {action}{Resource}(req, res) Body: Extract params → DB operation → Return result


## Output Checklist

After optimization, verify:

- `KNOWLEDGE.md` exists and is under 100 lines
- Task→knowledge mappings cover common workflows
- Quick reference has most-used facts
- Compiled docs are denser than sources
- No orphaned knowledge (everything indexed)
- Retrieval hints enable grep-based discovery
- Original source docs untouched (human reference)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.61%
按下载量换算56

Claude

28.5%
按下载量换算47

Cursor

20.66%
按下载量换算34

Gemini CLI

9.07%
按下载量换算15

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills