exception

exception is a skill for Claude Code, Codex from ncaq/konoka. It costs 43 tokens per session (1,208 once invoked), scanned A, original, Apache-2.0.

A Haskell error-handling guideline. It recommends returning structured error values from pure code and using typed exceptions in input/output code when exceptions are appropriate.

In plain words
What is it for?
Use it when writing or reviewing Haskell functions that can fail. Check uses of `error`, `throw`, `Either`, typed exceptions, swallowed I/O errors, and temporary `undefined` implementations.
Why use it?
It avoids hidden failures, unstructured error messages, and errors that disappear without explanation. It also makes failures easier for callers to handle and debug.

Skill for Claude CodeCodex

Part of the haskell-tasuke plugin — 19 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ncaq/konoka/exception
Any agent
npx skills add ncaq/konoka --skill exception
Clone the repo
git clone --depth 1 https://github.com/ncaq/konoka

Made for: Claude Code, Codex.

Or install haskell-tasuke, the plugin that ships this one along with the rest of its 19 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for exception

README.md
[![agentmods](https://agentmods.dev/badge/skills/ncaq/konoka/exception.svg)](https://agentmods.dev/skills/ncaq/konoka/exception)
Your own site
<a href="https://agentmods.dev/skills/ncaq/konoka/exception"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/exception.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,208 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.01208
Opus 5 $0.00022 $0.00604
Sonnet 5 $0.00009 $0.00242
Haiku 4.5 $0.00004 $0.00121

Measured 3d ago against content hash 0228638f3f9b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

exception scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/haskell-tasuke/skills/exception/SKILL.md · 97 lines

What it actually says

例外処理の原則

error関数の禁止

純粋関数空間の中で例外を投げられるerror関数の使用は原則として禁止です。

haskell-tasuke:partial-function でも触れましたが、 純粋関数空間で例外を投げてしまうと、 呼び出し側で捕捉するのが困難だからです。

また例外に入っているのがStringという非構造化されたデータであると、 デバッグが難しくなります。

throw(導入されている場合は非純粋であることを明示したimpureThrow)の方が、 例外に型がついているという点ではまだマシですが、 こちらも純粋関数空間で例外を投げているのは同じなのでやはり推奨されません。

呼び出し側にMonadThrowEitherなどを使ってエラー情報を伝播させてください。

例外

論理的にどう考えても発生しないはずの場所なら許容されます。

そんなおかしなことが起きているなら、 アプリケーション自体を終了させるのが適切なレベルの話です。

それでもなるべく型を作って例外を投げるのが望ましいです。

undefinedはPRを出すときにはクリーンアップしましょう

Haskell標準で用意されているundefinedは、 開発中に仮の実装として使うのは便利です。 Rustのtodo!と同じように使えます。

例えばテストファーストで開発をする時に、 とりあえずコンパイルを通すだけの関数シンボルをundefinedで埋めて、 テストコードを書いてから実装を進めるといった使い方ができます。

しかしundefinedは結局は純粋空間でも例外を投げる関数なので、 PRを出すときにはundefinedをクリーンアップしてください。

残っていると警告が出るはずなので見落としはあまりないとは思いますが。

例外は型をつけよう

throwStringのような関数を使うより、 ちゃんと例外に型をつけてthrowMなどで型がついた例外を使いましょう。

例外の状況を伝えるデータ型は、 Textなどの文字列型を使うのではなく、 なるべく構造的なデータ型をフィールドとして持ってください。 ただしcycle importが発生する場合は、 呼び出し側でTextに変換するのもやむを得ないでしょう。

エラーを握り潰すのは禁止

IOの文脈などで例外が生じた場合に、 単に握りつぶして何もしない行為は禁止です。

IOは文脈的に既に例外が発生する可能性があることを示しているので、 例外が上位に伝播することは許容されています。 なので握りつぶすぐらいなら、 例外をそのまま上位に任せてしまう方が概ね適切です。

例外が生じた時に、 そこで例外を処理するのが完全に適切なら、 問題の程度に応じたログを出して処理してください。

単にデバッグを楽にするだけで解決は出来ない場合は例外を再送出してください。

例外だけではなくEitherLeftなども適切に処理してください。 Leftに対してデフォルト値やフォールバック値を使ってください。 想定外で対処不能ならMonadThrowの文脈に載せて上位に任せてください。

IOが既にコンテキストにある状態でMaybeEitherで包むのは微妙

IOは例外が発生する可能性がある文脈を十分に表現しているモナドなので、 その中でMaybeEitherを使って例外的な状況を示すのは二重にネストしていて混乱を招きます。 素直に例外を投げてしまうのが良いでしょう。

基底モナドなどでIO的な操作をしているがIOそのものではないモナドの場合は、 MonadThrowMonadIOの型クラスが役に立ちます。

例外

データベースやネットワークと通信してデータを取得するような操作は、 存在しないというケースが頻繁に発生する正常系として扱われます。

その場合はIO (Maybe a)のようなシグネチャを使うことは分かり易く適切です。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 97 lines · 43 tokens per session scan A 0228638f3f9b

Subscribe to this mod's changes

exception is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed 5d ago), licensed Apache-2.0. It adds 43 tokens to every session and 1,208 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

api-testing

HTTP API testing for TypeScript (Supertest) and Python (httpx, pytest). Test REST APIs, GraphQL, request/response validation, authentication, and error handling.

secondsky/claude-skills · 39 tokens

api-gateway-configuration

Configures API gateways for routing, authentication, rate limiting, and request transformation in microservice architectures. Use when setting up Kong, Nginx, AWS API Gateway, or Traefik for centralized API management.

secondsky/claude-skills · 49 tokens

api-response-optimization

Optimizes API performance through payload reduction, caching strategies, and compression techniques. Use when improving API response times, reducing bandwidth usage, or implementing efficient caching.

secondsky/claude-skills · 36 tokens

espalier-migrate

Migrate an existing harness/espalier install to the current Espalier version — auto-detects which of v0.1→v0.2, v0.3→v0.4, v0.4→v0.5, the v0.5.3 coder-agent patch, v0.5→v0.6 (Stage 1 grill), v0.6→v0.7 (read-only /espalier-ask lane), v0.7→v0.8 (requirements approval gate), the v0.8.1 impact-analysis agent patch, the…

Junhanliu-dev/espalier-engineering · 0 tokens

recursive-decomposition

Handle tasks that exceed the context window by decomposing them: size and filter the input, chunk it, run recursive sub-agents on independent parts, verify on small windows, and synthesise programmatically, following the Recursive Language Models (RLM) research by Zhang, Kraska and Khattab (2025). Use when a task…

massimodeluisa/recursive-decomposition-skill · 151 tokens

math-unicode

Use when a response needs mathematical notation (equations, filters, set-builder notation, statistics, calculus, linear algebra, logic, ratios, drops, counts) and the output goes to a terminal or TUI that cannot render LaTeX: Claude Code, Codex CLI, SSH and tmux sessions, CI logs. Load it before composing, including…

vladimirrott/claude-math · 154 tokens