architecture-advisor
SKILL.md
Architecture Advisor
Purpose
Provide guidance on architectural decisions, patterns, and best practices for the monorepo.
When to Invoke
- Designing a new feature or module
- Deciding where to place code
- Planning database schema changes
- Evaluating architectural trade-offs
- Refactoring existing code
- Creating new packages or apps
Core Principles
Domain-Driven Design
- Bounded Contexts: Each app/domain has clear boundaries
- Ubiquitous Language: Consistent terminology within domains
- Aggregate Roots: Clear ownership of data
- Domain Events: Communicate between bounded contexts
CQRS Pattern
- Commands: Write operations (create, update, delete)
- Queries: Read operations (get, list)
- Events: Side effects and notifications
- Handlers: Execute commands/queries/events
Database Ownership
- Each domain owns its database schema
- Schema packages export types for tRPC inference
- Frontend never imports schema directly
- Repositories encapsulate data access
Package Organization
packages/
├── foundation/ # Base classes, interfaces
├── infrastructure/ # Cross-cutting concerns
├── shared-features/ # Reusable business features
└── db-[domain]/ # Domain-specific schemas
Dependency Rules
- Apps can depend on packages
- Foundation packages have no dependencies
- Infrastructure can depend on foundation
- Shared features can depend on foundation + infrastructure
- Domain-specific db packages are owned by their app
Feature Workflow
Creating a New Feature
- Identify bounded context
- Create or use existing domain package
- Define schema in appropriate db package
- Implement CQRS handlers in app
- Create tRPC router
- Build frontend components
- Add tests with Testcontainers
Adding to Existing Feature
- Locate the appropriate module
- Follow existing patterns
- Add migration if needed
- Update CQRS handlers
- Add tests
Sharing Code Between Apps
| Code Type | Location |
|---|---|
| Types | Domain-specific package |
| Utilities | Foundation package |
| Business Logic | Shared-feature package |
| UI Components | UI package |
Anti-Patterns to Avoid
- Frontend importing database schema
- Business logic in UI components
- Direct database access from multiple apps
- Circular dependencies
- Generic "shared" or "utils" packages
- Mixing commands and queries
- God modules/packages
Output Format
- Recommendation - Clear guidance on approach
- Rationale - Why this approach is recommended
- Trade-offs - Pros and cons of alternatives
- Implementation Steps - How to implement
- Examples - Code or structure examples
- References - Related documentation
Weekly Installs
1
Repository
rimthan-lab/rim…-pluginsGitHub Stars
1
First Seen
6 days ago
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1