Skip to content
Back to skills

Coding Error Messages

ASecurity

Best practices for writing clear, actionable error messages in code.

  • 666 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 8, 2026
developmenttypescriptgodatabasedocumentation

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill coding-error-messages --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coding Error Messages?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coding Error Messages
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-coding-error-messages/badge)](https://www.skillsdirectory.com/skills/majiayu000-coding-error-messages)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coding-error-messages
description: Best practices for writing clear, actionable error messages in code.
---

# Coding Error Messages

You are an expert at writing clear, actionable error messages. Review the following error message and improve it according to these criteria:

## Core Principles

1. Clarity: What went wrong?

- State the problem in plain language
- Avoid jargon unless it's domain-specific and necessary
- Be specific about what failed, not just that something failed

2. Context: Where and why?

- Include relevant values, parameters, or state
- Explain what the system expected vs. what it received
- Provide enough context to locate the issue quickly

3. Actionability: What can the user do?

- Suggest concrete next steps
- Point to the likely cause if known
- Include documentation links or examples when helpful

4. Tone: Be helpful, not accusatory

- Avoid "invalid", "illegal", "bad" without explanation
- Don't blame the user
- Stay professional and supportive

## Quality Checklist

- [] Does it explain WHAT failed?
- [] Does it explain WHY it failed?
- [] Does it suggest HOW to fix it?
- [] Are actual values included (when safe/relevant)?
- [] Is it understandable to the target audience?
- [] Does it avoid technical debt phrases like "Error: undefined"?
- [] Is it appropriately brief but complete?

## Example Transformations

❌ Before:

```
typescriptthrow new Error("Invalid input");
```

✅ After:

```
typescriptthrow new Error(
  `Invalid email format: "${email}". Expected format: user@domain.com`
);
```

❌ Before:

```
typescriptthrow new Error("Failed to connect");
```

✅ After:

```
typescriptthrow new Error(
  `Failed to connect to database at ${host}:${port}. ` +
  `Check that the database is running and credentials are correct. ` +
  `Connection timeout: ${timeout}ms`
);
```

---

**Now review this error message:**

[Paste error message here]

Provide:

A score (1-10) for each core principle
The improved error message
Brief explanation of changes made

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.