preen-knip
Preen Knip
Proactively reduce knip findings by removing unused dependencies, exports, and files in coherent, low-risk slices.
When to Run
Run this skill when maintaining code quality or during slack time, especially when the codebase has accumulated knip noise.
Discovery Phase
Capture a baseline of current findings:
pnpm exec knip --config knip.json --use-tsconfig-files --reporter compact || true
For machine-readable scoring/counting:
KNIP_JSON=$(mktemp)
pnpm exec knip --config knip.json --use-tsconfig-files --reporter json > "$KNIP_JSON" 2>/dev/null || true
jq '[
.issues[]? |
(.dependencies // []),
(.devDependencies // []),
(.unlisted // []),
(.unresolved // []),
(.exports // []),
(.types // [])
] | flatten | length' "$KNIP_JSON"
rm -f "$KNIP_JSON"
Slice Selection
Choose one coherent slice per run. Prefer macro slices over micro edits:
-
One package/domain group at a time (for example
packages/ui+packages/app-wallet) -
Low behavior risk changes first:
- remove clearly unused exports or dead files
- remove clearly unused dependencies after usage verification
-
Avoid mixed concerns (do not combine unrelated refactors)
Change Rules
- Verify each candidate before deleting/removing (search for usage with
rg) - Preserve public API ergonomics when needed (for example exported props/types for public components)
- Do not add
any, unsafe casts, or@ts-ignore - Keep changes behavior-preserving and test-backed
Validation
Run at least impacted checks for touched packages:
pnpm exec tsx scripts/ciImpact/runImpactedQuality.ts >/dev/null
pnpm exec tsx scripts/ciImpact/runImpactedTests.ts >/dev/null
If a package has direct build/test scripts, run those too for faster local confidence.
Re-measure knip findings after edits using the same baseline command.
Quality Gate
Only proceed when measured knip findings decrease for the selected slice:
# baseline_count captured before edits
# after_count captured after edits
[ "$after_count" -lt "$baseline_count" ]
Deliverable
- One focused PR per slice
- Clear summary of removed findings
- Enter merge queue and monitor to merge before starting the next slice
More from a2f0/tearleads
commit-and-push
Commit staged changes and push to the remote using conventional commits with GPG signing. Use when you need to commit and push work, create a PR if missing, and wait for Gemini review before addressing feedback.
33rebase
Rebase the current branch onto the latest main branch, resolving conflicts by preferring upstream changes.
2preen
Stateful preening across all preen skills. Lands focused improvements, opens a PR, and enters merge queue.
1issue-slice-autopilot
Run a long-lived, multi-PR issue completion loop for complex issues by selecting the largest non-overlapping sane slice, implementing it, and then invoking $commit-and-push followed by $enter-merge-queue for each slice until the issue is complete.
1infra-bootstrap
Run staged Terraform and Ansible bootstrap flows for staging/prod clusters and VPN with retries and clear failure output.
1preen-window-consistency
Proactively search for opportunities to normalize window components, standardize refresh patterns, and consolidate shared logic into `packages/window-manager`. Use when maintaining window components or during slack time.
1