Workspace patterns
Skill pantheon-org/tekhne/skills/repository-mgmt/nx/workspace-patterns
Configure and optimize Nx monorepo workspaces with deterministic project-graph structure, boundary enforcement, cache-aware pipelines, and affected-command CI workflows; use when designing workspace architecture, tightening dependency rules, or reducing CI cost through Nx task orchestration.From its SKILL.md
npx -y skills add pantheon-org/tekhne --skill workspace-patternsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 9 stars9 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.3 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Nx Workspace Patterns
Navigation hub for Nx workspace architecture and operations.
When to Use
- You are structuring or refactoring an Nx monorepo.
- You need dependency boundaries enforced by tags and lint rules.
- You need reliable affected-command CI and caching performance.
When Not to Use
- The repository is single-project with no monorepo coordination needs.
- The task is framework-specific build setup unrelated to Nx graph and task orchestration.
Workflow
- Structure workspace domains (
apps/,libs/,tools/). - Define tags and project graph conventions.
- Configure target pipelines and caching defaults.
- Enforce module boundaries and verify violations fail with
nx lint --skip-nx-cache. - Integrate affected commands in CI with explicit base/head strategy.
Constraint Guidelines
Hard Constraints
- MUST tag projects consistently for scope/type-based constraints.
- MUST configure
targetDefaultsfor build/test/lint dependency flow. - MUST use affected commands in CI for scalable execution.
Flexible Choices
- CAN choose tag vocabulary (
scope:*,type:*,platform:*) if consistent. - CAN choose cache backend (Nx Cloud or self-hosted) by org constraints.
- CAN choose library granularity based on team ownership and release cadence.
Fallback Behaviors
| Missing Config | Fallback |
|---|---|
| no explicit tags | allow broad deps temporarily with warning and migration plan |
| no target defaults | tasks run independently with reduced optimization |
| no CI base/head | default to main branch and document tradeoff |
Quick Commands
nx graph
nx affected -t lint,test,build --base=origin/main --parallel=3
nx show project my-app --web
nx reset
rg -n "@nx/enforce-module-boundaries|depConstraints" .
Configuration Examples
nx.json targetDefaults
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
"cache": true
},
"test": {
"dependsOn": ["build"],
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
}
}
}
ESLint depConstraints (tag-based boundaries)
{
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "scope:web",
"onlyDependOnLibsWithTags": ["scope:web", "scope:shared"]
},
{
"sourceTag": "type:feature",
"onlyDependOnLibsWithTags": ["type:feature", "type:ui", "type:data-access", "type:util"]
},
{
"sourceTag": "type:ui",
"onlyDependOnLibsWithTags": ["type:ui", "type:util"]
}
]
}
]
}
}
]
}
Anti-Patterns
NEVER create circular dependencies between projects
- WHY: cycles degrade graph clarity and destabilize build ordering.
- BAD:
libs/uidepends onlibs/datawhilelibs/datadepends onlibs/ui. - GOOD: extract shared contracts to a lower-level library.
NEVER run run-many --all in CI as the default verification path
- WHY: full-workspace execution wastes CI budget and slows feedback loops.
- BAD: always build/test every project on each PR.
- GOOD: use
nx affectedwith explicit base/head.
NEVER tag projects inconsistently
- WHY: boundary rules are only as strong as tag consistency.
- BAD: mixed ad hoc tags with no vocabulary.
- GOOD: defined tag taxonomy with lint enforcement.
NEVER skip target pipeline dependencies in targetDefaults
- WHY: missing
dependsOnprevents optimal scheduling and can hide ordering bugs. - BAD: implicit task order assumptions.
- GOOD: explicit
dependsOnfor build/test/lint behavior.
NEVER ignore cache inputs and outputs for critical targets
- WHY: incomplete cache metadata causes stale hits or unnecessary misses.
- BAD: cache enabled but no stable inputs/outputs.
- GOOD: declare outputs and relevant named inputs per target.
References
| Topic | Reference |
|---|---|
| Project graph and nx.json patterns | references/project-graph-configuration.md |
| Caching and optimization | references/caching-strategies.md |
| Boundaries and tags | references/project-boundaries.md |
| Affected commands and CI | references/affected-commands.md |
What ships with it: 10 files
16.9 KB alongside SKILL.md
.tessl-plugin/
- plugin.json431 B
evals/
- scenario-01.md3.1 KB
- scenario-02.md3.6 KB
- scenario-03.md3.6 KB
- scenario-04.md2.8 KB
references/
- CHANGELOG.md374 B