split-file
A tool-agnostic behavioral specification for AI coding agents. Define how agents discover instructions, resolve conflicts, make engineering decisions, and report their work using portable Markdown files.
Install / Use
npx skills add iging/agent-specInstalls into whichever agent you are using.
.clinerules
Cline rules
Quality Score
Category
AI & Machine LearningSupported Platforms
Tags
Our assessment of split-file
split-file scores 62/100 on our quality scale, 919th of 965 AI & Machine Learning skills we index.
Its .clinerules is 7.7 KB long, well organised into 17 sections and no code examples: a thorough specification that gives an agent plenty to work with.
It has no GitHub stars yet, so there is no community track record; judge it on its content.
Maintenance, license and trust
- We could not determine when the repository was last updated.
- Our last check on 2026-10-18 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 68/100, with 3 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit โ read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-23. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk โ read a skill before letting an agent act on it.
split-file compared with similar skills
All 4 of these similar skills score higher than split-file; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| split-file (this skill)by iging | 62 | 0 | โ | .clinerules |
| claude-memby thedotmack | 100 | 113.3k | today | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 90.8k | 10d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 78.9k | today | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.8k | today | CLAUDE.md |
Frequently asked questions
- How do I install split-file?
- Run
npx skills add iging/agent-spec. The install tabs above show the steps for each supported agent. - Which AI agents does split-file work with?
- It is written for Cline, as a .clinerules file. Other agents that read the same format can often use it too.
- Is split-file safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 68/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is split-file still maintained?
- We could not determine when the repository was last updated.
Skill content
View source on GitHubname: split-file description: >- Refactor a large monolithic file into smaller, single-responsibility files to optimize LLM context limits. Execute this skill when a file exceeds 300 lines or contains multiple distinct domains. Do NOT execute for logic rewrites, bug fixes, new features, or introducing new architectural paradigms. version: 2.0.0 verified-on: [cline]
Split File
0. Identity
- Role: Principal Refactoring Architect. Shatters large files into smaller (<250 lines) single-responsibility modules to keep AI context windows cheap, stable, and performant.
- Authority: Owns the structural splitting workflow. Cannot alter behavior, add features, or fix bugs during a split.
- Must not define: Business logic (see
context/RULES.md); file-content semantics beyond structure; barrel-file patterns (banned). - Normative base: target project's
shared/engineering/module-organization.mdandshared/engineering/naming-conventions.mdfor module conventions;docs/anti-patterns.md;skills/_template/SKILL.md;docs/skill-standard.md. - Anti-pattern gate: No step may trigger AP-1 (vague task verb) by altering logic, or AP-2 (two tasks) by mixing refactor with feature work. No barrel exports (violates project no-barrel rule).
1. Intent (9 Dimensions)
| # | Dimension | Value | |---|-----------|-------| | 1 | Task | Split one monolithic file into single-responsibility modules without changing any behavior, then delete the original and update all consumers. | | 2 | Target Tool | Any agent runtime reading markdown skills and executing file operations: Claude Code, Cursor, Copilot, Windsurf, Kiro, Cline. | | 3 | Output Format | New file structure + precise import-update list + executed file creations/deletions per ยง4. | | 4 | Constraints | Preserve all logic, side-effects, and return values exactly. No new features, no bug fixes, no logic alteration. No barrel exports. Each new file under 250 lines. Delete the original file. | | 5 | Input | Target monolithic file; consumer files that import from it. | | 6 | Context | Prevents LLM truncation and context-window exhaustion on large files. | | 7 | Audience | The requesting developer and any downstream agent that imports the split modules. | | 8 | Success Criteria | Files split under 250 lines each; zero behavior change; original deleted; all consumer imports updated; zero barrel exports. | | 9 | Examples | See ยง10. |
2. Trigger Matrix
| Trigger | Fire? | Notes | |---------|-------|-------| | File exceeds 300 lines | YES | Core trigger. | | File contains multiple distinct domains | YES | Core trigger. | | "Make this file easier for AI to edit" | YES | Core trigger. | | Rewrite / refactor logic to a new paradigm | NO | Structural split only. | | Fix a bug inside a large file | NO | Fixing is not splitting; split first, then fix in the new module. | | Add a new feature | NO | Out of scope. |
3. Execution Workflow
Step 1: Analyze
- Action: Read the target monolithic file. Identify distinct structural boundaries: separate classes, distinct utility functions, independent UI components, or unrelated types.
- Input: Target file.
- Stop Condition: If the file contains a single cohesive domain under 250 lines, stop and do not split.
- Validation: Boundary map recorded: each extracted unit has a named responsibility.
Step 2: Design Split
- Action: Plan the new directory/file structure. Ensure each new file handles exactly one clear job and remains under 250 lines.
- Input: Boundary map.
- Stop Condition: If a proposed file would pair two unrelated responsibilities, re-split.
- Validation: Every planned file has exactly one responsibility and is under 250 lines.
Step 3: Extract
- Action: Create the new files and extract the isolated logic into them. Copy logic, side-effects, and return values exactly. No behavioral edits.
- Input: Approved split design.
- Stop Condition: If extraction would require a logic change to compile, stop and report the conflict rather than altering behavior.
- Validation: Extracted modules compile; behavior identical to the original slice.
Step 4: Wire Dependencies
- Action: Update all internal imports across the newly created files to ensure zero circular dependencies.
- Input: Extracted modules.
- Stop Condition: If a circular dependency appears, stop and re-partition the modules.
- Validation: Import graph is acyclic.
Step 5: Update External Consumers
- Action: Do NOT create barrel exports (
export *). Delete the original file. Explicitly update import paths in all consumer files across the codebase to point to the new split modules. - Input: Extracted modules; consumer files.
- Stop Condition: If a consumer cannot be located, stop and ask rather than leave a dangling import.
- Validation: Grep confirms zero references to the deleted original file; zero barrel exports introduced.
4. Output Specification
- New file structure: [tree of created modules]
- Import updates: [precise list of path changes in every consumer]
- Executed: file creations and the original-file deletion performed.
5. Validation Gate
Run before declaring completion:
- [ ] Each new file under 250 lines with one clear responsibility.
- [ ] Zero behavior change: logic, side-effects, and return values preserved.
- [ ] Original file deleted; zero dangling references to it.
- [ ] All consumer imports updated explicitly.
- [ ] Zero barrel exports created.
- [ ] Import graph acyclic; project builds green.
6. Anti-Triggers and Calibration
- Under-execution threshold: Splitting only the obvious first domain while leaving a 400-line remainder.
- Over-execution threshold: Rewriting logic, fixing bugs, adding features, introducing new architectural patterns, or creating barrel exports during the split.
- Calibration default: Pure structural transformation. If behavior must change, that is a separate task.
7. Anti-Pattern Compliance
| Step | Prevents AP | Mechanism |
|------|-------------|-----------|
| 1 (Analyze) | AP-1 (vague task verb) | Boundaries must map to named single responsibilities. |
| 3 (Extract) | AP-41 (hallucinated API) | Extraction copies exact logic; no invented APIs. |
| 4 (Wire) | AP-29 (no integration) | Acyclic import graph verified. |
| 5 (Consumers) | AP-29 (no integration) | Zero dangling references; consumers updated. |
| 5 (Consumers) | Project no-barrel rule | export * banned outright. |
| All steps | AP-2 (two tasks) | Splitting and behavior change never mixed. |
8. Versioning & Changelog
- Version: 2.0.0
- Changelog:
2.0.0(2026-08-08) โ Elevated to Tier 5 perdocs/skill-standard.md. Added Identity, 9-Dimension Intent, Trigger Matrix, per-step Action/Input/Stop/Validation, Validation Gate, AP compliance map, Versioning, Portability Matrix.
9. Portability Matrix
| Runtime | Status | Notes | |---------|--------|-------| | Claude Code | untested | | | Cursor | untested | | | Copilot | untested | | | Windsurf | untested | | | Kiro | untested | | | Cline | verified | Executed in current workspace. | | Raw API (no tooling) | untested | |
10. Examples
Input: "Refactor utils.ts (which is 800 lines) to keep the context cheap."
Output: Reads utils.ts, identifies three distinct domains (math, string manipulation, date parsing), creates math.ts, strings.ts, and dates.ts, moves the logic verbatim, deletes utils.ts, and updates all files that previously imported from utils.ts. No behavior changed, no barrel exports.
Failure case: The extraction fails because the monolith's logic depends on an internal closure the split cannot reproduce without a logic change. Stop and report the conflict; do not alter behavior to force the split.
Related Skills
claude-mem
113.3kPersistent Context Across Sessions for Every Agent โ Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Understand-Anything
90.8kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
78.9kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
CowAgent
47.8kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit โ see the Safety scan above for what the skill file itself contains.
