next-project-structure
Installation
SKILL.md
Next.js Project Structure
Purpose
This skill defines the folder and file conventions for Next.js App Router applications. Use this to ensure file placement dictates the correct routing behavior and architectural consistency.
Usage
When creating new features or refactoring, you must first identify the project's Organization Strategy (see below) to determine where files belong.
1. Top-Level Organization Strategies
Identify which strategy the project is using and strictly adhere to it. Do not mix strategies.
| Strategy | Description | Indicator |
|---|---|---|
Store in src |
Application code lives in src/app. Config files live in root. |
src/app/page.tsx exists |
Root app |
Application code lives in app. Config files live in root. |
app/page.tsx exists |
| Split by Feature | Global code in app; feature code colocated in route segments. |
app/dashboard/_components/ exists |
| External Projects | Project files live in components/ or lib/ at root, outside app. |
components/ exists at root |