
screaming-architecture
by acbcdev
Claude Code: Extensible Plugin Ecosystem for Developers ๐
SKILL.md
name: screaming-architecture description: Organize code by feature intent, not framework layers. Structure projects to clearly communicate business purpose at first glance.
Screaming Architecture Skill
Screaming Architecture is a design philosophy where your folder structure screams the purpose of the application. Organize by feature and business domain, not by technical type.
Core Principle
Group by feature, not by type.
โ Bad: components/, hooks/, utils/, contexts/ (framework-focused)
โ
Good: features/todos/, features/auth/, features/dashboard/ (feature-focused)
Project Structure
Top-Level Organization
src/
โโโ features/ # Business features and domains
โ โโโ todos/
โ โโโ auth/
โ โโโ dashboard/
โ โโโ settings/
โโโ common/ # Truly shared utilities (used by 3+ features)
โ โโโ ui/ # Reusable UI components
โ โโโ hooks/ # Reusable custom hooks
โ โโโ utils/ # Utility functions
โ โโโ types/ # Global type definitions
โ โโโ providers/ # Global providers (Theme, Auth, etc.)
โโโ lib/ # Framework/library integrations
โโโ config/ # App-wide configuration
โโโ app.tsx # Root component
Rule: Features own their code; common utilities are truly cross-cutting.
Feature Folder Structure
Each feature is self-contained with all its code together.
features/todos/
โโโ add-todo-form/
โ โโโ add-todo-form.tsx # Component
โ โโโ add-todo-form.test.tsx # Tests
โ โโโ add-todo-form.module.css # Styles (optional)
โโโ todo-list/
โ โโโ todo-list.tsx
โ โโโ todo-list.test.tsx
โ โโโ todo-item.tsx # Sub-component
โโโ todo-provider/
โ โโโ todo-provider.tsx # Context provider
โ โโโ todo-context.ts # Context definition
โโโ use-todo/
โ โโโ use-todo.ts # Custom hook
โโโ types.ts # Feature-scoped types
โโโ index.ts # Barrel file (exports)
โโโ README.md # Feature documentation
Rules:
- One file per component/hook/utility
- Co-locate related code
- Use barrel files (index.ts) for clean imports
- No
index.tsx- use descriptive filenames
Naming Conventions
- Folders:
kebab-casewith clear feature names:add-todo-form,user-profile,payment-modal - Files:
kebab-case.tsx(notindex.tsx):todo-item.tsx,use-todos.ts,types.ts - Components:
PascalCasein filename:AddTodoForm.tsx,TodoList.tsx - Hooks:
use-prefix:use-todo.ts,use-todos.ts - Utilities:
verb-nounformat:format-date.ts,validate-email.ts - Types: Plural if exported as barrel:
types.ts - Styles: Match component name:
add-todo-form.module.css
// โ
Good
features/todos/add-todo-form/add-todo-form.tsx
features/todos/use-todo/use-todo.ts
features/todos/types.ts
// โ Bad
features/todos/AddTodoForm/index.tsx
features/todos/hooks/useTodo.ts
features/todos/utils/types.ts
Barrel Files (index.ts)
Export public API from each feature using barrel files.
// features/todos/index.ts
export { AddTodoForm } from './add-todo-form/add-todo-form';
export { TodoList } from './todo-list/todo-list';
export { TodoProvider } from './todo-provider/todo-provider';
export { useTodo } from './use-todo/use-todo';
export type { Todo, TodoContextType } from './types';
// Usage in other features
import { TodoList, useTodo } from 'features/todos';
Rules:
- Export components, hooks, and types
- DO NOT export internal utilities or sub-components
- Keep barrel files organized (components first, hooks, then types)
- One barrel file per feature (at feature root)
Type Organization
Feature-Scoped Types
Keep types with their feature in types.ts:
// features/todos/types.ts
export interface Todo {
id: string;
title: string;
completed: boolean;
createdAt: Date;
}
export interface TodoContextType {
todos: Todo[];
addTodo: (title: string) => void;
removeTodo: (id: string) => void;
}
// features/todos/todo-provider/todo-provider.tsx
import type { TodoContextType } from '../types';
Shared Global Types
Put truly shared types in shared/types/:
// shared/types/api.ts
export interface ApiResponse<T> {
data: T;
status: number;
error?: string;
}
// shared/types/user.ts
export interface User {
id: string;
name: string;
email: string;
}
Rule: Minimize global types; prefer feature-scoped types.
Feature Dependencies
DO
- โ
Feature can depend on
common/ - โ Feature can import from another feature's barrel file
- โ
Features can use global providers (
common/providers/)
DO NOT
- โ Features should not directly import internals from other features
- โ Circular dependencies between features
- โ Common utilities importing from features
// โ
Good: Import from barrel file
import { TodoList, useTodo } from 'features/todos';
// โ Bad: Import internal implementation
import { TodoProvider } from 'features/todos/todo-provider/todo-provider';
// โ Bad: Feature depending on another feature's types directly
import { Todo } from 'features/todos/types';
// Use barrel: import type { Todo } from 'features/todos';
Common Utilities
When to extract to common/:
- Used by 3+ features - Sign it's truly shared
- Generic utilities - Date formatting, string validation, API helpers
- Design tokens & UI components - Buttons, inputs, modals (no business logic)
- Custom hooks - Reusable patterns like
useLocalStorage,useApi
DO NOT put in common:
// โ Bad: Business logic in common
common/hooks/use-todo.ts // This is todos feature logic
// โ Bad: Feature-specific utilities
common/utils/format-todo-date.ts // This is todos feature logic
// โ
Good: Truly generic
common/utils/format-date.ts
common/hooks/use-local-storage.ts
common/ui/button.tsx
Common Patterns
Feature with Context Provider
features/auth/
โโโ auth-provider/
โ โโโ auth-provider.tsx
โ โโโ auth-context.ts
โโโ login-form/
โ โโโ login-form.tsx
โโโ use-auth/
โ โโโ use-auth.ts
โโโ types.ts
โโโ index.ts
Feature with Multiple Views
features/dashboard/
โโโ dashboard-header/
โ โโโ dashboard-header.tsx
โโโ dashboard-content/
โ โโโ dashboard-content.tsx
โ โโโ chart-widget/
โ โ โโโ chart-widget.tsx
โ โโโ stats-widget/
โ โโโ stats-widget.tsx
โโโ types.ts
โโโ index.ts
Feature with API Integration
features/todos/
โโโ add-todo-form/
โ โโโ add-todo-form.tsx
โโโ todo-list/
โ โโโ todo-list.tsx
โโโ api/
โ โโโ get-todos.ts
โ โโโ create-todo.ts
โ โโโ delete-todo.ts
โโโ types.ts
โโโ index.ts
Benefits
| Benefit | Why |
|---|---|
| Clarity | Folder structure immediately shows business features, not technical layers |
| Searchability | Finding todo-related code is intuitive - look in features/todos/ |
| Scalability | Easy to add new features without restructuring |
| Collaboration | Team members work on features, not layers; fewer merge conflicts |
| Testability | Features are isolated; easier to test feature logic independently |
| Onboarding | New developers see business domains immediately |
Anti-Patterns to Avoid
Excessive Nesting
// โ Too deep
features/todos/components/forms/add-todo-form/add-todo-form.tsx
// โ
Flat
features/todos/add-todo-form/add-todo-form.tsx
Generic Folder Names
// โ Unclear purpose
features/app/ // What is "app"?
features/common/ // What's common here?
// โ
Clear feature names
features/todos/
features/auth/
features/settings/
Feature-Specific Code in Shared
// โ This is todos logic, not shared
shared/utils/format-todo-date.ts
shared/hooks/use-todo-validation.ts
// โ
Keep in feature
features/todos/format-todo-date.ts
features/todos/use-todo-validation.ts
Circular Dependencies
// โ todos imports auth, auth imports todos
features/todos/ โ features/auth/
features/auth/ โ features/todos/
// โ
Both depend on shared if needed
features/todos/ โ shared/
features/auth/ โ shared/
Deep Component Nesting
// โ Sub-components buried
features/todos/todo-list/components/list/item/todo-item.tsx
// โ
Sub-components at feature level
features/todos/todo-item.tsx
features/todos/todo-list.tsx
Quick Reference
- Organize by feature, not technical type
- Co-locate everything related to a feature
- Use kebab-case for files and folders
- Avoid
index.tsx- use descriptive names - One barrel file per feature exports public API
- Keep types with their feature
- Share only what's truly generic (3+ features or framework utilities)
- No feature should import internals from another feature
- Flat hierarchy - avoid excessive nesting
The codebase should scream its business purpose.
Score
Total Score
Based on repository quality metrics
SKILL.mdใใกใคใซใๅซใพใใฆใใ
ใฉใคใปใณในใ่จญๅฎใใใฆใใ
100ๆๅญไปฅไธใฎ่ชฌๆใใใ
GitHub Stars 100ไปฅไธ
1ใถๆไปฅๅ ใซๆดๆฐ
10ๅไปฅไธใใฉใผใฏใใใฆใใ
ใชใผใใณIssueใ50ๆชๆบ
ใใญใฐใฉใใณใฐ่จ่ชใ่จญๅฎใใใฆใใ
1ใคไปฅไธใฎใฟใฐใ่จญๅฎใใใฆใใ
Reviews
Reviews coming soon
