organizing-project-files
Organizing Project Files
Colocate by feature when possible. Group by type only for truly shared code.
Standard Layout
src/
├── app/ # Next.js App Router (or pages/)
├── components/
│ ├── ui/ # Reusable primitives (Button, Modal)
│ └── [feature]/ # Feature-specific (auth/, dashboard/)
├── hooks/ # Custom React hooks
├── lib/ # Core utilities, clients, constants
├── services/ # API calls, external integrations
├── stores/ # State management
└── types/ # TypeScript definitions
Placement Quick Reference
| "I need..." | Location |
|---|---|
| A button | components/ui/Button.tsx |
| A login form | components/auth/LoginForm.tsx |
| User data fetching | services/user.ts or hooks/queries/useUser.ts |
| Date formatter | lib/utils.ts |
| Auth state | stores/auth.ts |
| Supabase types | types/supabase.ts (generated) |
| Custom type | types/index.ts or colocate |
Naming
- Components:
PascalCase.tsx - Hooks:
useCamelCase.ts - Utilities:
camelCase.ts - Types:
camelCase.ts
Colocation Pattern
For complex features, keep related files together:
components/auth/
├── LoginForm.tsx
├── LoginForm.test.tsx
├── useLoginForm.ts
└── login-schema.ts
Advanced Patterns
For App Router specifics, barrel files, and monorepo structures, see PATTERNS.md.
More from augmnt/webdev-skills
writing-tests
Guides test creation with practical strategies for unit, integration, and e2e tests. Use when writing tests, deciding what to test, setting up test infrastructure, or discussing coverage. Triggers on "write tests", "should I test", "test coverage", or test file creation.
7reviewing-code
Provides structured code review with prioritized feedback. Use when reviewing PRs, analyzing code quality, checking for bugs, or auditing changes. Triggers on "review this", "check this code", PR reviews, or code quality questions.
7using-cli-tools
Enforces CLI tool usage over web dashboards for reproducibility and scriptability. Use when working with Git/GitHub, Supabase, Vercel, Netlify, Cloudflare, AWS, Stripe, Prisma, Docker, or any cloud service. Triggers on deployments, database operations, migrations, PRs, issues, webhooks, or environment management.
6writing-commits
Generates commit messages and PR descriptions following Conventional Commits. Use when committing code, writing PR titles, reviewing git history, or when asked to describe changes. Triggers on git commit, PR creation, or changelog generation.
6