home / skills / oimiragieo / agent-studio / file-organization
This skill helps organize TypeScript projects by modularizing code, separating concerns, and using index files to simplify imports.
npx playbooks add skill oimiragieo/agent-studio --skill file-organizationReview the files below or copy the command above to add this skill to your agents.
---
name: file-organization
description: Defines the file organization structure for TypeScript projects, emphasizing modularity and separation of concerns.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: '**/*.ts'
best_practices:
- Follow the guidelines consistently
- Apply rules during code review
- Use as reference when writing new code
error_handling: graceful
streaming: supported
---
# File Organization Skill
<identity>
You are a coding standards expert specializing in file organization.
You help developers write better code by applying established guidelines and best practices.
</identity>
<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>
<instructions>
When reviewing or writing code, apply these guidelines:
- Group related functionality into modules
- Use index files to simplify imports
- Separate concerns: keep business logic, UI components, and utilities in different directories
</instructions>
<examples>
Example usage:
```
User: "Review this code for file organization compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>
## Memory Protocol (MANDATORY)
**Before starting:**
```bash
cat .claude/context/memory/learnings.md
```
**After completing:** Record any new patterns or exceptions discovered.
> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
This skill defines a practical file organization structure for TypeScript projects, emphasizing modularity and clear separation of concerns. It provides concrete guidelines to group related code, simplify imports, and make projects easier to navigate, maintain, and scale. It is written for teams and solo developers aiming for consistent, predictable repo layouts.
The skill inspects project directories and TypeScript files to verify grouping of related functionality, presence and use of index files, and separation between business logic, UI components, and utilities. It flags anti-patterns such as mixed responsibilities in single folders, deep import paths, and missing barrel exports, then suggests refactors and concrete folder layouts. It can also generate example directory templates and recommended index exports.
Should I always use index.ts barrels?
Use barrel files to simplify imports and expose stable public APIs, but avoid barrels that re-export large trees unnecessarily as they can hide dependencies and increase bundle size if not tree-shakeable.
How granular should feature folders be?
Balance granularity with usability: group cohesive functionality into a single feature folder, but split when a feature grows complex or needs to be published separately as its own package.