affected
Analyze which monorepo packages and apps are affected by current changes
SKILL.mdpacks/monorepo/claude/affected/SKILL.md
GitHubAffected
Determine which packages and apps in the monorepo are affected by current changes. Useful before committing, testing, or deploying to know the blast radius.
Process
Determine the change set:
- If
$ARGUMENTSspecifies a commit range or branch, usegit difffor that range. - Otherwise, use
git diff HEAD(staged + unstaged changes). - If no changes exist, check for unpushed commits with
git log @{u}..HEAD.
- If
Read the monorepo structure:
- Check for
turbo.json,pnpm-workspace.yaml,lerna.json, orpackage.jsonworkspaces to understand the package graph. - List all packages/apps and their locations.
- Check for
Map changes to packages:
- For each changed file, determine which package it belongs to.
- List directly changed packages.
Compute transitive dependents:
- Read
package.jsonof each directly changed package to find itsname. - Search other packages'
package.jsonfiles for dependencies on the changed packages. - Build the full dependency chain (direct → transitive).
- Read
Check for cross-cutting changes:
- Root config changes (
tsconfig.json,turbo.json,.env*,tailwind.config.*) affect all packages. - Shared package changes (e.g.,
packages/ui,packages/config) cascade to consumers.
- Root config changes (
Identify what to test:
- If Turborepo: suggest
turbo run test --filter=...[HEAD~1]or equivalent. - Otherwise: list the test commands for each affected package.
- If Turborepo: suggest
Output
Directly Changed
packages/foo— 3 files changed (briefly what)apps/bar— 1 file changed (briefly what)
Transitively Affected
apps/web— depends onpackages/fooapps/admin— depends onpackages/fooviapackages/shared
Cross-Cutting
tsconfig.base.jsonchanged — affects all TypeScript packages
Recommended Test Commands
# commands to test affected packages
Constraints
- Do not run tests — only analyze and recommend.
- If the monorepo tool is Turborepo, prefer Turbo-native filtering where possible.
- Keep the output concise — list packages, not individual files (unless scoped to a single package).
Default Shipping Contract
Follow the shared shipping contract convention in CLAUDE.md.