dev-server
Skill2 starsChanged yesterdayMITView on GitHub
Use whenever you're about to start, restart, or kill the Next.js dev server, or whenever the dev server is "acting weird" (404s on routes that exist, broken UI after a code change, port conflicts, HMR not picking up edits, two dev servers fighting). Catches the stray-process + corrupt-.next + competing-instance failure modes that produce these symptoms. Trigger phrases include "restart the dev server", "kill stray dev servers", "clean dev boot", "the dev server is broken", "/config 404", "fresh dev restart", "is the dev server clean", "why is HMR weird".
- Deletes or force-pushes
5 other projects use a version of this.
Adopted by
Most recently taken up by
- bloknayrb/tandemtheir own version, first seen Oct 29, 2026
- editframe/skillstheir own version, first seen Oct 13, 2026
- civitai/civitaitheir own version, first seen Oct 8, 2026
- yugasun/skillstheir own version, first seen Jun 24, 2026
- Azure/cosmos-explorertheir own version, first seen Apr 28, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- civitai/civitai★ 7.3ksame name
- Azure/cosmos-explorer★ 131same name
- bloknayrb/tandem★ 28same name
- editframe/skills★ 19same name
- yugasun/skills★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- audit-remediationsSkill
- audit-write-toolsSkill
- cost-summarySkill
- patch-contextSkill
- validate-bundleSkill
- verify-featureSkill
- verify-patchSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Always: list → kill → verify dead → clear .next → start → confirm single.
- Very specific: line 24
Don't skip steps. The mistake that produces all the symptoms above is killing one server while another is still running, then starting a …
- Distinctive: line 80
After running the script:
- Distinctive: line 85
If any of those fail, do NOT assume your code change is the problem — re-run the skill until the environment is clean before debugging the …
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
dev-server
The Next.js dev server has three failure modes that look like "code is broken" but are actually environment problems. Each maps to a specific symptom and a specific fix. Run this skill any time you're about to monkey with the dev server, or any time symptoms below show up.
Symptoms → diagnosis → fix
| Symptom | Likely cause | Fix |
/config returns 404 but the file exists | Two next-server processes trampling the same .next | Kill all + clear .next + start one |
Broken UI on / after a code change | Same as above, or HMR partial-write | Same |
| "Port 3000 is in use, using 3001 instead" in dev output | A previous next-server is still alive on 3000 | Kill the stray, restart on 3000 |
| HMR didn't pick up an edit | Stale build cache from a crashed prior session | Clear .next, restart |
lsof -ti :3000 returns nothing but you can't bind to 3000 | lsof's view is incomplete (different uid, namespace, or /proc lookup miss) | Use pkill -f, not lsof | kill |
The procedure
Always: list → kill → verify dead → clear .next → start → confirm single.
Don't skip steps. The mistake that produces all the symptoms above is killing one server while another is still running, then starting a third — three competing processes compile in parallel against the same .next directory and corrupt it.
Run
bash .claude/skills/dev-server/clean-restart.shThat script does the full sequence: kills every next-server / next dev process owned by you, verifies port 3000 is free, clears .next, starts one new dev server in the background, and confirms exactly one server is now running. It refuses to start a new server if a kill failed (so you can investigate instead of compounding the mess).
Flags:
KEEP_NEXT=1— skip therm -rf .nextstep (faster, but only safe when you're sure the cache isn't corrupt)NO_START=1— kill + clear only, don't start a new server (use when you're about to runmake-dist.shand need a clean tree)PORT=3001— target a non-default port
Manual checks (use when the script's behavior is wrong)
# What's running
ps aux | grep -E "next-server|next dev" | grep -v grep
# Kill them all (don't rely on lsof for this)
pkill -f "next-server"
pkill -f "next dev"
# Confirm dead — wait 2s then re-check
sleep 2 && ps aux | grep -E "next-server|next dev" | grep -v grep
# Hard kill if any survived
pkill -9 -f "next-server"
pkill -9 -f "next dev"
# Clear build cache
rm -rf .next
# Start one
npm run devWhy lsof -ti :3000 | xargs kill is unreliable
It looks correct and is the obvious incantation, but:
lsofcan return empty if the process is in a different namespace, owned by a different uid, or/procis in a weird state —killthen gets no PIDs and silently no-ops while the server keeps running.- The Next.js dev wrapper spawns a
sh -c next devshell, anodeprocess, AND anext-serverworker.lsof -i :3000only catches the one holding the socket — the parents survive and respawn the child.
pkill -f "next-server" and pkill -f "next dev" together cover the parent + worker pair regardless of which one currently holds the port.
Related foot-guns (memory-indexed)
- Don't run
make-dist.shwhile dev is alive (feedback_dont_build_with_dev_running). Build writes/deletes.next/; concurrentnext devcrashes ENOENT. Re-check port 3000 before EVERY build, not just the first one in a session. This skill'sNO_START=1mode is the right thing to run beforemake-dist.sh. globalThis-pin process-wide module state (module_state_globalthis_pinning). Two dev servers each have their own module state; they'll fight overdata/settings.jsonwrites and the file mutex.- DB bootstrap blocks routes (
standalone_secret_warmup_blocking-adjacent). If two servers race the DB open + WAL, you can land on a corrupt SQLite state — another reason single-instance matters now that the DB cutover landed.
Pass criteria
After running the script:
- Exactly one
next-serverprocess owned by your uid (ps aux | grep next-server | grep -v grep | wc -lreturns1) http://localhost:3000(or$PORT) responds with a 200 or 307 to a probe- Dev output shows
✓ Ready in <N>sand[db] bootstrap complete(if DB scaffold is present)
If any of those fail, do NOT assume your code change is the problem — re-run the skill until the environment is clean before debugging the code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

