Skip to content
Agentmart
Submit a tool

shrinkray

Shrinks repositories while preserving behavior by removing dead code, duplication, and verbosity with measured verification.

Skill by 0xdewy

IndexedMIT
Write a review

Chalk Labs

Need help deploying shrinkray?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/0xdewy-shrinkray

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Shrinks repositories while preserving behavior by removing dead code, duplication, and verbosity with measured verification. Only use when explicitly requested.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/shrinkray

What's inside

Skill name
shrinkray
Description
Shrinks repositories while preserving behavior by removing dead code, duplication, and verbosity with measured verification. Only use when explicitly requested.
License
MIT
Instructions
79 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (8)

  • SKILL.md
  • evals.json · evals/
  • subagent-prompts.md · references/
  • deadcode_scan.py · scripts/
  • dependency_index.py · scripts/
  • detect_runner.py · scripts/
  • less_code_pass.py · scripts/
  • measure_loc.py · scripts/

SKILL.md (first lines)

# Shrinkray

Clean a repository without changing intended behavior. Never commit.

Load `../common/patterns/execution-contract.md` and
`../common/patterns/scaling.md`. Load `references/subagent-prompts.md` only
when dispatching a role.

## Focus

- `--focus size` (default): dead code, unreferenced files, duplication,
  verbosity.
- `--focus correctness`: real defects, plus localized structural fixes with a
  measurable gain.
- `--focus security`: reachable vulnerabilities and high or critical reachable
  dependency advisories (`npm audit`, `pip-audit`, `cargo audit`,
  `govulncheck` when installed).
- `--focus all`: all three.

Not this skill: build minification, a findings-only review (`red-team`), a
PR or diff review (`pr-smellz`), or one obvious fix (just make it).

Work directly by default. Dispatch the focus's roles only when the target is
too large for one context: `--standard` 1-3 roles chosen from the evidence,
`--thorough` adds the size structural roles. Cap 5 iterations.

## Loop

1. **Setup.** Resolve `WORKSPACE` and read the project goal from its README
   or manifest. Run `git status --short`; outside git,
   warn and snapshot files before editing. Detect the runner with
   `scripts/detect_runner.py`, measure LOC with `scripts/measure_loc.py`, and
   run the tests once as the baseline. Record all of it in `session.json`.
2. **Evidence.** Run `scripts/less_code_pass.py <repo> <WORKSPACE>`
   (add `--test-command` when the runner is certain). `lc` applies and
   verifies its own changes; record `total_loc_removed`, or the skip reason
   when `ran` is false. Then run `scripts/deadcode_scan.py` and
   `scripts/dependency_index.py` with the same arguments. A missing tool is
   recorded, not fatal. Every focus uses these as leads.
3. **Find.** Review directly or dispatch roles. Findings are JSON:
   `{id, category, file, lines, description, evidence, confidence, source_tool}`.
   Rank tool-certified findings above model-only ones.
4. **Triage.** Drop low confidence. Where findings overlap, keep the larger
   gain. Flag public-API changes for human review instead of applying. Write
   `STAGED_CHANGES.md` before any edit. Nothing left: go to the report.
5. **Apply.** Order: correctness, security, unreferenced files, dead code,
   consolidation, verbosity. For each change, edit, save that change's diff
   to `WORKSPACE/changes/<id>.patch`, run the cheapest check (type checker,
   `py_compile`, `node --check`), and reverse the patch if it adds errors.
6. **Verify.** Run the full suite and available type-check and lint gates.
   On failure, reverse this iteration's patches newest first until green. If
   a reverse fails, stop and report the touched files and failed command.
7. **Repeat** from step 2 until a rescan finds no high or medium findings,
   fewer than 2 changes survive an iteration, or 5 iterations ran. Flag the
   run unstable when most of an iteration's changes were reverted.

## Report

LOC and test results before and after, changes kept and reverted per
category, and items left for human review. Tell the user to review
`git diff` and commit themselves. End with:

```text
DONE: <WORKSPACE> — <kept> changes across <iterations> iterations, -<lines> LOC (-<pct>%), verification <passed|partial|blocked>
```

From 0xdewy/skills, MIT.

More from 0xdewy/skills

Signals

Stars
0
Forks
0
Open issues
2
Last commit (this folder)
Oct 11, 2026 (20 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from 0xdewy

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get shrinkray running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying shrinkray?

CallGet help
Cite this page

shrinkray skill. Agent Mart. https://agentmart.dev/skills/0xdewy-shrinkray (last updated 2026-10-24)