code-to-doc

code-to-doc is a skill for Claude Code from ryanzhao1011/workframe. It costs 201 tokens per session (5,959 once invoked), scanned A, original, MIT.

A code-reading tool that turns a module's implementation into four current-state documents: architecture, API surface, data model, and code map. A monorepo is a repository containing multiple related projects, and the tool can account for that structure as well as other supported project layouts.

In plain words
What is it for?
Use it to create or refresh implementation documentation for one or more configured modules, including projects built with Next.js, WeChat Mini Programs, or mixed technologies.
Why use it?
It lets people understand how a module currently works without reading all its source code, while linking each conclusion to the exact source-file line behind it.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is - miniprogram/pages/profile/edit/** → ./miniprogram/pages/profile/edit/ (12 个 .js + 3 个 .wxml).

Part of the core plugin — 38 skills, 4 agents, 11 hooks shipped together

Good fit Use it to create or refresh implementation documentation for one or more configured modules, including projects built with Next.js, WeChat Mini Programs, or mixed technologies.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/ryanzhao1011/workframe
agentmods
npx agentmods add skills/ryanzhao1011/workframe/code-to-doc

Made for: Claude Code.

Or install core, the plugin that ships this one along with the rest of its 38 skills, 4 agents, 11 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-to-doc

README.md
[![agentmods](https://agentmods.dev/badge/skills/ryanzhao1011/workframe/code-to-doc/github.svg)](https://agentmods.dev/skills/ryanzhao1011/workframe/code-to-doc)
Your own site
<a href="https://agentmods.dev/skills/ryanzhao1011/workframe/code-to-doc"><img src="https://agentmods.dev/badge/skills/ryanzhao1011/workframe/code-to-doc/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-to-doc

Your own site · 80×15
<a href="https://agentmods.dev/skills/ryanzhao1011/workframe/code-to-doc"><img src="https://agentmods.dev/badge/skills/ryanzhao1011/workframe/code-to-doc.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 201 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,959 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00201 $0.05959
Opus 5.5 $0.00080 $0.02384
Sonnet 5.5 $0.00040 $0.01192
Haiku 4.5 $0.00020 $0.00596

Measured 21d ago against content hash 2844aaba2be3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-to-doc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 21d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/core/skills/code-to-doc/SKILL.md · 332 lines

How it starts

The opening of the file, as written. The whole thing — 332 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code to Doc Skill

前置依赖

调用本 skill 前需读 skill: document-norms §1(归属)/ §2(frontmatter,特别是 current-state 类)/ §5.3(current-state 正文 source path 行级 anchor 强约束)。

参考插件根 reference/module-architecture.md §4.1(current-state 双向闭环)/ §6.2(跨形态适配)。

定位

双向闭环的"代码 → 文档"半边。LLM 解析 code_paths 涉及的代码文件,输出结构化 current-state/,让 PM 不读代码也能理解架构、API、数据模型。

适用范围:

  • 子模块已创建(submodule.yaml 存在)且 code_paths 已配置
  • 代码可读(本仓 ∪ dev 已 paste 跨仓代码到 tmp 目录)

不适用:

  • 子模块未创建 → 先调 module-init
  • code_paths 为空 → 先在 submodule.yaml 配置
  • submodule.yaml 里 code_map_coverage: exempt → 该子模块有意不设 code-map(纯文档档等裁量), 不要为它生成 current-state/;豁免理由写在该子模块 overview,module-close-check 的检查 6 会跳过它并报一条 info
  • 仅刷新 frontmatter updated → 不需要本 skill
  • 写 PRD / 测试用例 → prd-writer / test-case-design

输入

模式 输入
单子模块(推荐) 二段式 <basic>/<sub>
多子模块批量 数组 [<basic1>/<sub1>, <basic2>/<sub2>, ...]
stale 触发 读 .workframe/state/stale-modules.yaml,按列表处理

可选:dev_paste_path(代码在外部仓库时,dev 把跨仓代码导出到本地 tmp,本 skill 解析此路径)。

工作流

Step 1: 形态适配 + 路径解析

1.1 读项目配置
  • 读 .workframe-config.json 获取 monorepo.workspaces(如有)
  • 读 project.config.json 获取 miniprogramRoot(如有)
  • 读 package.json 推断框架(next / nuxt / nestjs / 等)
1.2 解析 code_paths 实际位置

按 tech_stack[].stack + 配置自动加正确根前缀:

stack 适配规则
wechat-miniprogram miniprogramRoot=miniprogram/ 时已包含前缀;./ 时需加
wechat-cloudfunction 项目根直接(cloudfunctions/...)
nextjs 单仓 项目根直接(app/... / pages/...)
nextjs Monorepo 检查 workspaces,如 apps/web/ 则补前缀
跨技术栈数组 按数组 path 字段逐条处理

报告:

解析 code_paths:
  - miniprogram/pages/profile/edit/**  →  ./miniprogram/pages/profile/edit/   (12 个 .js + 3 个 .wxml)
  - cloudfunctions/profile/get/**      →  ./cloudfunctions/profile/get/        (2 个 .js + 1 个 .json)
  ...

Step 2: 代码扫描

按 stack 类型采用不同解析策略:

stack 解析重点
wechat-miniprogram Page({}) / Component({}) 入口 + data / methods / lifetimes + usingComponents
wechat-cloudfunction exports.main 入口 + event.action 路由 + cloud.database() 集合
nextjs (App Router) app/<route>/page.tsx / route.ts + Server Component 标记 + 中间件
nestjs @Controller / @Module / @Injectable 装饰器 + DTO + 数据库 entity
express app.get/post/... 路由 + middleware + handler
通用 grep TODO / FIXME / HACK 标记

Read the full file on GitHub · 332 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 21d ago Changed · +42 lines · +90 tokens per session scan B → A 2844aaba2be3
  2. 1mo ago First seen · 290 lines · 111 tokens per session scan B 5f025336f751

Subscribe to this mod's changes

code-to-doc is a skill published in the GitHub repository ryanzhao1011/workframe (7 stars, last pushed 23d ago), licensed MIT. It adds 201 tokens to every session and 5,959 once invoked, about $0.0008 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

migration-review

A review workflow for database migration files, which change the structure or data rules of a database. It checks the requested migration files and the code needed to assess their compatibility.

fancyboi999/ai-engineering-from-scratch-zh · 48 tokens

ocr

AI-powered multi-agent code review. Simulates a team of Principal Engineers reviewing code from different perspectives. Use when asked to review code, check a PR, analyze changes, or perform code review.

spencermarx/open-code-review · 44 tokens

OCR Review-to-Approval Loop

Drive a PR to an approved code review by looping OCR's multi-agent review and address steps. Runs /ocr:review then /ocr:address repeatedly until the review verdict is APPROVE, then one final /ocr:address for leftover suggestions, posting every review and every address round to the GitHub PR as comments. Use when the…

spencermarx/open-code-review · 178 tokens

pr-triage

4-phase PR backlog management with audit, deep code review, validated comments, and optional worktree setup. Use when triaging pull requests, catching up on pending code reviews, or managing a backlog of open PRs. Args: 'all' to review all, PR numbers to focus (e.g. '42 57'), 'en'/'fr' for language, no arg = audit…

FlorianBruniaux/claude-code-plugins · 86 tokens

audit-agents-skills

Audit Claude Code agents, skills, and commands for quality and production readiness. Use when evaluating skill quality, checking production readiness scores, or comparing agents against best-practice templates.

FlorianBruniaux/claude-code-plugins · 41 tokens

review-pr

Perform a comprehensive code review of a pull request.

FlorianBruniaux/claude-code-plugins · 12 tokens