.claude/skills/pm-troubleshoot/SKILL.md
Diagnose the root cause of a bug, error, crash, or unexpected behavior. Traces through code, logs, services, database state, and git history to find why something is broken. Researches error messages online for known issues. Produces a diagnosis with evidence and suggested fix. Use when the user reports a problem, error message, stack trace, test failure, or says things like "why is this happening", "this is broken", "I'm getting an error", "something's wrong with...", "debug this", or "figure out why...".
npx skillsauth add pinkroosterai/PinkRoosterMcp pm-troubleshootInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Given a symptom — an error message, unexpected behavior, crash, test failure, or vague "something's wrong" — systematically trace through the codebase, logs, services, and git history to find the root cause. The goal is a clear diagnosis the user can act on, not a guess.
Parse $ARGUMENTS to understand what went wrong. Classify the symptom:
Error message / stack trace: Extract the key error, file path, line number, and exception type. This is the most actionable starting point.
Unexpected behavior: "X happens when it should do Y." Understand both the expected and actual behavior.
Test failure: Extract the test name, assertion that failed, expected vs actual values.
Vague report: "Something's wrong with the dashboard" or "the API is slow." Need to narrow down before investigating — ask one focused question using AskUserQuestion:
[{label: "Error/crash", description: "I see an error message or stack trace"}, {label: "Wrong behavior", description: "Something works but does the wrong thing"}, {label: "Performance", description: "Something is slow or timing out"}, {label: "Test failure", description: "A test is failing"}]Record the symptom clearly — this is the hypothesis to prove or disprove.
Before diving into code, check if the issue is environmental. These checks are fast and often reveal the problem immediately.
# Check if containers are running and healthy
docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}" 2>/dev/null
If services are down or unhealthy, that may be the root cause. Check container logs:
# Last 50 lines from each service
docker compose logs --tail=50 api 2>/dev/null
docker compose logs --tail=50 mcp 2>/dev/null
docker compose logs --tail=50 dashboard 2>/dev/null
docker compose logs --tail=50 postgres 2>/dev/null
If the symptom involves data issues, missing records, or FK violations:
# Check database connectivity and basic state
docker compose exec -T postgres psql -U postgres -d pinkrooster -c "SELECT count(*) FROM projects;" 2>/dev/null
For specific entity issues, query the relevant table. Use the connection string from the environment.
Check what changed recently — the cause is often in the last few commits:
git log --oneline -10
git diff HEAD~3 --stat
If the symptom started after a specific change, git diff HEAD~1 or git log --oneline -5 -- {affected-file} narrows it down.
Skip environment checks when: The user provides a clear error with file/line reference, or the issue is obviously in static code (type errors, logic bugs). Go straight to Step 3.
This is the core investigation. Start from the symptom and work backward to the root cause.
If error message with file/line: Read that file directly, understand the context.
If stack trace: Trace from the top (where the error surfaced) down to the bottom (where it originated). Read the key frames.
If behavioral bug: Identify the code path that produces the wrong behavior:
If test failure: Read the test, understand what it asserts, then trace into the code under test.
Use Serena's tools for efficient code exploration:
mcp__serena__get_symbols_overview to understand file structure without reading everythingmcp__serena__find_symbol with include_body=True to read specific functionsmcp__serena__find_referencing_symbols to trace callers and dependenciesLook for common root cause patterns:
If you've identified the suspect code but don't know when/why it was introduced:
git log --oneline -5 -- {suspect-file}
git blame -L {startLine},{endLine} {suspect-file}
This reveals who changed the code and what the commit message says — often explains the intent behind the bug.
For error messages, library issues, or patterns you're unsure about — search online. This catches known issues, version-specific bugs, and correct usage patterns that aren't obvious from code alone.
When to research:
How to research:
WebSearch with the exact error message (in quotes) plus the technology stackWebSearch with the library name + "correct usage" for pattern verificationWebFetch to pull relevant documentation or GitHub issuesWhen to skip:
Synthesize findings into a clear diagnosis. The quality of the diagnosis determines whether the fix will be correct on the first attempt.
Trace from symptom → immediate cause → root cause:
Symptom: Dashboard shows blank white screen on WP detail page
↓
Immediate cause: `phases.map()` throws because `phases` is undefined
↓
Root cause: API returns `null` for phases when WP has none;
TypeScript type says `Phase[]` (non-optional) but API doesn't guarantee it
↓
Fix: Add null coalescing in the component OR fix the API to return `[]` instead of `null`
Rate your diagnosis:
## Diagnosis: {one-line summary}
### Symptom
{What the user reported or observed}
### Root Cause
{Clear explanation of WHY the issue occurs — not just WHERE}
### Evidence
1. {File:line — what was found and what it means}
2. {Log entry / DB state / git change — supporting evidence}
3. {Online reference — if research confirmed the diagnosis}
### Evidence Chain
{symptom} → {immediate cause} → {root cause}
### Confidence: {High | Medium | Low}
{Brief justification for the confidence level}
### Suggested Fix
{Specific code change or configuration fix}
- File: {path}
- Change: {what to do}
### Prevention
{How to prevent this class of issue in the future — optional, only if there's a clear pattern}
### Research (if performed)
- {key finding from online research}
Use the AskUserQuestion tool:
[{label: "Create issue", description: "Track this as a bug via /pm-plan with the root cause pre-filled"}, {label: "Fix now", description: "Implement the fix directly"}, {label: "Investigate more", description: "The diagnosis isn't conclusive — dig deeper"}, {label: "Done", description: "I have what I need"}]If Create issue: Invoke /pm-plan with a pre-formatted description:
Bug: {symptom summary}. Root cause: {root cause}. Fix: {suggested fix}.
Affected: {file paths}. Severity: {inferred from impact}.
If Fix now: Invoke /pm-implement if a task exists, or implement the fix directly following the suggested change.
If Investigate more: Ask what aspect needs more investigation and continue from Step 3.
tools
Verify acceptance criteria for a phase or entire work package. Runs verification based on each criterion's method (AutomatedTest, Manual, AgentReview) and records results via the MCP tool.
development
Review and prioritize open issues and feature requests. Analyzes severity, age, and codebase impact to recommend priority adjustments and next steps.
tools
Show project status dashboard with issue/FR/WP counts, active items, blocked items, and priority next actions. Use when the user asks about project status, progress, what's happening, what needs attention, or what to work on.
development
Scaffold a complete work package with phases, tasks, and dependencies based on a feature description or linked issue/FR. Analyzes the codebase to produce realistic target files and implementation notes. Auto-transitions linked entities to planning states. Use when the user wants to break down work, plan implementation, create a WP, or says "scaffold", "break this down", "plan the implementation", or "create tasks for...".