debug
Debug errors, test failures, or unexpected behavior. Auto-detects project type.
What this skill does
# Debug Command
## Context
```
TECH_STACK = config_read("tech_stack", "generic")
LESSONS_PATH = config_read("lessons_path", ".agents/lessons/")
```
## Bug Description
<bug_description>$ARGUMENTS</bug_description>
**If the bug description above is empty**, ask the user: "What error or issue are you experiencing? Please paste the error message or describe the unexpected behavior."
Do not proceed until you have a clear bug description.
## Discover Similar Past Issues
**Check if lessons directory exists, then discover similar past issues:**
```
Task(subagent_type="majestic-engineer:workflow:lessons-discoverer",
prompt="workflow_phase: debugging | tech_stack: [tech_stack from context] | task: [bug_description]")
```
**If lessons found with score > 70:**
Present the high-confidence matches to the user BEFORE starting investigation:
```
Found similar past issues:
1. [Lesson title] (score: 78)
{lessons_path}/[category]/[filename].md
2. [Lesson title] (score: 65)
{lessons_path}/[category]/[filename].md
```
Use AskUserQuestion:
```
High-confidence match found. Read the documented solution first?
1. Read Lesson 1 (Recommended)
2. Read Lesson 2
3. Continue with full investigation
```
**If user chooses to read a lesson:**
- Display the lesson content using `Read(file_path="[lesson_path]")`
- Ask: "Does this apply to your issue?"
- If yes: Apply the documented solution, verify it works
- If no: Continue with full investigation
**Error handling:**
- If lessons directory doesn't exist: Continue to Project Context Detection
- If discovery returns 0 lessons: Continue to Project Context Detection
- If discovery fails: Log warning, continue to Project Context Detection
This step is **non-blocking** - failures do not stop the workflow.
## Project Context Detection
**Step 1: Check config**
Use "Tech stack" from Context above. If configured, use it to determine project type.
**Step 2: Check AGENTS.md for debugging guidance**
Look for `AGENTS.md` in the project root for:
- Debugging workflows
- Testing commands
- Project-specific conventions
**Step 3: Fall back to file-based detection only if needed**
If neither config nor AGENTS.md provides context, detect project type from files:
```bash
ls Gemfile package.json pyproject.toml setup.py go.mod Cargo.toml 2>/dev/null
```
| File Found | Project Type | Debugger |
|------------|--------------|----------|
| Gemfile | Ruby/Rails | `agent rails-debugger` |
| package.json | Node.js | General debugging |
| pyproject.toml / setup.py | Python | General debugging |
| go.mod | Go | General debugging |
| Cargo.toml | Rust | General debugging |
## Workflow
### For Rails Projects (from AGENTS.md or Gemfile detected)
Invoke the specialized Rails debugger agent:
```
agent rails-debugger "<bug_description>"
```
The rails-debugger will:
- Analyze stack traces and error messages
- Check recent git changes
- Inspect logs and database state
- Identify root cause and propose fixes
### For Other Projects
1. **Analyze the error message** - Parse for error types, file paths, line numbers
2. **Check recent changes** - `git log --oneline -10` and `git diff HEAD~3`
3. **Search for solutions** - Use web-research agent if needed
4. **Propose fix** - Provide minimal code changes to resolve
## Output Format
After debugging, provide:
1. **Root Cause** - What's actually wrong (explain *why*, not just *what*)
2. **Evidence** - Specific logs, traces, or code proving the cause
3. **Fix** - Minimal code changes to resolve the issue
4. **Verification** - Commands or tests to confirm the fix works
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.