Use this skill to audit oversized source files in a repository and return only files that meet or exceed the specified line-count threshold.
When to use:
- From the
scripts/directory, select the packaged binary that matches the current operating system and CPU architecture. - Always run from the target repository root so that
.gitignoretakes effect correctly. - First inspect the repository structure and language stack, then decide the scan scope.
- Pass scan parameters explicitly via the command line; there is no default config file.
- First apply the repository
.gitignore, then apply additionalexcluderules. - Use one or more
includeglobs to limit the scan scope. - Output only files whose physical line count is greater than or equal to the threshold.
Install
npx skills add bosens-China/my-skills/skills/file-line-audit
Binary selection
From scripts/ select the executable for the corresponding platform:
- 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
Steps
- Confirm that you are currently in the target repository root.
- Inspect the repository structure and decide what to scan:
- Identify source directories, for example
src、app、apps、pkg、packages、lib、internal、cmd、backend、frontend、client、server、service、services、api、web。 - Identify relevant source extensions, for example
js、ts、tsx、vue、py、go、rs、java、kt、rb、php、cs、swift。 - Only when
.gitignoreis insufficient, add additionalexclude, for exampledist/、build/、coverage/or generated directories.
- Identify source directories, for example
- According to the current platform, select the correct
scripts/line-audit-*binary. - On Linux/macOS, ensure the binary is executable:
chmod +x <binary_path> - Use explicit
--include, optional--exclude, and optional--thresholdto run. - Return the list of files above the threshold to the user.
Command
In the following examples,<skill_root> is the absolute path of the current skill directory.
Run with the include parameter
Unix-like systems:
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/"
Run with JSON parameters
If a full parameter object is more convenient, use --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/"
]
}'
Parameters
--include/-i: Required glob pattern; multiple source roots or extension scopes can be passed repeatedly.--exclude/-e: Optional additional ignore rules, with the same syntax as.gitignore; can be passed repeatedly.--threshold/-t: Output threshold, default400。--json/-j: Optional JSON object, containingthreshold、include、exclude。--help/-h: Show CLI help.
Output format
Return the tool output directly. Expected format:
# File Line Audit
## Files Over Threshold (>= 400 lines)
- src/example.ts 512
- apps/web/pages/home.tsx 438
Limitations
- Only physical line counts are counted: code, comments, and blank lines are not distinguished.
- Binary files are skipped automatically.
- Depends on a Git environment to resolve
.gitignore。 - Optimized for source scanning; avoid scanning large data directories or build artifacts that are not covered by
.gitignore.
Notes
- Repository
.gitignorealways takes effect, even if no additionalexclude。 - Supports nested
.gitignore。 - Each run requires at least one
--includepattern.