fix-bun
npx skills add https://github.com/phrazzld/claude-config --skill fix-bun
Agent 安装分布
Skill 文档
/fix-bun
Fix one Bun migration issue at a time. Verify after each change.
What This Does
- Run
/check-bunto get current findings - Pick highest priority unfixed issue
- Apply fix
- Verify fix worked
- Report what was fixed
This is a fixer. It fixes ONE issue per invocation. Run multiple times for multiple issues.
Priority Order
Fix issues in this order:
- P1: Lockfile cleanup â Remove conflicting lockfiles
- P1: CI migration â Update GitHub Actions to use Bun
- P1: Workspace migration â Move workspaces to package.json
- P2: Script updates â Convert scripts to use bun run
- P2: Test runner â Enable Bun test runner
- P3: Optimizations â Native SQLite, Bun shell scripts
Fix Procedures
Fix: Remove Conflicting Lockfiles
When: Both pnpm-lock.yaml and bun.lock exist
# Choose one lockfile (keep the target one)
rm pnpm-lock.yaml # If migrating to Bun
# OR
rm bun.lock bun.lockb # If staying with pnpm
# Regenerate
bun install # OR pnpm install
Verify:
ls *.lock* | wc -l # Should be 1
Fix: Update CI to Bun
When: GitHub Actions using pnpm/action-setup
File: .github/workflows/ci.yml (or similar)
Change:
# From:
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
# To:
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
Verify:
grep -l "oven-sh/setup-bun" .github/workflows/*.yml
Fix: Migrate Workspace Configuration
When: pnpm-workspace.yaml exists but migrating to Bun
Step 1: Add workspaces to package.json
{
"workspaces": ["apps/*", "packages/*"]
}
Step 2: Remove pnpm workspace file
rm pnpm-workspace.yaml
Step 3: Update packageManager field
{
"packageManager": "bun@1.1.0"
}
Step 4: Reinstall
rm -rf node_modules
bun install
Verify:
[ ! -f "pnpm-workspace.yaml" ] && echo "â Workspace file removed"
grep -q '"workspaces"' package.json && echo "â Workspaces in package.json"
bun pm ls # List workspaces
Fix: Update npm Scripts
When: Scripts explicitly use node where bun would work
Change in package.json scripts:
{
"scripts": {
// From:
"start": "node dist/index.js",
"dev": "ts-node src/index.ts",
// To:
"start": "bun dist/index.js",
"dev": "bun src/index.ts"
}
}
Verify:
bun run dev # Should work
bun run start # Should work
Fix: Enable Bun Test Runner
When: Using Jest but Bun test runner would work
Step 1: Update test script
{
"scripts": {
"test": "bun test"
}
}
Step 2: Verify Jest-compatible syntax works
bun test
Note: Bun test runner is Jest-compatible. Most tests work without changes.
If Vitest: Can use Bun runner:
{
"scripts": {
"test": "vitest run"
}
}
Verify:
bun test # All tests pass
Fix: Update .gitignore
When: Migrating lockfile format
# Add/update in .gitignore
echo "# Bun" >> .gitignore
echo "bun.lockb" >> .gitignore # Binary lockfile (optional, some prefer text)
# Remove old lockfile from gitignore if needed
sed -i '' '/pnpm-lock.yaml/d' .gitignore
Verify:
cat .gitignore | grep -E "bun|pnpm"
Verification Checklist
After any fix:
# 1. Install works
bun install
# 2. Build works (if applicable)
bun run build
# 3. Tests pass
bun test
# 4. Dev server starts (if applicable)
bun run dev &
sleep 5
curl http://localhost:3000 > /dev/null && echo "â Dev server works"
kill %1
Output Format
## Fixed: [Issue Title]
**What was wrong**:
[Brief description]
**What was changed**:
- [File]: [Change description]
**Verification**:
- â bun install succeeds
- â bun test passes
- â [Other relevant checks]
**Next issue (if any)**:
Run /fix-bun again to fix: [Next P1/P2 issue]
Related
/check-bun– Audit for Bun compatibility/bun– Full Bun migration orchestrator/bun-best-practices– When to use Bun (reference)