code-health
Skill4 starsChanged 18 days agoMITView on GitHub
Measure a repo's structural health and its trend: real duplication, long functions with branches, nesting, exports nobody imports, unused dependencies and which files churn the most. It saves a baseline to answer whether the code is worse than last time. Use when wondering about technical debt, whether this is rotting, or where to start cleaning up; before planning a refactor, when inheriting a repo, and after a stretch of generating lots of code with agents.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- TDesktop-x64/tdesktoptheir own version, first seen Nov 9, 2026
- outcast1000/viboplrtheir own version, first seen Nov 8, 2026
- khoralabs/skillstheir own version, first seen Nov 1, 2026
- neijix/AICodeFactorytheir own version, first seen Nov 1, 2026
- kukuruzka165/materialgramtheir own version, first seen Oct 17, 2026
- telegramdesktop/tdesktoptheir own version, first seen Oct 17, 2026
Used with
Projects with it also use dependency-watch, perform-task and 3 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
telegramdesktopSkilldependency-watch
Audit Telegram Desktop dependencies on freshly fetched origin/dev for releases and security fixes, including upstream lag and backport candidates in patched forks. Use for the scheduled dependency monitor or an explicitly requested dependency report.
Also in 3 projects that use this
telegramdesktopSkillperform-task
Resolve, start or resume, implement, review, test, and publish exactly one existing ai-tdesktop task by short slug or full dated id, including rare blocked retries and split-required results. Use when the user invokes $perform-task or /perform-task with a known task name, or when the continue scheduler delegates one selected task. Runs standard review lenses with fast applicability bailouts and selects task-specific domain and evidence instruments without selecting additional work.
Also in 3 projects that use this
JerovinoSkillprocess-inbox
Processes tasks.md inbox items by triaging each one to its proper location in the vault
Also in 3 projects that use this
Trejon-888Skillcontinue
Load project context, alignment audit, status check, suggest next action. Auto-invoke at session start, after context switches, or when user says 'continue', 'pick up where we left off', 'resume', 'what's next', 'status check', 'what now'.
Also in 3 projects that use this
raineSkillrebase
Rebase the current branch with smart conflict resolution.
Also in 3 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- telegramdesktop/tdesktop★ 33ksame name
- TDesktop-x64/tdesktop★ 3ksame name
- kukuruzka165/materialgram★ 1.2ksame name
- ramboz/jig★ 7same name
- outcast1000/viboplr★ 6same name
- khoralabs/skills★ 1same name
- lepinkainen/skills★ 1same name
- mcabreradev/hermes-sdd-agency★ 1same name
- neijix/AICodeFactory★ 0same name
- PrairieAster-Ai/quality-butler★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- add-repo-to-docsSkill
- adrSkill
- auth-bypass-localSkill
- before-afterSkill
- bug-huntSkill
- carry-envSkill
- crux-doctorSkill
- crux-initSkill
- css-to-componentsSkill
- deploy-fallbackSkill
- deploy-watchSkill
- device-loopSkill
- drive-browserSkill
- e2eSkill
- end-sessionSkill
- eval-fixturesSkill
- explain-planSkill
- flowSkill
- grillSkill
- merge-conflictsSkill
- motion-videoSkill
- oauth-reauthorizeSkill
- prod-signalsSkill
- promote-to-docsSkill
- prose-checkSkill
- read-documentSkill
- render-loopSkill
- repo-mapSkill
- review-prSkill
- root-causeSkill
- runbookSkill
- security-auditSkill
- share-localSkill
- shipSkill
- skill-auditSkill
- skill-creatorSkill
- teachSkill
- ui-behaviourSkill
- ui-tellsSkill
- visual-diffSkill
- visual-testSkill
- wizardSkill
- workspaceSkill
- write-testsSkill
- x-postsSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
No dependencies: it only needs files and git.
- Distinctive: line 75
Every so many weeks, to see the trend.
- Distinctive: line 76
Before planning a refactor, to choose where instead of going by intuition.
- Very specific: line 77
When inheriting a repo, together with /repo-map.
- Distinctive: line 78
After a stretch of generating a lot of code.
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
code-health
Code review looks at the diff. This measures the whole, which is what nobody looks at and what erodes slowly.
It matters especially when working with agents: the pattern measured across the industry is that generated code sends duplication soaring, because the model tends to repeat a solution instead of looking for the one that already exists in the repo. It isn't noticeable in any specific diff; it is noticeable three months later.
Usage
node <this-skill-directory>/scripts/health.mjs [path] [--save] [--tests] [--top N]No dependencies: it only needs files and git. It works on TypeScript, JavaScript, Python, Go, Rust, Java and Ruby.
--save stores the baseline in .crux-health.json. That is the point: from
then on the question stops being "is this fine?" (which has no answer without
arguing over thresholds) and becomes "is it worse than last time?", which
does.
Tests are left out by default. Their duplication is largely legitimate (the same
setup repeated) and drowns out that of the production code, which is the one that
matters. With --tests they are included.
What it measures and how to interpret it
Duplication. Repeated blocks of logic, normalized so they don't depend on formatting. It only counts what has real logic: multiline imports, object literals and comments are filtered out, because otherwise they dominate the report and make it useless.
A block in two places may be chance. In four it is a missing function. If in addition it is in four files of the same module, the function is missing in that module.
Long functions with branches. Long is not the same as complex: a 1,500-line data catalogue is not a problem. That is why only what is long and has branching is reported. What is sought is "this does too many things", not "this takes up a lot of space".
Nesting. Maximum depth per file. Beyond seven levels, the reader stops holding the mental state.
Exports nobody imports. Dead-code candidates. Careful: they may be public API consumed from outside, entry points or things used by reflection. It is a list to review, not to delete.
Declared and unused dependencies. They are usually leftovers from something that was tried. Each one is attack surface and install time.
Most churned files. From the git history. On its own it says nothing bad: what is touched a lot is usually the heart of the repo.
The reading that really matters
Cross two lists: a file that shows up in both "most churned" and "deeply nested" or "long function" is where the refactor pays for itself. It is touched a lot and hard to touch. Refactoring something complex that nobody touches is wasted time.
Cadence
It is not an everyday skill. It makes sense:
- Every so many weeks, to see the trend.
- Before planning a refactor, to choose where instead of going by intuition.
- When inheriting a repo, together with
/repo-map. - After a stretch of generating a lot of code.
Save the baseline the first time. Without it the report is a snapshot, and what is valuable is the film.
What to do with the result
- Duplication first. It is the cheapest to fix and avoids the most debt: extracting a function is low-risk with immediate effect.
- Then the churned x complex crossing. That is where the real refactor goes.
- Orphans and dependencies, in a separate cleanup pass. They are background noise, not urgency.
- And what you are not going to fix, don't even look at. A report that produces a wish list nobody executes stops being read.
Anti-patterns
- Chasing zero. Some duplication is healthy; abstracting two things that look alike today but evolve differently is worse than repeating them.
- Deleting orphan exports without checking. It is the fastest way to break an external consumer.
- Measuring without a baseline. Absolute numbers invite arguing over thresholds; the trend admits no argument.
- Turning it into a CI gate. Blocking a commit over a structural metric breeds tricks, not quality. This informs decisions, it doesn't make them.
Related
/ship: the diff review, upstream of this/repo-map: orienting yourself in a repo, complementary when inheriting it/write-tests: before refactoring what this report points to
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.

