
Project Structure
- 329 installs
- 7 repo stars
- Updated July 26, 2026
- tartinerlabs/skills
project-structure is a tartinerlabs Claude skill that audits repository layout against five colocation and grouping rules for developers deciding where new code should live in frontend, backend, or monorepo projects.
About
project-structure is a tartinerlabs Claude skill that acts as a repository layout expert for growing codebases. It loads five rules—colocation, anti-patterns, feature-based grouping, layer-based grouping, and framework structure—from dedicated rule files, then runs a three-step workflow: detect project type from indicators like Next.js SPAs, Express APIs, or apps/packages monorepos; audit the tree against all rules with severity-grouped violations; and recommend where new code should live with colocation prioritized. Frontend SPAs and Next.js apps default to feature-based organization, while backend APIs on Express, Fastify, or Hono default to layer-based layouts, and existing patterns are respected rather than rewritten. Developers reach for project-structure when onboarding to an unfamiliar repo, adding a major feature, or suspecting scattered utils and cross-layer imports. Allowed tools are Read, Glob, and Grep for non-destructive analysis.
- project-structure
- AI & Agent Building
- AI-coding skill
Project Structure by the numbers
- 329 all-time installs (skills.sh)
- +10 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #2,183 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/tartinerlabs/skills --skill project-structureAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 329 |
|---|---|
| repo stars | ★ 7 |
| Last updated | July 26, 2026 |
| Repository | tartinerlabs/skills ↗ |
Where should new code live in this repo?
Helps with ai & agent building tasks.
Who is it for?
Developers onboarding to or refactoring growing frontend, backend, or monorepo codebases who need rule-based folder layout guidance.
Skip if: Teams needing runtime performance profiling, security audits, or language-specific lint fixes instead of directory organization decisions.
When should I use this skill?
A developer asks where to place new files, wants a structure audit, or suspects colocation or anti-pattern violations in the repository tree.
What you get
Project-type classification, severity-grouped structure violation report, and colocation-first recommendations for new file placement.
- Structure audit report
- New-file placement recommendations
By the numbers
- Enforces 5 project structure rules across dedicated rules/ markdown files
- Runs a 3-step detect, audit, and recommend workflow
- Maps Next.js and React SPAs to feature-based organization by default
Files
You are a project structure expert.
Read individual rule files in rules/ for detailed explanations and examples.
Rules Overview
| Rule | Impact | File |
|---|---|---|
| Colocation | HIGH | rules/colocation.md |
| Anti-patterns | HIGH | rules/anti-patterns.md |
| Feature-based grouping | MEDIUM | rules/feature-based.md |
| Layer-based grouping | MEDIUM | rules/layer-based.md |
| Framework structure | MEDIUM | rules/framework-structure.md |
Workflow
Step 1: Detect Project Type
Scan for project indicators to determine the appropriate organisation approach:
- Frontend SPA / Next.js / React → feature-based
- Backend API / Express / Fastify / Hono → layer-based
- Monorepo (apps/ + packages/) → hybrid
- Existing structure → respect and extend current patterns
Step 2: Audit
Check the existing structure against all rules. Report violations grouped by severity with directory paths.
Step 3: Recommend
Based on project type and existing patterns, recommend where new code should live. Always prioritise colocation.
Rule: Avoid common structural anti-patterns that make codebases hard to navigate and maintain.
Catch-All Files
Avoid generic utils.ts, helpers.ts, common.ts. Split by domain instead.
# Bad
src/utils.ts # 500 lines of unrelated helpers
# Good
src/lib/date.ts # Date formatting utilities
src/lib/currency.ts # Currency formatting utilitiesDeep Nesting
Keep directory depth under 4 levels. Use descriptive names instead of deeper nesting.
# Bad
src/features/auth/components/forms/fields/inputs/text-input.tsx
# Good
src/features/auth/components/auth-text-field.tsxBarrel Files
Avoid index.ts re-export files. They hurt tree-shaking, slow down TypeScript and bundlers, and create circular dependency risks. Import directly from source files instead.
# Bad — barrel file
src/components/index.ts # re-exports from 15 files
import { Button } from './components'
# Good — direct imports
import { Button } from './components/button'Only acceptable use: package entry points (packages/ui/index.ts) where a public API boundary is intentional.
Circular Dependencies
Watch for modules that import each other directly or through a chain. Common signs:
- Runtime errors about undefined imports
- Barrel files that re-export from modules that import back from the barrel
- Feature A importing from Feature B and vice versa
Fix by extracting shared code into a separate module that both features import from.
Separated Tests
Don't put all tests in a separate __tests__/ directory. Colocate unit tests next to the code they test.
Language Grouping in Monorepos
Group packages by domain, not by language.
# Bad
packages/typescript/
packages/go/
# Good
packages/auth/
packages/payments/Rule: Place code as close to where it's relevant as possible. Things that change together should be located together.
Incorrect
src/
├── components/
│ └── user-profile.tsx
├── hooks/
│ └── use-user.ts
├── types/
│ └── user.ts
└── tests/
└── user-profile.test.tsxCorrect
src/features/users/
├── user-profile.tsx
├── user-profile.test.tsx
├── use-user.ts
└── user.types.tsNext.js App Router
Colocate components with the route that uses them:
app/dashboard/
├── page.tsx
├── dashboard-chart.tsx
├── dashboard-stats.tsx
└── use-dashboard-data.tsWhere to Put Things
| Type | Location |
|---|---|
| Shared types | types/ or packages/types/ |
| Utilities | lib/ or utils/ (split by domain) |
| Config | config/ or root |
| Unit tests | Colocate: foo.test.ts next to foo.ts |
| E2E tests | e2e/ or tests/e2e/ |
| Mocks/fixtures | __mocks__/ or test/mocks/ |
Rule: Group by domain — all related code (components, hooks, services, tests) in one directory. Recommended for frontend projects.
Structure
src/features/
├── auth/
│ ├── components/
│ ├── hooks/
│ ├── auth.service.ts
│ └── auth.test.ts
├── users/
│ ├── components/
│ ├── hooks/
│ └── users.service.ts
└── products/
├── components/
└── products.service.tsNext.js App Router
Use route groups to organise by feature without affecting the URL:
app/
├── (auth)/
│ ├── login/page.tsx
│ ├── register/page.tsx
│ └── layout.tsx
├── (dashboard)/
│ ├── overview/page.tsx
│ ├── settings/page.tsx
│ └── layout.tsx
└── layout.tsxMonorepo Variant
apps/ # Applications
├── web/
├── api/
packages/ # Shared libraries (by domain, not language)
├── types/
├── utils/
└── ui/Rule: Follow framework-specific directory conventions. File-based routing frameworks require specific directory structures to function correctly.
Next.js App Router
app/
├── layout.tsx # Root layout (required)
├── page.tsx # Home route
├── loading.tsx # Loading UI
├── error.tsx # Error boundary
├── not-found.tsx # 404 page
├── (marketing)/ # Route group (no URL segment)
│ ├── about/page.tsx
│ └── pricing/page.tsx
├── dashboard/
│ ├── layout.tsx # Nested layout
│ ├── page.tsx
│ └── @modal/ # Parallel route (named slot)
│ └── default.tsx
└── api/
└── users/route.ts # API route handlerKey conventions:
app/is the root for all routes- Route groups
(name)/organise without affecting URLs - Parallel routes
@name/render multiple pages in the same layout middleware.tslives at the project root, not insideapp/
Expo Router
app/
├── (tabs)/
│ ├── index.tsx # First tab
│ └── settings.tsx # Second tab
└── [id].tsx # Dynamic routeKey conventions:
(name)/for layout groups (tabs, drawers)[param].tsxfor dynamic segments
Note: Expo Router requires specific prefixes for certain files (e.g., layout files, not-found screens). These are framework-mandated — do not use_or+prefixes for your own files outside of what the framework requires.
Rule: Group by technical layer. Common for backend/API projects where cross-cutting concerns span domains.
Structure
src/
├── controllers/ # Request handling
├── services/ # Business logic
├── models/ # Data models
├── routes/ # Route definitions
├── middleware/ # Express/Fastify middleware
└── utils/ # Shared utilitiesUse layer-based when the project is a focused API with clear horizontal layers. Switch to feature-based when the backend grows to span multiple distinct domains.
Related skills
How it compares
Use project-structure for folder-layout and colocation decisions; use a linter or architecture-review skill when the issue is code quality inside files rather than directory organization.
FAQ
How many rules does project-structure check?
project-structure checks five rules loaded from rules/: colocation, anti-patterns, feature-based grouping, layer-based grouping, and framework structure. Violations are reported with directory paths grouped by severity.
Does project-structure rewrite my repository automatically?
No. project-structure uses Read, Glob, and Grep to analyze layout and recommend where new code should live. It respects existing patterns and prioritizes colocation without moving files unless a developer acts on the advice.