SuperAPI AI 工具集

file-operations

办公与效率

查看项目

更新于 10-16 09:32

技能介绍

用途:通过 Claude 原生工具对文件做只读分析,获取元数据与内容统计,不会修改文件。适用于“分析某文件”“获取文件信息”“某文件多少行”“比较两个文件”“文件统计”等请求。

主要能力:

  1. 文件大小与元数据:stat -f "%z bytes, modified %Sm" [file_path](单文件)、ls -lh [directory](多文件)、du -h [file_path](可读大小)。
  2. 行数统计:wc -l [file_path]、wc -l [file1] [file2]、find [dir] -name "*.py" | xargs wc -l。
  3. 内容分析:用 Read 分析结构,再统计函数、类、导入等数量。
  4. 模式搜索:Grep(pattern="^def ", output_mode="count", path="src/") 统计函数;Grep(pattern="TODO|FIXME", output_mode="content", -n=true) 查找待办;Grep(pattern="^import ", output_mode="count") 统计导入。
  5. 查找文件:Glob(pattern="**/*.py")。

使用方式示例:综合分析可依次取大小与修改时间、统计行数、读取文件、统计函数与类数量;比较文件大小可先用 Glob 找文件,再用 ls -lh 或 du -sh 汇总;代码质量指标可统计总行数、测试文件数与 TODO 数量;查找大文件可用 find . -type f -not -path "./node_modules/*" -exec du -h {} + | sort -rh | head -20。

适用场景:代码库审查、文件对比、代码质量度量、定位大文件,可与 code-auditor、code-transfer、codebase-documenter 配合使用。

限制与注意:所有操作均为非破坏性,使用 Read、stat、wc 等只读方式;效率上小文件可完整读取,大文件建议用 Grep;元数据与统计结果需结合项目平均水平解读。具体安装方式、收费与平台信息暂未提供。