skills_all/architecture-patterns/SKILL.md
Apply Clean Architecture, Hexagonal (ports and adapters), onion architecture, layered architecture, and DDD patterns to backend systems. Define bounded contexts, create port/adapter interfaces, organize dependency layers, separate domain from infrastructure, enforce dependency inversion, and structure project layout for separation of concerns. Use when designing new services, refactoring tightly coupled code, planning microservices decomposition, or establishing project structure conventions.
npx skillsauth add activer007/ordinary-claude-skills architecture-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Follow these steps sequentially when applying architecture patterns to a codebase:
This trimmed example shows the key relationships: entity -> port -> use case -> adapter.
# domain/entities/user.py — Core entity, no framework dependencies
@dataclass
class User:
id: str
email: str
name: str
is_active: bool = True
def deactivate(self):
self.is_active = False
# domain/interfaces/user_repository.py — Port (abstract interface in domain)
class IUserRepository(ABC):
@abstractmethod
async def find_by_email(self, email: str) -> Optional[User]: ...
@abstractmethod
async def save(self, user: User) -> User: ...
# use_cases/create_user.py — Orchestrates domain + ports
class CreateUserUseCase:
def __init__(self, user_repo: IUserRepository):
self.user_repo = user_repo
async def execute(self, email: str, name: str) -> User:
if await self.user_repo.find_by_email(email):
raise ValueError("Email already exists")
user = User(id=str(uuid4()), email=email, name=name)
return await self.user_repo.save(user)
# adapters/postgres_user_repository.py — Adapter (implements port)
class PostgresUserRepository(IUserRepository):
def __init__(self, pool: asyncpg.Pool):
self.pool = pool
async def find_by_email(self, email: str) -> Optional[User]:
row = await self.pool.fetchrow("SELECT * FROM users WHERE email=$1", email)
return User(**row) if row else None
async def save(self, user: User) -> User:
await self.pool.execute(
"INSERT INTO users (id,email,name,is_active) VALUES ($1,$2,$3,$4) "
"ON CONFLICT (id) DO UPDATE SET email=$2, name=$3, is_active=$4",
user.id, user.email, user.name, user.is_active)
return user
app/
├── domain/ # Entities, value objects, ports (interfaces)
│ ├── entities/
│ ├── value_objects/
│ └── interfaces/
├── use_cases/ # Application business rules
├── adapters/ # Port implementations (DB, APIs, messaging)
│ ├── repositories/
│ ├── controllers/
│ └── gateways/
└── infrastructure/ # Framework config, logging, DI wiring
tools
Generate typed TypeScript SDKs for AI agents to interact with MCP servers. Converts verbose JSON-RPC curl commands to clean function calls (docs.createDocument() vs curl). Auto-detects MCP tools from server modules, generates TypeScript types and client methods, creates runnable example scripts. Use when: building MCP-enabled applications, need typed programmatic access to MCP tools, want Claude Code to manage apps via scripts, eliminating manual JSON-RPC curl commands, validating MCP inputs/outputs, or creating reusable agent automation.
testing
Generate structured task lists from specs or requirements. IMPORTANT: After completing ANY spec via ExitSpecMode, ALWAYS ask the user: "Would you like me to generate a task list for this spec?" Use when user confirms or explicitly requests task generation from a plan/spec/PRD.
tools
Create compelling story-format summaries using UltraThink to find the best narrative framing. Support multiple formats - 3-part narrative, n-length with inline links, abridged 5-line, or comprehensive via Foundry MCP. USE WHEN user says 'create story explanation', 'narrative summary', 'explain as a story', or wants content in Daniel's conversational first-person voice.
testing
Navigate through the original three-world shamanic technology. Deploy when soul retrieval, power animal guidance, or journey between realms emerges. Deeply respectful of Tungus, Buryat, Yakut, Evenki traditions. Use for consciousness navigation, NOT cultural appropriation.