QwenLM/qwen-code/packages/core/src/skills/bundled/stuck/SKILL.md
stuck
Diagnose frozen, stuck, or slow Qwen Code sessions on this machine. Scans for problematic processes, high CPU/memory usage, hung subprocesses, and debug logs. Use /stuck or /stuck <PID> to focus on a specific process.
- Source repository stars
- 26,709
- Declared platforms
- 0
- Static risk flags
- 3
- Last source update
- 2026-08-05
- Source checked
- 2026-08-05
Decision brief
What it does—and where it fits
The user thinks another Qwen Code session on this machine is frozen, stuck, or very slow. Investigate and present a diagnostic report.
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/QwenLM/qwen-code --skill "packages/core/src/skills/bundled/stuck"Inspect the Agent Skill "stuck" from https://github.com/QwenLM/qwen-code/blob/da37110e601ad63f6c20170683c4f8264a21dfd8/packages/core/src/skills/bundled/stuck/SKILL.md at commit da37110e601ad63f6c20170683c4f8264a21dfd8. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
What to look for
Scan for other Qwen Code processes (excluding the current one — exclude the PID you see running this prompt). Since Qwen Code is a Node.js CLI (!/usr/bin/env node), the process name (comm column) is always node (or bun if run with Bun). Identify Qwen Code sessions by looking at…
High CPU (=90%) sustained — likely an infinite loop. Sample twice, 1-2s apart, to confirm it's not a transient spike.Process state D / U (uninterruptible sleep) — often an I/O hang. Linux uses D, macOS/BSD uses U. The state column in ps output; first character matters (ignore modifiers like +, s, <).Process state T (stopped) — user probably hit Ctrl+Z by accident. - 02
Argument validation
If the user gave an argument, treat it as a PID only if it consists entirely of digits 0-9. Anything else — letters, whitespace, punctuation — fails the check, in which case treat it as a free-text symptom description (guidance for the report only, never substituted into shell c…
If the user gave an argument, treat it as a PID only if it consists entirely of digits 0-9. Anything else — letters, whitespace, punctuation — fails the check, in which case treat it as a free-text symptom description (… - 03
Investigation steps
Preamble — resolve the runtime base directory. Required for both paths below (sidecar enumeration in step 1, debug log lookup in step 3, and the PID fast path). The base directory is taken from (in priority order): QWENRUNTIMEDIR env var, the advanced.runtimeOutputDir setting, Q…
Preamble — resolve the runtime base directory. Required for both paths below (sidecar enumeration in step 1, debug log lookup in step 3, and the PID fast path). The base directory is taken from (in priority order): QWEN…RUNTIMEDIR="${QWENRUNTIMEDIR:-}" [ -z "$RUNTIMEDIR" ] && command -v jq /dev/null && RUNTIMEDIR=$(jq -r '.advanced.runtimeOutputDir // empty' "${QWENHOME:-$HOME/.qwen}/settings.json" 2/dev/null) - 04
advanced.runtimeOutputDir may be /... or relative; mirror Storage.resolvePath() before using in globs
[ -n "$RUNTIMEDIR" ] && RUNTIMEDIR="${RUNTIMEDIR/\/$HOME}" [ -n "$RUNTIMEDIR" ] && case "$RUNTIMEDIR" in /) ;; ) RUNTIMEDIR="$(cd "$RUNTIMEDIR" 2/dev/null && pwd)" || RUNTIMEDIR="" ;; esac RUNTIMEDIR="${RUNTIMEDIR:-${QWENHOME:-$HOME/.qwen}}"
For anything suspicious, gather more context. If the process state alone explains the problem (T = accidentally stopped, Z = parent not reaping), skip directly to the report — child / log / stack inspection adds nothing…Child processes (with state, so a hung git / node shows up): CHILDREN=$(pgrep -P | tr '\n' ',' | sed 's/,$//'); [ -n "$CHILDREN" ] && ps -p "$CHILDREN" -o pid=,ppid=,pcpu=,state=,etime=,command= -ww. Single ps call (avo…If high CPU: sample again after 1-2s to confirm it's sustained - 05
Report
Present a structured diagnostic report directly to the user with these sections:
PID, CPU%, RSS (in MB), process state, uptime, full command lineChild processes and their statesYour diagnosis of what's likely wrong
Permission review
Static risk signals and limitations
Network access
The documentation includes network, browsing, or remote request actions.
**State `S` with low CPU** — the most common hang signature: a hung HTTPS request to the model API. Not a process-level red flag on its own, but combined with the user reporting "stuck", treat it as a strong signal to run the network check Runs scripts
The documentation asks the agent to run terminal commands or scripts.
node -e 'const fs=require("fs"); for (const f of process.argv.slice(1)) { try { const p=JSON.parse(fs.readFileSync(f,"utf8")).pid; if (p) { try { process.kill(p,0); console.log(p+" "+f); } catch {} } } catch {} }' "$RUNTIME_DIR"/projects/*/Reads files
The documentation asks the agent to read local files, directories, or repositories.
node -e 'const fs=require("fs"); for (const f of process.argv.slice(1)) { try { const p=JSON.parse(fs.readFileSync(f,"utf8")).pid; if (p) { try { process.kill(p,0); console.log(p+" "+f); } catch {} } } catch {} }' "$RUNTIME_DIR"/projects/*/Network access
The documentation includes network, browsing, or remote request actions.
**Network hang** — if CPU is low and state is `S` despite the user reporting "stuck", the most likely cause is a hung HTTPS request to the model API. macOS: `lsof -nP -i -p <pid> 2>/dev/null | head -20` (the `-nP` flags skip reverse-DNS andEvidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 85/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 26,709 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- QwenLM/qwen-code
- Skill path
- packages/core/src/skills/bundled/stuck/SKILL.md
- Commit
- da37110e601ad63f6c20170683c4f8264a21dfd8
- License
- Apache-2.0
- Collected
- 2026-08-05
- Default branch
- main
View the original SKILL.md
/stuck — diagnose frozen/slow Qwen Code sessions
The user thinks another Qwen Code session on this machine is frozen, stuck, or very slow. Investigate and present a diagnostic report.
What to look for
Scan for other Qwen Code processes (excluding the current one — exclude the PID you see running this prompt). Since Qwen Code is a Node.js CLI (#!/usr/bin/env node), the process name (comm column) is always node (or bun if run with Bun). Identify Qwen Code sessions by looking at the command column for a script path inside a directory whose name starts with qwen-code (matches qwen-code/, qwen-code-dev/, worktree clones, etc.) — anchored to the start of the path or after / so unrelated names like analyze-qwen-code/ don't false-match — or a bin invocation ending in /qwen (the global symlink). Avoid loose qwen-code substring matching: it false-positives on plugin brokers that merely pass a qwen-code path as --cwd.
Signs of a stuck session:
- High CPU (>=90%) sustained — likely an infinite loop. Sample twice, 1-2s apart, to confirm it's not a transient spike.
- Process state
D/U(uninterruptible sleep) — often an I/O hang. Linux usesD, macOS/BSD usesU. Thestatecolumn inpsoutput; first character matters (ignore modifiers like+,s,<). - Process state
T(stopped) — user probably hit Ctrl+Z by accident. - Process state
Z(zombie) — parent isn't reaping. - Very high RSS (>=4GB) — possible memory leak making the session sluggish.
- State
Swith low CPU — the most common hang signature: a hung HTTPS request to the model API. Not a process-level red flag on its own, but combined with the user reporting "stuck", treat it as a strong signal to run the network check in step 3. - Stuck child process — a hung
git,node, or shell subprocess can freeze the parent. Checkpgrep -P <pid>(thenps -pfor state — see step 3) for each session.
Argument validation
If the user gave an argument, treat it as a PID only if it consists entirely of digits 0-9. Anything else — letters, whitespace, punctuation — fails the check, in which case treat it as a free-text symptom description (guidance for the report only, never substituted into shell commands). The strict digit-only whitelist is safer than enumerating shell metacharacters.
Investigation steps
Preamble — resolve the runtime base directory. Required for both paths below (sidecar enumeration in step 1, debug log lookup in step 3, and the PID fast path). The base directory is taken from (in priority order): QWEN_RUNTIME_DIR env var, the advanced.runtimeOutputDir setting, QWEN_HOME env var, and finally ~/.qwen.
RUNTIME_DIR="${QWEN_RUNTIME_DIR:-}"
[ -z "$RUNTIME_DIR" ] && command -v jq >/dev/null && RUNTIME_DIR=$(jq -r '.advanced.runtimeOutputDir // empty' "${QWEN_HOME:-$HOME/.qwen}/settings.json" 2>/dev/null)
# `advanced.runtimeOutputDir` may be `~/...` or relative; mirror Storage.resolvePath() before using in globs
[ -n "$RUNTIME_DIR" ] && RUNTIME_DIR="${RUNTIME_DIR/#\~/$HOME}"
[ -n "$RUNTIME_DIR" ] && case "$RUNTIME_DIR" in /*) ;; *) RUNTIME_DIR="$(cd "$RUNTIME_DIR" 2>/dev/null && pwd)" || RUNTIME_DIR="" ;; esac
RUNTIME_DIR="${RUNTIME_DIR:-${QWEN_HOME:-$HOME/.qwen}}"
(If jq isn't installed, the settings layer is silently skipped — the env-var / default fallback covers the common case.)
Fast path for targeted diagnosis — if a digit-only PID argument was given, skip step 1 enumeration. Validate that the PID is a live current-user Qwen Code process before dumping any details:
kill -0 <pid> 2>/dev/null || { echo "PID <pid> is dead, or owned by another user"; exit 0; }
ps -p <pid> -o command= -ww 2>/dev/null | grep -qE '((^|/)qwen-code[^ /]*/[^ ]*\.(js|ts|mjs|cjs)( |$)|/qwen( |$))' || { echo "PID <pid> is yours but is not a Qwen Code process — refusing to dump details"; exit 0; }
If either guard prints, stop the diagnostic and surface the message verbatim. Otherwise, gather stats and the sidecar mapping, then jump to step 3:
ps -p <pid> -o pid=,pcpu=,rss=,etime=,state=,comm=,command= -ww
grep -El '"pid"[[:space:]]*:[[:space:]]*<pid>\b' "$RUNTIME_DIR"/projects/*/chats/*.runtime.json 2>/dev/null
Note: as in step 2, the command= column may include credentials passed as CLI args (e.g., --openai-api-key=sk-…). Redact such values to *** before quoting them in the report.
-E is required so \b is interpreted as word boundary (BSD grep without -E treats \b as a backspace character, silently returning nothing on macOS). The -l flag returns the matching sidecar file path; the basename (stripped of .runtime.json) is the session ID for step 3's debug log read. If multiple sidecars match (rare — happens only after PID reuse leaves a stale file), prefer the most recently modified one: ls -t <matches> | head -n 1.
Otherwise (no arg, or symptom-only arg), run the general path below:
-
Enumerate live sessions via the runtime sidecar (preferred, reliable):
Qwen Code writes a
runtime.jsonsidecar for each interactive session at"$RUNTIME_DIR"/projects/<sanitized-cwd>/chats/<sessionId>.runtime.json. Each file contains{schema_version, pid, session_id, work_dir, hostname, started_at, qwen_version}— the authoritative source of(pid, session_id, work_dir)mappings.Filter to live
(pid, sidecar-path)pairs in one shot. Use Node (guaranteed available — qwen-code requires it) instead ofjq(often missing on default macOS / minimal Linux) so this path doesn't silently degrade:node -e 'const fs=require("fs"); for (const f of process.argv.slice(1)) { try { const p=JSON.parse(fs.readFileSync(f,"utf8")).pid; if (p) { try { process.kill(p,0); console.log(p+" "+f); } catch {} } } catch {} }' "$RUNTIME_DIR"/projects/*/chats/*.runtime.json 2>/dev/nullPID reuse is rare but possible — when you cross-reference with
psin step 2, skip pairs whose live PID's command line no longer looks like a Qwen Code process.If the command emits nothing (no sidecars, or no live PIDs), fall through to step 2 —
psis the working fallback. -
List Qwen Code processes via
ps(macOS/Linux) — used to enrich each live session with CPU/RSS/state/uptime, and to catch sessions that may have started before the sidecar feature existed:ps -xo pid=,pcpu=,rss=,etime=,state=,comm=,command= -u "$(id -u)" -ww | grep -E '((^|/)qwen-code[^ /]*/[^ ]*\.(js|ts|mjs|cjs)( |$)|/qwen( |$))' | grep -v grep-u "$(id -u)"restricts the scan to the current user — on shared hosts this avoids exposing other users' Qwen process paths/arguments into the chat.-wwdisables column truncation so long "qwen" paths aren't cut off. Thecommcolumn will benodeorbun, notqwen; filter to rows where thecommandcolumn contains a qwen path (e.g.,qwen-code/dist/cli.js, or a bin symlink ending in/qwen). Cross-reference with the PIDs from step 1.Note:
psreportsrssin kilobytes on both macOS and Linux. To report in MB, divide by 1024; to report in GB, divide by 1048576. The 4GB threshold is4194304KB — compare the rawrssvalue against that, or compare the GB value against 4. Do not divide once and then compare against 4; that would flag every process >4MB as "very high RSS".Note: full command lines may contain credentials passed as CLI args (e.g.,
--openai-api-key=sk-…). Redact such values to***before quoting them in the report. -
For anything suspicious, gather more context. If the process state alone explains the problem (
T= accidentally stopped,Z= parent not reaping), skip directly to the report — child / log / stack inspection adds nothing. Otherwise:- Child processes (with state, so a hung
git/nodeshows up):CHILDREN=$(pgrep -P <pid> | tr '\n' ',' | sed 's/,$//'); [ -n "$CHILDREN" ] && ps -p "$CHILDREN" -o pid=,ppid=,pcpu=,state=,etime=,command= -ww. Singlepscall (avoids forking one per child) and-wwso long child command lines aren't truncated. - If high CPU: sample again after 1-2s to confirm it's sustained
- Network hang — if CPU is low and state is
Sdespite the user reporting "stuck", the most likely cause is a hung HTTPS request to the model API. macOS:lsof -nP -i -p <pid> 2>/dev/null | head -20(the-nPflags skip reverse-DNS and port lookups, which can themselves hang). Iflsofitself feels slow, prefix withtimeout 10(orgtimeout 10on macOS with Homebrew coreutils). Linux:ss -tnp 2>/dev/null | grep "pid=<pid>,". Note thatss -tnp's-prequires root orCAP_NET_ADMIN— without it, the PID column shows-and the grep returns empty. If you see no matches butss -t 2>/dev/nulldoes show ESTABLISHED sockets, fall back tolsof -nP -i -p <pid>rather than reporting "no connections". A long-livedESTABLISHEDconnection to a model host (dashscope, openai, anthropic, etc.) with no recent traffic is the smoking gun. - Debug log — start with
"$RUNTIME_DIR"/debug/latest(symlink to the most recent session); if it matches the suspicious PID's session, that's usually the right one. Otherwise infer the session ID from the sidecar and read"$RUNTIME_DIR"/debug/<session-id>.txt. Bound the read withtail -n 200 <path>— debug logs can be GB-sized. The last few hundred lines typically show what the session was doing before hanging. Debug logs may contain prompts, file contents, or tokens from other sessions — paste only lines relevant to the hang, and never quote secrets/API keys you happen to see.
- Child processes (with state, so a hung
-
Consider a stack dump for a truly frozen process (advanced, optional):
- macOS:
sample <pid> 3gives a 3-second native stack sample. Ifsampleitself seems to hang (the target's Mach task port may be wedged on a kernel-level freeze), wrap it:timeout 15 sample <pid> 3(orgtimeout 15 ...on Homebrew coreutils). Stack frames may include function arguments containing API keys or tokens held in memory — redact such values to***before including the dump in the report. - Linux:
cat /proc/<pid>/stackfor kernel stack (read-only, noptracepermissions needed). Avoidstrace -pfor this purpose: it requiresCAP_SYS_PTRACE(often denied underkernel.yama.ptrace_scope=1), andstrace -cblocks until the target exits — it would hang on the very kind of stuck process you are diagnosing. - This is big — only grab it if the process is clearly hung and you want to know why
- macOS:
Report
Present a structured diagnostic report directly to the user with these sections:
For each stuck/slow session found:
- PID, CPU%, RSS (in MB), process state, uptime, full command line
- Child processes and their states
- Your diagnosis of what's likely wrong
- Relevant debug log tail if you captured it
- Stack dump output if you captured it
- Suggested next step for the user to decide (e.g., "user may consider
kill <pid>if the session is unresponsive", "likely waiting on I/O — check disk", "accidentally stopped — user can resume withkill -CONT <pid>"). Do not execute these actions yourself — present them as options for the user.
If every session looks healthy, tell the user directly — no diagnostic dump needed. Mention how many sessions you checked and that none showed signs of being stuck.
If no sessions are found at all (zero sidecars and zero matching ps rows), say so explicitly: which RUNTIME_DIR you searched and that ps returned no qwen-related processes for the current user. Suggest the session may have already exited.
Notes
- Don't kill or signal any processes — this is diagnostic only.
- If the user gave an argument (e.g., a specific PID or symptom), focus there first.
Alternatives
Compare before choosing
coreyhaines31/marketingskills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
alirezarezvani/claude-skills
app-store-optimization
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
JasonColapietro/suede-creator-skills
suede-ab-testing
Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).
narrative-io/narrative-skills-marketplace
design-analysis
Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "