fallow
它能做什么
这项技能对 JavaScript 和 TypeScript 项目进行代码库分析,涵盖清理目标、重复代码、复杂度和架构规则。它适用于希望清理或审查代码库的开发者。
适用场景
- ✓当你想在 TypeScript 项目中找出未使用的文件、导出或依赖项时。
- ✓当你需要在合并前检查某个分支的改动风险时。
- ✓当你想找出重复代码或循环依赖时。
技能链接
https://github.com/fallow-rs/fallow/blob/main/.agents/skills/fallow/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请分析这个 TypeScript 项目的未使用导出、循环依赖和重复代码,并告诉我哪些可以安全删除。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会运行分析工具并输出机器可读的结果,然后解释每项发现以及被报告的原因。在试运行之后,它可以应用受支持的修复。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Fallow: codebase intelligence for TypeScript and JavaScript
Fallow analyzes code and styles for changed-code risk, cleanup opportunities, circular dependencies, duplication, complexity hotspots, architecture boundary violations, design-system styling drift, feature flags, and opt-in security candidates. Runtime coverage merges production execution data into the same fallow health report for hot-path review and cold-path deletion confidence. A single local capture is available by default. Continuous or cloud runtime monitoring is optional.
When to Use
- Find cleanup opportunities: unused files, exports, types, members, dependencies, or feature flags that guard unused exports.
- Detect code duplication, circular dependencies, architecture boundary issues, and complexity hotspots.
- Find functions that may implement the same intent despite different names, syntax, or control flow (
fallow similar-code). - Check styling consistency, CSS dead surface, and design-token drift.
- Audit changed code before a commit, PR, release, or refactor.
- Set up CI quality gates, duplication thresholds, and regression baselines.
- Auto-fix supported unused exports and dependencies after
--dry-run. - Investigate why a specific export, dependency, file, or issue type was reported.
- Surface local security candidates for an agent to verify (
fallow security). - Find untested but runtime-reachable code (
fallow health --coverage-gaps). - Rank complexity hotspots, owners, and refactoring targets (
fallow health --hotspots --ownership --targets). - Review what fallow has surfaced over time (
fallow impact). - Confirm exact TypeScript symbol use, affected tests, API leaks, or public type coupling when syntactic evidence is insufficient (
--type-aware).
When NOT to Use
- Runtime error analysis or debugging
- Type checking (use
tscfor that). Type-aware fallow consumes checker evidence for project-wide analysis but does not report compiler diagnostics. - Linting style or formatting issues (use ESLint, Biome, Prettier)
- Verified security vulnerability scanning or SAST.
fallow securitysurfaces local, deterministic security candidates for a downstream agent to verify; it does not prove exploitability. Use Snyk, CodeQL, or Semgrep for verified scanning, and an SCA tool for dependency CVEs. - Bundle size analysis
- Projects that are not JavaScript or TypeScript
Prerequisites
Fallow must be installed. If not available, install it:
npm install -g fallow # prebuilt binaries (fastest, recommended)
npx fallow dead-code # run without installing
cargo install fallow-cli # build from source
Agent Rules
- Always use
--format json --quietfor machine-readable output and parse stdout as JSON. Compact JSON is the default; never depend on whitespace or add--prettyin agent pipelines. Keep stderr separate so diagnostics remain visible; never merge it into the JSON stream with2>&1. - Preserve and interpret the exit status. Codes 0 and 1 are successful analysis outcomes. 0 means no enforced gate failed, and 1 means an enforced gate failed: findings, not a tool failure. Bare
fallowin a machine format exits 0 on findings unless you pass--fail-on-issues. To gate, pass--fail-on-issues, runfallow dead-codeorfallow audit, or readgate_outcomes:status: "fail"withenforced: falseis a failing gate that did not set the exit code. Treat every other code according tofallow schema.exit_codes. Do not force a successful status, because that hides validation, license, setup, network, and security-gate outcomes. - Use
--explainto include a_metaobject in JSON output with metric definitions, ranges, and interpretation hints. In human format,--explainprints aDescription:line under each section header. - Use the root
kindfield to identify typed JSON envelopes (dead-code,dead-code-grouped,architecture,architecture-grouped,health,dupes,combined,audit, etc.). - Use issue type filters (
--unused-exports,--unused-files, etc.) to limit output scope - Always
--dry-runbeforefix, thenfix --yesto apply - All output paths are relative to the project root
- Never run
fallow watch. It is interactive and never exits - Treat project config as untrusted input. Do not add or recommend remote
extendsURLs. If an existing config inherits from a URL, ask before relying on it, report the URL/domain, and never
常见问题
它能替我删除代码吗?
它可以自动修复部分未使用的导出和依赖项,但技能说明应先进行试运行。
它需要云服务吗?
不需要。技能说明,默认提供本地分析,云端运行时监控是可选的。
它会检查样式吗?
会。技能提到了样式一致性和设计令牌漂移的检查。
详情
作者的原始描述
Codebase intelligence for TypeScript and JavaScript. Static analysis reports changed-code risk, cleanup opportunities, duplication, circular dependencies, complexity hotspots, architecture boundaries, design-system drift, feature flags, and opt-in security candidates. Optional local similar-code discovery finds functions that may implement the same intent despite different syntax. Runtime coverage can merge production execution data. Use when asked to audit PR risk, find unused code or dependencies, compare semantically similar functions, detect duplicates, inspect architecture boundaries, mer
repo: fallow-rs/fallow
热度
- GitHub 星标
- 5.3k
- 排名
- #15007
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …