skills/improve-codebase-architecture/SKILL.md
--- name: improve-codebase-architecture description: Scan a repo for shallow modules and propose consolidations into deeper ones. Ousterhout's deep-modules principle applied to AI-friendly codebases (better feedback loops, easier delegation, fewer parallel-agent collisions). Standalone skill; can run on any repo. Use when a codebase feels hard for agents to work in, when modules feel too small, or before starting a Pocock Flow on a repo you haven't shaped yet. Triggers on "deepen modules", "impr
npx skillsauth add RonanCodes/ronan-skills skills/improve-codebase-architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Matt Pocock's "one thing to take away" pitch: scan your repo for shallow modules and propose how to deepen them. Deep modules (small interface, large behaviour) are easier to test, easier to delegate to agents, and produce fewer merge conflicts when multiple agents work in parallel.
docs/architecture/module-audit.md (with --write).This skill is read-only by default. It proposes; the human (or a follow-up Ralph run) does the actual refactoring.
/improve-codebase-architecture [--repo <path>] [--write] [--target <subdir>]
Defaults:
--repo: current directory (resolved via git rev-parse --show-toplevel).--write: off; pass to persist the report.--target: scans everything; pass a subdirectory to scope the audit.Walk the source tree. Per language:
.ts / .tsx file is a module candidate. Group by directory for higher-level modules..py file; group by package..go file; group by package.mod declaration.For each module:
A rough heuristic:
depth_score = behaviour_size / max(interface_size, 1)
depth_score >= 8: deep. Good shape.4 <= depth_score < 8: medium. Probably fine.depth_score < 4: shallow. Flag for review.This heuristic is rough on purpose. Don't treat the number as truth; use it to surface candidates.
For each cluster of shallow modules that share callers or call each other heavily, propose a consolidation:
SHALLOW CLUSTER A
- utils/format-currency.ts (3 exports, 18 lines)
- utils/format-date.ts (4 exports, 22 lines)
- utils/format-percent.ts (2 exports, 14 lines)
PROPOSED DEEP MODULE: utils/format.ts
Single export: format(value, type)
Internal: all current helpers as private functions
Test boundary: one integration test per format type
For each proposal, include:
Matt's killer example was wrapping a whole subsystem (browser video editor, front end to back end) in one deep module using a discriminated union between layers. Look for similar patterns:
client/ and server/ but conceptually represents one operation.These are the highest-leverage refactors. Flag them at the top of the report.
docs/architecture/module-audit.md:
# Module Audit, YYYY-MM-DD
## Summary
- N modules analysed
- M flagged as shallow (depth_score < 4)
- K proposed consolidations
## High-leverage refactors (perfect-fit candidates)
...
## Shallow clusters
...
## Already-deep modules (kept for reference)
...
## How to act on this
1. Pick one proposed consolidation.
2. Run /matt-pocock-coding-workflow with the consolidation as the brief.
3. Re-run /improve-codebase-architecture after to confirm the depth_score improved.
llm-wiki-ai-research:deep-modules-for-aidevelopment
--- name: worktree description: Coordinate multiple agents on one repo via a worktree-lock pool, so two agents never clobber each other's working tree. Acquire the first free slot (main, then beta/gamma… worktrees, created on demand), work there on your own branch, release when you've pushed. Use before modifying any repo that might be in use by another agent (factory, dataforce, etc.), or whenever you're told a repo is being worked on. Backed by `ro worktree`. category: development argument-hin
testing
--- name: ship description: Ship a feature branch the local-CI-first way — run the full local gate, push, open a PR, squash-merge, then deploy, without waiting on GitHub Actions. Use when a branch is ready for main and you want it merged and deployed now. Reads CI policy from `ro ci` (default skips remote CI because GitHub Actions billing keeps hitting limits). Sibling to /ro:gh-ship (waits on GitHub checks) and /ro:cf-ship (the deploy half). Triggers on "ship it", "ship this", "merge and deploy
testing
--- name: setup-logging description: Set up (or audit) the observability stack in a TanStack Start + Cloudflare Workers app so it is "diagnosable by default" — structured logging (logtape) with a request context carrying trace_id + userId + tenant/orgId, a trace_id propagated FE→BE→logs→Sentry→PostHog, Cloudflare Workers observability enabled, and Sentry + PostHog wired. Two modes: `setup` (wire it into an app) and `audit` (check an existing app + report gaps). Use when scaffolding a new app, wh
development
Manage credentials INSIDE the active ~/.claude/.env file — read which token/account to use for a given app (Simplicity vs Dataforce vs Ronan-personal), add or update a secret WITHOUT it passing through the chat (an interactive Terminal window prompts for it), and track secrets that were exposed in a transcript so they get rotated. Sibling to /ro:context (which switches WHICH env file is active). Use when the user wants to add an API key/token/secret, asks "which credential do I use for X", needs the env organized/labelled, or a secret was pasted into the chat and should be rotated.