Skip to content
Back to skills

Dev Package Json

FSecurity

Organize and maintain package.json and pnpm config: scripts layout and separators, multi-process/multi-environment dev commands, serve/dev script tweaks (predev kill-port, `:net` LAN variants, non-destructive port-rotation launcher), corepack/packageManager pinning, and pnpm build-script security (allowBuilds / strictDepBuilds). Use when editing package.json scripts, on 'tweak serve', 'kill port', 'port in use', 'port rotation', 'don't kill the port', or on pnpm 'Ignored build scripts' warnings.

  • 12 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
toolsgonodetestingapisecurity

Works with

  • api

Security analysis

F34/100
  • criticalPipes output to a shell interpreter
  • mediumUses curl or wget to download content
  • criticalDownloads and executes remote scripts — classic supply chain attack
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 4 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add Takazudo/claude-resources --skill dev-package-json --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dev Package Json?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dev Package Json
[![Security: F — Skills Directory](https://www.skillsdirectory.com/api/skills/takazudo-dev-package-json/badge)](https://www.skillsdirectory.com/skills/takazudo-dev-package-json)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dev-package-json
description: "Organize and maintain package.json and pnpm config: scripts layout and separators, multi-process/multi-environment dev commands, serve/dev script tweaks (predev kill-port, `:net` LAN variants, non-destructive port-rotation launcher), corepack/packageManager pinning, and pnpm build-script security (allowBuilds / strictDepBuilds). Use when editing package.json scripts, on 'tweak serve', 'kill port', 'port in use', 'port rotation', 'don't kill the port', or on pnpm 'Ignored build scripts' warnings."
user-invocable: true
argument-hint: "[--kill] [--net] [--rotate]"
---

# package.json & pnpm config

## 1. Scripts organization

**Separator keys** — unused JSON keys as section dividers: `"// ── Name ───…": ""`, padded with `─` to ~50 chars, placed before the first script of each section.

```json
"// ── Core ─────────────────────────────────────────": "",
"dev": "next dev",
"build": "next build",
"// ── Testing ─────────────────────────────────────": "",
"test": "jest"
```

**Multi-process commands** — when a script starts 2+ background processes, extract it to `scripts/*.sh` from the template `scripts/multi-process-dev.sh.template` (trap-based cleanup so Ctrl+C takes every child down). `chmod +x` it.

**Multi-environment dev:**

```json
"// ── 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"
```

Section names, suffix conventions, monorepo namespace prefixes, `_` internal scripts: [references/patterns.md](references/patterns.md).

## 2. Serve / dev scripts

Read [references/serve-scripts.md](references/serve-scripts.md) before changing any server-starting script. It covers:

- `--kill` — `preXXX` hook: `lsof -ti :PORT | xargs kill 2>/dev/null; true` (multiple ports: repeat `-ti :PORT`, never `:A,:B`)
- `--net` — `COMMAND:net` variants bound to `0.0.0.0`, per-framework host flags
- `--rotate` — non-destructive port rotation: copy `assets/find-free-port.mjs` (verbatim) + `assets/dev-launcher.mjs` into the project; multi-process variant in [references/port-rotation-multi-process.md](references/port-rotation-multi-process.md)

Invoked with no flag and no clear intent: ask which tweak to apply. Prefer rotation over kill when worktrees/second checkouts run side by side or the port may belong to something the user wants alive.

## 3. pnpm version via corepack

Pin in package.json: `"packageManager": "pnpm@10.30.2+sha512.…"`. Once per machine: `corepack enable`.

- **Node ≥25 no longer bundles corepack** — `npm install -g corepack` first, or use pnpm's standalone installer (`curl -fsSL https://get.pnpm.io/install.sh | sh -`); recent pnpm reads `packageManager` and self-manages the pinned version.
- Never `pnpm self-update` — it errors under corepack.
- Never add `corepack use pnpm@latest` to setup steps (a common AI/automation mistake) — it bumps `packageManager` and churns `pnpm-lock.yaml`. Upgrade only intentionally: one person runs `corepack use pnpm@<version>` and commits package.json + lockfile.

## 4. Dependency build-script security

pnpm 10+ blocks dependency lifecycle scripts by default. Verdicts go in the `allowBuilds` map in **`pnpm-workspace.yaml`** (`true` = run, `false` = deny + silence the warning) — NOT `.npmrc`, where such keys are silent no-ops. Never bulk-approve; evaluate each package.

Workflow for "Ignored build scripts" warnings, decision criteria, known-package verdict table, `strictDepBuilds`: [references/build-scripts.md](references/build-scripts.md).

Files in this skill

  • SKILL.md5.8 KB
  • references/npmrc-build-scripts.md4.8 KB
  • references/patterns.md6.2 KB
  • scripts/multi-process-dev.sh.template933 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.