返回 Skill 列表
extension
分类: 开发与工程无需 API Key

backend-models

定义并配置数据库模型,包括适当的命名、关系、时间戳、数据类型、约束和验证。在创建或编辑app/Models/目录下的模型文件、Eloquent模型类、模型关系(hasMany, belongsTo等)、数据库表结构、模型属性和转换、模型工厂或种子时使用此技能。在处理模型验证逻辑、数据库约束、外键关系、索引、范围、访问器、修改器或任何与ORM相关的模型配置时也使用此技能。

person作者: jakexiaohubgithub

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.

When to use this skill

  • When creating or editing model files in app/Models/ or similar model directories
  • When defining Eloquent model classes and their properties
  • When configuring model relationships (hasMany, belongsTo, belongsToMany, hasOne, morphTo, etc.)
  • When setting up model casts, fillable properties, or hidden attributes
  • When implementing model validation rules or business logic
  • When configuring database timestamps (created_at, updated_at) on models
  • When defining model scopes (query scopes, local scopes, global scopes)
  • When creating model factories for testing or seeding
  • When writing database seeders that use models
  • When implementing model accessors or mutators for attribute transformation
  • When setting up soft deletes or other model traits
  • When configuring model events or observers

Instructions

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