shard

shard is a skill for Claude Code from cwinvestments/memstack. It costs 28 tokens per session (687 once invoked), scanned A, original, MIT.

A code-organization helper for splitting very large files into smaller modules with related code grouped together. A monolithic file is one large file containing many different responsibilities.

In plain words
What is it for?
Use it when a file is over 1,000 lines or when you explicitly need to split a monolithic file into focused files, with shared utilities separated from feature-specific code.
Why use it?
Large files are harder to understand and maintain. This helper provides a process for analyzing their contents, proposing a split, and moving code while preserving internal dependencies.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the memstack plugin — 87 skills, 2 commands, 6 hooks shipped together

Good fit Use it when a file is over 1,000 lines or when you explicitly need to split a monolithic file into focused files, with shared utilities separated from feature-specific code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cwinvestments/memstack/shard
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cwinvestments/memstack --skill shard
Clone the repo
git clone --depth 1 https://github.com/cwinvestments/memstack

Made for: Claude Code.

Or install memstack, the plugin that ships this one along with the rest of its 87 skills, 2 commands, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for shard

README.md
[![agentmods](https://agentmods.dev/badge/skills/cwinvestments/memstack/shard/github.svg)](https://agentmods.dev/skills/cwinvestments/memstack/shard)
Your own site
<a href="https://agentmods.dev/skills/cwinvestments/memstack/shard"><img src="https://agentmods.dev/badge/skills/cwinvestments/memstack/shard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for shard

Your own site · 80×15
<a href="https://agentmods.dev/skills/cwinvestments/memstack/shard"><img src="https://agentmods.dev/badge/skills/cwinvestments/memstack/shard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 687 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00687
Opus 5.5 $0.00011 $0.00275
Sonnet 5.5 $0.00006 $0.00137
Haiku 4.5 $0.00003 $0.00069

Measured 1mo ago against content hash c8eadd7a09fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

shard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/shard/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

💎 Shard: Refactoring Large File...

Split monolithic files into focused, maintainable modules.

Activation

When this skill activates, output:

💎 Shard: Refactoring large file...

Then execute the protocol below.

Context Guard

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

Protocol

  1. Identify the target file and count lines:

    wc -l <file>
    
  2. Analyze structure:

    • List all exports (functions, components, types, constants)
    • Identify logical groupings
    • Map internal dependencies (what calls what)
  3. Propose the split: present to user BEFORE executing:

    • Target: 100-300 lines per new file
    • Group related functionality
    • Keep types near consumers
    • Shared utilities in separate file
  4. Execute the refactor:

    • Create new files with proper names
    • Move code to appropriate files
    • Add import/export statements
    • Create index.ts barrel if needed for backwards compatibility
    • Update all imports throughout the project
  5. Verify build:

    npm run build 2>&1 | tail -20
    
  6. Present result: new file structure with line counts

Inputs

  • File path to refactor
  • Optional: preferred split strategy or target file count

Outputs

  • Multiple smaller files replacing the original
  • Updated imports throughout project
  • Build verification

Example Usage

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

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed c8eadd7a09fd
  2. 1mo ago First seen · 92 lines · 28 tokens per session scan A 9a191784d328

Subscribe to this mod's changes

shard is a skill published in the GitHub repository cwinvestments/memstack (425 stars, last pushed 4d ago), licensed MIT. It adds 28 tokens to every session and 687 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

plan-eng-review

Eng manager-mode plan review. Lock in the execution plan — architecture, data flow, diagrams, edge cases, test coverage, performance. Walks through issues interactively with opinionated recommendations. Use when asked to "review the architecture", "engineering review", or "lock in the plan". Proactively suggest when…

GCWing/BitFun · 116 tokens

autoplan

Auto-review pipeline — reads the full CEO, design, eng, and DX review skills from disk and runs them sequentially with auto-decisions using 6 decision principles. Surfaces taste decisions (close approaches, borderline scope, codex disagreements) at a final approval gate. One command, fully reviewed plan out. Use when…

GCWing/BitFun · 152 tokens

pre-landing-review

Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust boundary violations, conditional side effects, and other structural issues. Use when explicitly asked for the specialized pre-landing workflow. Product /review requests are handled by OpenBitFun's unified Review mechanism instead.…

GCWing/BitFun · 75 tokens

pr-review-canvas

Create a OpenBitFun Canvas for reviewing a pull request, branch diff, or change set with Cursor-style diff cards, review maps, risk callouts, and focused reviewer flow. Use when the user asks for a PR review canvas, diff walkthrough, change-set overview, or visual review summary.

GCWing/BitFun · 64 tokens

pr-review

Focused pull request review practices with severity-ranked, file-and-line-cited findings across four angles: security, performance, tests, and architecture. Use when asked to review a pull request, review a diff or set of changes, review "this PR," or provide a code review before merge.

Mindrally/skills · 61 tokens

eval-skills

Audit a project or library of skills for metadata, trigger boundaries, workflow completion criteria, local resource closure, instruction economy, tool scope, effort, and routing evidence. Use before shipping skills, after importing a skill collection, or when a skill triggers too often or not at all.

FlorianBruniaux/claude-code-ultimate-guide · 60 tokens