structure-law
Skill2 starsChanged 53 days agoMITView on GitHub
The Atelier Structure Law — canonical, industrial-standard file structures per stack (Next.js, FastAPI, monorepo, full platform), naming rules, and the intake questions that settle layout once. Load before scaffolding or moving files.
- Reads credentials
In this repository28 other files it gives its agents.
- anime-jsSkill
- apple-designSkill
- asset-pipelineSkill
- atelier-bootstrapSkill
- atelier-buildSkill
- atelier-clarifySkill
- atelier-doctorSkill
- atelier-learnSkill
- atelier-planSkill
- atelier-promoteSkill
- atelier-reviewSkill
- atelier-shipSkill
- atelier-statusSkill
- atelier-updateSkill
- auth-lawSkill
- clean-code-lawSkill
- deploy-advisorSkill
- design-lawSkill
- docs-siteSkill
- gatewaySkill
- living-graphicsSkill
- loop-engineSkill
- mcp-makerSkill
- principal-mindSkill
- security-lawSkill
- stack-guidesSkill
- web-3dSkill
- web-qualitySkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Every stack has ONE canonical layout.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Structure Law
Every stack has ONE canonical layout. Repos never invent their own. Structure
is settled at intake and recorded in projects — never re-litigated per task.
The structure ladder (pick by project size, once)
There is no single "correct" structure — there is one correct structure per project size. Climb only as far as the project demands:
| Project shape | Structure |
| Portfolio, practice app, tiny site | Flat — src/{components,pages,assets} |
| Medium app, small team | Type-based — src/{components,hooks,services,utils,context,pages,types} |
| Production app, SaaS, dashboards | Feature-based — src/features/<name>/{components,hooks,api,pages,types,index.ts} + shared/ layouts/ routes/ |
| Design system / component library | Atomic — components/{atoms,molecules,organisms,templates,pages} |
| Large multi-domain SaaS / enterprise | Domain-driven — src/modules/{users,orders,payments,…} |
Rules of the ladder:
- Feature-based is the production default. Related files stay together; features ship and delete as units. Type-based scatters one feature across seven folders — acceptable only below ~30 components.
- Atomic only for reusable component libraries. In a product app it forces "is this a molecule or organism?" debates that produce zero user value.
- Never scaffold a higher rung "for later" — a flat project moves to feature-based when the second real feature lands, not before (ponytail).
- Each feature exports through its own
index.ts; nothing deep-imports across features. But no giant root barrels — oneindex.tsre-exporting the world breaks tree-shaking and creates circular imports. - Colocate what only one route uses (App Router:
_components/inside the route). Promote toshared/on second use, never on first.
Intake questions (asked once)
- Frontend and backend: separate repos or one? (default: one repo, separated apps)
- Multiple frontends? → Turborepo monorepo. Single app? → plain Next.js.
- Frontend folder name:
frontend/or product name? (default:apps/<name>) - Model serving / workers as separate services? (default: yes if AI/ML or long jobs exist)
Next.js app (App Router)
app/ # routes; server components by default
components/ # one component per file; ui/ for primitives
hooks/ # use*.ts
lib/ # pure utils, api clients, auth
services/ # domain logic calling APIs
public/ # assets: images/ fonts/ icons/ (industry conventions)
styles/ # globals.css, tokensTurborepo monorepo (multiple frontends)
apps/ # app/ marketing/ studio/ admin/ … (one Next.js app each)
packages/ # ui/ auth/ config/ types/ eslint-config/
turbo.json pnpm-workspace.yamlFastAPI backend
app/
api/v1/endpoints/ # thin route handlers
services/ # business logic, LLM/external APIs
core/ # config, db, redis, security — no business logic
workers/ # celery tasks
models/ schemas/ # SQLAlchemy | Pydantic
database/schema.sql # single source of truthFull platform (frontend + backend + ML + infra)
apps/{frontend…, backend-api, worker, model-serving}
packages/ docs/ infra/{docker, cloudflared} scripts/ .github/workflows/
docker-compose.yml .env.example README.mdNaming conventions
| What | Convention | Example |
| Folders (frontend + backend) | kebab-case | user-profile/, order-history/ |
| React component files | PascalCase.tsx, filename = export | UserCard.tsx |
| Hooks | camelCase, use prefix | useAuthSession.ts |
| Non-component TS/JS files | camelCase | formatCurrency.ts |
| Python files/functions/vars | snake_case | user_service.py, get_user_by_id() |
| Python classes | PascalCase | class UserService: |
| DB tables/columns | snake_case, tables plural | users, order_items, created_at |
| API route segments | kebab-case, plural nouns | /api/v1/user-profiles/{id} |
| Env vars | SCREAMING_SNAKE_CASE | DATABASE_URL |
| Constants | SCREAMING_SNAKE_CASE | MAX_RETRIES |
One convention per language, applied everywhere — a mixed-case codebase is a review failure, not a style choice.
Rules
- URL pattern for APIs:
/api/v1/{feature}/{action}(path versioning — the default, what Stripe/GitHub/most SaaS expose publicly). Bump to/v2only on a breaking change; additive fields never bump. Alternative seen at scale (Stripe internally): a date-based version header instead of a path segment — only reach for it if you truly need per-customer version pinning; path versioning is simpler and is the default. Keep endpoints thin, logic in services. public/mirrors industry conventions; docs live indocs/, never scattered.- Shared code goes to
packages//lib/on second use — DRY is structural. - Env: every var documented in
.env.example; secrets never committed. - New file? It has exactly one obvious home in the trees above. If it doesn't, the task is misdesigned — stop and fix the plan.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

