Token导航 LogoToken导航TokenDH.com
开发external-servicegithub未标认证来源可访问clear审计未展示

models-standards型号标准

Agent Skill

models-standards 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

24,698

周安装

607

GitHub Stars

1,608

下载量

3,494
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:models-standards(型号标准)
来源仓库:https://github.com/maxritter/claude-codepro
仓库路径:skills/models-standards
安装命令:
npx skills add https://github.com/maxritter/claude-codepro --skill 'Models Standards'
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/maxritter/claude-codepro --skill 'Models Standards'

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定仓库安装,需确认权限和维护状态。
  • 涉及联网、命令执行或文件读写时,应先评估安全风险和操作边界。
  • 建议结合原始 README 核验具体用法和功能细节。

SKILL.md

Models Standards

Core Rule: Models define data structure and integrity. Keep them focused on data representation, not business logic.

When to use this skill

  • When creating or modifying database model files (models.py, models/, schema.prisma, etc.)
  • When defining ORM classes or ActiveRecord models for database tables
  • When establishing table relationships (one-to-many, many-to-many, has-many, belongs-to)
  • When configuring foreign keys, indexes, and cascade behaviors
  • When implementing model-level validation rules
  • When adding timestamp fields (created_at, updated_at) for auditing
  • When setting database constraints (NOT NULL, UNIQUE, CHECK constraints)
  • When choosing appropriate data types for model fields
  • When balancing normalization with query performance needs
  • When defining model methods or scopes for common queries

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.

Naming Conventions

Models: Singular, PascalCase (User, OrderItem, PaymentMethod)

Tables: Plural, snake_case (users, order_items, payment_methods)

Relationships: Descriptive and clear

  • user.orders (one-to-many)
  • order.items (one-to-many)
  • product.categories (many-to-many)

Avoid generic names: data, info, record, entity

Required Fields

Timestamps on every model:

created_at = Column(DateTime, nullable=False, default=datetime.utcnow)
updated_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)

Primary keys: Always explicit, prefer UUIDs for distributed systems or auto-incrementing integers for simplicity

Why: Auditing, debugging, data lineage tracking, soft deletes

Data Integrity - Database Level

Use constraints, not just application validation:

# NOT NULL for required fields
email = Column(String(255), nullable=False)

# UNIQUE constraints
email = Column(String(255), unique=True, nullable=False)

# CHECK constraints for business rules
age = Column(Integer, CheckConstraint('age >= 18'))

# Foreign keys with explicit cascade behavior
user_id = Column(Integer, ForeignKey('users.id', ondelete='CASCADE'))

Why: Database enforces rules even if application code bypassed. Defense in depth.

Data Types - Choose Appropriately

DataTypeAvoid
Email, URLVARCHAR(255)TEXT
Short textVARCHAR(n)TEXT
Long textTEXTVARCHAR
MoneyDECIMAL(10,2)FLOAT
BooleanBOOLEANTINYINT
TimestampsTIMESTAMP/DATETIMEVARCHAR
JSON dataJSON/JSONBTEXT
UUIDsUUIDVARCHAR(36)

Why: Correct types enable database optimizations, constraints, and prevent data corruption.

Indexes - Performance Critical

Always index:

  • Primary keys (automatic)
  • Foreign keys (manual in most ORMs)
  • Columns in WHERE clauses
  • Columns in JOIN conditions
  • Columns in ORDER BY clauses

Example:

class Order(Base):
    __tablename__ = 'orders'

    id = Column(Integer, primary_key=True)
    user_id = Column(Integer, ForeignKey('users.id'), index=True)
    status = Column(String(50), index=True)  # Frequently filtered
    created_at = Column(DateTime, index=True)  # Frequently sorted

Don't over-index: Each index slows writes. Index only queried columns.

Relationships - Explicit Configuration

Define both sides of relationships:

# One-to-many
class User(Base):
    orders = relationship('Order', back_populates='user', cascade='all, delete-orphan')

class Order(Base):
    user_id = Column(Integer, ForeignKey('users.id'))
    user = relationship('User', back_populates='orders')

Cascade behaviors:

  • CASCADE: Delete related records (user deleted → orders deleted)
  • SET NULL: Nullify foreign key (category deleted → product.category_id = NULL)
  • RESTRICT: Prevent deletion if related records exist
  • NO ACTION: Database default, usually same as RESTRICT

Choose based on business logic, not convenience.

Validation - Two Layers

Model-level validation (application):

@validates('email')
def validate_email(self, key, email):
    if not re.match(r'^[^@]+@[^@]+\.[^@]+$', email):
        raise ValueError('Invalid email format')
    return email

Database-level constraints (see Data Integrity section)

Why both: Model validation provides clear error messages. Database constraints prevent data corruption if application bypassed.

What Belongs in Models

YES:

  • Field definitions and types
  • Relationships to other models
  • Simple property methods (@property def full_name)
  • Data validation rules
  • Database constraints

NO:

  • Business logic (move to service layer)
  • External API calls
  • Complex calculations (move to service methods)
  • Email sending, file uploads, etc.

Models represent data structure, not behavior.

Normalization vs Performance

Normalize when:

  • Data has clear entity boundaries
  • Updates need to propagate (user email changes once)
  • Avoiding data duplication is critical

Denormalize when:

  • Read performance critical (analytics, reporting)
  • Data rarely changes (historical snapshots)
  • Joins become too expensive

Default to normalized. Denormalize only with evidence of performance issues.

Common Patterns

Soft deletes:

deleted_at = Column(DateTime, nullable=True, index=True)

# Query only active records
query = session.query(User).filter(User.deleted_at.is_(None))

Polymorphic associations:

# Avoid if possible - complex and hard to maintain
# Prefer separate relationship fields or inheritance

Enums for fixed values:

from enum import Enum

class OrderStatus(str, Enum):
    PENDING = 'pending'
    PAID = 'paid'
    SHIPPED = 'shipped'
    DELIVERED = 'delivered'

status = Column(Enum(OrderStatus), nullable=False, default=OrderStatus.PENDING)

Testing Models

Test constraints and validation:

def test_user_email_required():
    with pytest.raises(IntegrityError):
        user = User(name='Test')
        session.add(user)
        session.commit()

def test_user_email_unique():
    user1 = User(email='test@example.com')
    user2 = User(email='test@example.com')
    session.add(user1)
    session.commit()

    with pytest.raises(IntegrityError):
        session.add(user2)
        session.commit()

Test relationships:

def test_user_orders_cascade_delete():
    user = User(email='test@example.com')
    order = Order(user=user)
    session.add(user)
    session.commit()

    session.delete(user)
    session.commit()

    assert session.query(Order).count() == 0

Checklist for New Models

  • Singular model name, plural table name
  • Primary key defined
  • created_at and updated_at timestamps
  • NOT NULL on required fields
  • UNIQUE constraints where appropriate
  • Foreign keys with explicit cascade behavior
  • Indexes on foreign keys and queried columns
  • Appropriate data types (not all VARCHAR)
  • Validation at model and database levels
  • Relationships defined on both sides
  • Tests for constraints and validation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.54%
按下载量换算997

Cursor

21.05%
按下载量换算735

OpenCode

17.08%
按下载量换算597

Codex

12.09%
按下载量换算422

Gemini CLI

6.87%
按下载量换算240

windsurf

3.24%
按下载量换算113

安全审计

暂无安全审计结果可展示。

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源字段存在多来源差异,先按来源优先级自动处理,无法消解时进入异常复核队列。

来源信息

继续浏览同类 Skills