monorepo-architecture
Use when designing monorepo structure, organizing packages, or migrating to monorepo architecture with architectural patterns for managing dependencies and scalable workspace configurations.
What this skill does
# Monorepo Architecture Skill
## Overview
This skill provides comprehensive guidance on designing and structuring
monorepos, including workspace organization, dependency management, versioning
strategies, and architectural patterns that scale from small projects to
enterprise applications.
## Monorepo vs Polyrepo
### When to Choose Monorepo
A monorepo is beneficial when:
- **Code sharing is frequent**: Multiple projects share common libraries,
utilities, or components
- **Atomic changes needed**: Changes span multiple packages and need to be
deployed together
- **Unified tooling**: All projects benefit from consistent linting, testing,
and build processes
- **Team collaboration**: Teams work across project boundaries and need
visibility into related code
- **Version synchronization**: Related packages should maintain version
alignment
- **Refactoring at scale**: Large-scale refactoring across projects is common
- **Single source of truth**: All code, documentation, and tooling in one place
### When to Choose Polyrepo
A polyrepo is beneficial when:
- **Independent release cycles**: Projects deploy on completely different
schedules
- **Different tech stacks**: Projects use incompatible tooling or languages
- **Access control**: Different teams need isolated access to separate codebases
- **Repository size concerns**: Combined codebase would be too large to manage
efficiently
- **External dependencies**: Projects are maintained by different organizations
- **Simple project structure**: Overhead of monorepo tooling outweighs benefits
### Tradeoffs
**Monorepo Advantages**:
- Simplified dependency management
- Easier refactoring across boundaries
- Consistent tooling and standards
- Better code discoverability
- Atomic commits across projects
- Single CI/CD pipeline
**Monorepo Challenges**:
- Repository size growth
- CI/CD complexity
- Build time management
- Git performance at scale
- Tooling requirements
- Learning curve for developers
## Repository Structure Patterns
### Package-Based Structure
Organize by technical layer or package type.
```text
my-monorepo/
├── apps/
│ ├── web/ # Next.js web application
│ ├── mobile/ # React Native app
│ └── api/ # Node.js API server
├── packages/
│ ├── ui/ # Shared UI components
│ ├── utils/ # Shared utilities
│ ├── config/ # Shared configurations
│ └── types/ # Shared TypeScript types
├── services/
│ ├── auth/ # Authentication service
│ ├── payments/ # Payment processing
│ └── notifications/ # Notification service
└── tooling/
├── eslint-config/ # ESLint configuration
└── tsconfig/ # TypeScript configuration
```
**Best for**: Technical separation, shared library focus, platform diversity.
### Domain-Based Structure
Organize by business domain or feature.
```text
my-monorepo/
├── domains/
│ ├── user/
│ │ ├── api/ # User API
│ │ ├── web/ # User web UI
│ │ ├── mobile/ # User mobile UI
│ │ └── shared/ # User shared code
│ ├── billing/
│ │ ├── api/
│ │ ├── web/
│ │ └── shared/
│ └── analytics/
│ ├── api/
│ ├── web/
│ └── shared/
└── shared/
├── ui/ # Cross-domain UI components
├── utils/ # Cross-domain utilities
└── config/ # Cross-domain config
```
**Best for**: Domain-driven design, team ownership by feature, microservices
architecture.
### Hybrid Structure
Combine package-based and domain-based approaches.
```text
my-monorepo/
├── apps/
│ ├── customer-portal/ # Customer-facing app
│ └── admin-dashboard/ # Admin app
├── features/
│ ├── auth/ # Authentication feature
│ ├── checkout/ # Checkout feature
│ └── inventory/ # Inventory feature
├── packages/
│ ├── ui/ # Shared UI library
│ ├── api-client/ # API client library
│ └── analytics/ # Analytics library
└── infrastructure/
├── database/ # Database utilities
├── messaging/ # Message queue
└── deployment/ # Deployment configs
```
**Best for**: Complex organizations, balancing technical and domain concerns.
## Workspace Configuration
### NPM Workspaces
Basic workspace setup using native NPM workspaces.
```json
{
"name": "my-monorepo",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"dev": "npm run dev --workspaces",
"build": "npm run build --workspaces",
"test": "npm run test --workspaces"
},
"devDependencies": {
"typescript": "^5.3.0",
"eslint": "^8.54.0"
}
}
```
**Key Features**:
- Native NPM support (v7+)
- Simple configuration
- Automatic workspace linking
- Shared dependency hoisting
- Workspace-specific commands
### Yarn Workspaces
Yarn's workspace implementation with additional features.
```json
{
"name": "my-monorepo",
"private": true,
"workspaces": {
"packages": [
"apps/*",
"packages/*"
],
"nohoist": [
"**/react-native",
"**/react-native/**"
]
},
"packageManager": "[email protected]"
}
```
With `.yarnrc.yml` for Yarn Berry:
```yaml
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
enableGlobalCache: true
compressionLevel: mixed
```
**Key Features**:
- Fast installation
- Plugin system (Yarn Berry)
- Advanced workspace commands
- No-hoist for specific dependencies
- Zero-installs capability
### PNPM Workspaces
PNPM's efficient workspace implementation.
```yaml
# pnpm-workspace.yaml
packages:
- 'apps/*'
- 'packages/*'
- 'services/*'
- '!**/test/**'
```
With workspace-specific `.npmrc`:
```ini
# .npmrc
shared-workspace-lockfile=true
link-workspace-packages=true
prefer-workspace-packages=true
strict-peer-dependencies=false
auto-install-peers=true
```
**Key Features**:
- Content-addressable storage
- Strict node_modules structure
- Faster than NPM/Yarn
- Efficient disk space usage
- Built-in monorepo support
### Cargo Workspaces (Rust)
Rust monorepo workspace configuration.
```toml
# Cargo.toml (root)
[workspace]
members = [
"crates/core",
"crates/api",
"crates/cli",
]
exclude = ["archived/*"]
[workspace.package]
version = "1.0.0"
edition = "2021"
license = "MIT"
[workspace.dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.35", features = ["full"] }
```
Individual crate:
```toml
# crates/core/Cargo.toml
[package]
name = "my-core"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
serde.workspace = true
tokio.workspace = true
my-api = { path = "../api" }
```
## Dependency Management
### Internal Package Dependencies
Specify dependencies on other workspace packages.
```json
{
"name": "@myorg/web-app",
"version": "1.0.0",
"dependencies": {
"@myorg/ui": "workspace:*",
"@myorg/utils": "workspace:^",
"@myorg/api-client": "1.2.3",
"react": "^18.2.0"
}
}
```
**Workspace Protocol Variants**:
- `workspace:*` - Any version in workspace
- `workspace:^` - Compatible version (semver caret)
- `workspace:~` - Patch-level version (semver tilde)
- Specific version - Exact workspace version
### Shared Dependencies Hoisting
Configure how dependencies are hoisted to root.
```json
{
"name": "my-monorepo",
"workspaces": {
"packages": ["packages/*"],
"nohoist": [
"**/react-native",
"**/react-native/**",
"**/@babel/**"
]
}
}
```
**Hoisting Strategies**:
- **Full hoisting**: All common dependencies at root (default)
- **Selective hoisting**: Specific packages hoisted, others isolated
- **No hoisting**: Each package has isolated dependencies
- **Public hoisting**: Only public dependencies hoisted
### Version SynchroniRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.