
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.
ã¹ã³ã¢
ç·åã¹ã³ã¢
ãªããžããªã®åè³ªææšã«åºã¥ãè©äŸ¡
SKILL.mdãã¡ã€ã«ãå«ãŸããŠãã
ã©ã€ã»ã³ã¹ãèšå®ãããŠãã
100æå以äžã®èª¬æããã
GitHub Stars 100以äž
3ã¶æä»¥å ã«æŽæ°
10å以äžãã©ãŒã¯ãããŠãã
ãªãŒãã³Issueã50æªæº
ããã°ã©ãã³ã°èšèªãèšå®ãããŠãã
1ã€ä»¥äžã®ã¿ã°ãèšå®ãããŠãã
ã¬ãã¥ãŒ
ã¬ãã¥ãŒæ©èœã¯è¿æ¥å ¬éäºå®ã§ã
