home / skills / a5c-ai / babysitter / error-messages

This skill helps you design and implement clear, actionable compiler error messages with contextual displays and machine-readable output.

npx playbooks add skill a5c-ai/babysitter --skill error-messages

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.6 KB
---
name: Error Messages
description: Expert skill for designing and implementing high-quality compiler error messages
category: User Experience
allowed-tools:
  - Read
  - Write
  - Edit
  - Glob
  - Grep
  - Bash
---

# Error Messages Skill

## Overview

Expert skill for designing and implementing high-quality compiler error messages.

## Capabilities

- Design clear, actionable error message templates
- Implement source context display with underlines
- Generate fix suggestions and quick fixes
- Handle error cascades and suppression
- Implement multi-span error annotations
- Support machine-readable error output (JSON)
- Implement color/styled terminal output
- Design error recovery strategies for better diagnostics

## Target Processes

- error-message-enhancement.js
- parser-development.js
- type-system-implementation.js
- semantic-analysis.js
- lsp-server-implementation.js

## Dependencies

Elm/Rust error message guidelines

## Usage Guidelines

1. **Clarity**: Make error messages clear and actionable
2. **Context**: Show relevant source code context with precise location
3. **Suggestions**: Provide fix suggestions when possible
4. **Cascades**: Suppress cascading errors to avoid overwhelming users
5. **Machine-Readable**: Support JSON output for tooling integration

## Output Schema

```json
{
  "type": "object",
  "properties": {
    "errorFormat": {
      "type": "string",
      "enum": ["human", "json", "sarif"]
    },
    "features": {
      "type": "array",
      "items": { "type": "string" }
    },
    "colorSupport": { "type": "boolean" },
    "generatedFiles": {
      "type": "array",
      "items": { "type": "string" }
    }
  }
}
```

Overview

This skill helps design and implement high-quality compiler error messages that are clear, actionable, and integrate with development tooling. It focuses on readable source context, precise multi-span annotations, and machine-readable outputs for automation. The goal is to reduce developer friction by surfacing the right information and suggested fixes.

How this skill works

The skill provides patterns and implementations for rendering human-friendly and JSON/SARIF error formats, plus styled terminal output with color support. It defines templates for source underlines, multi-span annotations, and fix suggestions, and includes strategies to detect and suppress cascading errors. It also produces an output schema that tools can consume for further automation.

When to use it

  • Enhancing a compiler or interpreter’s diagnostics
  • Building or improving an LSP server’s diagnostic output
  • Designing error recovery and suppression strategies in parsers
  • Adding machine-readable error output (JSON or SARIF) for CI tools
  • Creating quick-fix suggestions and automated refactoring hints

Best practices

  • Prioritize clarity: short headline, precise location, and actionable suggestion
  • Show minimal but relevant source context with underlines or spans
  • Offer a single clear suggestion when confident, and multiple options when ambiguous
  • Suppress or collapse cascaded errors to avoid overwhelming users
  • Support both human-readable and machine-readable formats for integration

Example use cases

  • Implement human and JSON error formats for a new language compiler
  • Add multi-span error annotations to show declaration and use sites
  • Integrate quick-fix suggestions into an LSP server for one-click repairs
  • Emit SARIF from the build pipeline so linters and CI can aggregate diagnostics
  • Improve parser recovery to surface the primary root cause instead of many follow-up errors

FAQ

What output formats does this skill support?

Human-readable text, structured JSON for tooling, and SARIF for security and CI integrations.

How do you avoid cascading errors?

Detect primary failures, suppress dependent diagnostics, and surface recovery hints; provide an option to enable verbose cascades for debugging.