file-line-audit
Skill0 starsChanged 5 days agoMITView on GitHub
Audit oversized source files in a repository. Apply repository .gitignore rules plus extra exclude patterns, filter candidate files with include glob patterns, count physical lines, and output only files at or above the threshold. Use this skill when the user asks to find long files, review file-length distribution, identify split/refactor candidates, or analyze technical debt.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apply-yliu-frontend-practicesSkill
- build-mcp-appSkill
- build-mcpbSkill
- build-mcp-serverSkill
- chinese-article-writingSkill
- claude-md-improverSkill
- frontend-designSkill
- git-step-commitSkill
- integrate-ai-i18nSkill
- manage-prd-docsSkill
- modernize-ecmascriptSkill
- publish-npm-packagesSkill
- skill-creatorSkill
- skill-developmentSkill
- use-ai-i18n-mcpSkill
- use-lociSkill
The file
Files
File Line Audit
使用这个技能审计仓库中的超长源码文件,只返回达到或超过指定行数阈值的文件。
使用时:
- 从
scripts/目录选择匹配当前操作系统和 CPU 架构的打包二进制。 - 始终在目标仓库根目录运行,这样
.gitignore才能正确生效。 - 先查看仓库结构和语言栈,再决定扫描范围。
- 通过命令行显式传入扫描参数;没有默认配置文件。
- 先应用仓库
.gitignore,再应用额外的exclude规则。 - 使用一个或多个
includeglob 限定扫描范围。 - 只输出物理行数大于等于阈值的文件。
安装
npx skills add bosens-China/my-skills/skills/file-line-audit二进制选择
从 scripts/ 下选择对应平台的可执行文件:
- Windows amd64:
scripts/line-audit-windows-amd64.exe - Linux amd64:
scripts/line-audit-linux-amd64 - Linux arm64:
scripts/line-audit-linux-arm64 - macOS amd64:
scripts/line-audit-darwin-amd64 - macOS arm64:
scripts/line-audit-darwin-arm64
步骤
- 确认当前位于目标仓库根目录。
- 检查仓库结构,决定扫描哪些内容:
- 识别源码目录,例如
src、app、apps、pkg、packages、lib、internal、cmd、backend、frontend、client、server、service、services、api、web。 - 识别相关源码扩展名,例如
js、ts、tsx、vue、py、go、rs、java、kt、rb、php、cs、swift。 - 仅在
.gitignore不足时添加额外exclude,例如dist/、build/、coverage/或生成目录。
- 识别源码目录,例如
- 根据当前平台选择正确的
scripts/line-audit-*二进制。 - Linux/macOS 下确保二进制可执行:
chmod +x <binary_path> - 使用显式
--include、可选--exclude和可选--threshold运行。 - 向用户返回超阈值文件列表。
命令
以下示例中,<skill_root> 是当前 skill 目录的绝对路径。
使用 include 参数运行
Unix-like 系统:
chmod +x <skill_root>/scripts/line-audit-<target>
<skill_root>/scripts/line-audit-<target> \
--threshold 400 \
--include "src/**/*.{ts,tsx,js,jsx,vue}" \
--include "apps/**/*.{ts,tsx,js,jsx,vue}" \
--exclude "dist/" \
--exclude "build/"Windows:
& <skill_root>\scripts\line-audit-windows-amd64.exe `
--threshold 400 `
--include "src/**/*.{ts,tsx,js,jsx,vue}" `
--include "apps/**/*.{ts,tsx,js,jsx,vue}" `
--exclude "dist/" `
--exclude "build/"使用 JSON 参数运行
如果完整参数对象更方便,使用 --json:
<skill_root>/scripts/line-audit-<target> --json '{
"threshold": 400,
"include": [
"src/**/*.{ts,tsx,js,jsx,vue}",
"apps/**/*.{ts,tsx,js,jsx,vue}"
],
"exclude": [
"dist/",
"build/"
]
}'参数
--include/-i:必填 glob 模式;可以重复传入多个源码根或扩展名范围。--exclude/-e:可选额外忽略规则,语法与.gitignore一致;可以重复传入。--threshold/-t:输出阈值,默认400。--json/-j:可选 JSON 对象,包含threshold、include、exclude。--help/-h:显示 CLI 帮助。
输出格式
直接返回工具输出。预期格式:
# File Line Audit
## Files Over Threshold (>= 400 lines)
- src/example.ts 512
- apps/web/pages/home.tsx 438限制
- 只统计物理行数:不会区分代码、注释或空行。
- 自动跳过二进制文件。
- 依赖 Git 环境解析
.gitignore。 - 面向源码扫描优化;避免扫描未被
.gitignore覆盖的大型数据目录或构建产物。
说明
- 仓库
.gitignore始终生效,即使没有传入额外exclude。 - 支持嵌套
.gitignore。 - 每次运行至少需要一个
--include模式。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

