[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77P6M32FMENX6SJFZ134GEN":3,"skill-same:01M77P6M32FMENX6SJFZ134GEN":56},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M77P6M32FMENX6SJFZ134GEN","architecture-patterns",null,"Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.","Reihantt6\u002Fsns-myagent","Reihantt6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219822095?v=4","01M77KK94PV8B7C2D9XWXNS8DJ","Mohamad Reihan tegar prasetya","01M77KK958QFMTHYXGXFV7KZ79",2,"MIT","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Farchitecture-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.\"\n---\n# Architecture Patterns\n\nMaster proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design to build maintainable, testable, and scalable systems.\n\n**Given:** a service boundary or module to architect.\n**Produces:** layered structure with clear dependency rules, interface definitions, and test boundaries.\n\n## When to Use This Skill\n\n- Designing new backend services or microservices from scratch\n- Refactoring monolithic applications where business logic is entangled with ORM models or HTTP concerns\n- Establishing bounded contexts before splitting a system into services\n- Debugging dependency cycles where infrastructure code bleeds into the domain layer\n- Creating testable codebases where use-case tests do not require a running database\n- Implementing domain-driven design tactical patterns (aggregates, value objects, domain events)\n\n## Core Concepts\n\n### 1. Clean Architecture (Uncle Bob)\n\n**Layers (dependency flows inward):**\n\n- **Entities**: Core business models, no framework imports\n- **Use Cases**: Application business rules, orchestrate entities\n- **Interface Adapters**: Controllers, presenters, gateways — translate between use cases and external formats\n- **Frameworks & Drivers**: UI, database, external services — all at the outermost ring\n\n**Key Principles:**\n\n- Dependencies point inward only; inner layers know nothing about outer layers\n- Business logic is independent of frameworks, databases, and delivery mechanisms\n- Every layer boundary is crossed via an abstract interface\n- Testable without UI, database, or external services\n\n### 2. Hexagonal Architecture (Ports and Adapters)\n\n**Components:**\n\n- **Domain Core**: Business logic lives here, framework-free\n- **Ports**: Abstract interfaces that define how the core interacts with the outside world (driving and driven)\n- **Adapters**: Concrete implementations of ports (PostgreSQL adapter, Stripe adapter, REST adapter)\n\n**Benefits:**\n\n- Swap implementations without touching the core (e.g., replace PostgreSQL with DynamoDB)\n- Use in-memory adapters in tests — no Docker required\n- Technology decisions deferred to the edges\n\n### 3. Domain-Driven Design (DDD)\n\n**Strategic Patterns:**\n\n- **Bounded Contexts**: Isolate a coherent model for one subdomain; avoid sharing a single model across the whole system\n- **Context Mapping**: Define how contexts relate (Anti-Corruption Layer, Shared Kernel, Open Host Service)\n- **Ubiquitous Language**: Every term in code matches the term used by domain experts\n\n**Tactical Patterns:**\n\n- **Entities**: Objects with stable identity that change over time\n- **Value Objects**: Immutable objects identified by their attributes (Email, Money, Address)\n- **Aggregates**: Consistency boundaries; only the root is accessible from outside\n- **Repositories**: Persist and reconstitute aggregates; abstract over the storage mechanism\n- **Domain Events**: Capture things that happened inside the domain; used for cross-aggregate coordination\n\n## Detailed patterns and worked examples\n\nDetailed pattern documentation lives in `references\u002Fdetails.md`. Read that file when the navigation tier above is insufficient.\n\n## Testing — In-Memory Adapters\n\nThe hallmark of correctly applied Clean Architecture is that every use case can be exercised in a plain unit test with no real database, no Docker, and no network:\n\n```python\n# tests\u002Funit\u002Ftest_create_user.py\nimport asyncio\nfrom typing import Dict, Optional\nfrom domain.entities.user import User\nfrom domain.interfaces.user_repository import IUserRepository\nfrom use_cases.create_user import CreateUserUseCase, CreateUserRequest\n\n\nclass InMemoryUserRepository(IUserRepository):\n    def __init__(self):\n        self._store: Dict[str, User] = {}\n\n    async def find_by_id(self, user_id: str) -> Optional[User]:\n        return self._store.get(user_id)\n\n    async def find_by_email(self, email: str) -> Optional[User]:\n        return next((u for u in self._store.values() if u.email == email), None)\n\n    async def save(self, user: User) -> User:\n        self._store[user.id] = user\n        return user\n\n    async def delete(self, user_id: str) -> bool:\n        return self._store.pop(user_id, None) is not None\n\n\nasync def test_create_user_succeeds():\n    repo = InMemoryUserRepository()\n    use_case = CreateUserUseCase(user_repository=repo)\n\n    response = await use_case.execute(CreateUserRequest(email=\"alice@example.com\", name=\"Alice\"))\n\n    assert response.success\n    assert response.user.email == \"alice@example.com\"\n    assert response.user.id is not None\n\n\nasync def test_duplicate_email_rejected():\n    repo = InMemoryUserRepository()\n    use_case = CreateUserUseCase(user_repository=repo)\n\n    await use_case.execute(CreateUserRequest(email=\"alice@example.com\", name=\"Alice\"))\n    response = await use_case.execute(CreateUserRequest(email=\"alice@example.com\", name=\"Alice2\"))\n\n    assert not response.success\n    assert \"already exists\" in response.error\n```\n\n## Troubleshooting\n\n### Use case tests require a running database\n\nBusiness logic has leaked into the infrastructure layer. Move all database calls behind an `IRepository` interface and inject an in-memory implementation in tests (see Testing section above). The use case constructor must accept the abstract port, not the concrete class.\n\n### Circular imports between layers\n\nA common symptom is `ImportError: cannot import name X` between `use_cases` and `adapters`. This happens when a use case imports a concrete adapter class instead of the abstract port. Enforce the rule: `use_cases\u002F` imports only from `domain\u002F` (entities and interfaces). It must never import from `adapters\u002F` or `infrastructure\u002F`.\n\n### Framework decorators appearing in domain entities\n\nIf SQLAlchemy `Column()` or Pydantic `Field()` annotations appear on domain entities, the entity is no longer pure. Create a separate ORM model in `adapters\u002Frepositories\u002F` and map to\u002Ffrom the domain entity in the repository's `_to_entity()` method.\n\n### All logic ending up in controllers\n\nWhen the controller grows beyond HTTP parsing and response formatting, extract the logic into a use case class. A controller method should do three things only: parse the request, call a use case, map the response.\n\n### Value objects raising errors too late\n\nValidate invariants in `__post_init__` (Python) or the constructor so an invalid `Email` or `Money` cannot be constructed at all. This surfaces bad data at the boundary, not deep inside business logic.\n\n### Context bleed across bounded contexts\n\nIf the `Order` context is importing `User` entities from the `Identity` context, introduce an Anti-Corruption Layer. The `Order` context should hold its own lightweight `CustomerId` value object and only call the `Identity` context through an explicit interface.\n\n## Advanced Patterns\n\nFor detailed DDD bounded context mapping, full multi-service project trees, Anti-Corruption Layer implementations, and Onion Architecture comparisons, see:\n\n- [`references\u002Fadvanced-patterns.md`](references\u002Fadvanced-patterns.md)\n\n## Related Skills\n\n- `microservices-patterns` — Apply these architecture patterns when decomposing a monolith into services\n- `cqrs-implementation` — Use Clean Architecture as the structural foundation for CQRS command\u002Fquery separation\n- `saga-orchestration` — Sagas require well-defined aggregate boundaries, which DDD tactical patterns provide\n- `event-store-design` — Domain events produced by aggregates feed directly into an event store\n","# Architecture Patterns\n\nMaster proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design to build maintainable, testable, and scalable systems.\n\n**Given:** a service boundary or module to architect.\n**Produces:** layered structure with clear dependency rules, interface definitions, and test boundaries.\n\n## When to Use This Skill\n\n- Designing new backend services or microservices from scratch\n- Refactoring monolithic applications where business logic is entangled with ORM models or HTTP concerns\n- Establishing bounded contexts before splitting a system into services\n- Debugging dependency cycles where infrastructure code bleeds into the domain layer\n- Creating testable codebases where use-case tests do not require a running database\n- Implementing domain-driven design tactical patterns (aggregates, value objects, domain events)\n\n## Core Concepts\n\n### 1. Clean Architecture (Uncle Bob)\n\n**Layers (dependency flows inward):**\n\n- **Entities**: Core business models, no framework imports\n- **Use Cases**: Application business rules, orchestrate entities\n- **Interface Adapters**: Controllers, presenters, gateways — translate between use cases and external formats\n- **Frameworks & Drivers**: UI, database, external services — all at the outermost ring\n\n**Key Principles:**\n\n- Dependencies point inward only; inner layers know nothing about outer layers\n- Business logic is independent of frameworks, databases, and delivery mechanisms\n- Every layer boundary is crossed via an abstract interface\n- Testable without UI, database, or external services\n\n### 2. Hexagonal Architecture (Ports and Adapters)\n\n**Components:**\n\n- **Domain Core**: Business logic lives here, framework-free\n- **Ports**: Abstract interfaces that define how the core interacts with the outside world (driving and driven)\n- **Adapters**: Concrete implementations of ports (PostgreSQL adapter, Stripe adapter, REST adapter)\n\n**Benefits:**\n\n- Swap implementations without touching the core (e.g., replace PostgreSQL with DynamoDB)\n- Use in-memory adapters in tests — no Docker required\n- Technology decisions deferred to the edges\n\n### 3. Domain-Driven Design (DDD)\n\n**Strategic Patterns:**\n\n- **Bounded Contexts**: Isolate a coherent model for one subdomain; avoid sharing a single model across the whole system\n- **Context Mapping**: Define how contexts relate (Anti-Corruption Layer, Shared Kernel, Open Host Service)\n- **Ubiquitous Language**: Every term in code matches the term used by domain experts\n\n**Tactical Patterns:**\n\n- **Entities**: Objects with stable identity that change over time\n- **Value Objects**: Immutable objects identified by their attributes (Email, Money, Address)\n- **Aggregates**: Consistency boundaries; only the root is accessible from outside\n- **Repositories**: Persist and reconstitute aggregates; abstract over the storage mechanism\n- **Domain Events**: Capture things that happened inside the domain; used for cross-aggregate coordination\n\n## Detailed patterns and worked examples\n\nDetailed pattern documentation lives in `references\u002Fdetails.md`. Read that file when the navigation tier above is insufficient.\n\n## Testing — In-Memory Adapters\n\nThe hallmark of correctly applied Clean Architecture is that every use case can be exercised in a plain unit test with no real database, no Docker, and no network:\n\n```python\n# tests\u002Funit\u002Ftest_create_user.py\nimport asyncio\nfrom typing import Dict, Optional\nfrom domain.entities.user import User\nfrom domain.interfaces.user_repository import IUserRepository\nfrom use_cases.create_user import CreateUserUseCase, CreateUserRequest\n\n\nclass InMemoryUserRepository(IUserRepository):\n    def __init__(self):\n        self._store: Dict[str, User] = {}\n\n    async def find_by_id(self, user_id: str) -> Optional[User]:\n        return self._store.get(user_id)\n\n    async def find_by_email(self, email: str) -> Optional[User]:\n        return next((u for u in self._store.values() if u.email == email), None)\n\n    async def save(self, user: User) -> User:\n        self._store[user.id] = user\n        return user\n\n    async def delete(self, user_id: str) -> bool:\n        return self._store.pop(user_id, None) is not None\n\n\nasync def test_create_user_succeeds():\n    repo = InMemoryUserRepository()\n    use_case = CreateUserUseCase(user_repository=repo)\n\n    response = await use_case.execute(CreateUserRequest(email=\"alice@example.com\", name=\"Alice\"))\n\n    assert response.success\n    assert response.user.email == \"alice@example.com\"\n    assert response.user.id is not None\n\n\nasync def test_duplicate_email_rejected():\n    repo = InMemoryUserRepository()\n    use_case = CreateUserUseCase(user_repository=repo)\n\n    await use_case.execute(CreateUserRequest(email=\"alice@example.com\", name=\"Alice\"))\n    response = await use_case.execute(CreateUserRequest(email=\"alice@example.com\", name=\"Alice2\"))\n\n    assert not response.success\n    assert \"already exists\" in response.error\n```\n\n## Troubleshooting\n\n### Use case tests require a running database\n\nBusiness logic has leaked into the infrastructure layer. Move all database calls behind an `IRepository` interface and inject an in-memory implementation in tests (see Testing section above). The use case constructor must accept the abstract port, not the concrete class.\n\n### Circular imports between layers\n\nA common symptom is `ImportError: cannot import name X` between `use_cases` and `adapters`. This happens when a use case imports a concrete adapter class instead of the abstract port. Enforce the rule: `use_cases\u002F` imports only from `domain\u002F` (entities and interfaces). It must never import from `adapters\u002F` or `infrastructure\u002F`.\n\n### Framework decorators appearing in domain entities\n\nIf SQLAlchemy `Column()` or Pydantic `Field()` annotations appear on domain entities, the entity is no longer pure. Create a separate ORM model in `adapters\u002Frepositories\u002F` and map to\u002Ffrom the domain entity in the repository's `_to_entity()` method.\n\n### All logic ending up in controllers\n\nWhen the controller grows beyond HTTP parsing and response formatting, extract the logic into a use case class. A controller method should do three things only: parse the request, call a use case, map the response.\n\n### Value objects raising errors too late\n\nValidate invariants in `__post_init__` (Python) or the constructor so an invalid `Email` or `Money` cannot be constructed at all. This surfaces bad data at the boundary, not deep inside business logic.\n\n### Context bleed across bounded contexts\n\nIf the `Order` context is importing `User` entities from the `Identity` context, introduce an Anti-Corruption Layer. The `Order` context should hold its own lightweight `CustomerId` value object and only call the `Identity` context through an explicit interface.\n\n## Advanced Patterns\n\nFor detailed DDD bounded context mapping, full multi-service project trees, Anti-Corruption Layer implementations, and Onion Architecture comparisons, see:\n\n- [`references\u002Fadvanced-patterns.md`](references\u002Fadvanced-patterns.md)\n\n## Related Skills\n\n- `microservices-patterns` — Apply these architecture patterns when decomposing a monolith into services\n- `cqrs-implementation` — Use Clean Architecture as the structural foundation for CQRS command\u002Fquery separation\n- `saga-orchestration` — Sagas require well-defined aggregate boundaries, which DDD tactical patterns provide\n- `event-store-design` — Domain events produced by aggregates feed directly into an event store\n",{"description":7},"main","58843b159d7a4050d6b785a98b908cce505c0b92","agent\u002Fskills\u002Farchitecture-patterns",0,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent","https:\u002F\u002Fgithub.com\u002FReihantt6","reihsns.web.id","2026-08-19 20:08:18",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Reihantt6\u002Fsns-myagent --skill architecture-patterns",{"tool":38,"command":39},"bunx","bunx skills add Reihantt6\u002Fsns-myagent --skill architecture-patterns",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Reihantt6\u002Fsns-myagent --skill architecture-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Farchitecture-patterns\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fadvanced-patterns.md","REFERENCE","参考文档",15329,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Farchitecture-patterns\u002Freferences\u002Fadvanced-patterns.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fdetails.md",10993,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Farchitecture-patterns\u002Freferences\u002Fdetails.md",[57,64,71,78,85,92],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M77XDCYZ407XYMF2T4P6F7VT","youtube-transcript","Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com\u002Fwatch?v=, youtu.be\u002F, or similar). Supports output with or without timestamps.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-transcript\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M77XD7PBC98J6MXGJJ2TJ8DX","youtube-thumbnail-design","YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A\u002FB testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-thumbnail-design\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M77XD2541C8HXJ6RHYZP4NGJ","youtube-short-maker","Make YouTube Shorts that hold attention with Pexo — vertical 9:16, fast-paced, hook in the first 3 seconds. Describe your topic and Pexo writes the script, generates the shots, picks the models, and assembles a finished Short with music and captions. Use for YouTube Shorts: \"youtube short\", \"make a youtube short\", \"shorts video\", \"short-form video\". NOT for long-form or landscape video.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-short-maker\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M77XCXKVSYK7KTZ3PQBVVGFD","xcode-project-setup","Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fxcode-project-setup\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M77XCR1DV8ZQK2NHWKVY4EWX","x402","Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — \"just use it\" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing touches your codebase) or \"build it in\" (install the SDK and write the key + code into your project). Walks through wallet setup, funding, .env, and a ~$1 test run. Use when the user asks about x402, pay-per-use, USDC payments, or wants Browser Use Cloud without an API key. For the free-tier signup (reverse-CAPTCHA → API key), use `browser-use cloud signup` or the `cloud` skill instead.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx402\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M77XCMD3R3ZBZQQSW6E0793B","x-twitter-scraper","Build GitHub Copilot workflows with Xquik X API SDKs, REST endpoints, hosted Apify Actor runs, MCP tools, TweetClaw OpenClaw plugin installs, signed webhooks, tweet search, user lookup, follower exports, media actions, and agent automation.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx-twitter-scraper\u002FSKILL.md",[],[]]