[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EMD5EXNWNQQW9ZF5EZ2T56":3,"skill-same:01M6EMD5EXNWNQQW9ZF5EZ2T56":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6EMD5EXNWNQQW9ZF5EZ2T56","sqlmodel-crud",null,"Use when creating SQLModel database models, CRUD operations, queries with joins, or relationships.\nNOT when non-database operations, plain SQL, or unrelated data handling.\nTriggers: \"SQLModel\", \"database model\", \"CRUD\", \"create\u002Fread\u002Fupdate\u002Fdelete\", \"query\", \"ForeignKey\", \"relationship\".","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fawais68\u002Fsqlmodel-crud\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"sqlmodel crud","crud","use","database operations","triggers","database model","relationship","query","queries","models","unrelated","sql","operations","read","model","data","database","update","delete","create","2026-11-10 10:12:30",false,"---\nname: sqlmodel-crud\ndescription: |\n  Use when creating SQLModel database models, CRUD operations, queries with joins, or relationships.\n  NOT when non-database operations, plain SQL, or unrelated data handling.\n  Triggers: \"SQLModel\", \"database model\", \"CRUD\", \"create\u002Fread\u002Fupdate\u002Fdelete\", \"query\", \"ForeignKey\", \"relationship\".\n---\n\n# SQLModel CRUD Skill\n\n## Overview\n\nExpert guidance for SQLModel database models and CRUD operations, including Pydantic integration, async session management, query building with joins, and relationship configuration for ERP entities like Student, Fee, and Attendance.\n\n## When This Skill Applies\n\nThis skill triggers when users request:\n- **Models**: \"Student model\", \"SQLModel\", \"database model\", \"table=True\"\n- **CRUD Operations**: \"Create student\", \"Read fees\", \"Update attendance\", \"Delete record\"\n- **Query Building**: \"Query with join\", \"select statement\", \"where clause\", \"pagination\"\n- **Relationships**: \"ForeignKey\", \"back_populates\", \"relationship\", \"linked models\"\n- **Validation**: \"Pydantic validators\", \"field constraints\", \"indexes\"\n\n## Core Rules\n\n### 1. Models: table=True with Pydantic Validation\n\n```python\n# models\u002Fstudent.py\nfrom sqlmodel import SQLModel, Field, Relationship\nfrom datetime import datetime\nfrom typing import Optional, List\nfrom enum import Enum\n\nclass StudentRole(str, Enum):\n    STUDENT = \"student\"\n    TEACHER = \"teacher\"\n    ADMIN = \"admin\"\n\nclass Student(SQLModel, table=True):\n    \"\"\"Student model with relationships to fees and attendance\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str = Field(min_length=2, max_length=100, index=True)\n    email: str = Field(unique=True, index=True)\n    phone: Optional[str] = Field(default=None, pattern=r'^\\+?[\\d\\s-]+$')\n    password_hash: str\n    role: StudentRole = Field(default=StudentRole.STUDENT)\n    class_id: Optional[str] = Field(default=None, foreign_key=\"class.id\", index=True)\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n    updated_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    class_obj: Optional[\"Class\"] = Relationship(back_populates=\"students\")\n    fees: List[\"Fee\"] = Relationship(back_populates=\"student\")\n    attendance: List[\"Attendance\"] = Relationship(back_populates=\"student\")\n\n    class Config:\n        from_attributes = True\n\nclass Class(SQLModel, table=True):\n    \"\"\"Class model for organizing students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str = Field(min_length=2, max_length=50)\n    grade_level: int = Field(ge=1, le=12)\n    academic_year: str = Field(max_length=9, pattern=r'^\\d{4}-\\d{4}$')\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    students: List[Student] = Relationship(back_populates=\"class_obj\")\n\nclass Fee(SQLModel, table=True):\n    \"\"\"Fee model linked to students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    student_id: str = Field(foreign_key=\"student.id\", index=True)\n    amount: float = Field(gt=0)\n    description: str = Field(max_length=500)\n    status: str = Field(default=\"pending\", pattern=r'^(pending|paid|overdue|waived)$')\n    due_date: datetime\n    paid_date: Optional[datetime] = None\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n    updated_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    student: Optional[Student] = Relationship(back_populates=\"fees\")\n\nclass Attendance(SQLModel, table=True):\n    \"\"\"Attendance model linked to students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    student_id: str = Field(foreign_key=\"student.id\", index=True)\n    date: datetime = Field(index=True)\n    status: str = Field(pattern=r'^(present|absent|late|excused)$')\n    notes: Optional[str] = None\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    student: Optional[Student] = Relationship(back_populates=\"attendance\")\n```\n\n**Requirements:**\n- Use `table=True` for database tables\n- Add `index=True` for frequently queried fields\n- Use `unique=True` for email and other unique fields\n- Add `foreign_key` for relationships\n- Use Pydantic validators (min_length, max_length, pattern, ge, gt)\n- Use `Relationship` with `back_populates` for bidirectional links\n- Include `created_at` and `updated_at` timestamps\n\n### 2. CRUD Operations: Async Session Management\n\n```python\n# crud\u002Fstudent.py\nfrom sqlmodel import select, and_\nfrom sqlalchemy.ext.asyncio import AsyncSession\nfrom typing import List, Optional\nfrom datetime import datetime\n\nfrom models.student import Student\nfrom schemas.student import StudentCreate, StudentUpdate\n\nclass StudentCRUD:\n    \"\"\"CRUD operations for Student model\"\"\"\n\n    @staticmethod\n    async def create(db: AsyncSession, student_data: StudentCreate) -> Student:\n        \"\"\"Create a new student\"\"\"\n        student = Student(\n            name=student_data.name,\n            email=student_data.email,\n            phone=student_data.phone,\n            password_hash=student_data.password_hash,\n            role=student_data.role,\n            class_id=student_data.class_id,\n        )\n        db.add(student)\n        await db.commit()\n        await db.refresh(student)\n        return student\n\n    @staticmethod\n    async def get_by_id(db: AsyncSession, student_id: str) -> Optional[Student]:\n        \"\"\"Get student by ID\"\"\"\n        result = await db.execute(\n            select(Student).where(Student.id == student_id)\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_by_email(db: AsyncSession, email: str) -> Optional[Student]:\n        \"\"\"Get student by email\"\"\"\n        result = await db.execute(\n            select(Student).where(Student.email == email)\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_all(\n        db: AsyncSession,\n        skip: int = 0,\n        limit: int = 100,\n        class_id: Optional[str] = None,\n        role: Optional[str] = None,\n    ) -> List[Student]:\n        \"\"\"Get all students with pagination and filters\"\"\"\n        query = select(Student)\n\n        if class_id:\n            query = query.where(Student.class_id == class_id)\n        if role:\n            query = query.where(Student.role == role)\n\n        query = query.offset(skip).limit(limit).order_by(Student.created_at.desc())\n\n        result = await db.execute(query)\n        return result.scalars().all()\n\n    @staticmethod\n    async def update(\n        db: AsyncSession,\n        student_id: str,\n        student_data: StudentUpdate,\n    ) -> Optional[Student]:\n        \"\"\"Update a student\"\"\"\n        student = await StudentCRUD.get_by_id(db, student_id)\n        if not student:\n            return None\n\n        update_data = student_data.model_dump(exclude_unset=True)\n        for field, value in update_data.items():\n            setattr(student, field, value)\n\n        student.updated_at = datetime.utcnow()\n        await db.commit()\n        await db.refresh(student)\n        return student\n\n    @staticmethod\n    async def delete(db: AsyncSession, student_id: str) -> bool:\n        \"\"\"Delete a student\"\"\"\n        student = await StudentCRUD.get_by_id(db, student_id)\n        if not student:\n            return False\n\n        await db.delete(student)\n        await db.commit()\n        return True\n\n    @staticmethod\n    async def count(\n        db: AsyncSession,\n        class_id: Optional[str] = None,\n        role: Optional[str] = None,\n    ) -> int:\n        \"\"\"Count students with filters\"\"\"\n        query = select(Student)\n\n        if class_id:\n            query = query.where(Student.class_id == class_id)\n        if role:\n            query = query.where(Student.role == role)\n\n        result = await db.execute(query)\n        return len(result.scalars().all())\n```\n\n**Requirements:**\n- Use `AsyncSession` for async database operations\n- Use `select()`, `where()`, `offset()`, `limit()`, `order_by()`\n- Return `Optional[T]` for single items, `List[T]` for lists\n- Use `scalar_one_or_none()` for single results\n- Use `scalars().all()` for list results\n- Handle transactions with commit\u002Frollback\n- Update `updated_at` timestamp on modifications\n\n### 3. Query Building: Joins, Filters, Pagination\n\n```python\n# queries\u002Fadvanced.py\nfrom sqlmodel import select, and_, or_, func\nfrom sqlalchemy.ext.asyncio import AsyncSession\nfrom typing import Optional\n\nfrom models.student import Student, Fee, Attendance, Class\n\nclass StudentQueries:\n    \"\"\"Advanced student queries with joins\"\"\"\n\n    @staticmethod\n    async def get_student_with_fees(\n        db: AsyncSession,\n        student_id: str,\n    ) -> Optional[Student]:\n        \"\"\"Get student with all their fees\"\"\"\n        result = await db.execute(\n            select(Student)\n            .where(Student.id == student_id)\n            .options(\n                # Eager load fees relationship\n                selectinload(Student.fees)\n            )\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_students_with_pending_fees(\n        db: AsyncSession,\n        skip: int = 0,\n        limit: int = 100,\n    ) -> List[Student]:\n        \"\"\"Get students with pending fee balance\"\"\"\n        # Subquery to find students with pending fees\n        subquery = (\n            select(Fee.student_id)\n            .where(Fee.status == \"pending\")\n            .distinct()\n        )\n\n        result = await db.execute(\n            select(Student)\n            .where(Student.id.in_(subquery))\n            .offset(skip)\n            .limit(limit)\n            .order_by(Student.name)\n        )\n        return result.scalars().all()\n\n    @staticmethod\n    async def get_student_attendance_summary(\n        db: AsyncSession,\n        student_id: str,\n        month: int,\n        year: int,\n    ) -> dict:\n        \"\"\"Get attendance summary for a student in a month\"\"\"\n        from datetime import datetime\n\n        start_date = datetime(year, month, 1)\n        end_date = datetime(year, month + 1, 1) if month \u003C 12 else datetime(year + 1, 1, 1)\n\n        result = await db.execute(\n            select(\n                func.count().label(\"total_days\"),\n                func.sum(\n                    case((Attendance.status == \"present\", 1), else_=0)\n                ).label(\"present_days\"),\n                func.sum(\n                    case((Attendance.status == \"absent\", 1), else_=0)\n                ).label(\"absent_days\"),\n                func.sum(\n                    case((Attendance.status == \"late\", 1), else_=0)\n                ).label(\"late_days\"),\n            )\n            .where(\n                and_(\n                    Attendance.student_id == student_id,\n                    Attendance.date >= start_date,\n                    Attendance.date \u003C end_date,\n                )\n            )\n        )\n        row = result.one()\n        return {\n            \"total_days\": row.total_days or 0,\n            \"present_days\": row.present_days or 0,\n            \"absent_days\": row.absent_days or 0,\n            \"late_days\": row.late_days or 0,\n        }\n\n    @staticmethod\n    async def search_students(\n        db: AsyncSession,\n        search_term: str,\n        skip: int = 0,\n        limit: int = 100,\n    ) -> List[Student]:\n        \"\"\"Search students by name or email\"\"\"\n        search_pattern = f\"%{search_term}%\"\n\n        result = await db.execute(\n            select(Student)\n            .where(\n                or_(\n                    Student.name.ilike(search_pattern),\n                    Student.email.ilike(search_pattern),\n                )\n            )\n            .offset(skip)\n            .limit(limit)\n            .order_by(Student.name)\n        )\n        return result.scalars().all()\n\n    @staticmethod\n    async def get_students_by_class(\n        db: AsyncSession,\n        class_id: str,\n        include_inactive: bool = False,\n    ) -> List[Student]:\n        \"\"\"Get all students in a class\"\"\"\n        query = select(Student).where(Student.class_id == class_id)\n\n        if not include_inactive:\n            # Assuming there's an is_active field\n            query = query.where(Student.is_active == True)\n\n        query = query.order_by(Student.name)\n\n        result = await db.execute(query)\n        return result.scalars().all()\n\n    @staticmethod\n    async def get_fee_statistics(\n        db: AsyncSession,\n        class_id: Optional[str] = None,\n    ) -> dict:\n        \"\"\"Get fee statistics, optionally filtered by class\"\"\"\n        base_query = select(Fee)\n\n        if class_id:\n            # Join with Student to filter by class\n            base_query = (\n                select(Fee)\n                .join(Student, Student.id == Fee.student_id)\n                .where(Student.class_id == class_id)\n            )\n\n        result = await db.execute(\n            select(\n                func.count().label(\"total_fees\"),\n                func.sum(Fee.amount).label(\"total_amount\"),\n                func.sum(\n                    case((Fee.status == \"paid\", Fee.amount), else_=0)\n                ).label(\"total_collected\"),\n                func.sum(\n                    case((Fee.status == \"pending\", Fee.amount), else_=0)\n                ).label(\"total_pending\"),\n            )\n        )\n        row = result.one()\n        return {\n            \"total_fees\": row.total_fees or 0,\n            \"total_amount\": float(row.total_amount or 0),\n            \"total_collected\": float(row.total_collected or 0),\n            \"total_pending\": float(row.total_pending or 0),\n        }\n```\n\n**Requirements:**\n- Use `selectinload()` for eager loading relationships\n- Use `subquery` for complex filtering\n- Use `and_()`\u002F`or_()` for compound conditions\n- Use `func.count()`, `func.sum()` for aggregations\n- Use `case()` for conditional aggregation\n- Use `ilike()` for case-insensitive search\n- Use `order_by()` for sorting\n- Use `offset()`\u002F`limit()` for pagination\n\n### 4. Relationships: ForeignKey and back_populates\n\n```python\n# models\u002Frelationships.py\nfrom sqlmodel import SQLModel, Field, Relationship\nfrom datetime import datetime\nfrom typing import Optional, List\n\nclass Parent(SQLModel, table=True):\n    \"\"\"Parent model linked to students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str\n    email: str = Field(unique=True)\n    phone: Optional[str]\n\n    # One-to-Many: Parent can have multiple students\n    students: List[\"Student\"] = Relationship(\n        back_populates=\"parent\",\n        link_model=\"student_parent_link\"  # Many-to-many through table\n    )\n\nclass StudentParentLink(SQLModel, table=True):\n    \"\"\"Many-to-many link table for Student and Parent\"\"\"\n    student_id: str = Field(foreign_key=\"student.id\", primary_key=True)\n    parent_id: str = Field(foreign_key=\"parent.id\", primary_key=True)\n    relationship_type: str = Field(default=\"father\")  # father, mother, guardian\n\n# Updated Student with many-to-many relationship\nclass Student(SQLModel, table=True):\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str\n    email: str = Field(unique=True)\n\n    # Many-to-Many: Students can have multiple parents\n    parents: List[Parent] = Relationship(\n        back_populates=\"students\",\n        link_model=StudentParentLink\n    )\n\n# One-to-One relationship example\nclass StudentProfile(SQLModel, table=True):\n    \"\"\"One-to-one profile for student\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    student_id: str = Field(foreign_key=\"student.id\", unique=True)\n    bio: Optional[str] = None\n    avatar_url: Optional[str]\n    preferences: Optional[str] = None  # JSON string for flexible data\n\n    student: Optional[Student] = Relationship()\n\n# Self-referential relationship\nclass Employee(SQLModel, table=True):\n    \"\"\"Employee with manager relationship\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str\n    email: str = Field(unique=True)\n    manager_id: Optional[str] = Field(foreign_key=\"employee.id\")\n\n    # Self-referential relationship\n    manager: Optional[\"Employee\"] = Relationship(\n        back_populates=\"subordinates\",\n        sa_relationship_kwargs={\"remote_side\": \"[Employee.id]\"}\n    )\n    subordinates: List[\"Employee\"] = Relationship(back_populates=\"manager\")\n```\n\n**Requirements:**\n- Use `foreign_key` for relational links\n- Use `back_populates` for bidirectional relationships\n- Use `unique=True` for one-to-one relationships\n- Use link tables for many-to-many relationships\n- Use `remote_side` for self-referential relationships\n- Use `sa_relationship_kwargs` for advanced SQLAlchemy options\n\n## Output Requirements\n\n### Code Files\n\n1. **Models**:\n   - `models\u002F__init__.py`\n   - `models\u002Fstudent.py`\n   - `models\u002Ffee.py`\n   - `models\u002Fattendance.py`\n   - `models\u002Fclass.py`\n\n2. **CRUD Operations**:\n   - `crud\u002F__init__.py`\n   - `crud\u002Fstudent.py`\n   - `crud\u002Ffee.py`\n   - `crud\u002Fattendance.py`\n\n3. **Advanced Queries**:\n   - `queries\u002F__init__.py`\n   - `queries\u002Fadvanced.py`\n\n### Integration Requirements\n\n- **@fastapi-app**: Use models in FastAPI routes\n- **@fastapi-app\u002Fdependencies**: DB session dependency\n- **@api-client**: Type-safe responses for frontend\n\n### Documentation\n\n- **PHR**: Create Prompt History Record for schema design\n- **ADR**: Document relationship choices, indexing strategy\n- **Comments**: Document complex queries and relationships\n\n## Workflow\n\n1. **Design Schema**\n   - Identify entities (Student, Fee, Attendance, etc.)\n   - Define relationships (one-to-many, many-to-many)\n   - Add constraints (unique, foreign keys, indexes)\n\n2. **Create Models**\n   - Define SQLModel classes with `table=True`\n   - Add fields with types and validators\n   - Configure relationships with `back_populates`\n\n3. **Build CRUD Operations**\n   - Implement create, read, update, delete\n   - Add pagination and filtering\n   - Handle async sessions\n\n4. **Create Advanced Queries**\n   - Implement joins and subqueries\n   - Add aggregations and summaries\n   - Search and filter functionality\n\n5. **Test and Optimize**\n   - Test all CRUD operations\n   - Verify relationships work correctly\n   - Optimize slow queries with indexes\n\n## Quality Checklist\n\nBefore completing any SQLModel implementation:\n\n- [ ] **Indexes on freq queries**: Add index=True for commonly filtered\u002Fsorted fields\n- [ ] **Constraints FK\u002Funique**: Use foreign_key for relations, unique=True for emails\n- [ ] **Typed results**: Return properly typed Optional[T] or List[T]\n- [ ] **Async support**: Use AsyncSession for all operations\n- [ ] **Relationships**: Use back_populates for bidirectional links\n- [ ] **Validation**: Use Field validators (min_length, max_length, pattern)\n- [ ] **Timestamps**: Include created_at and updated_at\n- [ ] **Cascading**: Configure delete behavior for relationships\n- [ ] **Eager loading**: Use selectinload for relationship access\n- [ ] **Error handling**: Handle IntegrityError, foreign key violations\n\n## Common Patterns\n\n### Student Model with CRUD\n\n```python\n# models\u002Fstudent.py\nclass Student(SQLModel, table=True):\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str = Field(min_length=2, max_length=100, index=True)\n    email: str = Field(unique=True, index=True)\n    is_active: bool = Field(default=True)\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n\n    fees: List[\"Fee\"] = Relationship(back_populates=\"student\")\n```\n\n### CRUD Fees\n\n```python\n# crud\u002Ffee.py\nclass FeeCRUD:\n    @staticmethod\n    async def create(db: AsyncSession, fee_data: FeeCreate) -> Fee:\n        fee = Fee(**fee_data.model_dump())\n        db.add(fee)\n        await db.commit()\n        await db.refresh(fee)\n        return fee\n\n    @staticmethod\n    async def get_by_id(db: AsyncSession, fee_id: str) -> Optional[Fee]:\n        result = await db.execute(\n            select(Fee).where(Fee.id == fee_id)\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_pending_by_student(db: AsyncSession, student_id: str) -> List[Fee]:\n        result = await db.execute(\n            select(Fee)\n            .where(\n                and_(\n                    Fee.student_id == student_id,\n                    Fee.status == \"pending\"\n                )\n            )\n            .order_by(Fee.due_date)\n        )\n        return result.scalars().all()\n```\n\n### Query with Join\n\n```python\n# Get students with their class name using join\nasync def get_students_with_class(db: AsyncSession) -> List[dict]:\n    result = await db.execute(\n        select(\n            Student.id,\n            Student.name,\n            Student.email,\n            Class.name.label(\"class_name\"),\n        )\n        .outerjoin(Class, Student.class_id == Class.id)\n        .order_by(Student.name)\n    )\n    return [dict(row._mapping) for row in result]\n```\n\n## Database Setup\n\n```python\n# database.py\nfrom sqlmodel import create_engine, SQLModel\nfrom sqlalchemy.ext.asyncio import create_async_engine, AsyncSession\nfrom sqlalchemy.orm import sessionmaker\nimport os\n\nDATABASE_URL = os.getenv(\n    \"DATABASE_URL\",\n    \"postgresql+asyncpg:\u002F\u002Fuser:password@localhost:5432\u002Ferp_db\"\n)\n\n# Async engine\nasync_engine = create_async_engine(DATABASE_URL, echo=True)\nasync_session_maker = sessionmaker(\n    async_engine,\n    class_=AsyncSession,\n    expire_on_commit=False,\n)\n\nasync def init_db():\n    \"\"\"Initialize database tables\"\"\"\n    async with async_engine.begin() as conn:\n        await conn.run_sync(SQLModel.metadata.create_all)\n\nasync def get_db() -> AsyncSession:\n    async with async_session_maker() as session:\n        try:\n            yield session\n            await session.commit()\n        except Exception:\n            await session.rollback()\n            raise\n        finally:\n            await session.close()\n```\n\n## Migrations with Alembic\n\n```python\n# alembic\u002Fenv.py\nfrom sqlalchemy import pool\nfrom sqlalchemy.engine import Connection\nfrom sqlalchemy.ext.asyncio import async_engine_from_url\nfrom alembic import context\n\n# Import models for autogenerate\nfrom models.student import Student\nfrom models.fee import Fee\nfrom models.attendance import Attendance\n\ntarget_metadata = SQLModel.metadata\n\n# alembic revision --autogenerate -m \"Initial migration\"\n# alembic upgrade head\n```\n\n## References\n\n- SQLModel Documentation: https:\u002F\u002Fsqlmodel.tiangolo.com\n- SQLAlchemy Relationships: https:\u002F\u002Fdocs.sqlalchemy.org\u002Fen\u002F20\u002Form\u002Frelationships.html\n- SQLAlchemy Async: https:\u002F\u002Fdocs.sqlalchemy.org\u002Fen\u002F20\u002Form\u002Fextensions\u002Fasyncio.html\n- Pydantic Validation: https:\u002F\u002Fdocs.pydantic.dev\u002Flatest\u002Fusage\u002Fvalidators\u002F\n- Alembic Migrations: https:\u002F\u002Falembic.sqlalchemy.org\u002Fen\u002Flatest\u002F\n","# SQLModel CRUD Skill\n\n## Overview\n\nExpert guidance for SQLModel database models and CRUD operations, including Pydantic integration, async session management, query building with joins, and relationship configuration for ERP entities like Student, Fee, and Attendance.\n\n## When This Skill Applies\n\nThis skill triggers when users request:\n- **Models**: \"Student model\", \"SQLModel\", \"database model\", \"table=True\"\n- **CRUD Operations**: \"Create student\", \"Read fees\", \"Update attendance\", \"Delete record\"\n- **Query Building**: \"Query with join\", \"select statement\", \"where clause\", \"pagination\"\n- **Relationships**: \"ForeignKey\", \"back_populates\", \"relationship\", \"linked models\"\n- **Validation**: \"Pydantic validators\", \"field constraints\", \"indexes\"\n\n## Core Rules\n\n### 1. Models: table=True with Pydantic Validation\n\n```python\n# models\u002Fstudent.py\nfrom sqlmodel import SQLModel, Field, Relationship\nfrom datetime import datetime\nfrom typing import Optional, List\nfrom enum import Enum\n\nclass StudentRole(str, Enum):\n    STUDENT = \"student\"\n    TEACHER = \"teacher\"\n    ADMIN = \"admin\"\n\nclass Student(SQLModel, table=True):\n    \"\"\"Student model with relationships to fees and attendance\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str = Field(min_length=2, max_length=100, index=True)\n    email: str = Field(unique=True, index=True)\n    phone: Optional[str] = Field(default=None, pattern=r'^\\+?[\\d\\s-]+$')\n    password_hash: str\n    role: StudentRole = Field(default=StudentRole.STUDENT)\n    class_id: Optional[str] = Field(default=None, foreign_key=\"class.id\", index=True)\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n    updated_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    class_obj: Optional[\"Class\"] = Relationship(back_populates=\"students\")\n    fees: List[\"Fee\"] = Relationship(back_populates=\"student\")\n    attendance: List[\"Attendance\"] = Relationship(back_populates=\"student\")\n\n    class Config:\n        from_attributes = True\n\nclass Class(SQLModel, table=True):\n    \"\"\"Class model for organizing students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str = Field(min_length=2, max_length=50)\n    grade_level: int = Field(ge=1, le=12)\n    academic_year: str = Field(max_length=9, pattern=r'^\\d{4}-\\d{4}$')\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    students: List[Student] = Relationship(back_populates=\"class_obj\")\n\nclass Fee(SQLModel, table=True):\n    \"\"\"Fee model linked to students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    student_id: str = Field(foreign_key=\"student.id\", index=True)\n    amount: float = Field(gt=0)\n    description: str = Field(max_length=500)\n    status: str = Field(default=\"pending\", pattern=r'^(pending|paid|overdue|waived)$')\n    due_date: datetime\n    paid_date: Optional[datetime] = None\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n    updated_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    student: Optional[Student] = Relationship(back_populates=\"fees\")\n\nclass Attendance(SQLModel, table=True):\n    \"\"\"Attendance model linked to students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    student_id: str = Field(foreign_key=\"student.id\", index=True)\n    date: datetime = Field(index=True)\n    status: str = Field(pattern=r'^(present|absent|late|excused)$')\n    notes: Optional[str] = None\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n\n    # Relationships\n    student: Optional[Student] = Relationship(back_populates=\"attendance\")\n```\n\n**Requirements:**\n- Use `table=True` for database tables\n- Add `index=True` for frequently queried fields\n- Use `unique=True` for email and other unique fields\n- Add `foreign_key` for relationships\n- Use Pydantic validators (min_length, max_length, pattern, ge, gt)\n- Use `Relationship` with `back_populates` for bidirectional links\n- Include `created_at` and `updated_at` timestamps\n\n### 2. CRUD Operations: Async Session Management\n\n```python\n# crud\u002Fstudent.py\nfrom sqlmodel import select, and_\nfrom sqlalchemy.ext.asyncio import AsyncSession\nfrom typing import List, Optional\nfrom datetime import datetime\n\nfrom models.student import Student\nfrom schemas.student import StudentCreate, StudentUpdate\n\nclass StudentCRUD:\n    \"\"\"CRUD operations for Student model\"\"\"\n\n    @staticmethod\n    async def create(db: AsyncSession, student_data: StudentCreate) -> Student:\n        \"\"\"Create a new student\"\"\"\n        student = Student(\n            name=student_data.name,\n            email=student_data.email,\n            phone=student_data.phone,\n            password_hash=student_data.password_hash,\n            role=student_data.role,\n            class_id=student_data.class_id,\n        )\n        db.add(student)\n        await db.commit()\n        await db.refresh(student)\n        return student\n\n    @staticmethod\n    async def get_by_id(db: AsyncSession, student_id: str) -> Optional[Student]:\n        \"\"\"Get student by ID\"\"\"\n        result = await db.execute(\n            select(Student).where(Student.id == student_id)\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_by_email(db: AsyncSession, email: str) -> Optional[Student]:\n        \"\"\"Get student by email\"\"\"\n        result = await db.execute(\n            select(Student).where(Student.email == email)\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_all(\n        db: AsyncSession,\n        skip: int = 0,\n        limit: int = 100,\n        class_id: Optional[str] = None,\n        role: Optional[str] = None,\n    ) -> List[Student]:\n        \"\"\"Get all students with pagination and filters\"\"\"\n        query = select(Student)\n\n        if class_id:\n            query = query.where(Student.class_id == class_id)\n        if role:\n            query = query.where(Student.role == role)\n\n        query = query.offset(skip).limit(limit).order_by(Student.created_at.desc())\n\n        result = await db.execute(query)\n        return result.scalars().all()\n\n    @staticmethod\n    async def update(\n        db: AsyncSession,\n        student_id: str,\n        student_data: StudentUpdate,\n    ) -> Optional[Student]:\n        \"\"\"Update a student\"\"\"\n        student = await StudentCRUD.get_by_id(db, student_id)\n        if not student:\n            return None\n\n        update_data = student_data.model_dump(exclude_unset=True)\n        for field, value in update_data.items():\n            setattr(student, field, value)\n\n        student.updated_at = datetime.utcnow()\n        await db.commit()\n        await db.refresh(student)\n        return student\n\n    @staticmethod\n    async def delete(db: AsyncSession, student_id: str) -> bool:\n        \"\"\"Delete a student\"\"\"\n        student = await StudentCRUD.get_by_id(db, student_id)\n        if not student:\n            return False\n\n        await db.delete(student)\n        await db.commit()\n        return True\n\n    @staticmethod\n    async def count(\n        db: AsyncSession,\n        class_id: Optional[str] = None,\n        role: Optional[str] = None,\n    ) -> int:\n        \"\"\"Count students with filters\"\"\"\n        query = select(Student)\n\n        if class_id:\n            query = query.where(Student.class_id == class_id)\n        if role:\n            query = query.where(Student.role == role)\n\n        result = await db.execute(query)\n        return len(result.scalars().all())\n```\n\n**Requirements:**\n- Use `AsyncSession` for async database operations\n- Use `select()`, `where()`, `offset()`, `limit()`, `order_by()`\n- Return `Optional[T]` for single items, `List[T]` for lists\n- Use `scalar_one_or_none()` for single results\n- Use `scalars().all()` for list results\n- Handle transactions with commit\u002Frollback\n- Update `updated_at` timestamp on modifications\n\n### 3. Query Building: Joins, Filters, Pagination\n\n```python\n# queries\u002Fadvanced.py\nfrom sqlmodel import select, and_, or_, func\nfrom sqlalchemy.ext.asyncio import AsyncSession\nfrom typing import Optional\n\nfrom models.student import Student, Fee, Attendance, Class\n\nclass StudentQueries:\n    \"\"\"Advanced student queries with joins\"\"\"\n\n    @staticmethod\n    async def get_student_with_fees(\n        db: AsyncSession,\n        student_id: str,\n    ) -> Optional[Student]:\n        \"\"\"Get student with all their fees\"\"\"\n        result = await db.execute(\n            select(Student)\n            .where(Student.id == student_id)\n            .options(\n                # Eager load fees relationship\n                selectinload(Student.fees)\n            )\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_students_with_pending_fees(\n        db: AsyncSession,\n        skip: int = 0,\n        limit: int = 100,\n    ) -> List[Student]:\n        \"\"\"Get students with pending fee balance\"\"\"\n        # Subquery to find students with pending fees\n        subquery = (\n            select(Fee.student_id)\n            .where(Fee.status == \"pending\")\n            .distinct()\n        )\n\n        result = await db.execute(\n            select(Student)\n            .where(Student.id.in_(subquery))\n            .offset(skip)\n            .limit(limit)\n            .order_by(Student.name)\n        )\n        return result.scalars().all()\n\n    @staticmethod\n    async def get_student_attendance_summary(\n        db: AsyncSession,\n        student_id: str,\n        month: int,\n        year: int,\n    ) -> dict:\n        \"\"\"Get attendance summary for a student in a month\"\"\"\n        from datetime import datetime\n\n        start_date = datetime(year, month, 1)\n        end_date = datetime(year, month + 1, 1) if month \u003C 12 else datetime(year + 1, 1, 1)\n\n        result = await db.execute(\n            select(\n                func.count().label(\"total_days\"),\n                func.sum(\n                    case((Attendance.status == \"present\", 1), else_=0)\n                ).label(\"present_days\"),\n                func.sum(\n                    case((Attendance.status == \"absent\", 1), else_=0)\n                ).label(\"absent_days\"),\n                func.sum(\n                    case((Attendance.status == \"late\", 1), else_=0)\n                ).label(\"late_days\"),\n            )\n            .where(\n                and_(\n                    Attendance.student_id == student_id,\n                    Attendance.date >= start_date,\n                    Attendance.date \u003C end_date,\n                )\n            )\n        )\n        row = result.one()\n        return {\n            \"total_days\": row.total_days or 0,\n            \"present_days\": row.present_days or 0,\n            \"absent_days\": row.absent_days or 0,\n            \"late_days\": row.late_days or 0,\n        }\n\n    @staticmethod\n    async def search_students(\n        db: AsyncSession,\n        search_term: str,\n        skip: int = 0,\n        limit: int = 100,\n    ) -> List[Student]:\n        \"\"\"Search students by name or email\"\"\"\n        search_pattern = f\"%{search_term}%\"\n\n        result = await db.execute(\n            select(Student)\n            .where(\n                or_(\n                    Student.name.ilike(search_pattern),\n                    Student.email.ilike(search_pattern),\n                )\n            )\n            .offset(skip)\n            .limit(limit)\n            .order_by(Student.name)\n        )\n        return result.scalars().all()\n\n    @staticmethod\n    async def get_students_by_class(\n        db: AsyncSession,\n        class_id: str,\n        include_inactive: bool = False,\n    ) -> List[Student]:\n        \"\"\"Get all students in a class\"\"\"\n        query = select(Student).where(Student.class_id == class_id)\n\n        if not include_inactive:\n            # Assuming there's an is_active field\n            query = query.where(Student.is_active == True)\n\n        query = query.order_by(Student.name)\n\n        result = await db.execute(query)\n        return result.scalars().all()\n\n    @staticmethod\n    async def get_fee_statistics(\n        db: AsyncSession,\n        class_id: Optional[str] = None,\n    ) -> dict:\n        \"\"\"Get fee statistics, optionally filtered by class\"\"\"\n        base_query = select(Fee)\n\n        if class_id:\n            # Join with Student to filter by class\n            base_query = (\n                select(Fee)\n                .join(Student, Student.id == Fee.student_id)\n                .where(Student.class_id == class_id)\n            )\n\n        result = await db.execute(\n            select(\n                func.count().label(\"total_fees\"),\n                func.sum(Fee.amount).label(\"total_amount\"),\n                func.sum(\n                    case((Fee.status == \"paid\", Fee.amount), else_=0)\n                ).label(\"total_collected\"),\n                func.sum(\n                    case((Fee.status == \"pending\", Fee.amount), else_=0)\n                ).label(\"total_pending\"),\n            )\n        )\n        row = result.one()\n        return {\n            \"total_fees\": row.total_fees or 0,\n            \"total_amount\": float(row.total_amount or 0),\n            \"total_collected\": float(row.total_collected or 0),\n            \"total_pending\": float(row.total_pending or 0),\n        }\n```\n\n**Requirements:**\n- Use `selectinload()` for eager loading relationships\n- Use `subquery` for complex filtering\n- Use `and_()`\u002F`or_()` for compound conditions\n- Use `func.count()`, `func.sum()` for aggregations\n- Use `case()` for conditional aggregation\n- Use `ilike()` for case-insensitive search\n- Use `order_by()` for sorting\n- Use `offset()`\u002F`limit()` for pagination\n\n### 4. Relationships: ForeignKey and back_populates\n\n```python\n# models\u002Frelationships.py\nfrom sqlmodel import SQLModel, Field, Relationship\nfrom datetime import datetime\nfrom typing import Optional, List\n\nclass Parent(SQLModel, table=True):\n    \"\"\"Parent model linked to students\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str\n    email: str = Field(unique=True)\n    phone: Optional[str]\n\n    # One-to-Many: Parent can have multiple students\n    students: List[\"Student\"] = Relationship(\n        back_populates=\"parent\",\n        link_model=\"student_parent_link\"  # Many-to-many through table\n    )\n\nclass StudentParentLink(SQLModel, table=True):\n    \"\"\"Many-to-many link table for Student and Parent\"\"\"\n    student_id: str = Field(foreign_key=\"student.id\", primary_key=True)\n    parent_id: str = Field(foreign_key=\"parent.id\", primary_key=True)\n    relationship_type: str = Field(default=\"father\")  # father, mother, guardian\n\n# Updated Student with many-to-many relationship\nclass Student(SQLModel, table=True):\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str\n    email: str = Field(unique=True)\n\n    # Many-to-Many: Students can have multiple parents\n    parents: List[Parent] = Relationship(\n        back_populates=\"students\",\n        link_model=StudentParentLink\n    )\n\n# One-to-One relationship example\nclass StudentProfile(SQLModel, table=True):\n    \"\"\"One-to-one profile for student\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    student_id: str = Field(foreign_key=\"student.id\", unique=True)\n    bio: Optional[str] = None\n    avatar_url: Optional[str]\n    preferences: Optional[str] = None  # JSON string for flexible data\n\n    student: Optional[Student] = Relationship()\n\n# Self-referential relationship\nclass Employee(SQLModel, table=True):\n    \"\"\"Employee with manager relationship\"\"\"\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str\n    email: str = Field(unique=True)\n    manager_id: Optional[str] = Field(foreign_key=\"employee.id\")\n\n    # Self-referential relationship\n    manager: Optional[\"Employee\"] = Relationship(\n        back_populates=\"subordinates\",\n        sa_relationship_kwargs={\"remote_side\": \"[Employee.id]\"}\n    )\n    subordinates: List[\"Employee\"] = Relationship(back_populates=\"manager\")\n```\n\n**Requirements:**\n- Use `foreign_key` for relational links\n- Use `back_populates` for bidirectional relationships\n- Use `unique=True` for one-to-one relationships\n- Use link tables for many-to-many relationships\n- Use `remote_side` for self-referential relationships\n- Use `sa_relationship_kwargs` for advanced SQLAlchemy options\n\n## Output Requirements\n\n### Code Files\n\n1. **Models**:\n   - `models\u002F__init__.py`\n   - `models\u002Fstudent.py`\n   - `models\u002Ffee.py`\n   - `models\u002Fattendance.py`\n   - `models\u002Fclass.py`\n\n2. **CRUD Operations**:\n   - `crud\u002F__init__.py`\n   - `crud\u002Fstudent.py`\n   - `crud\u002Ffee.py`\n   - `crud\u002Fattendance.py`\n\n3. **Advanced Queries**:\n   - `queries\u002F__init__.py`\n   - `queries\u002Fadvanced.py`\n\n### Integration Requirements\n\n- **@fastapi-app**: Use models in FastAPI routes\n- **@fastapi-app\u002Fdependencies**: DB session dependency\n- **@api-client**: Type-safe responses for frontend\n\n### Documentation\n\n- **PHR**: Create Prompt History Record for schema design\n- **ADR**: Document relationship choices, indexing strategy\n- **Comments**: Document complex queries and relationships\n\n## Workflow\n\n1. **Design Schema**\n   - Identify entities (Student, Fee, Attendance, etc.)\n   - Define relationships (one-to-many, many-to-many)\n   - Add constraints (unique, foreign keys, indexes)\n\n2. **Create Models**\n   - Define SQLModel classes with `table=True`\n   - Add fields with types and validators\n   - Configure relationships with `back_populates`\n\n3. **Build CRUD Operations**\n   - Implement create, read, update, delete\n   - Add pagination and filtering\n   - Handle async sessions\n\n4. **Create Advanced Queries**\n   - Implement joins and subqueries\n   - Add aggregations and summaries\n   - Search and filter functionality\n\n5. **Test and Optimize**\n   - Test all CRUD operations\n   - Verify relationships work correctly\n   - Optimize slow queries with indexes\n\n## Quality Checklist\n\nBefore completing any SQLModel implementation:\n\n- [ ] **Indexes on freq queries**: Add index=True for commonly filtered\u002Fsorted fields\n- [ ] **Constraints FK\u002Funique**: Use foreign_key for relations, unique=True for emails\n- [ ] **Typed results**: Return properly typed Optional[T] or List[T]\n- [ ] **Async support**: Use AsyncSession for all operations\n- [ ] **Relationships**: Use back_populates for bidirectional links\n- [ ] **Validation**: Use Field validators (min_length, max_length, pattern)\n- [ ] **Timestamps**: Include created_at and updated_at\n- [ ] **Cascading**: Configure delete behavior for relationships\n- [ ] **Eager loading**: Use selectinload for relationship access\n- [ ] **Error handling**: Handle IntegrityError, foreign key violations\n\n## Common Patterns\n\n### Student Model with CRUD\n\n```python\n# models\u002Fstudent.py\nclass Student(SQLModel, table=True):\n    id: Optional[str] = Field(default=None, primary_key=True)\n    name: str = Field(min_length=2, max_length=100, index=True)\n    email: str = Field(unique=True, index=True)\n    is_active: bool = Field(default=True)\n    created_at: datetime = Field(default_factory=datetime.utcnow)\n\n    fees: List[\"Fee\"] = Relationship(back_populates=\"student\")\n```\n\n### CRUD Fees\n\n```python\n# crud\u002Ffee.py\nclass FeeCRUD:\n    @staticmethod\n    async def create(db: AsyncSession, fee_data: FeeCreate) -> Fee:\n        fee = Fee(**fee_data.model_dump())\n        db.add(fee)\n        await db.commit()\n        await db.refresh(fee)\n        return fee\n\n    @staticmethod\n    async def get_by_id(db: AsyncSession, fee_id: str) -> Optional[Fee]:\n        result = await db.execute(\n            select(Fee).where(Fee.id == fee_id)\n        )\n        return result.scalar_one_or_none()\n\n    @staticmethod\n    async def get_pending_by_student(db: AsyncSession, student_id: str) -> List[Fee]:\n        result = await db.execute(\n            select(Fee)\n            .where(\n                and_(\n                    Fee.student_id == student_id,\n                    Fee.status == \"pending\"\n                )\n            )\n            .order_by(Fee.due_date)\n        )\n        return result.scalars().all()\n```\n\n### Query with Join\n\n```python\n# Get students with their class name using join\nasync def get_students_with_class(db: AsyncSession) -> List[dict]:\n    result = await db.execute(\n        select(\n            Student.id,\n            Student.name,\n            Student.email,\n            Class.name.label(\"class_name\"),\n        )\n        .outerjoin(Class, Student.class_id == Class.id)\n        .order_by(Student.name)\n    )\n    return [dict(row._mapping) for row in result]\n```\n\n## Database Setup\n\n```python\n# database.py\nfrom sqlmodel import create_engine, SQLModel\nfrom sqlalchemy.ext.asyncio import create_async_engine, AsyncSession\nfrom sqlalchemy.orm import sessionmaker\nimport os\n\nDATABASE_URL = os.getenv(\n    \"DATABASE_URL\",\n    \"postgresql+asyncpg:\u002F\u002Fuser:password@localhost:5432\u002Ferp_db\"\n)\n\n# Async engine\nasync_engine = create_async_engine(DATABASE_URL, echo=True)\nasync_session_maker = sessionmaker(\n    async_engine,\n    class_=AsyncSession,\n    expire_on_commit=False,\n)\n\nasync def init_db():\n    \"\"\"Initialize database tables\"\"\"\n    async with async_engine.begin() as conn:\n        await conn.run_sync(SQLModel.metadata.create_all)\n\nasync def get_db() -> AsyncSession:\n    async with async_session_maker() as session:\n        try:\n            yield session\n            await session.commit()\n        except Exception:\n            await session.rollback()\n            raise\n        finally:\n            await session.close()\n```\n\n## Migrations with Alembic\n\n```python\n# alembic\u002Fenv.py\nfrom sqlalchemy import pool\nfrom sqlalchemy.engine import Connection\nfrom sqlalchemy.ext.asyncio import async_engine_from_url\nfrom alembic import context\n\n# Import models for autogenerate\nfrom models.student import Student\nfrom models.fee import Fee\nfrom models.attendance import Attendance\n\ntarget_metadata = SQLModel.metadata\n\n# alembic revision --autogenerate -m \"Initial migration\"\n# alembic upgrade head\n```\n\n## References\n\n- SQLModel Documentation: https:\u002F\u002Fsqlmodel.tiangolo.com\n- SQLAlchemy Relationships: https:\u002F\u002Fdocs.sqlalchemy.org\u002Fen\u002F20\u002Form\u002Frelationships.html\n- SQLAlchemy Async: https:\u002F\u002Fdocs.sqlalchemy.org\u002Fen\u002F20\u002Form\u002Fextensions\u002Fasyncio.html\n- Pydantic Validation: https:\u002F\u002Fdocs.pydantic.dev\u002Flatest\u002Fusage\u002Fvalidators\u002F\n- Alembic Migrations: https:\u002F\u002Falembic.sqlalchemy.org\u002Fen\u002Flatest\u002F\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Fawais68\u002Fsqlmodel-crud",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill sqlmodel-crud",{"tool":59,"command":60},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill sqlmodel-crud",{"tool":62,"command":63},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill sqlmodel-crud","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fawais68\u002Fsqlmodel-crud\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"skill-report.json","REFERENCE","参考文档",17643,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fawais68\u002Fsqlmodel-crud\u002Fskill-report.json",[74,82,91,100,106,112],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[33,80,81],"model hierarchy","model hierarchy skill",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[88,89,90],"MCP","zoom","zoom mcp",{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[97,98,99,89],"sdk","zoom apps sdk","apps",{"skillNo":101,"name":102,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[102],{"skillNo":107,"name":108,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[108],{"skillNo":113,"name":114,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[114]]