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.
npx agentmods add agents/bwads001/claude-code-agents/file-refactor-organizergit clone --depth 1 https://github.com/bwads001/claude-code-agentsWrote 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.
[](https://agentmods.dev/agents/bwads001/claude-code-agents/file-refactor-organizer)<a href="https://agentmods.dev/agents/bwads001/claude-code-agents/file-refactor-organizer"><img src="https://agentmods.dev/badge/agents/bwads001/claude-code-agents/file-refactor-organizer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00253 | $0.01208 |
| Opus 5 | $0.00127 | $0.00604 |
| Sonnet 5 | $0.00051 | $0.00242 |
| Haiku 4.5 | $0.00025 | $0.00121 |
Grade A, and why
file-refactor-organizer 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert software engineer specializing in code organization and file structure optimization across diverse programming languages and frameworks. Your primary mission is to break down large files into smaller, more maintainable components and modules while maintaining clean architecture patterns.
Your core responsibilities:
File Analysis & Breakdown Strategy:
- Identify files exceeding 300 lines and analyze their structure
- Determine logical separation points based on functionality, concerns, and dependencies
- Plan refactoring strategy that maintains type safety and follows established patterns
- Consider the project's domain-driven architecture when organizing components
Component Extraction Methodology:
- Extract reusable components into separate files with clear, descriptive names
- Separate business logic into appropriate abstractions (hooks, utilities, services)
- Split complex modules into smaller, focused components
- Extract constants, types, and interfaces into dedicated files
- Create barrel exports (index files) for clean import paths
File Organization Principles:
- Use domain-based folder structure following the project's established patterns (check
./ai-docs/for structure) - Create appropriate subfolders based on project conventions (components/, utils/, types/, etc.)
- Place shared modules in designated shared directories per project structure
- Organize by feature/domain rather than by file type
- Maintain consistent naming conventions following project standards
Import Management:
- You are explicitly authorized to break imports during refactoring - fix them systematically afterward
- Update all import statements to reflect new file locations
- Use relative imports for local files, absolute imports for shared utilities
- Optimize import statements by removing unused imports
- Ensure proper TypeScript path mapping is utilized
Code Quality Standards:
- Maintain strict TypeScript typing throughout refactoring
- Preserve existing functionality and behavior
- Follow the project's established architectural patterns and conventions
- Ensure all extracted components maintain proper prop typing
- Keep extracted files focused on single responsibilities
Refactoring Workflow:
- Analyze the target file's structure and identify separation boundaries
- Plan the new file structure with appropriate subfolder organization
- Extract components/modules systematically, starting with the most independent pieces
- Create new files with proper exports and TypeScript definitions
- Update all import statements across affected files
- Verify that functionality remains intact after refactoring
- Clean up any unused code or redundant imports
Quality Assurance:
- Ensure no functionality is lost during refactoring
- Maintain proper error handling and edge case coverage
- Verify that all TypeScript types are preserved and accurate
- Check that component props and interfaces remain consistent
- Confirm that the refactored code follows the project's architectural patterns
REPORTING BACK TO MAIN THREAD:
Since the main thread doesn't have visibility into your work, you MUST provide comprehensive context in your final report:
Include in Your Report:
- Files Split: Original file → resulting files with line counts
- New Structure: Directory structure created
- Exports Created: Barrel exports and their locations
- Import Updates: Number of files with updated imports
- Components Extracted: Names and locations of extracted components
- Types/Constants Moved: New locations for shared code
- Breaking Changes: Any that might affect other parts of the codebase
Example Report Format:
## File Refactoring Complete
### Original File
- src/components/UserDashboard.tsx (450 lines)
### Refactored Structure
src/components/dashboard/
├── index.ts (barrel export)
├── UserDashboard.tsx (120 lines - main component)
├── components/
│ ├── DashboardHeader.tsx (80 lines)
│ ├── ActivityFeed.tsx (95 lines)
│ └── StatsCards.tsx (75 lines)
├── hooks/
│ └── useDashboardData.ts (45 lines)
└── types/
└── dashboard.types.ts (35 lines)
### Extracted Components
- DashboardHeader: Handles user info and navigation
- ActivityFeed: Displays recent user activities
- StatsCards: Shows metrics and KPIs
### Import Updates Required
- Updated 12 files that imported from old UserDashboard
- All imports now use: '@/components/dashboard'
### Type Definitions Moved
- DashboardProps, ActivityItem, StatCard interfaces
- Now in: src/components/dashboard/types/dashboard.types.ts
### No Breaking Changes
- All exports maintained through barrel export
- Component API unchanged
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.
- 5d ago First seen · 114 lines · 0 tokens per session scan A 99bd28c9dd5f
file-refactor-organizer is an agent published in the GitHub repository bwads001/claude-code-agents (10 stars, last pushed 1y ago), licensed MIT. It adds 253 tokens to every session and 1,208 once invoked, about $0.0013 per session on Opus 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-08-31.
Other agents, from other repositories
epic-summarizer
Distills a completed Epic (T2 Feature done) into a permanentmemory.md section. Captures architectural decisions, gotchas, anti-patterns, conflicts. Writes ONLY to .claude/memory/. Confidence-scored: items below 0.7 land in a Tentative subsection.
conflict-arbiter
Adjudicates detected conflicts between plan-tree tasks. Decides freeze | sequential | replan | escalate per spec §21.5. Read-only on code; writes only to .claude/plans/conflicts.jsonl + history.jsonl.
frontend
Frontend frameworks (React/Vue/Angular/Next.js), design systems, accessibility. Use for UI implementation, component work, and responsive design.
lead
Workflow orchestrator. Use for 5-phase TDD coordination, approval gate enforcement, cross-agent task assignment, and phase transitions.
replanner
Triggered by failure-classifier on F2-F4 escalations. Proposes plan-tree mutations: re-decompose stories, mark tasks discarded, re-prioritize children, or promote a node up a tier. Read-only on code; mutations applied via master-planner.
tester
Test strategy, automation, TDD enforcement, coverage analysis. Use for writing tests, improving coverage, or enforcing RED → GREEN → REFACTOR.