## Tip: Use Specific Error Messages When Debugging

**Category**: debugging

**Problem**: Asking Claude to "fix the code" without specific error information leads to guesswork.

**Solution**: Always provide the complete error message, stack trace, and context.

**Example**:

❌ **Vague Debugging Request**:
```
"This code doesn't work, please fix it"
```

✅ **Specific Debugging Request**:
```
"I'm getting this error when running the user signup:

TypeError: Cannot read property 'email' of undefined
    at validateUser (src/auth/validate.ts:15:25)
    at POST /api/signup (src/api/auth.ts:42:18)

This happens when submitting the signup form. The request body looks like:
{
  "username": "test",
  "password": "secret123"
}

Expected: validation should pass
Actual: crashes with undefined error

Code in question: [paste relevant code]
"
```

**Even Better - Include**:
1. **Complete error message** (don't truncate)
2. **Stack trace** (shows where error occurred)
3. **Input that caused error** (helps reproduce)
4. **Expected vs actual behavior**
5. **Relevant code** (not entire file)
6. **Environment** (if relevant - browser, Node version, etc.)

**Template to Use**:
```
Error: [paste complete error]

Stack trace:
[paste stack trace]

Reproduction steps:
1. [step 1]
2. [step 2]
3. Error occurs

Input/Request: [paste]

Expected: [what should happen]
Actual: [what happens instead]

Relevant code:
[paste code section]
```

**Why It Works**:
- Claude can identify exact issue
- Faster diagnosis
- More accurate fixes
- Reduces back-and-forth

**Pro Tip**: Use `console.log()` or debugger to capture:
- Variable values before error
- Function inputs
- Intermediate state

**Tags**: #debugging #claude-code #error-handling #best-practices
