From claude-resources
Organizes package.json scripts with comment separators, extracts multi-process commands to shell scripts, adds predev port cleanup, configures .npmrc security settings, and manages pnpm via corepack and packageManager field.
npx claudepluginhub takazudo/claude-resourcesThis skill uses the workspace's default tool permissions.
Two techniques for keeping large `scripts` sections readable and maintainable.
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Two techniques for keeping large scripts sections readable and maintainable.
Add visual section dividers using unused JSON keys:
{
"scripts": {
"// ── Core ─────────────────────────────────────────": "",
"dev": "next dev",
"build": "next build",
"// ── Testing ─────────────────────────────────────": "",
"test": "jest",
"test:e2e": "playwright test"
}
}
Format: "// ── Section Name ──────..." with ─ padding to ~50 chars, value "".
Add a predev script that kills stale processes on dev server ports before starting. This prevents "port already in use" errors that commonly occur after crashes, orphaned processes, or forgotten terminal sessions.
{
"scripts": {
"predev": "lsof -ti :5173,:8787 | xargs kill 2>/dev/null; true",
"dev": "next dev"
}
}
How it works:
lsof -ti :PORT — finds PIDs listening on specified ports (-t = terse/PID-only, -i = internet addresses):5173,:8787 checks multiple ports at oncexargs kill — sends SIGTERM (graceful) to found processes2>/dev/null; true — silently succeeds when no processes are foundpredev before dev (lifecycle hook convention)Adapt port numbers to match your project's dev servers (e.g., :3000,:8080 for a typical Node.js + API setup).
When a command starts 2+ background processes, extract to scripts/*.sh.
Template available at scripts/multi-process-dev.sh.template. Key pattern:
#!/bin/bash
set -e
cleanup() {
kill $PID_1 $PID_2 2>/dev/null
wait $PID_1 $PID_2 2>/dev/null
}
trap cleanup EXIT INT TERM
if [ "$MODE" = "local" ]; then
backend-server &
PID_1=$!
sleep 3
fi
pnpm dev &
PID_2=$!
wait
Call from package.json: "dev:full": "MODE=local ./scripts/dev-full.sh"
Make executable: chmod +x scripts/*.sh
For apps with local/preview/production API targets:
{
"// ── Dev with API (3 environments) ───────────────": "",
"dev:full": "API_MODE=local ./scripts/dev-full.sh",
"dev:full:preview": "API_MODE=preview pnpm dev",
"dev:full:prod": "API_MODE=production pnpm dev"
}
See references/patterns.md for:
_ prefix)packageManager FieldPin the exact pnpm version in package.json:
{
"packageManager": "pnpm@10.30.2+sha512.36cdc707e7b..."
}
This ensures every developer and CI uses the identical pnpm version. Corepack reads this field and auto-downloads the specified version.
corepack enable
After this, running pnpm install / pnpm dev / etc. just works — corepack intercepts the pnpm command and uses the pinned version automatically. No global pnpm install needed.
pnpm self-update — it errors when pnpm is managed by corepackcorepack use pnpm@latest routinely — it bumps the version in package.json and often regenerates pnpm-lock.yaml, creating noisy diffscorepack use pnpm@<version>, commits the package.json + lockfile changes, and everyone else gets it via pnpm installAI tools and automation sometimes add corepack use pnpm@latest to setup steps. This causes unnecessary version bumps and lockfile churn. Remove it — corepack enable + the existing packageManager field is sufficient.
Evaluate and manage dependency build scripts for supply chain security.
See references/npmrc-build-scripts.md for: