[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-4bc0fe84-ec3a-41d7-9442-884d2322698e":3,"$ffj-fkTo7E77ZA-xXAASKK8E4xDhaFgoHwcxGjdFLmTk":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},"4bc0fe84-ec3a-41d7-9442-884d2322698e","ddd-tactical-patterns","在代码中应用DDD战术模式，使用实体、值对象、聚合、仓储和领域事件，并明确不变性。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: ddd-tactical-patterns\ndescription: \"Apply DDD tactical patterns in code using entities, value objects, aggregates, repositories, and domain events with explicit invariants.\"\nrisk: safe\nsource: self\ntags: \"[ddd, tactical, aggregates, value-objects, domain-events]\"\ndate_added: \"2026-02-27\"\n---\n\n# DDD Tactical Patterns\n\n## Use this skill when\n\n- Translating domain rules into code structures.\n- Designing aggregate boundaries and invariants.\n- Refactoring an anemic model into behavior-rich domain objects.\n- Defining repository contracts and domain event boundaries.\n\n## Do not use this skill when\n\n- You are still defining strategic boundaries.\n- The task is only API documentation or UI layout.\n- Full DDD complexity is not justified.\n\n## Instructions\n\n1. Identify invariants first and design aggregates around them.\n2. Model immutable value objects for validated concepts.\n3. Keep domain behavior in domain objects, not controllers.\n4. Emit domain events for meaningful state transitions.\n5. Keep repositories at aggregate root boundaries.\n\nIf detailed checklists are needed, open `references\u002Ftactical-checklist.md`.\n\n## Example\n\n```typescript\nclass Order {\n  private status: \"draft\" | \"submitted\" = \"draft\";\n\n  submit(itemsCount: number): void {\n    if (itemsCount === 0) throw new Error(\"Order cannot be submitted empty\");\n    if (this.status !== \"draft\") throw new Error(\"Order already submitted\");\n    this.status = \"submitted\";\n  }\n}\n```\n\n## Limitations\n\n- This skill does not define deployment architecture.\n- It does not choose databases or transport protocols.\n- It should be paired with testing patterns for invariant coverage.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,148,870,"2026-05-16 13:14:39",{"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},"ead01c62-10db-4f31-92bc-5cd7799f2994","1.0.0","ddd-tactical-patterns.zip",1445,"uploads\u002Fskills\u002F4bc0fe84-ec3a-41d7-9442-884d2322698e\u002Fddd-tactical-patterns.zip","a1ebf65fda42ecbc1bf64e82932f0d8008cb04ad804d70dcb99fbda3feafd4a6","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":1650},{\"path\":\"references\u002Ftactical-checklist.md\",\"isDirectory\":false,\"size\":611}]",{"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]