- Home
- Skills
- Maxritter
- Pilot Shell
- Standards Models
standards-models_skill
- TypeScript
419
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill maxritter/pilot-shell --skill standards-models- SKILL.md8.0 KB
Overview
This skill defines production-grade database models with clear naming, appropriate data types, constraints, relationships, and layered validation. It focuses models on data representation, enforces integrity at the database and application levels, and guides decisions about indexing, cascade behavior, and normalization vs denormalization.
How this skill works
The skill inspects model files or schema definitions and enforces standards: singular PascalCase model names, plural snake_case table names, explicit primary keys and timestamps, suitable column types, NOT NULL/UNIQUE/CHECK constraints, and explicit foreign keys with cascade policies. It also recommends indexing for query patterns, dual-layer validation (model and DB), and keeping business logic out of models.
When to use it
- Creating or modifying ORM classes, schema.prisma, models.py, or Sequelize/ActiveRecord models
- Defining table structures, field types, and required/unique constraints
- Setting up relationships, foreign keys, and cascade behaviors
- Adding auditing timestamps, soft deletes, or enum fields
- Optimizing indexes for WHERE/JOIN/ORDER BY patterns
- Balancing normalization and denormalization for performance
Best practices
- Name models singular PascalCase and tables plural snake_case (User → users)
- Always define primary key and created_at/updated_at timestamps
- Enforce required rules at the DB (NOT NULL, UNIQUE, CHECK) and validate in-model for clear errors
- Choose precise types (DECIMAL for money, JSONB for JSON, UUID for IDs when distributed)
- Index foreign keys and frequently filtered/sorted columns, but avoid over-indexing
- Keep business logic, external calls, and heavy calculations out of models—use service layer
Example use cases
- Adding a new Order model with user_id FK, status enum, created_at/updated_at, and indexes on status and created_at
- Converting a text email field to VARCHAR(255) with UNIQUE and model-level format validation
- Defining cascading deletes for a parent-child relationship where child records must be removed with the parent
- Introducing soft deletes via deleted_at and updating queries to filter active records
- Switching a monetary column from FLOAT to DECIMAL(10,2) to prevent precision errors
FAQ
Yes. Model-level validation gives helpful error messages; database constraints provide defense in depth if the application is bypassed.
When should I denormalize data?
Denormalize only when read performance justifies it (analytics, snapshots) and you have evidence that joins are a bottleneck; default to normalized design.