- Home
- Skills
- Code Quality & Review
- Fault Lines: Find the Files to Refactor First
More screenshots
Works with the AI Agents you already use
Fault Lines: Find the Files to Refactor First
Fault Lines finds the files in your JavaScript or TypeScript codebase that would break the most if they broke, and tells you which to refactor first.
$9
Fault Lines: Find the Files to Refactor First
Example session with this skill installed
Run Fault Lines on this project and tell me which files to refactor first.
- Read your context and instructions
- Compiled the fault lines
- Generated the UI component
Fault Lines on Ghost (ghost/core, 1,388 files). The report opens from disk: fault-lines-report/index.html.
The run is trustworthy. Coverage is 96.4%: 3,416 of 3,544 declared internal imports resolved. The invariant reads OK (Ca* 329,184 = Ce* 329,184).
The queue: 12 files, in the order to work through them
server/data/schema/schema.js: about 500 files stop working if it breaks; about 2,800 lines.server/services/email-service/batch-sending-service.js: about 410 files; about 1,900 lines.server/services/email-service/email-renderer.js: about 410 files; about 1,650 lines.server/services/comments/comments-service.js: about 410 files; about 1,000 lines.server/services/members/members-api/controllers/router-controller.js: about 410 files; 1,400 lines.server/services/members/members-api/repositories/event-repository.js: about 410 files; about 1,300 lines.- to 12.
member-repository.js(3,050 lines, the largest file),database-automations-repository.ts,models/post.js,gift-service.ts,stripe-api.jsandmodels/user.js: about 280 files each, all six in the same 125-file dependency cycle, the bigger first.
Files 7 to 12 share one blast radius because anything that reaches one of them reaches the whole cycle. Each is big enough to be in the queue on its own, and the cycle ties them together: none can be changed or tested in isolation from the other 124 files.
The counters
Cycles: 4, of 125, 114, 7 and 2 files. The two big ones sit low in the graph, which is why even the median file has a large blast radius.
Amplifiers: 3, small files that many import and that import many, such as frontend/services/proxy.js (122 lines, imports 13, imported by 40).
- Orphans: 20, each either an entry point or dead code; only a person can tell which.
Controllers used as dependencies and direction violations: not checked, because Ghost declares no leaf layers and no layering rule.
What moved: this is the first run, the baseline. The next run will report files entering or leaving the queue, blast radius moving, and cycles opening, closing, growing or shrinking.
What the numbers cannot decide: the queue ranks by risk. Whether a refactoring is worth doing now, and where to cut the 125-file cycle, is a human call.
index.html
TSX · React component
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Fault Lines finds the files in your JavaScript or TypeScript codebase that would break the most if they broke, and tells you which to refactor first. It crosses each file's blast radius, how many modules stop working if it fails, directly or through others, against its size, and ranks the files that are both widely depended on and big.
Why two axes
A file that half the system imports is not a problem by itself: a small, widely used utility is the healthy foundation of the system, and refactoring it is wasted effort. The danger is a big file that much of the system depends on: a middleware, an authorization layer, a repository with thousands of lines. One change there without tests breaks several parts at once. Fault Lines plots every file on blast radius against lines of code, and only the files in the top-right corner, the pain zone, enter the refactoring queue.
What you get
- A standalone HTML report, opened straight from disk: a scatter chart of every file, the zones drawn from your own thresholds, and a sortable table below it.
- Click any file to draw its links: solid red lines are what it uses, dashed blue lines are what depends on it, one level or the whole chain.
- Top N keeps only the riskiest files; By domain groups them by feature.
- The refactoring queue, in the order to work through it: the biggest blast radius first, the easier refactoring first between two similar targets.
- Structural detectors: dependency cycles, amplifiers (small files that pass risk through in both directions), orphans, controllers used as libraries, and layer-direction violations when you declare a layer order.
- What moved since the last run. Run it again after a refactoring and your agent tells you which files left or entered the queue, whose blast radius grew or shrank, and which cycles opened or closed.
How it works
On the first run your agent asks your permission, installs the analysis tooling (madge and TypeScript, pinned versions) once in a per-user cache outside your project, and writes a short config by reading your project's structure. It calibrates the thresholds to your codebase and checks that the dependency graph is complete before reporting anything: if too many imports failed to resolve, the run stops instead of showing a report that understates the coupling.
From then on every run executes the bundled scripts and reads only their output. Your source tree is not read again, and two runs over an unchanged tree give byte-identical reports.
Good to know
- JavaScript and TypeScript today, including mixed projects, path aliases and monorepos. More languages are coming soon.
- Delivered through Agensi's MCP: one setup step, and your agent always gets the latest version.
- Needs Node.js 18 or later and npm, and network access on the first run to install the tooling.
- Nothing of the skill is left in your project. It writes one config file and one report folder; your package.json is never touched.
- It is a diagnosis, not a gate. It fails no build and blocks no commit.
The demo shows Fault Lines on Ghost (MIT), the open-source publishing platform.
JavaScript and TypeScript only for now (.js, .jsx, .mjs, .cjs, .ts, .tsx); more languages are coming. Static analysis: an import inside a function counts as a dependency, a path built at run time does not. Needs Node.js 18 or later and npm, and network access on the first run. Validated end to end with Claude Code. It ranks files by risk; whether a refactoring is worth doing now is still your call.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 6 days ago
Requires
Permissions
File Scopes
Read files: your project's folder structure and its tsconfig, once, to write the config; the bundled scripts read the source files to build the dependency graph. Write files: the config and the report folder only. Terminal: to run the four bundled scripts with Node.js, and, once, with your permission, to install madge and TypeScript (pinned versions) in a per-user cache outside your project. Network: only that first install, from the npm registry. Nothing is sent to any other service.