[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-fc08db58-8cdd-4098-a304-cca29eed6c82":3,"$f-N76JajrNObxa7YMOEO9SRwuu4-W1et3LdajzyYx95Y":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"fc08db58-8cdd-4098-a304-cca29eed6c82","pydantic-models-py","根据多模型模式创建Pydantic模型，以实现干净的API合约。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: pydantic-models-py\ndescription: \"Create Pydantic models following the multi-model pattern for clean API contracts.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Pydantic Models\n\nCreate Pydantic models following the multi-model pattern for clean API contracts.\n\n## Quick Start\n\nCopy the template from assets\u002Ftemplate.py and replace placeholders:\n- `{{ResourceName}}` → PascalCase name (e.g., `Project`)\n- `{{resource_name}}` → snake_case name (e.g., `project`)\n\n## Multi-Model Pattern\n\n| Model | Purpose |\n|-------|---------|\n| `Base` | Common fields shared across models |\n| `Create` | Request body for creation (required fields) |\n| `Update` | Request body for updates (all optional) |\n| `Response` | API response with all fields |\n| `InDB` | Database document with `doc_type` |\n\n## camelCase Aliases\n\n```python\nclass MyModel(BaseModel):\n    workspace_id: str = Field(..., alias=\"workspaceId\")\n    created_at: datetime = Field(..., alias=\"createdAt\")\n    \n    class Config:\n        populate_by_name = True  # Accept both snake_case and camelCase\n```\n\n## Optional Update Fields\n\n```python\nclass MyUpdate(BaseModel):\n    \"\"\"All fields optional for PATCH requests.\"\"\"\n    name: Optional[str] = Field(None, min_length=1)\n    description: Optional[str] = None\n```\n\n## Database Document\n\n```python\nclass MyInDB(MyResponse):\n    \"\"\"Adds doc_type for Cosmos DB queries.\"\"\"\n    doc_type: str = \"my_resource\"\n```\n\n## Integration Steps\n\n1. Create models in `src\u002Fbackend\u002Fapp\u002Fmodels\u002F`\n2. Export from `src\u002Fbackend\u002Fapp\u002Fmodels\u002F__init__.py`\n3. Add corresponding TypeScript types\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,79,1947,"2026-05-16 13:35:49",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"b00ee784-8b06-4221-a72e-42481aaed3e4","1.0.0","pydantic-models-py.zip",1113,"uploads\u002Fskills\u002Ffc08db58-8cdd-4098-a304-cca29eed6c82\u002Fpydantic-models-py.zip","e6b8612a0754ed21da67d562580c0e26373c5668f9a33beeb604abd2b0268504","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":2018}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]