@zimezone/z-command 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/package.json +4 -1
  2. package/templates/agents/api-documenter.agent.md +161 -0
  3. package/templates/agents/architect-review.agent.md +146 -0
  4. package/templates/agents/arm-cortex-expert.agent.md +288 -0
  5. package/templates/agents/backend-architect.agent.md +309 -0
  6. package/templates/agents/backend-security-coder.agent.md +152 -0
  7. package/templates/agents/bash-pro.agent.md +285 -0
  8. package/templates/agents/c-pro.agent.md +35 -0
  9. package/templates/agents/c4-code.agent.md +320 -0
  10. package/templates/agents/c4-component.agent.md +227 -0
  11. package/templates/agents/c4-container.agent.md +248 -0
  12. package/templates/agents/c4-context.agent.md +235 -0
  13. package/templates/agents/conductor-validator.agent.md +245 -0
  14. package/templates/agents/csharp-pro.agent.md +38 -0
  15. package/templates/agents/customer-support.agent.md +148 -0
  16. package/templates/agents/database-admin.agent.md +142 -0
  17. package/templates/agents/database-architect.agent.md +238 -0
  18. package/templates/agents/database-optimizer.agent.md +144 -0
  19. package/templates/agents/debugger.agent.md +30 -0
  20. package/templates/agents/deployment-engineer.agent.md +0 -0
  21. package/templates/agents/devops-troubleshooter.agent.md +138 -0
  22. package/templates/agents/django-pro.agent.md +159 -0
  23. package/templates/agents/docs-architect.agent.md +77 -0
  24. package/templates/agents/dotnet-architect.agent.md +175 -0
  25. package/templates/agents/dx-optimizer.agent.md +63 -0
  26. package/templates/agents/elixir-pro.agent.md +38 -0
  27. package/templates/agents/error-detective.agent.md +32 -0
  28. package/templates/agents/event-sourcing-architect.agent.md +42 -0
  29. package/templates/agents/fastapi-pro.agent.md +171 -0
  30. package/templates/agents/firmware-analyst.agent.md +330 -0
  31. package/templates/agents/frontend-security-coder.agent.md +149 -0
  32. package/templates/agents/haskell-pro.agent.md +37 -0
  33. package/templates/agents/hr-pro.agent.md +105 -0
  34. package/templates/agents/incident-responder.agent.md +190 -0
  35. package/templates/agents/ios-developer.agent.md +198 -0
  36. package/templates/agents/java-pro.agent.md +156 -0
  37. package/templates/agents/javascript-pro.agent.md +35 -0
  38. package/templates/agents/julia-pro.agent.md +187 -0
  39. package/templates/agents/legal-advisor.agent.md +49 -0
  40. package/templates/agents/malware-analyst.agent.md +272 -0
  41. package/templates/agents/mermaid-expert.agent.md +39 -0
  42. package/templates/agents/minecraft-bukkit-pro.agent.md +104 -0
  43. package/templates/agents/mobile-security-coder.agent.md +163 -0
  44. package/templates/agents/monorepo-architect.agent.md +44 -0
  45. package/templates/agents/observability-engineer.agent.md +228 -0
  46. package/templates/agents/performance-engineer.agent.md +167 -0
  47. package/templates/agents/php-pro.agent.md +43 -0
  48. package/templates/agents/posix-shell-pro.agent.md +284 -0
  49. package/templates/agents/quant-analyst.agent.md +32 -0
  50. package/templates/agents/reference-builder.agent.md +167 -0
  51. package/templates/agents/reverse-engineer.agent.md +202 -0
  52. package/templates/agents/risk-manager.agent.md +41 -0
  53. package/templates/agents/ruby-pro.agent.md +35 -0
  54. package/templates/agents/rust-pro.agent.md +156 -0
  55. package/templates/agents/sales-automator.agent.md +35 -0
  56. package/templates/agents/scala-pro.agent.md +60 -0
  57. package/templates/agents/search-specialist.agent.md +59 -0
  58. package/templates/agents/security-auditor.agent.md +138 -0
  59. package/templates/agents/seo-authority-builder.agent.md +116 -0
  60. package/templates/agents/seo-cannibalization-detector.agent.md +103 -0
  61. package/templates/agents/seo-content-auditor.agent.md +63 -0
  62. package/templates/agents/seo-content-planner.agent.md +88 -0
  63. package/templates/agents/seo-content-refresher.agent.md +98 -0
  64. package/templates/agents/seo-content-writer.agent.md +76 -0
  65. package/templates/agents/seo-keyword-strategist.agent.md +75 -0
  66. package/templates/agents/seo-meta-optimizer.agent.md +72 -0
  67. package/templates/agents/seo-snippet-hunter.agent.md +94 -0
  68. package/templates/agents/seo-structure-architect.agent.md +88 -0
  69. package/templates/agents/service-mesh-expert.agent.md +41 -0
  70. package/templates/agents/sql-pro.agent.md +146 -0
  71. package/templates/agents/tdd-orchestrator.agent.md +183 -0
  72. package/templates/agents/temporal-python-pro.agent.md +349 -0
  73. package/templates/agents/terraform-specialist.agent.md +137 -0
  74. package/templates/agents/test-automator.agent.md +203 -0
  75. package/templates/agents/threat-modeling-expert.agent.md +44 -0
  76. package/templates/agents/tutorial-engineer.agent.md +118 -0
  77. package/templates/agents/ui-ux-designer.agent.md +188 -0
  78. package/templates/agents/ui-visual-validator.agent.md +192 -0
  79. package/templates/agents/vector-database-engineer.agent.md +43 -0
  80. package/templates/skills/angular-migration/SKILL.md +410 -0
  81. package/templates/skills/api-design-principles/SKILL.md +528 -0
  82. package/templates/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  83. package/templates/skills/api-design-principles/assets/rest-api-template.py +182 -0
  84. package/templates/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  85. package/templates/skills/api-design-principles/references/rest-best-practices.md +408 -0
  86. package/templates/skills/architecture-decision-records/SKILL.md +428 -0
  87. package/templates/skills/architecture-patterns/SKILL.md +494 -0
  88. package/templates/skills/async-python-patterns/SKILL.md +694 -0
  89. package/templates/skills/auth-implementation-patterns/SKILL.md +634 -0
  90. package/templates/skills/changelog-automation/SKILL.md +552 -0
  91. package/templates/skills/code-review-excellence/SKILL.md +520 -0
  92. package/templates/skills/competitive-landscape/SKILL.md +479 -0
  93. package/templates/skills/context-driven-development/SKILL.md +385 -0
  94. package/templates/skills/cost-optimization/SKILL.md +274 -0
  95. package/templates/skills/cqrs-implementation/SKILL.md +554 -0
  96. package/templates/skills/data-quality-frameworks/SKILL.md +587 -0
  97. package/templates/skills/data-storytelling/SKILL.md +453 -0
  98. package/templates/skills/database-migration/SKILL.md +424 -0
  99. package/templates/skills/dbt-transformation-patterns/SKILL.md +561 -0
  100. package/templates/skills/debugging-strategies/SKILL.md +527 -0
  101. package/templates/skills/defi-protocol-templates/SKILL.md +454 -0
  102. package/templates/skills/dependency-upgrade/SKILL.md +409 -0
  103. package/templates/skills/deployment-pipeline-design/SKILL.md +359 -0
  104. package/templates/skills/distributed-tracing/SKILL.md +438 -0
  105. package/templates/skills/dotnet-backend-patterns/SKILL.md +815 -0
  106. package/templates/skills/dotnet-backend-patterns/assets/repository-template.cs +523 -0
  107. package/templates/skills/dotnet-backend-patterns/assets/service-template.cs +336 -0
  108. package/templates/skills/dotnet-backend-patterns/references/dapper-patterns.md +544 -0
  109. package/templates/skills/dotnet-backend-patterns/references/ef-core-best-practices.md +355 -0
  110. package/templates/skills/e2e-testing-patterns/SKILL.md +547 -0
  111. package/templates/skills/employment-contract-templates/SKILL.md +507 -0
  112. package/templates/skills/error-handling-patterns/SKILL.md +636 -0
  113. package/templates/skills/event-store-design/SKILL.md +437 -0
  114. package/templates/skills/fastapi-templates/SKILL.md +567 -0
  115. package/templates/skills/git-advanced-workflows/SKILL.md +400 -0
  116. package/templates/skills/github-actions-templates/SKILL.md +333 -0
  117. package/templates/skills/go-concurrency-patterns/SKILL.md +655 -0
  118. package/templates/skills/grafana-dashboards/SKILL.md +369 -0
  119. package/templates/skills/helm-chart-scaffolding/SKILL.md +544 -0
  120. package/templates/skills/helm-chart-scaffolding/assets/Chart.yaml.template +42 -0
  121. package/templates/skills/helm-chart-scaffolding/assets/values.yaml.template +185 -0
  122. package/templates/skills/helm-chart-scaffolding/references/chart-structure.md +500 -0
  123. package/templates/skills/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
  124. package/templates/skills/javascript-testing-patterns/SKILL.md +1025 -0
  125. package/templates/skills/langchain-architecture/SKILL.md +338 -0
  126. package/templates/skills/llm-evaluation/SKILL.md +471 -0
  127. package/templates/skills/microservices-patterns/SKILL.md +595 -0
  128. package/templates/skills/modern-javascript-patterns/SKILL.md +911 -0
  129. package/templates/skills/monorepo-management/SKILL.md +622 -0
  130. package/templates/skills/nextjs-app-router-patterns/SKILL.md +544 -0
  131. package/templates/skills/nodejs-backend-patterns/SKILL.md +1020 -0
  132. package/templates/skills/nx-workspace-patterns/SKILL.md +452 -0
  133. package/templates/skills/openapi-spec-generation/SKILL.md +1028 -0
  134. package/templates/skills/paypal-integration/SKILL.md +467 -0
  135. package/templates/skills/pci-compliance/SKILL.md +466 -0
  136. package/templates/skills/postgresql/SKILL.md +204 -0
  137. package/templates/skills/projection-patterns/SKILL.md +490 -0
  138. package/templates/skills/prometheus-configuration/SKILL.md +392 -0
  139. package/templates/skills/prompt-engineering-patterns/SKILL.md +201 -0
  140. package/templates/skills/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
  141. package/templates/skills/prompt-engineering-patterns/assets/prompt-template-library.md +246 -0
  142. package/templates/skills/prompt-engineering-patterns/references/chain-of-thought.md +399 -0
  143. package/templates/skills/prompt-engineering-patterns/references/few-shot-learning.md +369 -0
  144. package/templates/skills/prompt-engineering-patterns/references/prompt-optimization.md +414 -0
  145. package/templates/skills/prompt-engineering-patterns/references/prompt-templates.md +470 -0
  146. package/templates/skills/prompt-engineering-patterns/references/system-prompts.md +189 -0
  147. package/templates/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
  148. package/templates/skills/python-packaging/SKILL.md +870 -0
  149. package/templates/skills/python-performance-optimization/SKILL.md +869 -0
  150. package/templates/skills/python-testing-patterns/SKILL.md +907 -0
  151. package/templates/skills/rag-implementation/SKILL.md +403 -0
  152. package/templates/skills/react-modernization/SKILL.md +513 -0
  153. package/templates/skills/react-native-architecture/SKILL.md +671 -0
  154. package/templates/skills/react-state-management/SKILL.md +429 -0
  155. package/templates/skills/risk-metrics-calculation/SKILL.md +555 -0
  156. package/templates/skills/rust-async-patterns/SKILL.md +517 -0
  157. package/templates/skills/secrets-management/SKILL.md +346 -0
  158. package/templates/skills/security-requirement-extraction/SKILL.md +677 -0
  159. package/templates/skills/shellcheck-configuration/SKILL.md +454 -0
  160. package/templates/skills/similarity-search-patterns/SKILL.md +558 -0
  161. package/templates/skills/slo-implementation/SKILL.md +329 -0
  162. package/templates/skills/sql-optimization-patterns/SKILL.md +493 -0
  163. package/templates/skills/stripe-integration/SKILL.md +442 -0
  164. package/templates/skills/tailwind-design-system/SKILL.md +666 -0
  165. package/templates/skills/temporal-python-testing/SKILL.md +158 -0
  166. package/templates/skills/temporal-python-testing/resources/integration-testing.md +455 -0
  167. package/templates/skills/temporal-python-testing/resources/local-setup.md +553 -0
  168. package/templates/skills/temporal-python-testing/resources/replay-testing.md +462 -0
  169. package/templates/skills/temporal-python-testing/resources/unit-testing.md +328 -0
  170. package/templates/skills/terraform-module-library/SKILL.md +249 -0
  171. package/templates/skills/terraform-module-library/references/aws-modules.md +63 -0
  172. package/templates/skills/threat-mitigation-mapping/SKILL.md +745 -0
  173. package/templates/skills/track-management/SKILL.md +593 -0
  174. package/templates/skills/typescript-advanced-types/SKILL.md +717 -0
  175. package/templates/skills/uv-package-manager/SKILL.md +831 -0
  176. package/templates/skills/vector-index-tuning/SKILL.md +521 -0
  177. package/templates/skills/wcag-audit-patterns/SKILL.md +555 -0
  178. package/templates/skills/workflow-orchestration-patterns/SKILL.md +316 -0
  179. package/templates/skills/workflow-patterns/SKILL.md +623 -0
  180. package/templates/agents/game-developer.agent.md +0 -57
  181. package/templates/agents/kubernetes-specialist.agent.md +0 -56
  182. package/templates/agents/market-researcher.agent.md +0 -47
@@ -0,0 +1,622 @@
1
+ ---
2
+ name: monorepo-management
3
+ description: Master monorepo management with Turborepo, Nx, and pnpm workspaces to build efficient, scalable multi-package repositories with optimized builds and dependency management. Use when setting up monorepos, optimizing builds, or managing shared dependencies.
4
+ ---
5
+
6
+ # Monorepo Management
7
+
8
+ Build efficient, scalable monorepos that enable code sharing, consistent tooling, and atomic changes across multiple packages and applications.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Setting up new monorepo projects
13
+ - Migrating from multi-repo to monorepo
14
+ - Optimizing build and test performance
15
+ - Managing shared dependencies
16
+ - Implementing code sharing strategies
17
+ - Setting up CI/CD for monorepos
18
+ - Versioning and publishing packages
19
+ - Debugging monorepo-specific issues
20
+
21
+ ## Core Concepts
22
+
23
+ ### 1. Why Monorepos?
24
+
25
+ **Advantages:**
26
+ - Shared code and dependencies
27
+ - Atomic commits across projects
28
+ - Consistent tooling and standards
29
+ - Easier refactoring
30
+ - Simplified dependency management
31
+ - Better code visibility
32
+
33
+ **Challenges:**
34
+ - Build performance at scale
35
+ - CI/CD complexity
36
+ - Access control
37
+ - Large Git repository
38
+
39
+ ### 2. Monorepo Tools
40
+
41
+ **Package Managers:**
42
+ - pnpm workspaces (recommended)
43
+ - npm workspaces
44
+ - Yarn workspaces
45
+
46
+ **Build Systems:**
47
+ - Turborepo (recommended for most)
48
+ - Nx (feature-rich, complex)
49
+ - Lerna (older, maintenance mode)
50
+
51
+ ## Turborepo Setup
52
+
53
+ ### Initial Setup
54
+
55
+ ```bash
56
+ # Create new monorepo
57
+ npx create-turbo@latest my-monorepo
58
+ cd my-monorepo
59
+
60
+ # Structure:
61
+ # apps/
62
+ # web/ - Next.js app
63
+ # docs/ - Documentation site
64
+ # packages/
65
+ # ui/ - Shared UI components
66
+ # config/ - Shared configurations
67
+ # tsconfig/ - Shared TypeScript configs
68
+ # turbo.json - Turborepo configuration
69
+ # package.json - Root package.json
70
+ ```
71
+
72
+ ### Configuration
73
+
74
+ ```json
75
+ // turbo.json
76
+ {
77
+ "$schema": "https://turbo.build/schema.json",
78
+ "globalDependencies": ["**/.env.*local"],
79
+ "pipeline": {
80
+ "build": {
81
+ "dependsOn": ["^build"],
82
+ "outputs": ["dist/**", ".next/**", "!.next/cache/**"]
83
+ },
84
+ "test": {
85
+ "dependsOn": ["build"],
86
+ "outputs": ["coverage/**"]
87
+ },
88
+ "lint": {
89
+ "outputs": []
90
+ },
91
+ "dev": {
92
+ "cache": false,
93
+ "persistent": true
94
+ },
95
+ "type-check": {
96
+ "dependsOn": ["^build"],
97
+ "outputs": []
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ```json
104
+ // package.json (root)
105
+ {
106
+ "name": "my-monorepo",
107
+ "private": true,
108
+ "workspaces": [
109
+ "apps/*",
110
+ "packages/*"
111
+ ],
112
+ "scripts": {
113
+ "build": "turbo run build",
114
+ "dev": "turbo run dev",
115
+ "test": "turbo run test",
116
+ "lint": "turbo run lint",
117
+ "format": "prettier --write \"**/*.{ts,tsx,md}\"",
118
+ "clean": "turbo run clean && rm -rf node_modules"
119
+ },
120
+ "devDependencies": {
121
+ "turbo": "^1.10.0",
122
+ "prettier": "^3.0.0",
123
+ "typescript": "^5.0.0"
124
+ },
125
+ "packageManager": "pnpm@8.0.0"
126
+ }
127
+ ```
128
+
129
+ ### Package Structure
130
+
131
+ ```json
132
+ // packages/ui/package.json
133
+ {
134
+ "name": "@repo/ui",
135
+ "version": "0.0.0",
136
+ "private": true,
137
+ "main": "./dist/index.js",
138
+ "types": "./dist/index.d.ts",
139
+ "exports": {
140
+ ".": {
141
+ "import": "./dist/index.js",
142
+ "types": "./dist/index.d.ts"
143
+ },
144
+ "./button": {
145
+ "import": "./dist/button.js",
146
+ "types": "./dist/button.d.ts"
147
+ }
148
+ },
149
+ "scripts": {
150
+ "build": "tsup src/index.ts --format esm,cjs --dts",
151
+ "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
152
+ "lint": "eslint src/",
153
+ "type-check": "tsc --noEmit"
154
+ },
155
+ "devDependencies": {
156
+ "@repo/tsconfig": "workspace:*",
157
+ "tsup": "^7.0.0",
158
+ "typescript": "^5.0.0"
159
+ },
160
+ "dependencies": {
161
+ "react": "^18.2.0"
162
+ }
163
+ }
164
+ ```
165
+
166
+ ## pnpm Workspaces
167
+
168
+ ### Setup
169
+
170
+ ```yaml
171
+ # pnpm-workspace.yaml
172
+ packages:
173
+ - 'apps/*'
174
+ - 'packages/*'
175
+ - 'tools/*'
176
+ ```
177
+
178
+ ```json
179
+ // .npmrc
180
+ # Hoist shared dependencies
181
+ shamefully-hoist=true
182
+
183
+ # Strict peer dependencies
184
+ auto-install-peers=true
185
+ strict-peer-dependencies=true
186
+
187
+ # Performance
188
+ store-dir=~/.pnpm-store
189
+ ```
190
+
191
+ ### Dependency Management
192
+
193
+ ```bash
194
+ # Install dependency in specific package
195
+ pnpm add react --filter @repo/ui
196
+ pnpm add -D typescript --filter @repo/ui
197
+
198
+ # Install workspace dependency
199
+ pnpm add @repo/ui --filter web
200
+
201
+ # Install in all packages
202
+ pnpm add -D eslint -w
203
+
204
+ # Update all dependencies
205
+ pnpm update -r
206
+
207
+ # Remove dependency
208
+ pnpm remove react --filter @repo/ui
209
+ ```
210
+
211
+ ### Scripts
212
+
213
+ ```bash
214
+ # Run script in specific package
215
+ pnpm --filter web dev
216
+ pnpm --filter @repo/ui build
217
+
218
+ # Run in all packages
219
+ pnpm -r build
220
+ pnpm -r test
221
+
222
+ # Run in parallel
223
+ pnpm -r --parallel dev
224
+
225
+ # Filter by pattern
226
+ pnpm --filter "@repo/*" build
227
+ pnpm --filter "...web" build # Build web and dependencies
228
+ ```
229
+
230
+ ## Nx Monorepo
231
+
232
+ ### Setup
233
+
234
+ ```bash
235
+ # Create Nx monorepo
236
+ npx create-nx-workspace@latest my-org
237
+
238
+ # Generate applications
239
+ nx generate @nx/react:app my-app
240
+ nx generate @nx/next:app my-next-app
241
+
242
+ # Generate libraries
243
+ nx generate @nx/react:lib ui-components
244
+ nx generate @nx/js:lib utils
245
+ ```
246
+
247
+ ### Configuration
248
+
249
+ ```json
250
+ // nx.json
251
+ {
252
+ "extends": "nx/presets/npm.json",
253
+ "$schema": "./node_modules/nx/schemas/nx-schema.json",
254
+ "targetDefaults": {
255
+ "build": {
256
+ "dependsOn": ["^build"],
257
+ "inputs": ["production", "^production"],
258
+ "cache": true
259
+ },
260
+ "test": {
261
+ "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
262
+ "cache": true
263
+ },
264
+ "lint": {
265
+ "inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
266
+ "cache": true
267
+ }
268
+ },
269
+ "namedInputs": {
270
+ "default": ["{projectRoot}/**/*", "sharedGlobals"],
271
+ "production": [
272
+ "default",
273
+ "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
274
+ "!{projectRoot}/tsconfig.spec.json"
275
+ ],
276
+ "sharedGlobals": []
277
+ }
278
+ }
279
+ ```
280
+
281
+ ### Running Tasks
282
+
283
+ ```bash
284
+ # Run task for specific project
285
+ nx build my-app
286
+ nx test ui-components
287
+ nx lint utils
288
+
289
+ # Run for affected projects
290
+ nx affected:build
291
+ nx affected:test --base=main
292
+
293
+ # Visualize dependencies
294
+ nx graph
295
+
296
+ # Run in parallel
297
+ nx run-many --target=build --all --parallel=3
298
+ ```
299
+
300
+ ## Shared Configurations
301
+
302
+ ### TypeScript Configuration
303
+
304
+ ```json
305
+ // packages/tsconfig/base.json
306
+ {
307
+ "compilerOptions": {
308
+ "strict": true,
309
+ "esModuleInterop": true,
310
+ "skipLibCheck": true,
311
+ "forceConsistentCasingInFileNames": true,
312
+ "module": "ESNext",
313
+ "moduleResolution": "bundler",
314
+ "resolveJsonModule": true,
315
+ "isolatedModules": true,
316
+ "incremental": true,
317
+ "declaration": true
318
+ },
319
+ "exclude": ["node_modules"]
320
+ }
321
+
322
+ // packages/tsconfig/react.json
323
+ {
324
+ "extends": "./base.json",
325
+ "compilerOptions": {
326
+ "jsx": "react-jsx",
327
+ "lib": ["ES2022", "DOM", "DOM.Iterable"]
328
+ }
329
+ }
330
+
331
+ // apps/web/tsconfig.json
332
+ {
333
+ "extends": "@repo/tsconfig/react.json",
334
+ "compilerOptions": {
335
+ "outDir": "dist",
336
+ "rootDir": "src"
337
+ },
338
+ "include": ["src"],
339
+ "exclude": ["node_modules", "dist"]
340
+ }
341
+ ```
342
+
343
+ ### ESLint Configuration
344
+
345
+ ```javascript
346
+ // packages/config/eslint-preset.js
347
+ module.exports = {
348
+ extends: [
349
+ 'eslint:recommended',
350
+ 'plugin:@typescript-eslint/recommended',
351
+ 'plugin:react/recommended',
352
+ 'plugin:react-hooks/recommended',
353
+ 'prettier',
354
+ ],
355
+ plugins: ['@typescript-eslint', 'react', 'react-hooks'],
356
+ parser: '@typescript-eslint/parser',
357
+ parserOptions: {
358
+ ecmaVersion: 2022,
359
+ sourceType: 'module',
360
+ ecmaFeatures: {
361
+ jsx: true,
362
+ },
363
+ },
364
+ settings: {
365
+ react: {
366
+ version: 'detect',
367
+ },
368
+ },
369
+ rules: {
370
+ '@typescript-eslint/no-unused-vars': 'error',
371
+ 'react/react-in-jsx-scope': 'off',
372
+ },
373
+ };
374
+
375
+ // apps/web/.eslintrc.js
376
+ module.exports = {
377
+ extends: ['@repo/config/eslint-preset'],
378
+ rules: {
379
+ // App-specific rules
380
+ },
381
+ };
382
+ ```
383
+
384
+ ## Code Sharing Patterns
385
+
386
+ ### Pattern 1: Shared UI Components
387
+
388
+ ```typescript
389
+ // packages/ui/src/button.tsx
390
+ import * as React from 'react';
391
+
392
+ export interface ButtonProps {
393
+ variant?: 'primary' | 'secondary';
394
+ children: React.ReactNode;
395
+ onClick?: () => void;
396
+ }
397
+
398
+ export function Button({ variant = 'primary', children, onClick }: ButtonProps) {
399
+ return (
400
+ <button
401
+ className={`btn btn-${variant}`}
402
+ onClick={onClick}
403
+ >
404
+ {children}
405
+ </button>
406
+ );
407
+ }
408
+
409
+ // packages/ui/src/index.ts
410
+ export { Button, type ButtonProps } from './button';
411
+ export { Input, type InputProps } from './input';
412
+
413
+ // apps/web/src/app.tsx
414
+ import { Button } from '@repo/ui';
415
+
416
+ export function App() {
417
+ return <Button variant="primary">Click me</Button>;
418
+ }
419
+ ```
420
+
421
+ ### Pattern 2: Shared Utilities
422
+
423
+ ```typescript
424
+ // packages/utils/src/string.ts
425
+ export function capitalize(str: string): string {
426
+ return str.charAt(0).toUpperCase() + str.slice(1);
427
+ }
428
+
429
+ export function truncate(str: string, length: number): string {
430
+ return str.length > length ? str.slice(0, length) + '...' : str;
431
+ }
432
+
433
+ // packages/utils/src/index.ts
434
+ export * from './string';
435
+ export * from './array';
436
+ export * from './date';
437
+
438
+ // Usage in apps
439
+ import { capitalize, truncate } from '@repo/utils';
440
+ ```
441
+
442
+ ### Pattern 3: Shared Types
443
+
444
+ ```typescript
445
+ // packages/types/src/user.ts
446
+ export interface User {
447
+ id: string;
448
+ email: string;
449
+ name: string;
450
+ role: 'admin' | 'user';
451
+ }
452
+
453
+ export interface CreateUserInput {
454
+ email: string;
455
+ name: string;
456
+ password: string;
457
+ }
458
+
459
+ // Used in both frontend and backend
460
+ import type { User, CreateUserInput } from '@repo/types';
461
+ ```
462
+
463
+ ## Build Optimization
464
+
465
+ ### Turborepo Caching
466
+
467
+ ```json
468
+ // turbo.json
469
+ {
470
+ "pipeline": {
471
+ "build": {
472
+ // Build depends on dependencies being built first
473
+ "dependsOn": ["^build"],
474
+
475
+ // Cache these outputs
476
+ "outputs": ["dist/**", ".next/**"],
477
+
478
+ // Cache based on these inputs (default: all files)
479
+ "inputs": ["src/**/*.tsx", "src/**/*.ts", "package.json"]
480
+ },
481
+ "test": {
482
+ // Run tests in parallel, don't depend on build
483
+ "cache": true,
484
+ "outputs": ["coverage/**"]
485
+ }
486
+ }
487
+ }
488
+ ```
489
+
490
+ ### Remote Caching
491
+
492
+ ```bash
493
+ # Turborepo Remote Cache (Vercel)
494
+ npx turbo login
495
+ npx turbo link
496
+
497
+ # Custom remote cache
498
+ # turbo.json
499
+ {
500
+ "remoteCache": {
501
+ "signature": true,
502
+ "enabled": true
503
+ }
504
+ }
505
+ ```
506
+
507
+ ## CI/CD for Monorepos
508
+
509
+ ### GitHub Actions
510
+
511
+ ```yaml
512
+ # .github/workflows/ci.yml
513
+ name: CI
514
+
515
+ on:
516
+ push:
517
+ branches: [main]
518
+ pull_request:
519
+ branches: [main]
520
+
521
+ jobs:
522
+ build:
523
+ runs-on: ubuntu-latest
524
+
525
+ steps:
526
+ - uses: actions/checkout@v3
527
+ with:
528
+ fetch-depth: 0 # For Nx affected commands
529
+
530
+ - uses: pnpm/action-setup@v2
531
+ with:
532
+ version: 8
533
+
534
+ - uses: actions/setup-node@v3
535
+ with:
536
+ node-version: 18
537
+ cache: 'pnpm'
538
+
539
+ - name: Install dependencies
540
+ run: pnpm install --frozen-lockfile
541
+
542
+ - name: Build
543
+ run: pnpm turbo run build
544
+
545
+ - name: Test
546
+ run: pnpm turbo run test
547
+
548
+ - name: Lint
549
+ run: pnpm turbo run lint
550
+
551
+ - name: Type check
552
+ run: pnpm turbo run type-check
553
+ ```
554
+
555
+ ### Deploy Affected Only
556
+
557
+ ```yaml
558
+ # Deploy only changed apps
559
+ - name: Deploy affected apps
560
+ run: |
561
+ if pnpm nx affected:apps --base=origin/main --head=HEAD | grep -q "web"; then
562
+ echo "Deploying web app"
563
+ pnpm --filter web deploy
564
+ fi
565
+ ```
566
+
567
+ ## Best Practices
568
+
569
+ 1. **Consistent Versioning**: Lock dependency versions across workspace
570
+ 2. **Shared Configs**: Centralize ESLint, TypeScript, Prettier configs
571
+ 3. **Dependency Graph**: Keep it acyclic, avoid circular dependencies
572
+ 4. **Cache Effectively**: Configure inputs/outputs correctly
573
+ 5. **Type Safety**: Share types between frontend/backend
574
+ 6. **Testing Strategy**: Unit tests in packages, E2E in apps
575
+ 7. **Documentation**: README in each package
576
+ 8. **Release Strategy**: Use changesets for versioning
577
+
578
+ ## Common Pitfalls
579
+
580
+ - **Circular Dependencies**: A depends on B, B depends on A
581
+ - **Phantom Dependencies**: Using deps not in package.json
582
+ - **Incorrect Cache Inputs**: Missing files in Turborepo inputs
583
+ - **Over-Sharing**: Sharing code that should be separate
584
+ - **Under-Sharing**: Duplicating code across packages
585
+ - **Large Monorepos**: Without proper tooling, builds slow down
586
+
587
+ ## Publishing Packages
588
+
589
+ ```bash
590
+ # Using Changesets
591
+ pnpm add -Dw @changesets/cli
592
+ pnpm changeset init
593
+
594
+ # Create changeset
595
+ pnpm changeset
596
+
597
+ # Version packages
598
+ pnpm changeset version
599
+
600
+ # Publish
601
+ pnpm changeset publish
602
+ ```
603
+
604
+ ```yaml
605
+ # .github/workflows/release.yml
606
+ - name: Create Release Pull Request or Publish
607
+ uses: changesets/action@v1
608
+ with:
609
+ publish: pnpm release
610
+ env:
611
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
612
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
613
+ ```
614
+
615
+ ## Resources
616
+
617
+ - **references/turborepo-guide.md**: Comprehensive Turborepo documentation
618
+ - **references/nx-guide.md**: Nx monorepo patterns
619
+ - **references/pnpm-workspaces.md**: pnpm workspace features
620
+ - **assets/monorepo-checklist.md**: Setup checklist
621
+ - **assets/migration-guide.md**: Multi-repo to monorepo migration
622
+ - **scripts/dependency-graph.ts**: Visualize package dependencies