Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…

: '\u003crootDir>/../../packages/$1/src'\n },\n collectCoverageFrom: [\n 'src/**/*.{ts,tsx}',\n '!src/**/*.d.ts',\n '!src/**/*.stories.tsx'\n ]\n};\n```\n\n**Package test scripts**:\n\n```json\n{\n \"scripts\": {\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\",\n \"test:ci\": \"jest --ci --coverage --maxWorkers=2\"\n }\n}\n```\n\n**Integration testing**:\n\n```typescript\n// __tests__/integration/package-interaction.test.ts\nimport { Button } from '@myorg/ui';\nimport { formatDate } from '@myorg/utils';\n\ndescribe('Package Integration', () => {\n it('uses utility in component', () => {\n const date = new Date('2024-01-01');\n const formatted = formatDate(date);\n expect(formatted).toBe('2024-01-01');\n });\n});\n```\n\n## CI/CD Patterns\n\n### Matrix Builds Per Package\n\nRun builds in parallel across packages.\n\n```yaml\n# .github/workflows/ci.yml\nname: CI\nuser-invocable: false\n\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n setup:\n runs-on: ubuntu-latest\n outputs:\n packages: ${{ steps.packages.outputs.packages }}\n steps:\n - uses: actions/checkout@v4\n - name: Get changed packages\n id: packages\n run: |\n packages=$(pnpm -r list --json | jq -r '.[].name' | jq -R -s -c 'split(\"\\n\")[:-1]')\n echo \"packages=$packages\" >> $GITHUB_OUTPUT\n\n build:\n needs: setup\n runs-on: ubuntu-latest\n strategy:\n matrix:\n package: ${{ fromJson(needs.setup.outputs.packages) }}\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n - run: pnpm install --frozen-lockfile\n - run: pnpm --filter ${{ matrix.package }} run build\n - run: pnpm --filter ${{ matrix.package }} run test\n```\n\n### Affected-Only CI\n\nBuild and test only changed packages.\n\n```yaml\n# .github/workflows/ci.yml\nname: CI\nuser-invocable: false\n\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n affected:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n\n - name: Install dependencies\n run: pnpm install --frozen-lockfile\n\n - name: Build affected\n run: pnpm turbo run build --filter=[origin/main...HEAD]\n\n - name: Test affected\n run: pnpm turbo run test --filter=[origin/main...HEAD]\n\n - name: Lint affected\n run: pnpm turbo run lint --filter=[origin/main...HEAD]\n```\n\n**With Nx affected**:\n\n```yaml\n- name: Build affected\n run: npx nx affected --target=build --base=origin/main --head=HEAD\n\n- name: Test affected\n run: npx nx affected --target=test --base=origin/main --head=HEAD --parallel=3\n```\n\n### Distributed Task Execution\n\nSpread tasks across multiple CI agents.\n\n```yaml\n# .github/workflows/ci.yml\nname: CI with Distribution\nuser-invocable: false\n\non: [pull_request, push]\n\njobs:\n setup:\n runs-on: ubuntu-latest\n outputs:\n tasks: ${{ steps.tasks.outputs.tasks }}\n steps:\n - uses: actions/checkout@v4\n - name: Generate task list\n id: tasks\n run: |\n tasks=$(pnpm turbo run build test --dry-run=json | jq -c '.tasks')\n echo \"tasks=$tasks\" >> $GITHUB_OUTPUT\n\n execute:\n needs: setup\n runs-on: ubuntu-latest\n strategy:\n matrix:\n task: ${{ fromJson(needs.setup.outputs.tasks) }}\n max-parallel: 10\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - run: pnpm install --frozen-lockfile\n - run: ${{ matrix.task.command }}\n```\n\n### Parallel Pipeline Jobs\n\nExecute independent jobs concurrently.\n\n```yaml\n# .github/workflows/ci.yml\nname: Parallel CI\nuser-invocable: false\n\non: [pull_request, push]\n\njobs:\n install:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n - run: pnpm install --frozen-lockfile\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n\n lint:\n needs: install\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n - run: pnpm turbo run lint\n\n test:\n needs: install\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n - run: pnpm turbo run test --coverage\n\n build:\n needs: install\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n - run: pnpm turbo run build\n```\n\n### Selective Deployments\n\nDeploy only changed applications.\n\n```yaml\n# .github/workflows/deploy.yml\nname: Deploy\nuser-invocable: false\n\non:\n push:\n branches: [main]\n\njobs:\n deploy-web:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - name: Check if web changed\n id: changed\n run: |\n if git diff --name-only HEAD^ HEAD | grep -q \"^apps/web/\"; then\n echo \"changed=true\" >> $GITHUB_OUTPUT\n fi\n\n - name: Deploy web\n if: steps.changed.outputs.changed == 'true'\n run: |\n pnpm turbo run build --filter=@myorg/web\n # Deploy commands here\n\n deploy-api:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - name: Check if API changed\n id: changed\n run: |\n if git diff --name-only HEAD^ HEAD | grep -q \"^apps/api/\"; then\n echo \"changed=true\" >> $GITHUB_OUTPUT\n fi\n\n - name: Deploy API\n if: steps.changed.outputs.changed == 'true'\n run: |\n pnpm turbo run build --filter=@myorg/api\n # Deploy commands here\n```\n\n## Version Management\n\n### Changesets Workflow\n\nAutomated versioning and changelog generation.\n\n**Installation and setup**:\n\n```bash\npnpm add -DW @changesets/cli\npnpm changeset init\n```\n\n**Configuration**:\n\n```json\n{\n \"changelog\": \"@changesets/cli/changelog\",\n \"commit\": false,\n \"fixed\": [],\n \"linked\": [],\n \"access\": \"restricted\",\n \"baseBranch\": \"main\",\n \"updateInternalDependencies\": \"patch\",\n \"ignore\": [\n \"@myorg/private-package\"\n ]\n}\n```\n\n**Creating changesets**:\n\n```bash\n# Interactive changeset creation\npnpm changeset\n\n# Example changeset file generated:\n# .changeset/cool-feature.md\n```\n\n```markdown\n---\n\"@myorg/ui\": minor\n\"@myorg/web\": patch\n---\n\nAdd new Button variant and update documentation\n```\n\n**Version bumping**:\n\n```bash\n# Consume changesets and update versions\npnpm changeset version\n\n# Updates package.json versions\n# Updates CHANGELOG.md files\n# Removes consumed changeset files\n```\n\n**Publishing**:\n\n```bash\n# Build and publish changed packages\npnpm changeset publish\n\n# Push tags\ngit push --follow-tags\n```\n\n**GitHub Action integration**:\n\n```yaml\n# .github/workflows/release.yml\nname: Release\nuser-invocable: false\n\non:\n push:\n branches: [main]\n\njobs:\n release:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n\n - run: pnpm install --frozen-lockfile\n - run: pnpm turbo run build\n\n - name: Create Release Pull Request or Publish\n uses: changesets/action@v1\n with:\n publish: pnpm changeset publish\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\n### Conventional Commits\n\nStandardized commit message format for automated versioning.\n\n**Commit message format**:\n\n```text\n\u003ctype>(\u003cscope>): \u003csubject>\n\n\u003cbody>\n\n\u003cfooter>\n```\n\n**Examples**:\n\n```bash\ngit commit -m \"feat(ui): add Button component variant\"\ngit commit -m \"fix(api): resolve authentication bug\"\ngit commit -m \"docs(readme): update installation instructions\"\ngit commit -m \"chore(deps): update dependencies\"\n```\n\n**Commitlint configuration**:\n\n```javascript\n// commitlint.config.js\nmodule.exports = {\n extends: ['@commitlint/config-conventional'],\n rules: {\n 'scope-enum': [\n 2,\n 'always',\n ['ui', 'api', 'web', 'mobile', 'utils', 'config', 'ci']\n ],\n 'type-enum': [\n 2,\n 'always',\n [\n 'feat',\n 'fix',\n 'docs',\n 'style',\n 'refactor',\n 'perf',\n 'test',\n 'chore',\n 'revert'\n ]\n ]\n }\n};\n```\n\n**Husky pre-commit hook**:\n\n```bash\n#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\npnpm commitlint --edit $1\n```\n\n### Automated Changelogs\n\nGenerate changelogs from commit history.\n\n**Using conventional-changelog**:\n\n```bash\npnpm add -DW conventional-changelog-cli\n```\n\n```json\n{\n \"scripts\": {\n \"changelog\": \"conventional-changelog -p angular -i CHANGELOG.md -s\",\n \"version\": \"pnpm run changelog && git add CHANGELOG.md\"\n }\n}\n```\n\n**Using semantic-release**:\n\n```json\n{\n \"branches\": [\"main\"],\n \"plugins\": [\n \"@semantic-release/commit-analyzer\",\n \"@semantic-release/release-notes-generator\",\n \"@semantic-release/changelog\",\n \"@semantic-release/npm\",\n \"@semantic-release/github\",\n \"@semantic-release/git\"\n ]\n}\n```\n\n### Version Bumping Strategies\n\nDifferent approaches to version management.\n\n**Independent versioning**:\n\n```json\n{\n \"version\": \"independent\",\n \"packages\": [\n \"packages/*\"\n ]\n}\n```\n\nEach package has its own version:\n\n- `@myorg/[email protected]`\n- `@myorg/[email protected]`\n- `@myorg/[email protected]`\n\n**Fixed versioning**:\n\n```json\n{\n \"version\": \"1.2.3\",\n \"packages\": [\n \"packages/*\"\n ]\n}\n```\n\nAll packages share same version:\n\n- `@myorg/[email protected]`\n- `@myorg/[email protected]`\n- `@myorg/[email protected]`\n\n### Pre-Release Versions\n\nManage alpha, beta, and release candidate versions.\n\n**With changesets**:\n\n```bash\n# Enter pre-release mode\npnpm changeset pre enter next\n\n# Create changeset\npnpm changeset\n\n# Version packages (creates -next.0 versions)\npnpm changeset version\n\n# Publish pre-release\npnpm changeset publish --tag next\n\n# Exit pre-release mode\npnpm changeset pre exit\n```\n\n**Result**:\n\n```text\n@myorg/[email protected]\n@myorg/[email protected]\n@myorg/[email protected]\n```\n\n**With NPM dist-tags**:\n\n```bash\n# Publish to specific tag\npnpm publish --tag beta\n\n# Install from tag\npnpm add @myorg/ui@beta\n\n# List tags\npnpm view @myorg/ui dist-tags\n```\n\n## Publishing Workflows\n\n### NPM Publishing\n\nPublish packages to NPM registry.\n\n**Configuration**:\n\n```json\n{\n \"name\": \"@myorg/ui\",\n \"version\": \"1.0.0\",\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\"\n ]\n}\n```\n\n**Publishing script**:\n\n```bash\n#!/bin/bash\n# scripts/publish.sh\n\n# Build all packages\npnpm turbo run build\n\n# Run tests\npnpm turbo run test\n\n# Version packages\npnpm changeset version\n\n# Publish\npnpm changeset publish\n\n# Push tags\ngit push --follow-tags\n```\n\n**NPM automation token**:\n\n```bash\n# Generate automation token on npmjs.com\n# Add to GitHub secrets as NPM_TOKEN\n\n# Use in CI\necho \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > .npmrc\npnpm publish --no-git-checks\n```\n\n### GitHub Packages\n\nPublish to GitHub Package Registry.\n\n**Configuration**:\n\n```json\n{\n \"name\": \"@myorg/ui\",\n \"publishConfig\": {\n \"registry\": \"https://npm.pkg.github.com/\"\n }\n}\n```\n\n**.npmrc for publishing**:\n\n```ini\n@myorg:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}\n```\n\n**GitHub Action**:\n\n```yaml\n- name: Publish to GitHub Packages\n run: pnpm changeset publish\n env:\n NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Canary Releases\n\nPublish test versions from PRs or branches.\n\n**Canary script**:\n\n```bash\n#!/bin/bash\n# scripts/canary-release.sh\n\n# Get short commit hash\nCOMMIT_HASH=$(git rev-parse --short HEAD)\n\n# Update versions with canary identifier\npnpm changeset version --snapshot canary-$COMMIT_HASH\n\n# Publish with canary tag\npnpm changeset publish --tag canary\n\necho \"Published canary release: canary-$COMMIT_HASH\"\n```\n\n**GitHub Action for canary**:\n\n```yaml\nname: Canary Release\nuser-invocable: false\n\non:\n pull_request:\n types: [labeled]\n\njobs:\n canary:\n if: contains(github.event.pull_request.labels.*.name, 'canary')\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - run: pnpm install --frozen-lockfile\n - run: pnpm turbo run build\n - run: bash scripts/canary-release.sh\n env:\n NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\n### Package Provenance\n\nEnable package provenance for supply chain security.\n\n**NPM provenance**:\n\n```yaml\n- name: Publish with provenance\n run: pnpm publish --provenance --access public\n env:\n NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\n**Package.json metadata**:\n\n```json\n{\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/myorg/monorepo.git\",\n \"directory\": \"packages/ui\"\n }\n}\n```\n\n### Registry Authentication\n\nManage authentication for multiple registries.\n\n**.npmrc configuration**:\n\n```ini\n# Public packages\n@myorg:registry=https://registry.npmjs.org/\n//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n\n# Private packages\n@private:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}\n\n# Corporate registry\n@corp:registry=https://npm.corp.example.com/\n//npm.corp.example.com/:_authToken=${CORP_TOKEN}\n```\n\n**Environment-specific auth**:\n\n```bash\n# Development\ncp .npmrc.dev .npmrc\n\n# CI\ncp .npmrc.ci .npmrc\n```\n\n## Code Sharing\n\n### Shared ESLint Configs\n\nMaintain consistent linting across packages.\n\n**Create config package**:\n\n```javascript\n// packages/eslint-config/index.js\nmodule.exports = {\n extends: [\n 'eslint:recommended',\n 'plugin:@typescript-eslint/recommended',\n 'plugin:react/recommended',\n 'plugin:react-hooks/recommended'\n ],\n rules: {\n 'no-console': 'warn',\n '@typescript-eslint/no-unused-vars': 'error',\n 'react/react-in-jsx-scope': 'off'\n },\n settings: {\n react: {\n version: 'detect'\n }\n }\n};\n```\n\n**Package.json**:\n\n```json\n{\n \"name\": \"@myorg/eslint-config\",\n \"version\": \"1.0.0\",\n \"main\": \"index.js\",\n \"peerDependencies\": {\n \"eslint\": \"^8.0.0\",\n \"typescript\": \"^5.0.0\"\n }\n}\n```\n\n**Usage in packages**:\n\n```json\n{\n \"extends\": \"@myorg/eslint-config\"\n}\n```\n\n### Shared TypeScript Configs\n\nShare TypeScript configuration across packages.\n\n**Base configuration**:\n\n```json\n// packages/tsconfig/base.json\n{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n \"jsx\": \"react-jsx\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"resolveJsonModule\": true,\n \"isolatedModules\": true,\n \"declaration\": true,\n \"declarationMap\": true,\n \"sourceMap\": true\n }\n}\n```\n\n**React configuration**:\n\n```json\n// packages/tsconfig/react.json\n{\n \"extends\": \"./base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"]\n }\n}\n```\n\n**Node configuration**:\n\n```json\n// packages/tsconfig/node.json\n{\n \"extends\": \"./base.json\",\n \"compilerOptions\": {\n \"module\": \"NodeNext\",\n \"moduleResolution\": \"NodeNext\",\n \"lib\": [\"ES2022\"]\n }\n}\n```\n\n**Package usage**:\n\n```json\n// apps/web/tsconfig.json\n{\n \"extends\": \"@myorg/tsconfig/react.json\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\"\n },\n \"include\": [\"src\"],\n \"exclude\": [\"node_modules\"]\n}\n```\n\n### Shared Testing Setup\n\nCommon test configuration and utilities.\n\n**Jest preset**:\n\n```javascript\n// packages/test-config/jest-preset.js\nmodule.exports = {\n preset: 'ts-jest',\n testEnvironment: 'jsdom',\n setupFilesAfterEnv: ['\u003crootDir>/jest.setup.ts'],\n moduleNameMapper: {\n '^@myorg/(.*)

Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…

: '\u003crootDir>/../../packages/$1/src',\n '\\\\.(css|less|scss|sass)

Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…

: 'identity-obj-proxy'\n },\n collectCoverageFrom: [\n 'src/**/*.{ts,tsx}',\n '!src/**/*.d.ts',\n '!src/**/*.stories.tsx',\n '!src/**/index.ts'\n ],\n coverageThresholds: {\n global: {\n branches: 80,\n functions: 80,\n lines: 80,\n statements: 80\n }\n }\n};\n```\n\n**Test utilities**:\n\n```typescript\n// packages/test-utils/src/index.ts\nimport { render, RenderOptions } from '@testing-library/react';\nimport { ReactElement } from 'react';\n\nexport function customRender(\n ui: ReactElement,\n options?: RenderOptions\n) {\n return render(ui, {\n wrapper: ({ children }) => children,\n ...options\n });\n}\n\nexport * from '@testing-library/react';\nexport { customRender as render };\n```\n\n**Package usage**:\n\n```json\n// packages/ui/jest.config.js\n{\n \"preset\": \"@myorg/test-config\"\n}\n```\n\n```typescript\n// packages/ui/src/Button.test.tsx\nimport { render, screen } from '@myorg/test-utils';\nimport { Button } from './Button';\n\ndescribe('Button', () => {\n it('renders correctly', () => {\n render(\u003cButton>Click me\u003c/Button>);\n expect(screen.getByText('Click me')).toBeInTheDocument();\n });\n});\n```\n\n### Shared Build Configs\n\nCommon build tool configurations.\n\n**Vite config**:\n\n```typescript\n// packages/build-config/vite.config.ts\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\nimport dts from 'vite-plugin-dts';\n\nexport function createConfig() {\n return defineConfig({\n plugins: [\n react(),\n dts({\n insertTypesEntry: true\n })\n ],\n build: {\n lib: {\n entry: 'src/index.ts',\n formats: ['es', 'cjs'],\n fileName: (format) => `index.${format}.js`\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM'\n }\n }\n }\n }\n });\n}\n```\n\n**Package usage**:\n\n```typescript\n// packages/ui/vite.config.ts\nimport { createConfig } from '@myorg/build-config';\n\nexport default createConfig();\n```\n\n### Package Templates\n\nStandardized templates for new packages.\n\n**Template structure**:\n\n```text\ntemplates/package/\n├── package.json.template\n├── tsconfig.json\n├── README.md.template\n├── src/\n│ └── index.ts\n└── __tests__/\n └── index.test.ts\n```\n\n**Generator script**:\n\n```typescript\n// scripts/create-package.ts\nimport fs from 'fs';\nimport path from 'path';\n\ninterface PackageOptions {\n name: string;\n type: 'library' | 'app';\n description: string;\n}\n\nfunction createPackage({ name, type, description }: PackageOptions) {\n const dir = path.join('packages', name);\n const template = path.join('templates', type);\n\n // Copy template\n fs.cpSync(template, dir, { recursive: true });\n\n // Update package.json\n const pkgPath = path.join(dir, 'package.json');\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));\n pkg.name = `@myorg/${name}`;\n pkg.description = description;\n fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));\n\n console.log(`Created package: @myorg/${name}`);\n}\n```\n\n## Migration Strategies\n\n### Polyrepo to Monorepo\n\nMigrate multiple repositories into monorepo.\n\n**Migration steps**:\n\n```bash\n#!/bin/bash\n# scripts/migrate-to-monorepo.sh\n\n# 1. Create monorepo structure\nmkdir my-monorepo\ncd my-monorepo\n\n# 2. Initialize git with clean history\ngit init\ngit commit --allow-empty -m \"Initial commit\"\n\n# 3. Add first repo preserving history\ngit remote add -f repo1 ../old-repo1\ngit merge repo1/main --allow-unrelated-histories\nmkdir -p packages/package1\ngit mv * packages/package1/\ngit commit -m \"Move repo1 to packages/package1\"\n\n# 4. Add second repo preserving history\ngit remote add -f repo2 ../old-repo2\ngit merge repo2/main --allow-unrelated-histories\nmkdir -p packages/package2\ngit mv * packages/package2/\ngit commit -m \"Move repo2 to packages/package2\"\n\n# 5. Set up workspace\ncat > package.json \u003c\u003c EOF\n{\n \"name\": \"my-monorepo\",\n \"private\": true,\n \"workspaces\": [\"packages/*\"]\n}\nEOF\n\ngit add package.json\ngit commit -m \"Add workspace configuration\"\n```\n\n### Monorepo Splitting\n\nExtract packages from monorepo to separate repos.\n\n**Split script**:\n\n```bash\n#!/bin/bash\n# scripts/split-package.sh\n\nPACKAGE=$1\nTARGET_REPO=$2\n\n# Filter git history for package\ngit filter-branch --prune-empty --subdirectory-filter packages/$PACKAGE -- --all\n\n# Push to new repo\ngit remote add origin $TARGET_REPO\ngit push -u origin main\n\n# Cleanup original monorepo\ncd ../monorepo\nrm -rf packages/$PACKAGE\ngit add .\ngit commit -m \"Remove $PACKAGE (moved to separate repo)\"\n```\n\n### Incremental Adoption\n\nGradually adopt monorepo practices.\n\n**Phase approach**:\n\n1. **Move packages**: Migrate repositories one at a time\n2. **Add tooling**: Implement Turborepo/Nx incrementally\n3. **Optimize builds**: Enable caching and affected analysis\n4. **Automate workflows**: Set up CI/CD and publishing\n\n**Gradual migration**:\n\n```json\n{\n \"workspaces\": [\n \"packages/migrated/*\",\n \"legacy/*\"\n ]\n}\n```\n\n### Tooling Migration\n\nSwitch between monorepo tools.\n\n**Lerna to Turborepo**:\n\n```bash\n# 1. Install Turborepo\npnpm add -DW turbo\n\n# 2. Create turbo.json\ncat > turbo.json \u003c\u003c EOF\n{\n \"pipeline\": {\n \"build\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [\"dist/**\"]\n }\n }\n}\nEOF\n\n# 3. Remove Lerna\npnpm remove -DW lerna\nrm lerna.json\n\n# 4. Update scripts\n# Replace \"lerna run build\" with \"turbo run build\"\n```\n\n**NPM to PNPM**:\n\n```bash\n# 1. Install PNPM\ncorepack enable pnpm\n\n# 2. Create workspace file\ncat > pnpm-workspace.yaml \u003c\u003c EOF\npackages:\n - 'packages/*'\n - 'apps/*'\nEOF\n\n# 3. Remove old files\nrm -rf node_modules package-lock.json\n\n# 4. Install with PNPM\npnpm install\n```\n\n## Git Workflows\n\n### Branch Strategies\n\nEffective branching for monorepo development.\n\n**Feature branches**:\n\n```bash\n# Create feature branch\ngit checkout -b feature/add-button-component\n\n# Work on specific package\ncd packages/ui\n# Make changes\n\n# Commit with conventional format\ngit commit -m \"feat(ui): add Button component\"\n\n# Push and create PR\ngit push -u origin feature/add-button-component\n```\n\n**Release branches**:\n\n```bash\n# Create release branch\ngit checkout -b release/v2.0.0\n\n# Version packages\npnpm changeset version\n\n# Commit and tag\ngit commit -m \"chore: version packages for v2.0.0\"\ngit tag v2.0.0\n\n# Merge to main\ngit checkout main\ngit merge release/v2.0.0\n```\n\n### Pull Request Structure\n\nOrganize PRs for efficient reviews.\n\n**PR template**:\n\n```markdown\n## Description\nBrief description of changes\n\n## Packages Changed\n- @myorg/ui\n- @myorg/web\n\n## Type of Change\n- [ ] Bug fix\n- [ ] New feature\n- [ ] Breaking change\n- [ ] Documentation\n\n## Checklist\n- [ ] Tests added/updated\n- [ ] Documentation updated\n- [ ] Changeset added\n- [ ] No breaking changes (or documented)\n- [ ] All CI checks passing\n```\n\n**CODEOWNERS**:\n\n```text\n# Global owners\n* @myorg/core-team\n\n# Package-specific owners\n/packages/ui/ @myorg/frontend-team\n/packages/api/ @myorg/backend-team\n/apps/web/ @myorg/web-team\n/apps/mobile/ @myorg/mobile-team\n```\n\n### Code Review Practices\n\nEffective code review in monorepo context.\n\n**Review checklist**:\n\n- [ ] Changes limited to necessary packages\n- [ ] No unnecessary dependency additions\n- [ ] Tests cover new/changed code\n- [ ] Documentation updated\n- [ ] Breaking changes documented\n- [ ] Changesets added\n- [ ] No circular dependencies introduced\n\n**Automated checks**:\n\n```yaml\n# .github/workflows/pr-checks.yml\n- name: Check for circular dependencies\n run: pnpm check:circular\n\n- name: Check for missing changesets\n run: pnpm changeset status\n\n- name: Verify package boundaries\n run: pnpm lint:boundaries\n```\n\n### Merge Strategies\n\nEffective merging for monorepo.\n\n**Squash and merge** (recommended):\n\n```bash\n# PR merged as single commit\ngit merge --squash feature/add-button\n\n# Commit with conventional format\ngit commit -m \"feat(ui): add Button component (#123)\"\n```\n\n**Rebase and merge**:\n\n```bash\n# Rebase feature branch\ngit rebase main\n\n# Fast-forward merge\ngit merge --ff-only feature/add-button\n```\n\n### Protected Packages\n\nRestrict changes to critical packages.\n\n**GitHub branch protection**:\n\n```yaml\n# .github/settings.yml\nbranches:\n - name: main\n protection:\n required_pull_request_reviews:\n required_approving_review_count: 2\n dismiss_stale_reviews: true\n required_status_checks:\n strict: true\n contexts:\n - build\n - test\n - lint\n```\n\n**Package-specific protection**:\n\n```text\n# CODEOWNERS\n/packages/core/ @myorg/core-maintainers\n/packages/security/ @myorg/security-team\n```\n\n## Documentation Practices\n\n### Package READMEs\n\nComprehensive documentation for each package.\n\n**README template**:\n\n```markdown\n# @myorg/ui\n\nReact component library for MyOrg applications.\n\n## Installation\n\npnpm add @myorg/ui\n\n## Usage\n\nimport { Button } from '@myorg/ui';\n\nfunction App() {\n return \u003cButton onClick={() => alert('Clicked!')}>Click me\u003c/Button>;\n}\n\n## Components\n\n- Button\n- Input\n- Modal\n\n## API Reference\n\nSee [API.md](./API.md) for detailed documentation.\n\n## Development\n\npnpm run dev\npnpm run build\npnpm run test\n\n## Contributing\n\nSee [CONTRIBUTING.md](../../CONTRIBUTING.md).\n\n## License\n\nMIT\n```\n\n### Architecture Decision Records\n\nDocument significant architectural decisions.\n\n**ADR template**:\n\n```markdown\n# ADR-001: Use Turborepo for Build Orchestration\n\n## Status\nAccepted\n\n## Context\nNeed efficient build system for monorepo with 20+ packages.\n\n## Decision\nUse Turborepo for task orchestration and caching.\n\n## Consequences\nPositive:\n- Fast builds with intelligent caching\n- Simple configuration\n- Remote cache support\n\nNegative:\n- Additional dependency\n- Learning curve for team\n\n## Alternatives Considered\n- Nx: More features but steeper learning curve\n- Lerna: Simpler but lacks caching\n\n## Date\n2024-01-15\n```\n\n### API Documentation\n\nGenerate and maintain API documentation.\n\n**TypeDoc configuration**:\n\n```json\n{\n \"entryPoints\": [\"packages/*/src/index.ts\"],\n \"out\": \"docs/api\",\n \"excludePrivate\": true,\n \"excludeProtected\": true,\n \"categorizeByGroup\": true,\n \"categoryOrder\": [\"Components\", \"Hooks\", \"Utilities\", \"*\"]\n}\n```\n\n**Generate docs**:\n\n```bash\npnpm typedoc --options typedoc.json\n```\n\n### Onboarding Guides\n\nHelp new developers get started.\n\n**ONBOARDING.md**:\n\n```markdown\n# Developer Onboarding\n\n## Prerequisites\n- Node.js 18+\n- PNPM 8+\n\n## Setup\n\n# Clone repository\ngit clone https://github.com/myorg/monorepo.git\n\n# Install dependencies\npnpm install\n\n# Build all packages\npnpm run build\n\n## Development\n\n# Start development servers\npnpm run dev\n\n# Run tests\npnpm run test\n\n## Project Structure\n\n/apps - Applications\n/packages - Shared packages\n/docs - Documentation\n\n## Common Tasks\n\nSee [COMMON_TASKS.md](./COMMON_TASKS.md).\n```\n\n### Runbooks\n\nOperational procedures and troubleshooting.\n\n**RUNBOOK.md**:\n\n```markdown\n# Operations Runbook\n\n## Build Failures\n\n### Symptom\nBuild fails with \"Cannot find module '@myorg/ui'\"\n\n### Solution\npnpm install\npnpm run build --filter=@myorg/ui...\n\n## Cache Issues\n\n### Symptom\nStale builds despite changes\n\n### Solution\nturbo run build --force\n\n## Version Conflicts\n\n### Symptom\nPeer dependency warnings\n\n### Solution\npnpm syncpack fix-mismatches\npnpm install\n```\n\n## Best Practices\n\n### 1. Use Changesets for Versioning\n\nAutomate version management with changesets.\n\n### 2. Implement Affected-Based CI\n\nOnly build and test changed packages in CI.\n\n### 3. Automate Package Publishing\n\nUse CI/CD for consistent, reliable publishing.\n\n### 4. Document Workflows Clearly\n\nMaintain comprehensive workflow documentation.\n\n### 5. Use Consistent Git Practices\n\nEnforce conventional commits and branch naming.\n\n### 6. Implement Code Owners\n\nAssign package ownership for better reviews.\n\n### 7. Set Up Pre-Commit Hooks\n\nCatch issues before they reach CI.\n\n### 8. Use Semantic Versioning\n\nFollow semver for all package versions.\n\n### 9. Test in CI Before Publish\n\nNever publish untested packages.\n\n### 10. Monitor Deployment Health\n\nTrack deployment success and rollback capability.\n\n## Common Pitfalls\n\n### 1. Manual Version Management\n\nLeads to errors and inconsistencies.\n\n### 2. Running Full CI for All Changes\n\nWastes time and resources.\n\n### 3. Inconsistent Publishing Process\n\nCauses confusion and potential errors.\n\n### 4. Poor Documentation\n\nMakes onboarding and collaboration difficult.\n\n### 5. Complex Git Workflows\n\nSlows development and causes confusion.\n\n### 6. No Deployment Automation\n\nManual deployments are error-prone.\n\n### 7. Breaking Changes Without Warning\n\nBreaks dependent packages and applications.\n\n### 8. Missing Changelogs\n\nUsers don't know what changed.\n\n### 9. Untested Packages Published\n\nBreaks production for consumers.\n\n### 10. No Rollback Strategy\n\nCan't recover from bad deployments.\n\n## When to Use This Skill\n\nApply monorepo workflow practices when:\n\n- **Setting up CI/CD** - Configuring automated builds and deployments\n- **Implementing versioning** - Establishing version management\n- **Optimizing workflows** - Improving development efficiency\n- **Managing releases** - Publishing and deploying packages\n- **Team collaboration** - Establishing team practices\n- **Automating processes** - Creating automated workflows\n- **Troubleshooting issues** - Solving workflow problems\n- **Onboarding developers** - Teaching monorepo workflows\n- **Migrating workflows** - Updating or changing processes\n- **Scaling operations** - Growing team and processes\n\n## Resources\n\n- [Changesets Documentation](https://github.com/changesets/changesets) -\n Version management and changelog generation\n- [Conventional Commits](https://www.conventionalcommits.org/) - Commit\n message specification\n- [Semantic Versioning](https://semver.org/) - Version numbering scheme\n- [GitHub Actions](https://docs.github.com/actions) - CI/CD automation\n- [Turborepo CI/CD](https://turbo.build/repo/docs/ci) - Turborepo in CI/CD\n environments\n- [Nx CI/CD](https://nx.dev/ci/intro/ci-with-nx) - Nx continuous\n integration patterns\n- [PNPM Publishing](https://pnpm.io/cli/publish) - Publishing with PNPM\n- [NPM Provenance](https://docs.npmjs.com/generating-provenance-statements)\n - Package supply chain security\n---","attachment_filenames":[],"attachments":[],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Monorepo Workflows Skill","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Overview","type":"text"}]},{"type":"paragraph","content":[{"text":"This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Development Workflows","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Local Development Setup","type":"text"}]},{"type":"paragraph","content":[{"text":"Configure efficient local development environment.","type":"text"}]},{"type":"paragraph","content":[{"text":"Package.json scripts","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"scripts\": {\n \"dev\": \"turbo run dev --parallel\",\n \"dev:web\": \"turbo run dev --filter=@myorg/web...\",\n \"build\": \"turbo run build\",\n \"test\": \"turbo run test\",\n \"lint\": \"turbo run lint\",\n \"clean\": \"turbo run clean && rm -rf node_modules\",\n \"reset\": \"pnpm clean && pnpm install\"\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Environment setup script","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/bin/bash\n# scripts/setup-dev.sh\n\necho \"Setting up development environment...\"\n\n# Check Node version\nrequired_node_version=\"18.0.0\"\ncurrent_node_version=$(node -v | cut -d'v' -f2)\n\nif [ \"$(printf '%s\\n' \"$required_node_version\" \\\n \"$current_node_version\" | sort -V | head -n1)\" != \\\n \"$required_node_version\" ]; then\n echo \"Error: Node.js $required_node_version or higher required\"\n exit 1\nfi\n\n# Enable pnpm\ncorepack enable pnpm\n\n# Install dependencies\npnpm install\n\n# Build all packages\npnpm run build\n\n# Setup git hooks\npnpm husky install\n\necho \"Development environment ready!\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Cross-Package Development","type":"text"}]},{"type":"paragraph","content":[{"text":"Work across multiple packages simultaneously.","type":"text"}]},{"type":"paragraph","content":[{"text":"Using workspace linking","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# All workspace packages automatically linked\npnpm install\n\n# Verify links\npnpm list --depth 1","type":"text"}]},{"type":"paragraph","content":[{"text":"Development with watch mode","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"scripts\": {\n \"dev:packages\": \"turbo run dev --filter='./packages/*'\",\n \"dev:apps\": \"turbo run dev --filter='./apps/*'\"\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Concurrent development","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"scripts\": {\n \"dev:all\": \"concurrently \\\"pnpm:dev:*\\\"\",\n \"dev:ui\": \"pnpm --filter @myorg/ui run dev\",\n \"dev:web\": \"pnpm --filter @myorg/web run dev\",\n \"dev:api\": \"pnpm --filter @myorg/api run dev\"\n },\n \"devDependencies\": {\n \"concurrently\": \"^8.2.2\"\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Hot Module Reloading","type":"text"}]},{"type":"paragraph","content":[{"text":"Enable fast refresh across package boundaries.","type":"text"}]},{"type":"paragraph","content":[{"text":"Vite configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// apps/web/vite.config.ts\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\n\nexport default defineConfig({\n plugins: [react()],\n server: {\n watch: {\n // Watch workspace packages\n ignored: ['!**/node_modules/@myorg/**']\n }\n },\n optimizeDeps: {\n // Force optimize workspace packages\n include: ['@myorg/ui', '@myorg/utils']\n }\n});","type":"text"}]},{"type":"paragraph","content":[{"text":"Next.js configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"// apps/web/next.config.js\nconst withTM = require('next-transpile-modules')([\n '@myorg/ui',\n '@myorg/utils'\n]);\n\nmodule.exports = withTM({\n reactStrictMode: true,\n experimental: {\n esmExternals: 'loose'\n }\n});","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Debugging Across Packages","type":"text"}]},{"type":"paragraph","content":[{"text":"Set up debugging for monorepo projects.","type":"text"}]},{"type":"paragraph","content":[{"text":"VS Code launch configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \"Debug Web App\",\n \"type\": \"node\",\n \"request\": \"launch\",\n \"runtimeExecutable\": \"pnpm\",\n \"runtimeArgs\": [\"--filter\", \"@myorg/web\", \"run\", \"dev\"],\n \"skipFiles\": [\"\u003cnode_internals>/**\"],\n \"console\": \"integratedTerminal\"\n },\n {\n \"name\": \"Debug API\",\n \"type\": \"node\",\n \"request\": \"launch\",\n \"program\": \"${workspaceFolder}/apps/api/src/index.ts\",\n \"preLaunchTask\": \"build-dependencies\",\n \"outFiles\": [\"${workspaceFolder}/apps/api/dist/**/*.js\"],\n \"sourceMaps\": true\n },\n {\n \"name\": \"Debug Tests\",\n \"type\": \"node\",\n \"request\": \"launch\",\n \"runtimeExecutable\": \"pnpm\",\n \"runtimeArgs\": [\"test\", \"--\", \"--inspect-brk\"],\n \"console\": \"integratedTerminal\",\n \"internalConsoleOptions\": \"neverOpen\"\n }\n ]\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Chrome DevTools debugging","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"scripts\": {\n \"debug:web\": \"NODE_OPTIONS='--inspect' pnpm --filter @myorg/web run dev\",\n \"debug:api\": \"NODE_OPTIONS='--inspect-brk' pnpm --filter @myorg/api run dev\"\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Testing Strategies","type":"text"}]},{"type":"paragraph","content":[{"text":"Comprehensive testing across monorepo packages.","type":"text"}]},{"type":"paragraph","content":[{"text":"Test organization","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"packages/ui/\n├── src/\n│ ├── components/\n│ │ ├── Button/\n│ │ │ ├── Button.tsx\n│ │ │ └── Button.test.tsx\n│ │ └── Input/\n│ │ ├── Input.tsx\n│ │ └── Input.test.tsx\n└── __tests__/\n └── integration/\n └── form.test.tsx","type":"text"}]},{"type":"paragraph","content":[{"text":"Shared test configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// packages/test-config/jest.config.js\nmodule.exports = {\n preset: 'ts-jest',\n testEnvironment: 'jsdom',\n setupFilesAfterEnv: ['\u003crootDir>/jest.setup.ts'],\n moduleNameMapper: {\n '^@myorg/(.*)

Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…

: '\u003crootDir>/../../packages/$1/src'\n },\n collectCoverageFrom: [\n 'src/**/*.{ts,tsx}',\n '!src/**/*.d.ts',\n '!src/**/*.stories.tsx'\n ]\n};","type":"text"}]},{"type":"paragraph","content":[{"text":"Package test scripts","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"scripts\": {\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\",\n \"test:ci\": \"jest --ci --coverage --maxWorkers=2\"\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Integration testing","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// __tests__/integration/package-interaction.test.ts\nimport { Button } from '@myorg/ui';\nimport { formatDate } from '@myorg/utils';\n\ndescribe('Package Integration', () => {\n it('uses utility in component', () => {\n const date = new Date('2024-01-01');\n const formatted = formatDate(date);\n expect(formatted).toBe('2024-01-01');\n });\n});","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"CI/CD Patterns","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Matrix Builds Per Package","type":"text"}]},{"type":"paragraph","content":[{"text":"Run builds in parallel across packages.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/ci.yml\nname: CI\nuser-invocable: false\n\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n setup:\n runs-on: ubuntu-latest\n outputs:\n packages: ${{ steps.packages.outputs.packages }}\n steps:\n - uses: actions/checkout@v4\n - name: Get changed packages\n id: packages\n run: |\n packages=$(pnpm -r list --json | jq -r '.[].name' | jq -R -s -c 'split(\"\\n\")[:-1]')\n echo \"packages=$packages\" >> $GITHUB_OUTPUT\n\n build:\n needs: setup\n runs-on: ubuntu-latest\n strategy:\n matrix:\n package: ${{ fromJson(needs.setup.outputs.packages) }}\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n - run: pnpm install --frozen-lockfile\n - run: pnpm --filter ${{ matrix.package }} run build\n - run: pnpm --filter ${{ matrix.package }} run test","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Affected-Only CI","type":"text"}]},{"type":"paragraph","content":[{"text":"Build and test only changed packages.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/ci.yml\nname: CI\nuser-invocable: false\n\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n affected:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n\n - name: Install dependencies\n run: pnpm install --frozen-lockfile\n\n - name: Build affected\n run: pnpm turbo run build --filter=[origin/main...HEAD]\n\n - name: Test affected\n run: pnpm turbo run test --filter=[origin/main...HEAD]\n\n - name: Lint affected\n run: pnpm turbo run lint --filter=[origin/main...HEAD]","type":"text"}]},{"type":"paragraph","content":[{"text":"With Nx affected","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"- name: Build affected\n run: npx nx affected --target=build --base=origin/main --head=HEAD\n\n- name: Test affected\n run: npx nx affected --target=test --base=origin/main --head=HEAD --parallel=3","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Distributed Task Execution","type":"text"}]},{"type":"paragraph","content":[{"text":"Spread tasks across multiple CI agents.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/ci.yml\nname: CI with Distribution\nuser-invocable: false\n\non: [pull_request, push]\n\njobs:\n setup:\n runs-on: ubuntu-latest\n outputs:\n tasks: ${{ steps.tasks.outputs.tasks }}\n steps:\n - uses: actions/checkout@v4\n - name: Generate task list\n id: tasks\n run: |\n tasks=$(pnpm turbo run build test --dry-run=json | jq -c '.tasks')\n echo \"tasks=$tasks\" >> $GITHUB_OUTPUT\n\n execute:\n needs: setup\n runs-on: ubuntu-latest\n strategy:\n matrix:\n task: ${{ fromJson(needs.setup.outputs.tasks) }}\n max-parallel: 10\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - run: pnpm install --frozen-lockfile\n - run: ${{ matrix.task.command }}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Parallel Pipeline Jobs","type":"text"}]},{"type":"paragraph","content":[{"text":"Execute independent jobs concurrently.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/ci.yml\nname: Parallel CI\nuser-invocable: false\n\non: [pull_request, push]\n\njobs:\n install:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n - run: pnpm install --frozen-lockfile\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n\n lint:\n needs: install\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n - run: pnpm turbo run lint\n\n test:\n needs: install\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n - run: pnpm turbo run test --coverage\n\n build:\n needs: install\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/cache@v3\n with:\n path: node_modules\n key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}\n - run: pnpm turbo run build","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Selective Deployments","type":"text"}]},{"type":"paragraph","content":[{"text":"Deploy only changed applications.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/deploy.yml\nname: Deploy\nuser-invocable: false\n\non:\n push:\n branches: [main]\n\njobs:\n deploy-web:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - name: Check if web changed\n id: changed\n run: |\n if git diff --name-only HEAD^ HEAD | grep -q \"^apps/web/\"; then\n echo \"changed=true\" >> $GITHUB_OUTPUT\n fi\n\n - name: Deploy web\n if: steps.changed.outputs.changed == 'true'\n run: |\n pnpm turbo run build --filter=@myorg/web\n # Deploy commands here\n\n deploy-api:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n\n - name: Check if API changed\n id: changed\n run: |\n if git diff --name-only HEAD^ HEAD | grep -q \"^apps/api/\"; then\n echo \"changed=true\" >> $GITHUB_OUTPUT\n fi\n\n - name: Deploy API\n if: steps.changed.outputs.changed == 'true'\n run: |\n pnpm turbo run build --filter=@myorg/api\n # Deploy commands here","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Version Management","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Changesets Workflow","type":"text"}]},{"type":"paragraph","content":[{"text":"Automated versioning and changelog generation.","type":"text"}]},{"type":"paragraph","content":[{"text":"Installation and setup","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm add -DW @changesets/cli\npnpm changeset init","type":"text"}]},{"type":"paragraph","content":[{"text":"Configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"changelog\": \"@changesets/cli/changelog\",\n \"commit\": false,\n \"fixed\": [],\n \"linked\": [],\n \"access\": \"restricted\",\n \"baseBranch\": \"main\",\n \"updateInternalDependencies\": \"patch\",\n \"ignore\": [\n \"@myorg/private-package\"\n ]\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Creating changesets","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Interactive changeset creation\npnpm changeset\n\n# Example changeset file generated:\n# .changeset/cool-feature.md","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"---\n\"@myorg/ui\": minor\n\"@myorg/web\": patch\n---\n\nAdd new Button variant and update documentation","type":"text"}]},{"type":"paragraph","content":[{"text":"Version bumping","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Consume changesets and update versions\npnpm changeset version\n\n# Updates package.json versions\n# Updates CHANGELOG.md files\n# Removes consumed changeset files","type":"text"}]},{"type":"paragraph","content":[{"text":"Publishing","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Build and publish changed packages\npnpm changeset publish\n\n# Push tags\ngit push --follow-tags","type":"text"}]},{"type":"paragraph","content":[{"text":"GitHub Action integration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/release.yml\nname: Release\nuser-invocable: false\n\non:\n push:\n branches: [main]\n\njobs:\n release:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - uses: actions/setup-node@v4\n with:\n node-version: 18\n cache: 'pnpm'\n\n - run: pnpm install --frozen-lockfile\n - run: pnpm turbo run build\n\n - name: Create Release Pull Request or Publish\n uses: changesets/action@v1\n with:\n publish: pnpm changeset publish\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n NPM_TOKEN: ${{ secrets.NPM_TOKEN }}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Conventional Commits","type":"text"}]},{"type":"paragraph","content":[{"text":"Standardized commit message format for automated versioning.","type":"text"}]},{"type":"paragraph","content":[{"text":"Commit message format","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"\u003ctype>(\u003cscope>): \u003csubject>\n\n\u003cbody>\n\n\u003cfooter>","type":"text"}]},{"type":"paragraph","content":[{"text":"Examples","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git commit -m \"feat(ui): add Button component variant\"\ngit commit -m \"fix(api): resolve authentication bug\"\ngit commit -m \"docs(readme): update installation instructions\"\ngit commit -m \"chore(deps): update dependencies\"","type":"text"}]},{"type":"paragraph","content":[{"text":"Commitlint configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"// commitlint.config.js\nmodule.exports = {\n extends: ['@commitlint/config-conventional'],\n rules: {\n 'scope-enum': [\n 2,\n 'always',\n ['ui', 'api', 'web', 'mobile', 'utils', 'config', 'ci']\n ],\n 'type-enum': [\n 2,\n 'always',\n [\n 'feat',\n 'fix',\n 'docs',\n 'style',\n 'refactor',\n 'perf',\n 'test',\n 'chore',\n 'revert'\n ]\n ]\n }\n};","type":"text"}]},{"type":"paragraph","content":[{"text":"Husky pre-commit hook","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\npnpm commitlint --edit $1","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Automated Changelogs","type":"text"}]},{"type":"paragraph","content":[{"text":"Generate changelogs from commit history.","type":"text"}]},{"type":"paragraph","content":[{"text":"Using conventional-changelog","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm add -DW conventional-changelog-cli","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"scripts\": {\n \"changelog\": \"conventional-changelog -p angular -i CHANGELOG.md -s\",\n \"version\": \"pnpm run changelog && git add CHANGELOG.md\"\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Using semantic-release","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"branches\": [\"main\"],\n \"plugins\": [\n \"@semantic-release/commit-analyzer\",\n \"@semantic-release/release-notes-generator\",\n \"@semantic-release/changelog\",\n \"@semantic-release/npm\",\n \"@semantic-release/github\",\n \"@semantic-release/git\"\n ]\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Version Bumping Strategies","type":"text"}]},{"type":"paragraph","content":[{"text":"Different approaches to version management.","type":"text"}]},{"type":"paragraph","content":[{"text":"Independent versioning","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"version\": \"independent\",\n \"packages\": [\n \"packages/*\"\n ]\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Each package has its own version:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"@myorg/[email protected]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"@myorg/[email protected]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"@myorg/[email protected]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"paragraph","content":[{"text":"Fixed versioning","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"version\": \"1.2.3\",\n \"packages\": [\n \"packages/*\"\n ]\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"All packages share same version:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"@myorg/[email protected]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"@myorg/[email protected]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"@myorg/[email protected]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Pre-Release Versions","type":"text"}]},{"type":"paragraph","content":[{"text":"Manage alpha, beta, and release candidate versions.","type":"text"}]},{"type":"paragraph","content":[{"text":"With changesets","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Enter pre-release mode\npnpm changeset pre enter next\n\n# Create changeset\npnpm changeset\n\n# Version packages (creates -next.0 versions)\npnpm changeset version\n\n# Publish pre-release\npnpm changeset publish --tag next\n\n# Exit pre-release mode\npnpm changeset pre exit","type":"text"}]},{"type":"paragraph","content":[{"text":"Result","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"@myorg/[email protected]\n@myorg/[email protected]\n@myorg/[email protected]","type":"text"}]},{"type":"paragraph","content":[{"text":"With NPM dist-tags","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Publish to specific tag\npnpm publish --tag beta\n\n# Install from tag\npnpm add @myorg/ui@beta\n\n# List tags\npnpm view @myorg/ui dist-tags","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Publishing Workflows","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"NPM Publishing","type":"text"}]},{"type":"paragraph","content":[{"text":"Publish packages to NPM registry.","type":"text"}]},{"type":"paragraph","content":[{"text":"Configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"name\": \"@myorg/ui\",\n \"version\": \"1.0.0\",\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\"\n ]\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Publishing script","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/bin/bash\n# scripts/publish.sh\n\n# Build all packages\npnpm turbo run build\n\n# Run tests\npnpm turbo run test\n\n# Version packages\npnpm changeset version\n\n# Publish\npnpm changeset publish\n\n# Push tags\ngit push --follow-tags","type":"text"}]},{"type":"paragraph","content":[{"text":"NPM automation token","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Generate automation token on npmjs.com\n# Add to GitHub secrets as NPM_TOKEN\n\n# Use in CI\necho \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > .npmrc\npnpm publish --no-git-checks","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"GitHub Packages","type":"text"}]},{"type":"paragraph","content":[{"text":"Publish to GitHub Package Registry.","type":"text"}]},{"type":"paragraph","content":[{"text":"Configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"name\": \"@myorg/ui\",\n \"publishConfig\": {\n \"registry\": \"https://npm.pkg.github.com/\"\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":".npmrc for publishing","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"ini"},"content":[{"text":"@myorg:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}","type":"text"}]},{"type":"paragraph","content":[{"text":"GitHub Action","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"- name: Publish to GitHub Packages\n run: pnpm changeset publish\n env:\n NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Canary Releases","type":"text"}]},{"type":"paragraph","content":[{"text":"Publish test versions from PRs or branches.","type":"text"}]},{"type":"paragraph","content":[{"text":"Canary script","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/bin/bash\n# scripts/canary-release.sh\n\n# Get short commit hash\nCOMMIT_HASH=$(git rev-parse --short HEAD)\n\n# Update versions with canary identifier\npnpm changeset version --snapshot canary-$COMMIT_HASH\n\n# Publish with canary tag\npnpm changeset publish --tag canary\n\necho \"Published canary release: canary-$COMMIT_HASH\"","type":"text"}]},{"type":"paragraph","content":[{"text":"GitHub Action for canary","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"name: Canary Release\nuser-invocable: false\n\non:\n pull_request:\n types: [labeled]\n\njobs:\n canary:\n if: contains(github.event.pull_request.labels.*.name, 'canary')\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: pnpm/action-setup@v2\n - run: pnpm install --frozen-lockfile\n - run: pnpm turbo run build\n - run: bash scripts/canary-release.sh\n env:\n NPM_TOKEN: ${{ secrets.NPM_TOKEN }}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Package Provenance","type":"text"}]},{"type":"paragraph","content":[{"text":"Enable package provenance for supply chain security.","type":"text"}]},{"type":"paragraph","content":[{"text":"NPM provenance","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"- name: Publish with provenance\n run: pnpm publish --provenance --access public\n env:\n NPM_TOKEN: ${{ secrets.NPM_TOKEN }}","type":"text"}]},{"type":"paragraph","content":[{"text":"Package.json metadata","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/myorg/monorepo.git\",\n \"directory\": \"packages/ui\"\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Registry Authentication","type":"text"}]},{"type":"paragraph","content":[{"text":"Manage authentication for multiple registries.","type":"text"}]},{"type":"paragraph","content":[{"text":".npmrc configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"ini"},"content":[{"text":"# Public packages\n@myorg:registry=https://registry.npmjs.org/\n//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n\n# Private packages\n@private:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}\n\n# Corporate registry\n@corp:registry=https://npm.corp.example.com/\n//npm.corp.example.com/:_authToken=${CORP_TOKEN}","type":"text"}]},{"type":"paragraph","content":[{"text":"Environment-specific auth","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Development\ncp .npmrc.dev .npmrc\n\n# CI\ncp .npmrc.ci .npmrc","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Code Sharing","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Shared ESLint Configs","type":"text"}]},{"type":"paragraph","content":[{"text":"Maintain consistent linting across packages.","type":"text"}]},{"type":"paragraph","content":[{"text":"Create config package","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"// packages/eslint-config/index.js\nmodule.exports = {\n extends: [\n 'eslint:recommended',\n 'plugin:@typescript-eslint/recommended',\n 'plugin:react/recommended',\n 'plugin:react-hooks/recommended'\n ],\n rules: {\n 'no-console': 'warn',\n '@typescript-eslint/no-unused-vars': 'error',\n 'react/react-in-jsx-scope': 'off'\n },\n settings: {\n react: {\n version: 'detect'\n }\n }\n};","type":"text"}]},{"type":"paragraph","content":[{"text":"Package.json","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"name\": \"@myorg/eslint-config\",\n \"version\": \"1.0.0\",\n \"main\": \"index.js\",\n \"peerDependencies\": {\n \"eslint\": \"^8.0.0\",\n \"typescript\": \"^5.0.0\"\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Usage in packages","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"extends\": \"@myorg/eslint-config\"\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Shared TypeScript Configs","type":"text"}]},{"type":"paragraph","content":[{"text":"Share TypeScript configuration across packages.","type":"text"}]},{"type":"paragraph","content":[{"text":"Base configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"// packages/tsconfig/base.json\n{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n \"jsx\": \"react-jsx\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"resolveJsonModule\": true,\n \"isolatedModules\": true,\n \"declaration\": true,\n \"declarationMap\": true,\n \"sourceMap\": true\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"React configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"// packages/tsconfig/react.json\n{\n \"extends\": \"./base.json\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"]\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Node configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"// packages/tsconfig/node.json\n{\n \"extends\": \"./base.json\",\n \"compilerOptions\": {\n \"module\": \"NodeNext\",\n \"moduleResolution\": \"NodeNext\",\n \"lib\": [\"ES2022\"]\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Package usage","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"// apps/web/tsconfig.json\n{\n \"extends\": \"@myorg/tsconfig/react.json\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\"\n },\n \"include\": [\"src\"],\n \"exclude\": [\"node_modules\"]\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Shared Testing Setup","type":"text"}]},{"type":"paragraph","content":[{"text":"Common test configuration and utilities.","type":"text"}]},{"type":"paragraph","content":[{"text":"Jest preset","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"// packages/test-config/jest-preset.js\nmodule.exports = {\n preset: 'ts-jest',\n testEnvironment: 'jsdom',\n setupFilesAfterEnv: ['\u003crootDir>/jest.setup.ts'],\n moduleNameMapper: {\n '^@myorg/(.*)

Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…

: '\u003crootDir>/../../packages/$1/src',\n '\\\\.(css|less|scss|sass)

Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…

: 'identity-obj-proxy'\n },\n collectCoverageFrom: [\n 'src/**/*.{ts,tsx}',\n '!src/**/*.d.ts',\n '!src/**/*.stories.tsx',\n '!src/**/index.ts'\n ],\n coverageThresholds: {\n global: {\n branches: 80,\n functions: 80,\n lines: 80,\n statements: 80\n }\n }\n};","type":"text"}]},{"type":"paragraph","content":[{"text":"Test utilities","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// packages/test-utils/src/index.ts\nimport { render, RenderOptions } from '@testing-library/react';\nimport { ReactElement } from 'react';\n\nexport function customRender(\n ui: ReactElement,\n options?: RenderOptions\n) {\n return render(ui, {\n wrapper: ({ children }) => children,\n ...options\n });\n}\n\nexport * from '@testing-library/react';\nexport { customRender as render };","type":"text"}]},{"type":"paragraph","content":[{"text":"Package usage","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"// packages/ui/jest.config.js\n{\n \"preset\": \"@myorg/test-config\"\n}","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// packages/ui/src/Button.test.tsx\nimport { render, screen } from '@myorg/test-utils';\nimport { Button } from './Button';\n\ndescribe('Button', () => {\n it('renders correctly', () => {\n render(\u003cButton>Click me\u003c/Button>);\n expect(screen.getByText('Click me')).toBeInTheDocument();\n });\n});","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Shared Build Configs","type":"text"}]},{"type":"paragraph","content":[{"text":"Common build tool configurations.","type":"text"}]},{"type":"paragraph","content":[{"text":"Vite config","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// packages/build-config/vite.config.ts\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\nimport dts from 'vite-plugin-dts';\n\nexport function createConfig() {\n return defineConfig({\n plugins: [\n react(),\n dts({\n insertTypesEntry: true\n })\n ],\n build: {\n lib: {\n entry: 'src/index.ts',\n formats: ['es', 'cjs'],\n fileName: (format) => `index.${format}.js`\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM'\n }\n }\n }\n }\n });\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Package usage","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// packages/ui/vite.config.ts\nimport { createConfig } from '@myorg/build-config';\n\nexport default createConfig();","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Package Templates","type":"text"}]},{"type":"paragraph","content":[{"text":"Standardized templates for new packages.","type":"text"}]},{"type":"paragraph","content":[{"text":"Template structure","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"templates/package/\n├── package.json.template\n├── tsconfig.json\n├── README.md.template\n├── src/\n│ └── index.ts\n└── __tests__/\n └── index.test.ts","type":"text"}]},{"type":"paragraph","content":[{"text":"Generator script","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// scripts/create-package.ts\nimport fs from 'fs';\nimport path from 'path';\n\ninterface PackageOptions {\n name: string;\n type: 'library' | 'app';\n description: string;\n}\n\nfunction createPackage({ name, type, description }: PackageOptions) {\n const dir = path.join('packages', name);\n const template = path.join('templates', type);\n\n // Copy template\n fs.cpSync(template, dir, { recursive: true });\n\n // Update package.json\n const pkgPath = path.join(dir, 'package.json');\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));\n pkg.name = `@myorg/${name}`;\n pkg.description = description;\n fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));\n\n console.log(`Created package: @myorg/${name}`);\n}","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Migration Strategies","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Polyrepo to Monorepo","type":"text"}]},{"type":"paragraph","content":[{"text":"Migrate multiple repositories into monorepo.","type":"text"}]},{"type":"paragraph","content":[{"text":"Migration steps","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/bin/bash\n# scripts/migrate-to-monorepo.sh\n\n# 1. Create monorepo structure\nmkdir my-monorepo\ncd my-monorepo\n\n# 2. Initialize git with clean history\ngit init\ngit commit --allow-empty -m \"Initial commit\"\n\n# 3. Add first repo preserving history\ngit remote add -f repo1 ../old-repo1\ngit merge repo1/main --allow-unrelated-histories\nmkdir -p packages/package1\ngit mv * packages/package1/\ngit commit -m \"Move repo1 to packages/package1\"\n\n# 4. Add second repo preserving history\ngit remote add -f repo2 ../old-repo2\ngit merge repo2/main --allow-unrelated-histories\nmkdir -p packages/package2\ngit mv * packages/package2/\ngit commit -m \"Move repo2 to packages/package2\"\n\n# 5. Set up workspace\ncat > package.json \u003c\u003c EOF\n{\n \"name\": \"my-monorepo\",\n \"private\": true,\n \"workspaces\": [\"packages/*\"]\n}\nEOF\n\ngit add package.json\ngit commit -m \"Add workspace configuration\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Monorepo Splitting","type":"text"}]},{"type":"paragraph","content":[{"text":"Extract packages from monorepo to separate repos.","type":"text"}]},{"type":"paragraph","content":[{"text":"Split script","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/bin/bash\n# scripts/split-package.sh\n\nPACKAGE=$1\nTARGET_REPO=$2\n\n# Filter git history for package\ngit filter-branch --prune-empty --subdirectory-filter packages/$PACKAGE -- --all\n\n# Push to new repo\ngit remote add origin $TARGET_REPO\ngit push -u origin main\n\n# Cleanup original monorepo\ncd ../monorepo\nrm -rf packages/$PACKAGE\ngit add .\ngit commit -m \"Remove $PACKAGE (moved to separate repo)\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Incremental Adoption","type":"text"}]},{"type":"paragraph","content":[{"text":"Gradually adopt monorepo practices.","type":"text"}]},{"type":"paragraph","content":[{"text":"Phase approach","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Move packages","type":"text","marks":[{"type":"strong"}]},{"text":": Migrate repositories one at a time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Add tooling","type":"text","marks":[{"type":"strong"}]},{"text":": Implement Turborepo/Nx incrementally","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Optimize builds","type":"text","marks":[{"type":"strong"}]},{"text":": Enable caching and affected analysis","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Automate workflows","type":"text","marks":[{"type":"strong"}]},{"text":": Set up CI/CD and publishing","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Gradual migration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"workspaces\": [\n \"packages/migrated/*\",\n \"legacy/*\"\n ]\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Tooling Migration","type":"text"}]},{"type":"paragraph","content":[{"text":"Switch between monorepo tools.","type":"text"}]},{"type":"paragraph","content":[{"text":"Lerna to Turborepo","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 1. Install Turborepo\npnpm add -DW turbo\n\n# 2. Create turbo.json\ncat > turbo.json \u003c\u003c EOF\n{\n \"pipeline\": {\n \"build\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [\"dist/**\"]\n }\n }\n}\nEOF\n\n# 3. Remove Lerna\npnpm remove -DW lerna\nrm lerna.json\n\n# 4. Update scripts\n# Replace \"lerna run build\" with \"turbo run build\"","type":"text"}]},{"type":"paragraph","content":[{"text":"NPM to PNPM","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 1. Install PNPM\ncorepack enable pnpm\n\n# 2. Create workspace file\ncat > pnpm-workspace.yaml \u003c\u003c EOF\npackages:\n - 'packages/*'\n - 'apps/*'\nEOF\n\n# 3. Remove old files\nrm -rf node_modules package-lock.json\n\n# 4. Install with PNPM\npnpm install","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Git Workflows","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Branch Strategies","type":"text"}]},{"type":"paragraph","content":[{"text":"Effective branching for monorepo development.","type":"text"}]},{"type":"paragraph","content":[{"text":"Feature branches","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Create feature branch\ngit checkout -b feature/add-button-component\n\n# Work on specific package\ncd packages/ui\n# Make changes\n\n# Commit with conventional format\ngit commit -m \"feat(ui): add Button component\"\n\n# Push and create PR\ngit push -u origin feature/add-button-component","type":"text"}]},{"type":"paragraph","content":[{"text":"Release branches","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Create release branch\ngit checkout -b release/v2.0.0\n\n# Version packages\npnpm changeset version\n\n# Commit and tag\ngit commit -m \"chore: version packages for v2.0.0\"\ngit tag v2.0.0\n\n# Merge to main\ngit checkout main\ngit merge release/v2.0.0","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Pull Request Structure","type":"text"}]},{"type":"paragraph","content":[{"text":"Organize PRs for efficient reviews.","type":"text"}]},{"type":"paragraph","content":[{"text":"PR template","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"## Description\nBrief description of changes\n\n## Packages Changed\n- @myorg/ui\n- @myorg/web\n\n## Type of Change\n- [ ] Bug fix\n- [ ] New feature\n- [ ] Breaking change\n- [ ] Documentation\n\n## Checklist\n- [ ] Tests added/updated\n- [ ] Documentation updated\n- [ ] Changeset added\n- [ ] No breaking changes (or documented)\n- [ ] All CI checks passing","type":"text"}]},{"type":"paragraph","content":[{"text":"CODEOWNERS","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"# Global owners\n* @myorg/core-team\n\n# Package-specific owners\n/packages/ui/ @myorg/frontend-team\n/packages/api/ @myorg/backend-team\n/apps/web/ @myorg/web-team\n/apps/mobile/ @myorg/mobile-team","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Code Review Practices","type":"text"}]},{"type":"paragraph","content":[{"text":"Effective code review in monorepo context.","type":"text"}]},{"type":"paragraph","content":[{"text":"Review checklist","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"checkbox_list","attrs":{"id":null},"content":[{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Changes limited to necessary packages","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"No unnecessary dependency additions","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Tests cover new/changed code","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Documentation updated","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Breaking changes documented","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Changesets added","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"No circular dependencies introduced","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Automated checks","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/pr-checks.yml\n- name: Check for circular dependencies\n run: pnpm check:circular\n\n- name: Check for missing changesets\n run: pnpm changeset status\n\n- name: Verify package boundaries\n run: pnpm lint:boundaries","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Merge Strategies","type":"text"}]},{"type":"paragraph","content":[{"text":"Effective merging for monorepo.","type":"text"}]},{"type":"paragraph","content":[{"text":"Squash and merge","type":"text","marks":[{"type":"strong"}]},{"text":" (recommended):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# PR merged as single commit\ngit merge --squash feature/add-button\n\n# Commit with conventional format\ngit commit -m \"feat(ui): add Button component (#123)\"","type":"text"}]},{"type":"paragraph","content":[{"text":"Rebase and merge","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Rebase feature branch\ngit rebase main\n\n# Fast-forward merge\ngit merge --ff-only feature/add-button","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Protected Packages","type":"text"}]},{"type":"paragraph","content":[{"text":"Restrict changes to critical packages.","type":"text"}]},{"type":"paragraph","content":[{"text":"GitHub branch protection","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/settings.yml\nbranches:\n - name: main\n protection:\n required_pull_request_reviews:\n required_approving_review_count: 2\n dismiss_stale_reviews: true\n required_status_checks:\n strict: true\n contexts:\n - build\n - test\n - lint","type":"text"}]},{"type":"paragraph","content":[{"text":"Package-specific protection","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"# CODEOWNERS\n/packages/core/ @myorg/core-maintainers\n/packages/security/ @myorg/security-team","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Documentation Practices","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Package READMEs","type":"text"}]},{"type":"paragraph","content":[{"text":"Comprehensive documentation for each package.","type":"text"}]},{"type":"paragraph","content":[{"text":"README template","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"# @myorg/ui\n\nReact component library for MyOrg applications.\n\n## Installation\n\npnpm add @myorg/ui\n\n## Usage\n\nimport { Button } from '@myorg/ui';\n\nfunction App() {\n return \u003cButton onClick={() => alert('Clicked!')}>Click me\u003c/Button>;\n}\n\n## Components\n\n- Button\n- Input\n- Modal\n\n## API Reference\n\nSee [API.md](./API.md) for detailed documentation.\n\n## Development\n\npnpm run dev\npnpm run build\npnpm run test\n\n## Contributing\n\nSee [CONTRIBUTING.md](../../CONTRIBUTING.md).\n\n## License\n\nMIT","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Architecture Decision Records","type":"text"}]},{"type":"paragraph","content":[{"text":"Document significant architectural decisions.","type":"text"}]},{"type":"paragraph","content":[{"text":"ADR template","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"# ADR-001: Use Turborepo for Build Orchestration\n\n## Status\nAccepted\n\n## Context\nNeed efficient build system for monorepo with 20+ packages.\n\n## Decision\nUse Turborepo for task orchestration and caching.\n\n## Consequences\nPositive:\n- Fast builds with intelligent caching\n- Simple configuration\n- Remote cache support\n\nNegative:\n- Additional dependency\n- Learning curve for team\n\n## Alternatives Considered\n- Nx: More features but steeper learning curve\n- Lerna: Simpler but lacks caching\n\n## Date\n2024-01-15","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"API Documentation","type":"text"}]},{"type":"paragraph","content":[{"text":"Generate and maintain API documentation.","type":"text"}]},{"type":"paragraph","content":[{"text":"TypeDoc configuration","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"entryPoints\": [\"packages/*/src/index.ts\"],\n \"out\": \"docs/api\",\n \"excludePrivate\": true,\n \"excludeProtected\": true,\n \"categorizeByGroup\": true,\n \"categoryOrder\": [\"Components\", \"Hooks\", \"Utilities\", \"*\"]\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Generate docs","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm typedoc --options typedoc.json","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Onboarding Guides","type":"text"}]},{"type":"paragraph","content":[{"text":"Help new developers get started.","type":"text"}]},{"type":"paragraph","content":[{"text":"ONBOARDING.md","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"# Developer Onboarding\n\n## Prerequisites\n- Node.js 18+\n- PNPM 8+\n\n## Setup\n\n# Clone repository\ngit clone https://github.com/myorg/monorepo.git\n\n# Install dependencies\npnpm install\n\n# Build all packages\npnpm run build\n\n## Development\n\n# Start development servers\npnpm run dev\n\n# Run tests\npnpm run test\n\n## Project Structure\n\n/apps - Applications\n/packages - Shared packages\n/docs - Documentation\n\n## Common Tasks\n\nSee [COMMON_TASKS.md](./COMMON_TASKS.md).","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Runbooks","type":"text"}]},{"type":"paragraph","content":[{"text":"Operational procedures and troubleshooting.","type":"text"}]},{"type":"paragraph","content":[{"text":"RUNBOOK.md","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"# Operations Runbook\n\n## Build Failures\n\n### Symptom\nBuild fails with \"Cannot find module '@myorg/ui'\"\n\n### Solution\npnpm install\npnpm run build --filter=@myorg/ui...\n\n## Cache Issues\n\n### Symptom\nStale builds despite changes\n\n### Solution\nturbo run build --force\n\n## Version Conflicts\n\n### Symptom\nPeer dependency warnings\n\n### Solution\npnpm syncpack fix-mismatches\npnpm install","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"1. Use Changesets for Versioning","type":"text"}]},{"type":"paragraph","content":[{"text":"Automate version management with changesets.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"2. Implement Affected-Based CI","type":"text"}]},{"type":"paragraph","content":[{"text":"Only build and test changed packages in CI.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"3. Automate Package Publishing","type":"text"}]},{"type":"paragraph","content":[{"text":"Use CI/CD for consistent, reliable publishing.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"4. Document Workflows Clearly","type":"text"}]},{"type":"paragraph","content":[{"text":"Maintain comprehensive workflow documentation.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"5. Use Consistent Git Practices","type":"text"}]},{"type":"paragraph","content":[{"text":"Enforce conventional commits and branch naming.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"6. Implement Code Owners","type":"text"}]},{"type":"paragraph","content":[{"text":"Assign package ownership for better reviews.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"7. Set Up Pre-Commit Hooks","type":"text"}]},{"type":"paragraph","content":[{"text":"Catch issues before they reach CI.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"8. Use Semantic Versioning","type":"text"}]},{"type":"paragraph","content":[{"text":"Follow semver for all package versions.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"9. Test in CI Before Publish","type":"text"}]},{"type":"paragraph","content":[{"text":"Never publish untested packages.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"10. Monitor Deployment Health","type":"text"}]},{"type":"paragraph","content":[{"text":"Track deployment success and rollback capability.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Common Pitfalls","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"1. Manual Version Management","type":"text"}]},{"type":"paragraph","content":[{"text":"Leads to errors and inconsistencies.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"2. Running Full CI for All Changes","type":"text"}]},{"type":"paragraph","content":[{"text":"Wastes time and resources.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"3. Inconsistent Publishing Process","type":"text"}]},{"type":"paragraph","content":[{"text":"Causes confusion and potential errors.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"4. Poor Documentation","type":"text"}]},{"type":"paragraph","content":[{"text":"Makes onboarding and collaboration difficult.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"5. Complex Git Workflows","type":"text"}]},{"type":"paragraph","content":[{"text":"Slows development and causes confusion.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"6. No Deployment Automation","type":"text"}]},{"type":"paragraph","content":[{"text":"Manual deployments are error-prone.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"7. Breaking Changes Without Warning","type":"text"}]},{"type":"paragraph","content":[{"text":"Breaks dependent packages and applications.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"8. Missing Changelogs","type":"text"}]},{"type":"paragraph","content":[{"text":"Users don't know what changed.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"9. Untested Packages Published","type":"text"}]},{"type":"paragraph","content":[{"text":"Breaks production for consumers.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"10. No Rollback Strategy","type":"text"}]},{"type":"paragraph","content":[{"text":"Can't recover from bad deployments.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use This Skill","type":"text"}]},{"type":"paragraph","content":[{"text":"Apply monorepo workflow practices when:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Setting up CI/CD","type":"text","marks":[{"type":"strong"}]},{"text":" - Configuring automated builds and deployments","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implementing versioning","type":"text","marks":[{"type":"strong"}]},{"text":" - Establishing version management","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Optimizing workflows","type":"text","marks":[{"type":"strong"}]},{"text":" - Improving development efficiency","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Managing releases","type":"text","marks":[{"type":"strong"}]},{"text":" - Publishing and deploying packages","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Team collaboration","type":"text","marks":[{"type":"strong"}]},{"text":" - Establishing team practices","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Automating processes","type":"text","marks":[{"type":"strong"}]},{"text":" - Creating automated workflows","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Troubleshooting issues","type":"text","marks":[{"type":"strong"}]},{"text":" - Solving workflow problems","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Onboarding developers","type":"text","marks":[{"type":"strong"}]},{"text":" - Teaching monorepo workflows","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Migrating workflows","type":"text","marks":[{"type":"strong"}]},{"text":" - Updating or changing processes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scaling operations","type":"text","marks":[{"type":"strong"}]},{"text":" - Growing team and processes","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Resources","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Changesets Documentation","type":"text","marks":[{"type":"link","attrs":{"href":"https://github.com/changesets/changesets","title":null}}]},{"text":" - Version management and changelog generation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Conventional Commits","type":"text","marks":[{"type":"link","attrs":{"href":"https://www.conventionalcommits.org/","title":null}}]},{"text":" - Commit message specification","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Semantic Versioning","type":"text","marks":[{"type":"link","attrs":{"href":"https://semver.org/","title":null}}]},{"text":" - Version numbering scheme","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"GitHub Actions","type":"text","marks":[{"type":"link","attrs":{"href":"https://docs.github.com/actions","title":null}}]},{"text":" - CI/CD automation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Turborepo CI/CD","type":"text","marks":[{"type":"link","attrs":{"href":"https://turbo.build/repo/docs/ci","title":null}}]},{"text":" - Turborepo in CI/CD environments","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Nx CI/CD","type":"text","marks":[{"type":"link","attrs":{"href":"https://nx.dev/ci/intro/ci-with-nx","title":null}}]},{"text":" - Nx continuous integration patterns","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"PNPM Publishing","type":"text","marks":[{"type":"link","attrs":{"href":"https://pnpm.io/cli/publish","title":null}}]},{"text":" - Publishing with PNPM","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"NPM Provenance","type":"text","marks":[{"type":"link","attrs":{"href":"https://docs.npmjs.com/generating-provenance-statements","title":null}}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Package supply chain security","type":"text"}]}]}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"monorepo-workflows","author":"@skillopedia","source":{"stars":163,"repo_name":"han","origin_url":"https://github.com/thebushidocollective/han/blob/HEAD/plugins/patterns/monorepo/skills/monorepo-workflows/SKILL.md","repo_owner":"thebushidocollective","body_sha256":"3f4845b064322588200a41dc8128d71c65a60aca2cb11587b684b7bd243b658f","cluster_key":"036d66c2d819c6233add3809efd409f2c2a51232e9bec8cc3ca188c8e6f56c54","clean_bundle":{"format":"clean-skill-bundle-v1","source":"thebushidocollective/han/plugins/patterns/monorepo/skills/monorepo-workflows/SKILL.md","bundle_sha256":"b6550771bb0183ac6dbd1cb1ab5462ae747583f72e34d114d52641aa331ae172","attachment_count":0,"text_attachments":0,"binary_attachments":0},"cluster_size":1,"skill_md_path":"plugins/patterns/monorepo/skills/monorepo-workflows/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"devops-infrastructure","category_label":"DevOps"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"devops-infrastructure","import_tag":"clean-skills-v1","description":"Use when setting up CI/CD, implementing versioning, optimizing workflows, or managing releases with monorepo development workflows including version management, publishing, and team collaboration practices.","allowed-tools":["Read","Write","Edit","Bash","Glob","Grep"],"user-invocable":false}},"renderedAt":1782987548860}

Monorepo Workflows Skill Overview This skill provides comprehensive guidance on development workflows, CI/CD patterns, version management, publishing strategies, and collaboration practices for monorepo environments. Development Workflows Local Development Setup Configure efficient local development environment. Package.json scripts : Environment setup script : Cross-Package Development Work across multiple packages simultaneously. Using workspace linking : Development with watch mode : Concurrent development : Hot Module Reloading Enable fast refresh across package boundaries. Vite configura…