关于
This skill automatically adds PUT workflow annotations to source files using the correct comment syntax for over 30 programming languages. It generates annotation skeletons with `put_generate()`, handles multiline formats and internal variables, and includes validation. Use it when you need to document workflows in data pipelines, ETL processes, or multi-step computations after analyzing your codebase.
快速安装
Claude Code
推荐npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/annotate-source-files在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
註源檔
加 PUT 流註於源使 putior 取構流數而生 Mermaid 圖。
用
- 以
analyze-codebase-workflow析後有註計→用 - 加流文於新或既源→用
- 以手標與接富自察流→用
- 文數管、ETL、多步算→用
入
- 必:欲註之源
- 必:註計或流步知
- 可:式偏:單行或多行(默單行)
- 可:用
put_generate()生骨否(默是)
行
一:定註前綴
各言有 PUT 註前綴。用 get_comment_prefix() 求正者。
library(putior)
# Common prefixes
get_comment_prefix("R") # "#"
get_comment_prefix("py") # "#"
get_comment_prefix("sql") # "--"
get_comment_prefix("js") # "//"
get_comment_prefix("ts") # "//"
get_comment_prefix("go") # "//"
get_comment_prefix("rs") # "//"
get_comment_prefix("m") # "%"
get_comment_prefix("lua") # "--"
得:串如 "#"、"--"、"//"、"%"。
行與塊註:putior 察行註(
//、#、--)與 C 式塊註(/* */、/** */)之註。JS/TS 兩//與/* */塊皆掃。Python 三引號(''' ''')不察——Python 註用#。
敗:延不識→檔言或不支。察 get_supported_extensions() 得全列。不支言用 # 為慣默。
二:生註骨
用 put_generate() 由自察 I/O 建註模。
# Print suggestions to console
put_generate("./src/etl/")
# Single-line style (default)
put_generate("./src/etl/", style = "single")
# Multiline style for complex annotations
put_generate("./src/etl/", style = "multiline")
# Copy to clipboard for pasting
put_generate("./src/etl/", output = "clipboard")
R 例出:
# put id:'extract_data', label:'Extract Customer Data', input:'customers.csv', output:'raw_data.internal'
SQL 例出:
-- put id:'load_data', label:'Load Customer Table', output:'customers'
得:各源一或多註行,預填察函名與 I/O。
敗:無薦→檔或無可識 I/O 紋。按碼解手書註。
三:精註
改生骨加正標、接、元。
註語參:
<prefix> put id:'unique_id', label:'Human Readable Label', input:'file1.csv, file2.rds', output:'result.parquet, summary.internal'
欄:
id(必):獨識,為節接用label(必):圖中可讀述input:分號分入檔或變列output:分號分出檔或變列.internal延:示內存變(腳本間不存)node_type:控 Mermaid 節形與類樣。值:"input"—— 體育場形([...])為數源與設"output"—— 子程形[[...]]為生產"process"—— 矩[...]為處步(默)"decision"—— 菱{...}為條邏"start"/"end"—— 體育場形([...])為入/終節
node_type 例:
# put id:'config', label:'Load Config', node_type:'input', output:'config.internal'
# put id:'transform', label:'Apply Rules', node_type:'process', input:'config.internal', output:'result.rds'
# put id:'report', label:'Generate Report', node_type:'output', input:'result.rds'
多行語(複雜註):
# put id:'complex_step', \
# label:'Multi-line Label', \
# input:'data.csv, config.yaml', \
# output:'result.parquet'
塊註語(唯 // 前綴言:JS、TS、Go、Rust、C、C++、Java 等):
// 行註之言亦支 /* */ 與 /** */ 塊註內 PUT 註。塊體內以 * put 為行前綴:
/* put id:'init', label:'Initialize Config', output:'config.internal' */
/**
* put id:'process', \
* label:'Process Records', \
* input:'config.internal, records.json', \
* output:'results.json'
*/
function processRecords(config, records) {
// ...
}
JSDoc 式註尤益於文流步附 API 文:
/**
* Transform raw sensor data into normalized readings.
* put id:'normalize', label:'Normalize Sensor Data', input:'raw_readings.json', output:'normalized.parquet'
*/
export function normalizeSensorData(readings: SensorReading[]): NormalizedData {
// ...
}
註:塊註註不支
#前綴言(R、Python、Shell)或--前綴言(SQL、Lua)。彼諸言唯用行註。塊出註不支跨行反斜續。
跨檔數流(接腳以檔 I/O):
# Script 1: extract.R
# put id:'extract', label:'Extract Data', output:'raw_data.internal, raw_data.rds'
data <- read.csv("source.csv")
saveRDS(data, "raw_data.rds")
# Script 2: transform.R
# put id:'transform', label:'Transform Data', input:'raw_data.rds', output:'clean_data.parquet'
data <- readRDS("raw_data.rds")
arrow::write_parquet(clean, "clean_data.parquet")
得:註精以正 ID、標、I/O 反實數流。
敗:I/O 不確→內存中間用 .internal 延、存數用明檔名。
四:插註入檔
置註於檔頂或關碼上。
置例:
- 檔級註:置於檔頂、shebang 或檔頭註後
- 塊級註:置於所述碼上
- 每檔多註:用於有獨流階之檔
R 例置:
#!/usr/bin/env Rscript
# ETL Extract Script
#
# put id:'read_source', label:'Read Source Data', input:'raw_data.csv', output:'df.internal'
df <- read.csv("raw_data.csv")
# put id:'clean_data', label:'Clean and Validate', input:'df.internal', output:'clean.rds'
df_clean <- df[complete.cases(df), ]
saveRDS(df_clean, "clean.rds")
用 Edit 工於既檔插註而不擾周碼。
得:註插於各源適位。
敗:註破編輯器語法亮→確言註前綴正。PUT 註乃標註不應影碼行。
五:驗註
行 putior 驗以察註語與接。
# Scan annotated files
workflow <- put("./src/", validate = TRUE)
# Check for validation issues
print(workflow)
cat(sprintf("Total nodes: %d\n", nrow(workflow)))
# Verify connections by checking input/output overlap
inputs <- unlist(strsplit(workflow$input, ",\\s*"))
outputs <- unlist(strsplit(workflow$output, ",\\s*"))
connected <- intersect(inputs, outputs)
cat(sprintf("Connected data flows: %d\n", length(connected)))
# Generate diagram to visually inspect
cat(put_diagram(workflow, theme = "github", show_source_info = TRUE))
# Merge with auto-detected for maximum coverage
merged <- put_merge("./src/", merge_strategy = "supplement")
cat(put_diagram(merged, theme = "github"))
得:諸註析無誤。圖示接流。put_merge() 補自察缺。
敗:常驗症:
- 缺閉引:
id:'name→id:'name' - 內用雙引:
id:"name"→id:'name' - 跨檔重 ID:各
id須於全掃處獨 - 反斜續於誤行:
\須為換行前末字
驗
- 諸註檔有語有效 PUT 註
-
put("./src/")返預期節數之數框 - 掃處無重
id -
put_diagram()出接流圖(非孤節) - 多行註(若用)以反斜續正析
-
.internal變唯為出,不為跨檔入 - 經
exclude排之檔不於流(如put("./src/", exclude = "test_")跳測助)
忌
- 引嵌誤:PUT 註用單引:
id:'name'。雙引致註於串脈時析誤 - 重 ID:各
id於掃域須全獨。用<script>_<step>例(如extract_read、transform_clean) .internal為跨檔入:.internal變唯腳本行時存。腳本間傳數用存式(.rds、.csv、.parquet)為一腳本之出與次之入- 缺接:圖示斷節→察一註之出檔名與他註之入檔名字字相符(含延)
- 註前綴誤:SQL 用
#或 Python 用//致註為碼非註。恆以get_comment_prefix()驗 - 忘多行續:多行註各續行須以
\終、次行須以註前綴始 - Python 三引號:putior 不掃 Python 三引號(
''' '''、""" """)。Python PUT 註恆用# - 元管線註:註亦掃註之建腳(如腳呼
put()與put_diagram()),其註現於生圖。或自掃排檔(見generate-workflow-diagram忌)或建腳本內勿置 PUT 註
參
analyze-codebase-workflow—— 前置:出此技循之註計generate-workflow-diagram—— 次步:自註生末圖install-putior—— 註前須裝 putiorconfigure-putior-mcp—— MCP 工供互註助
GitHub 仓库
Frequently asked questions
What is the annotate-source-files skill?
annotate-source-files is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform annotate-source-files-related tasks without extra prompting.
How do I install annotate-source-files?
Use the install commands on this page: add annotate-source-files to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does annotate-source-files belong to?
annotate-source-files is in the Meta category, tagged word, automation and data.
Is annotate-source-files free to use?
Yes. annotate-source-files is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
相关推荐技能
Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
