AgentSkillsCN

Backend Models

定义并构建数据库模型,采用恰当的命名规范、数据完整性约束及关系定义。在创建或修改数据库模型文件、定义表模式、设置模型关系(一对多、多对多、一对一)、处理ORM模型文件(schema.prisma、models/*、app/models/*、entities/*)、在模型级别实施数据验证、添加时间戳和审计字段、定义外键和索引、选择合适的数据类型、配置级联行为或平衡数据库规范化与查询性能时,可使用此技能。在设计数据库模式、创建新模型、重构现有模型结构或审查数据完整性及关系配置时,可应用此技能。

SKILL.md
--- frontmatter
name: Backend Models
description: Define and structure database models with proper naming conventions, data integrity constraints, and relationship definitions. Use this skill when creating or modifying database model files, defining table schemas, setting up model relationships (one-to-many, many-to-many, one-to-one), working with ORM model files (schema.prisma, models/*, app/models/*, entities/*), implementing data validation at the model level, adding timestamps and audit fields, defining foreign keys and indexes, choosing appropriate data types, configuring cascade behaviors, or balancing database normalization with query performance. Apply this skill when designing database schemas, creating new models, refactoring existing model structures, or reviewing data integrity and relationship configurations.

Backend Models

When to use this skill

  • When creating or modifying database model files (e.g., schema.prisma, models/*, app/models/*, entities/*)
  • When defining table schemas and column data types
  • When setting up model relationships (one-to-many, many-to-many, one-to-one)
  • When adding database constraints (NOT NULL, UNIQUE, foreign keys, check constraints)
  • When implementing timestamps (createdAt, updatedAt) and audit fields
  • When choosing appropriate data types for columns based on data requirements
  • When adding indexes on foreign keys and frequently queried fields
  • When defining validation rules at the model or database level
  • When configuring cascade behaviors for relationships (CASCADE, SET NULL, RESTRICT)
  • When balancing database normalization with practical query performance needs
  • When naming models following singular/plural conventions
  • When reviewing data integrity and relationship definitions

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