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

ws-codebase-documenterws 代码库文档管理器

Agent Skill

ws-codebase-documenter 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

188

周安装

8

GitHub Stars

1

下载量

66
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/wondersauce/claude-code-plugin --skill ws-codebase-documenter

简介

用于查找、检索和筛选相关信息。

  • 适合根据关键词或任务场景快速定位候选结果。
  • 可结合来源仓库和原始 README 核验具体用法,建议确认权限和维护状态。
  • 安装命令:npx skills add https://github.com/wondersauce/claude-code-plugin --skill ws-codebase-documenter。
  • 支持 Codex、Claude、Cursor、Gemini CLI,通过 GitHub 仓库安装。

SKILL.md

Codebase Documenter

Generate structured documentation designed for consumption by AI assistants and code agents working on dependent projects.

Workflow

1. Determine Mode

Check if documentation/config.json exists:

  • Does not exist: Bootstrap Mode (first run)
  • Exists: Check the user's argument:

- regenerate [doc-type]: Regenerate Mode (targeted re-generation) - Otherwise: Incremental Mode (subsequent runs)

2. Bootstrap Mode

Execute when documentation/config.json is absent.

2.1 Detect Stack

Check for these files in order:

FileStack
package.jsonnodejs
requirements.txt, pyproject.toml, setup.pypython
go.modgo
Cargo.tomlrust
*.csproj, *.slndotnet
pom.xml, build.gradlejava
composer.jsonphp

2.2 Create Config

Write a single documentation/config.json file containing all fields:

{
  "stack": "[detected-stack]",
  "exclude": [
    "**/*.test.*",
    "**/*.spec.*",
    "**/test/**",
    "**/tests/**",
    "**/__tests__/**",
    "**/node_modules/**",
    "**/vendor/**",
    "**/dist/**",
    "**/build/**",
    "**/target/**"
  ],
  "include_inline_examples": true,
  "include_architecture_diagrams": true,
  "docusaurus": null,
  "frontend": {
    "enabled": true,
    "css_paths": [],
    "js_paths": [],
    "token_files": [],
    "build_tool": null,
    "methodology": null
  },
  "playbook": {
    "enabled": true,
    "custom_procedures": []
  },
  "capability_map": {
    "enabled": true,
    "custom_categories": []
  },
  "style_guide": {
    "enabled": true,
    "forbidden_patterns": ["!important", "inline styles"],
    "custom_rules": []
  },
  "integration_map": {
    "enabled": true
  },
  "consistency_check": {
    "enabled": true,
    "strict": false
  },
  "claude_md": {
    "inject_rules": true,
    "max_rules": 25,
    "custom_rules": []
  }
}

If Docusaurus sync is requested, set the docusaurus field:

{
  "docusaurus": {
    "repo": "git@github.com:org/docs-site.git",
    "branch": "main",
    "docs_path": "docs/api",
    "sidebar_label": "API Reference"
  }
}

All fields from frontend onward are optional — existing config.json files without these fields use the defaults shown above.

2.2b Backfill Config

After the scan (step 2.4) completes, update documentation/config.json a second time with auto-detected values:

  • Set frontend.css_paths to detected CSS/SCSS directory paths
  • Set frontend.js_paths to detected JS/TS frontend directory paths
  • Set frontend.token_files to detected design token file paths
  • Set frontend.build_tool to detected build tool name
  • Set frontend.methodology to detected CSS methodology

This second write backfills detected values so the user can review and override them in subsequent runs.

2.3 Read Stack Reference

Load the appropriate reference file:

  • references/stacks/[stack].md

This provides patterns for identifying public/private API, documentation comments, error handling, and project structure conventions.

2.4 Scan Codebase

  1. List all source files (respecting exclude patterns)
  2. Identify public API surface using stack-specific patterns
  3. Categorize items: functions, types, errors, features
  4. Extract documentation comments
  5. Map relationships between items
  6. If config.frontend.enabled is true: scan frontend assets following the procedures in references/frontend-detection.md. This detects CSS/SCSS organization, methodology, design tokens, breakpoints, JS initialization patterns, build tools, and anti-patterns.
  7. Track cross-module function calls using patterns from the "Cross-Module Patterns" section in references/stacks/[stack].md. Record: calling module, called function/method, file path, and data passed.
  8. For each design pattern detected in step 5, extract concrete details for playbook generation: file path globs, base classes/interfaces, directory conventions, required method signatures.
  9. While scanning, build the capability map incrementally — classify each public function/type into a functional domain category as it is discovered. Do NOT defer this to a second pass.

2.5 Generate Documentation

Read references/doc-templates.md for exact formats.

Create directory structure:

documentation/
├── config.json
├── .docstate
├── overview.md
├── architecture.md
├── playbook.md
├── capability-map.md
├── style-guide.md
├── integration-map.md
├── public/
│   ├── _index.md
│   ├── features/
│   ├── api/
│   ├── functions/
│   ├── types/
│   └── errors/
└── private/
    ├── _index.md
    ├── functions/
    ├── types/
    └── utils/

Generate files:

  1. overview.md - Project purpose, entry points, quick start
  2. architecture.md - Component diagrams, data flow, design patterns
  3. Function docs - One file per function in appropriate directory
  4. Type docs - One file per type
  5. Error docs - Error hierarchy and patterns
  6. Index files - _index.md in each directory
  7. playbook.md — Read template 11 from references/doc-templates.md. For each design pattern extracted in step 2.4 (item 8), generate a numbered step-by-step procedure. Include checklists and common mistakes. Only generated when config.playbook.enabled is true.
  8. capability-map.md — Read template 12 from references/doc-templates.md. Use the domain classifications built incrementally during step 2.4 (item 9). Organize into task-oriented categories. Only generated when config.capability_map.enabled is true.
  9. style-guide.md — Read template 13 from references/doc-templates.md. Use frontend scan results from step 2.4 (item 6). Only generated when config.style_guide.enabled is true AND frontend assets were detected.
  10. integration-map.md — Read template 14 from references/doc-templates.md. Use cross-module data from step 2.4 (item 7). Only generated when config.integration_map.enabled is true.

2.6 Update Claude Code Instructions

Create or update CLAUDE.md in the project root to reference the documentation. If the file exists, check for existing sections before modifying:

  1. Read the file and search for ## Project Rules and ## Codebase Documentation headings
  2. If a section already exists, replace it in place (preserve surrounding content)
  3. If a section does not exist, append it to the end of the file
  4. If the file does not exist, create it

Step A: If config.claude_md.inject_rules is true (default), add the Project Rules section:

## Project Rules

These rules MUST be followed when modifying this codebase:

### Architecture
- [Generated rules from architecture.md and playbook.md]

### Data Access
- [Generated rules about ORM/Model usage patterns]

### Frontend
- [Generated rules from style-guide.md]

### Before Creating New Code
- Check `documentation/capability-map.md` before creating any new utility, helper, or shared function
- Check `documentation/public/_index.md` before creating any new public API
- Follow the step-by-step procedures in `documentation/playbook.md` for common tasks

### Documentation
- After adding new public functions, types, or components, update the relevant documentation files
- After adding new cross-module integrations, update `documentation/integration-map.md`

Extract project-specific rules to populate the subsections above (max config.claude_md.max_rules, default 25). Priority order when candidates exceed the limit:

  1. config.claude_md.custom_rules — user-defined rules, always included first
  2. Architecture rules from architecture.md and playbook.md
  3. Data access rules from detected Model/Repository patterns
  4. Frontend rules from style-guide.md (when applicable)
  5. Documentation maintenance rules

If config.claude_md.inject_rules is false, skip Step A entirely.

Step B: Always add the Codebase Documentation section:

## Codebase Documentation

This project has AI-optimized documentation in the `documentation/` folder.

Before making changes to this codebase:
1. Read `documentation/overview.md` for project purpose and entry points
2. Read `documentation/architecture.md` for system design and data flow
3. Read `documentation/playbook.md` for how to add new features
4. Check `documentation/capability-map.md` for existing utilities and helpers
5. Check `documentation/style-guide.md` for frontend conventions
6. Check `documentation/public/_index.md` for the public API surface

When modifying existing code:
- Check the relevant function/type doc in `documentation/public/` or `documentation/private/`
- Note any error handling patterns in `documentation/public/errors/`

When adding new public APIs:
- Follow patterns documented in `documentation/playbook.md`
- Ensure consistency with existing APIs in `documentation/public/`
- Update `documentation/capability-map.md` with the new capability

2.7 Write State

Create documentation/.docstate:

{
  "last_commit": "[current HEAD SHA]",
  "last_run": "[ISO timestamp]",
  "docusaurus_last_sync": null,
  "docusaurus_synced_files": [],
  "consistency_last_check": null,
  "consistency_violations": 0,
  "generated_docs": [
    "overview.md",
    "architecture.md",
    "playbook.md",
    "capability-map.md",
    "style-guide.md",
    "integration-map.md"
  ],
  "detected_patterns": {
    "rest_endpoint": {
      "description": "Router → Controller → Model",
      "glob": "src/controllers/*.php",
      "base_class": "BaseController",
      "required_methods": ["handle", "validate"]
    },
    "data_access": {
      "description": "Model static methods with caching",
      "glob": "src/models/*.php",
      "base_class": "BaseModel",
      "required_methods": ["save", "to_array", "get_by"]
    },
    "frontend_css": {
      "description": "Component SCSS files",
      "glob": "src/css/blocks/*.scss"
    },
    "frontend_js": {
      "description": "Block entry points with .init()",
      "glob": "src/js/blocks/*.js"
    }
  },
  "frontend_stats": {
    "important_count": 0,
    "inline_style_count": 0,
    "token_count": 0,
    "breakpoint_count": 0
  }
}

Only include detected_patterns entries for patterns that were actually detected. generated_docs lists only the doc files that were actually generated (based on config flags). frontend_stats is only included when config.frontend.enabled is true.

Get current HEAD:

git rev-parse HEAD

3. Incremental Mode

Execute when documentation/config.json exists.

3.1 Load State

Read documentation/config.json and documentation/.docstate.

3.2 Get Changes

git diff --name-status [last_commit]..HEAD

Filter to source files only (exclude test files, config, etc).

3.3 Analyze Changes

For each changed file:

  1. Get the diff: git diff [last_commit]..HEAD -- [file]
  2. Identify semantic changes:

- New functions/types/classes added - Signatures modified (parameters, return types) - Items removed or deprecated - Error handling changes - Documentation comment updates

3.4 Update Documentation

For each semantic change:

Change TypeAction
New itemCreate new doc file
Modified signatureUpdate existing doc
Removed itemMark deprecated or delete
New errorAdd to error docs

Also update:

  • Relevant _index.md files
  • architecture.md if structure changed
  • Cross-references in related docs

Also update prescriptive documents when relevant changes are detected:

Change TypeDocument to Update
New design pattern or pattern changeplaybook.md — add or update procedure
New public function/type/helpercapability-map.md — add to relevant category
New frontend files or convention changestyle-guide.md — update rules and tokens
New cross-module call or shared resourceintegration-map.md — add integration pattern

3.4.1 Prescriptive Document Change Detection

For each changed file from step 3.2, run these detection heuristics to determine if prescriptive documents need updating:

Playbook triggers (playbook.md):

  1. If a new file matches an existing detected_patterns glob: check if it introduces a new base class, interface, or required method not in the current pattern definition. If yes, update the playbook procedure.
  2. If a new file does NOT match any detected_patterns glob but contains route definitions, model definitions, or service class patterns: a new pattern may have emerged. Flag for playbook addition.
  3. If an existing file matching a pattern glob has its base class or required method signatures changed: update the corresponding playbook procedure.

Capability-map triggers (capability-map.md):

  1. If a new public function, class, or exported module is added (detected via stack-specific export patterns from references/stacks/[stack].md): add to the appropriate capability-map category.
  2. If a public function's signature changes (parameters added/removed, return type changed): update the existing capability-map entry.
  3. If a public function is deleted: remove from capability-map (or mark deprecated if referenced elsewhere).

Style-guide triggers (style-guide.md):

  1. If new CSS/SCSS files are added: check for new design tokens (variables) not in the current token registry. Add any new tokens.
  2. If the root stylesheet's import chain changes: re-detect CSS organization pattern.
  3. If a new CSS methodology indicator appears (e.g., first *.module.css file): flag for methodology review.

Integration-map triggers (integration-map.md):

  1. If a file imports from a module it didn't previously import from (cross-module call): add integration pattern.
  2. If a new event emitter, signal, or hook registration is added: add to event/hook contracts.
  3. If a new database table or shared cache key appears in multiple modules: add to shared resources.

3.4.5 Consistency Check

Skip if config.consistency_check.enabled is false.

  1. Load references/consistency-rules.md for rule definitions and the execution procedure
  2. Load detected_patterns from documentation/.docstate
  3. For each changed file from step 3.2, run applicable consistency rules following the execution procedure in references/consistency-rules.md
  4. Generate documentation/.consistency-report.md using template 15 from references/doc-templates.md. This file is fully replaced on each run (never appended). If no violations are found, write a passing report.
  5. Include consistency results in the PR description (step 4.3)

Severity is determined by config.consistency_check.strict:

  • strict: true — High-confidence violations are Errors, best-effort findings are Warnings
  • strict: false — All findings are Warnings

3.5 Verify Claude Code Instructions

Check that CLAUDE.md contains both:

  1. The "Codebase Documentation" reference section (from step 2.6)
  2. The "Project Rules" section (from step 2.6), if config.claude_md.inject_rules is true

If the documentation reference section is missing, add it using the template from step 2.6.

If rules have changed (because underlying documentation was updated in step 3.4), regenerate the rules section using the priority order from step 2.6 and update CLAUDE.md.

3.6 Update State

Update documentation/.docstate with new HEAD and timestamp.

3b. Regenerate Mode

Execute when user runs with regenerate [doc-type].

Valid doc-types: playbook, capability-map, style-guide, integration-map, overview, architecture, consistency-report, all

3b.1 Determine Scan Scope

Each doc type requires a different scan scope:

Doc TypeRequired Scan Steps
playbookPattern detection (step 2.4, items 5, 8)
capability-mapFull API scan (step 2.4, items 1-5, 9)
style-guideFrontend scan only (step 2.4, item 6)
integration-mapCross-module scan (step 2.4, item 7)
overviewBasic scan (step 2.4, items 1-3)
architectureFull scan (step 2.4, items 1-5)
consistency-reportNo scan — run consistency check (step 3.4.5) against current HEAD using existing .docstate patterns
allFull scan (all of step 2.4)

3b.2 Load Config and State

Read documentation/config.json and documentation/.docstate. Load the stack reference file.

3b.3 Execute Targeted Scan

Run only the scan steps required by the doc type (per the table above).

3b.4 Regenerate Document

Regenerate the specified document file using the corresponding template from references/doc-templates.md.

3b.5 Update State

Update documentation/.docstate:

  • Set last_run to current timestamp
  • Update detected_patterns if the scan detected changes
  • Update frontend_stats if frontend scan was run
  • Do NOT update last_commit — regeneration does not advance the incremental baseline

4. Create PR

4.1 Branch Naming

Format: docs/auto-update-YYYY-MM-DD-HH:MM

If branch exists, append -2, -3, etc.

BRANCH="docs/auto-update-$(date +%Y-%m-%d-%H:%M)"
git checkout -b "$BRANCH"

4.2 Commit Changes

git add documentation/
git commit -m "docs: update documentation for [commit range]"

4.3 Push and Create PR

git push -u origin "$BRANCH"

Create PR with description summarizing changes (see PR Description template in references/doc-templates.md).

5. Docusaurus Sync (Optional)

Execute only if config.docusaurus is configured. See references/docusaurus.md for detailed patterns.

5.1 Clone/Update Docusaurus Repo

DOCS_REPO="[config.docusaurus.repo]"
DOCS_BRANCH="[config.docusaurus.branch]"
DOCS_PATH="[config.docusaurus.docs_path]"

# Clone to temp directory if not exists
if [ ! -d ".docusaurus-sync" ]; then
  git clone --depth 1 -b "$DOCS_BRANCH" "$DOCS_REPO" .docusaurus-sync
else
  cd .docusaurus-sync && git pull && cd ..
fi

5.2 Transform Documentation

For each markdown file in documentation/:

  1. Add Docusaurus frontmatter: --- id: [filename-without-extension] title: [extracted-from-h1] sidebar_label: [short-title] sidebar_position: [order] ---
  2. Convert internal links from ../types/Foo.md to Docusaurus paths
  3. Copy to .docusaurus-sync/[docs_path]/

5.3 Generate Sidebar

Create or update .docusaurus-sync/[docs_path]/_category_.json for each directory:

{
  "label": "[directory-name-titlecased]",
  "position": [order],
  "collapsed": false
}

Generate sidebars.js entry if needed (see references/docusaurus.md).

5.4 Commit and Push to Docusaurus Repo

cd .docusaurus-sync
git add .
git commit -m "docs: sync from [source-repo] @ [commit-sha]"
git push origin "$DOCS_BRANCH"

Or create a PR in the Docusaurus repo if preferred.

5.5 Cleanup

rm -rf .docusaurus-sync

Documentation Standards

AI Optimization

Documentation must be optimized for AI consumption:

  1. Structured data over prose - Use tables for parameters, errors, options
  2. Explicit types - Always include full type signatures
  3. Complete examples - Show imports, setup, and usage
  4. Error recovery - Document how to handle each error
  5. Cross-references - Link to related functions and types
  6. No ambiguity - Specify defaults, constraints, edge cases

Public vs Private

Public (documentation/public/):

  • Exported functions, classes, types
  • Items intended for external use
  • API surface for dependent projects

Private (documentation/private/):

  • Internal implementation details
  • Helper functions
  • Useful for understanding internals but not for direct use

When to Document Private Items

Document private items when:

  • They're complex and non-obvious
  • They're frequently modified
  • Understanding them helps debug issues
  • They contain important business logic

Skip documenting:

  • Trivial helpers (less than 5 lines)
  • Generated code
  • Boilerplate

Error Handling

If documentation generation fails:

  1. Do not commit partial changes
  2. Log the error
  3. Exit with non-zero status

Common issues:

  • Cannot detect stack: Ask user to set stack in config.json
  • Cannot parse source files: Skip unparseable files, continue with others
  • Git operations fail: Ensure clean working directory
  • Reference file missing: See the fallback column in the Reference Files table below

Reference Files

Load these as needed. If a file cannot be read (missing, corrupted install, partial update), follow the fallback behavior:

FileWhen to LoadIf Missing
references/stacks/[stack].mdAfter detecting or reading stackFail — cannot generate accurate docs without stack-specific rules. Log: "Missing reference file for stack '{stack}'. Reinstall the plugin." Stop.
references/doc-templates.mdWhen generating any documentationFail — templates are required for all output. Log: "Missing doc-templates.md. Reinstall the plugin." Stop.
references/docusaurus.mdWhen config.docusaurus is configuredSkip feature — skip Docusaurus sync. Log: "Missing docusaurus.md. Skipping Docusaurus sync."
references/frontend-detection.mdDuring frontend scan (step 2.4, item 6)Skip feature — set all frontend results to empty/null, set config.frontend.enabled to false. Log: "Missing frontend-detection.md. Skipping frontend scan."
references/consistency-rules.mdDuring consistency check (step 3.4.5)Skip feature — skip consistency checking entirely, omit the Consistency Check section from the PR description. Log: "Missing consistency-rules.md. Skipping consistency checks."

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.02%
按下载量换算24

Claude

29.53%
按下载量换算19

Cursor

19.17%
按下载量换算13

Gemini CLI

8.49%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills