From memstack
Splits monolithic files over 1000 lines into focused, maintainable modules with import updates and build verification.
How this skill is triggered — by the user, by Claude, or both
Slash command
/memstack:shardThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
*Split monolithic files into focused, maintainable modules.*
Split monolithic files into focused, maintainable modules.
When this skill activates, output:
💎 Shard — Refactoring large file...
Then execute the protocol below.
| Context | Status |
|---|---|
| User says "shard", "split file", or "refactor" | ACTIVE — full protocol |
| Editing a file over 1000 lines | ACTIVE — suggest refactor |
| User says "refactor" for logic changes (not splitting) | DORMANT — not a shard task |
| Discussing code organization concepts | DORMANT — do not activate |
| File is under 500 lines | DORMANT — not worth splitting |
Identify the target file and count lines:
wc -l <file>
Analyze structure:
Propose the split — present to user BEFORE executing:
Execute the refactor:
Verify build:
npm run build 2>&1 | tail -20
Present result — new file structure with line counts
User: "shard infrastructure/page.tsx — it's 1100 lines"
💎 Shard — Refactoring large file...
infrastructure/page.tsx (1,110 lines) → 6 files:
page.tsx (~120 lines) — Main page, tab switcher
RailwayTab.tsx (~200 lines) — Railway monitoring
HetznerTab.tsx (~180 lines) — Hetzner monitoring
HeadroomTab.tsx (~250 lines) — Headroom + setup guide
types.ts (~80 lines) — Shared interfaces
constants.ts (~60 lines) — Status configs
Build check: ✓ passed
npx claudepluginhub cwinvestments/memstack --plugin memstackSplits large markdown documents into smaller organized files by level 2 sections using npx @kayvan/markdown-tree-parser. Useful for managing large docs; activates on 'perform shard document'.
Splits large markdown documents into smaller organized files by level 2 sections using npx @kayvan/markdown-tree-parser. Useful for managing large docs; activates on 'perform shard document'.
Safe multi-file refactoring with automatic rollback: rename, extract, inline, move, split, and merge code while preserving type/test baselines.