Skip to content
galahad logo

Coding Agent Quality Rules (Galahad Principle)

galahad

how to approach tests, types and coverage

SKILL.md

Full skill instructions

Coding Agent Quality Rules (Galahad Principle)

Based on Jonathan Lange’s “The Galahad Principle”: https://jml.io/galahad-principle/

Core idea: getting to 100% yields disproportionate value—especially simplicity and trust. When checks are truly “all green”, any new failure is a strong, unambiguous signal; “absence of evidence becomes evidence of absence”.

Non-negotiables: never evade feedback

Treat type errors, test failures, pre-commit hooks, lint errors, and coverage warnings as helpful feedback. Fix root causes.

Absolutely forbidden (unless the user explicitly orders it)

  • Type escapes / silencing
    • any, sketchy unknown laundering, unchecked casts, as any, @ts-ignore, # type: ignore, noqa, disabling strict mode, weakening compiler flags, etc.
  • Coverage gaming
    • Ignoring/​excluding lines/​branches/​files just to hit targets (/​* istanbul ignore */, # pragma: no cover, “generated” tricks, config exclusions, decorator/​macro suppression).
  • Faking results
    • Skipping CI steps and claiming success; “snapshotting” coverage; lowering thresholds; marking tests flaky to ignore them.

Priorities

Type safety is part of correctness and outranks tests.

When tradeoffs exist, prioritize in this order:

  1. Type safety / soundness
  2. Correctness + meaningful tests
  3. Clarity / maintainability
  4. Performance
  5. Backwards compatibility (lowest)

Breaking changes are acceptable when they improve verifiability and simplify the system.

Default workflow (when anything fails)

  1. Read the failure output carefully.
  2. Restate the real invariant being violated in plain English.
  3. Fix the root cause (not the symptom).
  4. Improve tests so the behavior is pinned and regressions get caught.
  5. Refactor production code if needed to make it easy to type-check and validate.

Run checks in this order

  1. Typecheck
  2. Unit tests
  3. Integration tests
  4. Lint / pre-commit
  5. Coverage

Goal: a repo where “all green” is normal, and any new red is a loud, trustworthy signal.

“Hard to test” means refactor

If something is hard to test or hard to type:

  • Treat it as a design smell.
  • Refactor towards:
    • smaller pure functions
    • explicit data flow, minimal global state
    • clear boundaries between logic and side effects
    • typed domain models over stringly-typed blobs

Mocks: don’t overuse them

Avoid injecting mocks via monkeypatching or replacing system utilities by default.

Preferred approach:

  • Make the function under test able to operate in multiple environments by passing in the substitutable operations explicitly (usually as function parameters or small interfaces).
  • Only do this for operations that genuinely need substitution in tests (time, randomness, network, filesystem, process execution, etc.).
  • This makes the injection point explicit, documents what varies, and keeps tests honest without fragile mocking.

What “good” looks like

  • Types encode invariants; no “trust me” casts.
  • Tests assert observable behavior (not implementation trivia).
  • Coverage comes from exercising real behavior, not exclusions.
  • If a thing can’t be verified cleanly, refactor until it can.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View