HashQL Diagnostic Writing

SkillCommunication

HashQL diagnostic writing patterns using hashql-diagnostics crate. Use when creating error messages, warnings, Labels, Messages, Severity levels, Patches, Suggestions, or improving diagnostic quality in HashQL code.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the HashQL Diagnostic Writing skill

What this skill tells your AI

The instructions your AI receives, as published by hashintel/hash in .agents/skills/writing-hashql-diagnostics/SKILL.md and read by ahel’s review.

Provides HASH-specific patterns for writing high-quality diagnostics using the hashql-diagnostics crate, ensuring messages are helpful, actionable, and follow consistent style conventions.

Core Principles

Diagnostics should be helpful, not just correct:

DO:

  • Start messages with lowercase
  • Use backticks for code elements: expected `bool`, found `String`
  • Make messages actionable and specific
  • Use "invalid" not "illegal"
  • Keep help messages as imperatives: "add type annotations"

DON'T:

  • End messages with punctuation (unless multi-sentence)
  • Use apologetic language ("sorry", "unfortunately")
  • Write vague messages ("something went wrong")
  • Capitalize message starts (unless code identifier)

Quick Reference

Creating a Diagnostic

use hashql_diagnostics::{Diagnostic, Label, Message, Severity};

let mut diagnostic = Diagnostic::new(category, Severity::Error)
    .primary(Label::new(span, "expected `bool`, found `String`"));

diagnostic.add_label(Label::new(other_span, "expected because of this"));
diagnostic.add_message(Message::help("try using a comparison"));

Severity Levels

SeverityWhen to Use
BugInternal compiler error
FatalUnrecoverable error
ErrorMust be fixed to compile
WarningSuspicious code to review
NoteInformational context

Message Style

// ✅ Good
"cannot find variable `count` in this scope"
"expected `;` after expression"

// ❌ Bad
"Error: Variable not found."  // capitalized, punctuation
"Sorry, there's a type mismatch"  // apologetic

Adding Suggestions

use hashql_diagnostics::{Message, Patch, Suggestions};

let suggestion = Suggestions::patch(Patch::new(span, "corrected_code"));
diagnostic.add_message(
    Message::help("fix the typo").with_suggestions(suggestion)
);

References

Signals

GitHub stars
2k
Forks
122
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
writing-hashql-diagnostics
Source
github.com/hashintel/hash