| name | diagnostics |
| description | Access LSP diagnostics and suggest project rollback. Use for debugging static errors and helping users revert changes. |
Diagnostics Skill
Tools for debugging code issues and managing project state.
When to Use
Use this skill when:
- Checking for syntax errors, type errors, or import issues after code changes
- User wants to undo changes or revert to a previous state
- Debugging static errors detected by the language server
When NOT to Use
- Runtime errors or logic bugs (use logs and debugging)
- Small changes that don't need LSP validation
- Code search (use grep/glob tools)
Available Functions
getLatestLspDiagnostics(filePath=None)
Retrieve LSP diagnostics - syntax errors, type errors, and code issues.
Parameters:
filePath (str, optional): File path to check. If omitted, checks all files with errors.
Returns: Dict with diagnostics (file paths to error lists) and filePath (filter used)
Example:
const result = await getLatestLspDiagnostics({ filePath: "src/auth.ts" });
for (const [path, errors] of Object.entries(result.diagnostics)) {
for (const error of errors) {
console.log(`Line ${error.startLine}: ${error.message}`);
}
}
const allErrors = await getLatestLspDiagnostics();
console.log(`Files with errors: ${Object.keys(allErrors.diagnostics)}`);
When to check LSP:
- After refactoring >100 lines of code
- User reports "errors" or "something's not working"
- After adding imports or dependencies
- Before completing a task with >100 lines of changes
Skip LSP when:
- Making small changes (<10 lines)
- Adding comments or documentation
- Debugging runtime errors (LSP won't show these)
Suggest rollback
Suggest rolling back to a previous checkpoint. Call SuggestUserAction({ action: "rollback", message: "..." }) with a short, non-technical explanation for why rollback is suggested.
Use when user expresses intent to:
- Undo changes: "can you undo what you just did?", "revert the last changes"
- Restore previous version: "roll back", "go back to how it was yesterday"
- Fix major error: "you deleted my database!", "everything is broken"
- Try different approach: "take a completely different approach", "start over"
Important:
- This does NOT perform the rollback - it shows a "View Checkpoints" button
- After calling, direct the user to click the button that appears
- This pauses the agent to wait for user response
Best Practices
- Check LSP after significant changes: Large refactors, new features, or when user reports errors
- Use filePath parameter: When checking a specific file you just edited
- Suggest rollback carefully: Only when user clearly wants to undo or revert
Example Workflows
Debugging after refactoring
const errors = await getLatestLspDiagnostics({ filePath: "src/services/user.ts" });
if (Object.keys(errors.diagnostics).length > 0) {
for (const [path, diags] of Object.entries(errors.diagnostics)) {
for (const diag of diags) {
console.log(`Fix: ${diag.rendered}`);
}
}
}