AgentSkillsCN

Backend Models

以恰当的关系、约束条件与数据类型定义数据库模型与实体架构。当创建或修改模型定义、实体类,或设计数据库架构时,可使用此技能。适用于models/*.ts、entities/*.ts、schema.prisma等文件,或任何ORM模型定义的开发工作。对于落实规范的命名约定、时间戳(createdAt/updatedAt)、数据完整性约束(NOT NULL、UNIQUE、外键)、关系定义(hasMany、belongsTo、manyToMany)、外键索引,以及模型级别的校验而言,此项技能至关重要。

SKILL.md
--- frontmatter
name: Backend Models
description: Define database models and entity schemas with proper relationships, constraints, and data types. Use this skill when creating or modifying model definitions, entity classes, or database schemas. Apply when working on files like models/*.ts, entities/*.ts, schema.prisma, or any ORM model definitions. Essential for implementing proper naming conventions, timestamps (createdAt/updatedAt), data integrity constraints (NOT NULL, UNIQUE, foreign keys), relationship definitions (hasMany, belongsTo, manyToMany), indexes on foreign keys, and model-level validations.

When to use this skill:

  • When creating new database model or entity files
  • When defining relationships between models (one-to-many, many-to-many)
  • When adding database constraints (NOT NULL, UNIQUE, CHECK)
  • When defining foreign key relationships and cascade behaviors
  • When choosing appropriate data types for columns
  • When adding timestamps or audit fields to models
  • When implementing model-level validations
  • When working on files in /models/, /entities/, or /prisma/ directories
  • When indexing columns for query performance
  • When balancing normalization with query performance needs

Backend Models

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend models.

Instructions

For details, refer to the information provided in this file: backend models