Provides patterns for file structure, module boundaries, naming conventions, directory organization, and import/export patterns. Use when organizing code, creating new projects, restructuring codebases, establishing module boundaries, or reviewing project architecture.
Provides patterns for file structure, module boundaries, naming conventions, directory organization, and import/export patterns.
/plugin marketplace add mgd34msu/goodvibes-plugin/plugin install goodvibes@goodvibes-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/import-export-patterns.mdreferences/module-patterns.mdreferences/naming-conventions.mdreferences/project-layouts.mdSystematic patterns for organizing code into maintainable, scalable structures.
Analyze project structure:
Review this project's file organization and suggest improvements
Set up new project:
Help me organize a new React/Node/Python project with proper structure
Identify module boundaries:
Analyze this codebase and identify where module boundaries should be
Standard layouts by framework type.
project/
src/
components/ # Reusable UI components
Button/
Button.tsx
Button.test.tsx
Button.styles.ts
index.ts
features/ # Feature-based modules
auth/
components/
hooks/
api/
types.ts
index.ts
hooks/ # Shared custom hooks
utils/ # Utility functions
services/ # API/external services
stores/ # State management
types/ # Shared TypeScript types
App.tsx
main.tsx
tests/
project/
src/
api/
v1/
users/
controller.ts
service.ts
repository.ts
routes.ts
config/
middleware/
models/
services/
utils/
index.ts
tests/
project/
src/
package_name/
__init__.py
api/
core/
models/
services/
utils/
config.py
tests/
See references/project-layouts.md for complete layouts.
| Indicator | Description |
|---|---|
| Single Responsibility | Module has one clear purpose |
| Cohesion | Internal components relate closely |
| Minimal Interface | Few, well-defined exports |
| Loose Coupling | Changes don't cascade across modules |
| Smell | Fix |
|---|---|
| Circular Dependencies | Extract shared code to third module |
| Feature Envy | Move related code together |
| Shotgun Surgery | Consolidate related functionality |
| God Module | Split by responsibility |
// BEFORE: No clear boundaries
src/
components/
UserProfile.tsx // Mixes auth, user data, UI
LoginForm.tsx
api/
users.ts
auth.ts
// AFTER: Clear domain boundaries
src/
features/
auth/
components/
hooks/
api/
types.ts
index.ts # Public API
users/
components/
hooks/
api/
types.ts
index.ts # Public API
See references/module-patterns.md for complete patterns.
| Type | Convention | Examples |
|---|---|---|
| React Components | PascalCase | UserProfile.tsx, Button.tsx |
| Hooks | camelCase + use | useAuth.ts, useFetch.ts |
| Utilities | camelCase | formatDate.ts, validators.ts |
| Tests | Source + .test/.spec | UserProfile.test.tsx |
| Python modules | snake_case | user_service.py |
| Directories | kebab-case | user-profile/ |
// BAD: Generic names
utils.ts, helpers.ts, misc.ts
// BAD: Numbered files
component1.tsx, handler2.ts
// BAD: Inconsistent casing
userProfile.tsx, user_settings.tsx
// BAD: Unclear abbreviations
usr.ts, auth_mgr.ts, btn.tsx
See references/naming-conventions.md for complete guide.
| Trigger | Action |
|---|---|
| >5-7 files | Group by function or domain |
| Related tests | Co-locate or mirror structure |
| Multiple file types | Group by component |
// Component co-location
UserProfile/
UserProfile.tsx
UserProfile.test.tsx
UserProfile.styles.ts
useUserProfile.ts
index.ts
// Feature co-location
features/
checkout/
components/
hooks/
api/
types.ts
index.ts
// LAYER-BASED: Small apps, simple domains
src/
components/
services/
models/
utils/
// FEATURE-BASED: Large apps, complex domains
src/
features/
users/
products/
orders/
shared/
components/
utils/
// components/Button/index.ts
export { Button } from './Button';
export type { ButtonProps } from './Button';
// Usage: Clean imports
import { Button } from '@/components/Button';
// features/auth/index.ts - PUBLIC API
export { LoginForm } from './components/LoginForm';
export { useAuth } from './hooks/useAuth';
export type { User, AuthState } from './types';
// Internal components NOT exported
// tsconfig.json
{
"compilerOptions": {
"paths": {
"@/*": ["src/*"],
"@components/*": ["src/components/*"],
"@features/*": ["src/features/*"]
}
}
}
See references/import-export-patterns.md for complete patterns.
| Code Type | Location | Purpose |
|---|---|---|
| Components | components/ | UI presentation |
| Hooks | hooks/ | Reusable stateful logic |
| Services | services/ | External API interactions |
| Utils | utils/ | Pure functions, helpers |
| Types | types/ | TypeScript definitions |
// UTILS: Pure functions, no side effects
utils/
formatDate.ts
validators.ts
// HELPERS: May have side effects
helpers/
localStorage.ts
dom.ts
// SERVICES: External interactions, async
services/
api.ts
analytics.ts
1. PROJECT SIZE
Small (<10 files) -> Flat structure
Medium (10-50 files) -> Simple grouping
Large (>50 files) -> Feature-based
2. TEAM SIZE
Solo/Pair -> Flexible structure
Small team (3-5) -> Consistent conventions
Large team (>5) -> Strict boundaries
3. DOMAIN COMPLEXITY
Simple -> Layer-based
Complex -> Feature-based
4. SCALING EXPECTATIONS
Stable -> Current needs only
Growing -> Plan for modularity
| Trigger | Action |
|---|---|
| Adding feature takes too long | Extract modules |
| Merge conflicts on same files | Split by responsibility |
| Hard to find files | Improve naming |
| Circular dependencies | Restructure hierarchy |
| God files (>500 lines) | Split by concern |
| Import paths too deep | Add barrel exports |
## Project Setup
- [ ] Clear root structure (src/, tests/, scripts/)
- [ ] Consistent file naming convention
- [ ] Path aliases configured
- [ ] Index files for clean imports
## Module Organization
- [ ] Features grouped by domain
- [ ] Shared code extracted
- [ ] Clear public APIs (index.ts)
- [ ] No circular dependencies
## File Organization
- [ ] Co-located related files
- [ ] Appropriate nesting depth
- [ ] Consistent naming patterns
## Imports
- [ ] Barrel exports for features
- [ ] Path aliases for common paths
- [ ] Absolute imports preferred
- [ ] No deep relative imports
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.