collapse-pass

Removes unjustified indirection from codebases through iterative, commit-scoped simplification passes.

4.8k|376|Updated Mar 16, 2023
One-click install
npx skills add https://github.com/EpicenterHQ/epicenter --skill collapse-pass
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: collapse-pass
Source: https://github.com/EpicenterHQ/epicenter/tree/main/.agents/skills/collapse-pass
Command: npx skills add https://github.com/EpicenterHQ/epicenter --skill collapse-pass

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Codebases accumulate dead exports, one-call wrappers, re-export chains, and shallow abstractions that inflate the public surface and slow down every future read. This Skill provides a disciplined, session-long protocol for finding and deleting that indirection one surgical commit at a time, without breaking durable data formats or public contracts.

Core Features & Use Cases

  • Per-iteration ritual: Count callers with ripgrep, mentally inline helpers, run a one-sentence cohesion test, and surface each finding before editing.
  • Anti-cosmetic gate: Every commit must shrink the public API surface, file count, call-graph depth, or first-read effort, or it gets reverted.
  • Safety guardrails: A never-touch list protects durable strings, schemas, and storage formats, with explicit pause conditions for package-boundary and public-API changes.
  • Use Case: After a large feature wave in a TypeScript monorepo, run a collapse pass over packages/auth and packages/data to delete dead exports and inline single-caller wrappers, landing one conventional commit per simplification with tests and typechecks per checkpoint.

Quick Start

Ask the AI to run a collapse pass on a specific package or pull request diff, declaring the scope, stop condition, and starting target.

Frequently Asked Questions about collapse-pass

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a collapse pass on a codebase?

Declare the scope (packages or apps), a stop condition such as three consecutive no-finding files or a checkpoint budget, and a starting target. The skill then iterates: count callers with ripgrep, mentally inline candidates, surface each finding, and commit only changes that shrink surface, files, or call depth.

How do I find dead exports and unused code in a TypeScript monorepo?

Grep for exported symbols with ripgrep, then cross-reference each name across the repo; a symbol whose only hit is its own definition is a dead-export candidate. Verify it is not in a package's exports map or consumed by external CLI/SDK users before deleting.

Can a collapse pass run on a pull request or branch diff?

Yes. The skill isolates the PR or branch in a git worktree, computes scope with git diff against the base, and runs the same per-iteration ritual on changed files first. It does not stage, commit, or push unless explicitly asked.

When should I not collapse a one-caller helper or wrapper?

Keep one-caller boundaries when they isolate a lifecycle, an unsafe boundary, a public contract, or a long imperative phase. Also pause before changing durable strings, merging packages, or altering signatures that cross a published package boundary.

What stops a collapse pass from making cosmetic-only changes?

The anti-cosmetic gate requires every commit to shrink the public API surface, file count, or call-graph depth, or measurably ease a future first read. If none of those is true after a commit, the change is reverted and a deeper smell is sought.