Tidy Skill for Repo Housekeeping

A structured, behavior-preserving housekeeping pass prevents repo entropy without the risk of accidental refactors.

Tags

Tidy Skill for Repo Housekeeping

The Lesson

Repositories accumulate entropy — stale docs, dead code, orphaned scripts, outdated counts — and the longer it goes unaddressed, the harder it is to trust what's in the repo. A structured, scoped housekeeping pass that archives rather than deletes, verifies before removing, and never changes behavior keeps the codebase trustworthy without introducing risk.

Context

Across multiple projects (lessons, Artemis, JobClass, Certification), the same pattern repeated: one-time migration scripts lingered in the repo root, documentation counts drifted from reality, unused imports accumulated, and files ended up in the wrong directories. Developers hesitated to clean up because cleanup mixed with behavior changes is dangerous — a "quick tidy" that accidentally removes a dynamically-dispatched module breaks production.

The /tidy skill was built to formalize housekeeping as a distinct, auditable activity with explicit safety rails.

What Happened

  1. Early repo maintenance was ad-hoc — developers would notice stale files and delete them inline with feature work, making it hard to distinguish housekeeping from functional changes in code review.
  2. Several incidents occurred where "cleanup" commits introduced bugs: an import removed because it looked unused was actually loaded dynamically via a dispatch dictionary; a script archived while another script still referenced it by path.
  3. The tidy skill was designed as a six-step protocol: archive stale files, update documentation, clean dead code, normalize file organization, verify consistency, and commit. Each step has explicit "do NOT" rules to prevent overreach.
  4. Key safety decisions: files are archived (git mv to archive/) rather than deleted; every removal requires a Grep confirmation that no references exist; test assertions are only updated when the tidy itself changed a path or count; and all housekeeping goes in a single chore: tidy commit separate from any feature work.
  5. The skill supports scoped runs (/tidy docs, /tidy scripts, /tidy code, or a specific path) so a developer can address one area without committing to a full sweep.

Key Insights

Applicability

This pattern applies to any project that lives longer than a few months. It's especially valuable for:

It does NOT apply to:

Related Lessons

Related Lessons