laravel-agent-rules / database
CLAUDE.md9 starsChanged 2 months agoMITView on GitHub
Schema design + naming conventions. Sub-directory rules: MUST avoid SQL reserved words (e.g. order, group, desc, key, range) as identifiers. Prefer a more specific name (order_column, group_name). Order columns top-to-bottom as: When adding columns in later migrations on MySQL/MariaDB, SHOULD use after() / before() to preserve this ordering. Those modifiers are MySQL/MariaDB-only — Postgres, SQLite, and SQL Server do not support column positioning; omit them there.
In this repository7 other files it gives its agents.
- app/CLAUDE.mdCLAUDE.md
- bootstrap/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- config/CLAUDE.mdCLAUDE.md
- lang/CLAUDE.mdCLAUDE.md
- routes/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
MUST: avoid SQL reserved words (e.g.
- Distinctive: line 24
SHOULD: use auto-incrementing big integer for internal-only tables.
- Distinctive: line 25
SHOULD: use UUID (or ULID) PK when the row will be exposed in a public URL or contains sensitive data (orders, invoices, bank accounts).
- Very specific: line 56
SHOULD: add an index (or composite index) for filters, sorts, and joins that show up in real query paths — verify with EXPLAIN / slow-query …
- Distinctive: line 57
MUST: add a composite index when multiple columns are queried together as a unit (and order columns to match the query).
- Distinctive: line 63
SHOULD: use UUID/ULID for publicly addressable rows: external order numbers, public profile pages, signed invoices.
- Very specific: line 64
SHOULD: keep id as an internal bigint and add a separate uuid column for external use, unless the project explicitly switches to UUID PKs.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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
Database
Schema design + naming conventions. Sub-directory rules:
database/migrations/CLAUDE.md— migration workflow.database/factories/CLAUDE.md— factory rules.database/seeders/CLAUDE.md— seeder rules.
Naming
| Entity | Pattern | Examples |
| Table | snake_case, plural | users, products, categories |
| Pivot table | snake_case, singular names, alphabetical | category_product, order_user |
| Column | snake_case, no table prefix | title, price, description |
| Primary key | always id | id |
| Foreign key | {singular_model}_id | user_id, product_id, category_id |
MUST avoid SQL reserved words (e.g. order, group, desc, key, range) as identifiers. Prefer a more specific name (order_column, group_name).
Primary keys
- MUST name the PK
id. - SHOULD use auto-incrementing big integer for internal-only tables.
- SHOULD use UUID (or ULID) PK when the row will be exposed in a public URL or contains sensitive data (orders, invoices, bank accounts).
Foreign keys
- MUST name
{singular_model}_id. - SHOULD declare with
foreignId(...)->constrained()and an explicitonDelete()policy.
Column type → name patterns
- boolean → prefix
is_/has_(is_enabled,has_reviews). - timestamp → suffix
_at/_from/_for(published_at,valid_from,scheduled_for). - PREFER a nullable timestamp over a boolean when the moment of state-change is also useful: replace
is_finishedwithfinished_at— encodes two facts (whether + when) in one column.
Column sorting
Order columns top-to-bottom as:
id- Foreign keys
- Domain columns, ordered by priority and grouped by context
- Native timestamps (
created_at,updated_at,deleted_at)
When adding columns in later migrations on MySQL/MariaDB, SHOULD use
after()/before()to preserve this ordering. Those modifiers are MySQL/MariaDB-only — Postgres, SQLite, and SQL Server do not support column positioning; omit them there.
Common column patterns
order_column— sort position (avoid reserved wordorderas a column name).
Indexes
- MUST index foreign keys (Laravel's
foreignId()/foreignIdFor()adds one automatically) and columns that enforce uniqueness. - SHOULD add an index (or composite index) for filters, sorts, and joins that show up in real query paths — verify with
EXPLAIN/ slow-query logs rather than indexing everyWHERE/ORDER BYcolumn by habit. - MUST add a composite index when multiple columns are queried together as a unit (and order columns to match the query).
- AVOID indexes on low-cardinality columns alone (booleans, small enums) unless they are part of a selective composite.
- AVOID redundant single-column indexes that are already covered by a composite index's leading column.
UUIDs
- SHOULD use UUID/ULID for publicly addressable rows: external order numbers, public profile pages, signed invoices.
- SHOULD keep
idas an internal bigint and add a separateuuidcolumn for external use, unless the project explicitly switches to UUID PKs.
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.

