partial-function

partial-function is a skill for Claude Code from ncaq/konoka. It costs 55 tokens per session (672 once invoked), scanned A, original, Apache-2.0.

A Haskell coding rule that avoids functions which can crash for some inputs, such as empty lists or invalid text. It recommends returning an explicit result like Maybe instead.

In plain words
What is it for?
Use it when writing or reviewing Haskell code that reads lists, parses strings, accesses Maybe values, or uses indexes.
Why use it?
It reduces runtime crashes that type checking cannot catch and makes failures easier to handle predictably.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

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

Good fit Use it when writing or reviewing Haskell code that reads lists, parses strings, accesses Maybe values, or uses indexes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ncaq/konoka/partial-function
View source ↗ ncaq/konoka
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.

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

Made for: Claude Code.

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 partial-function

README.md
[![agentmods](https://agentmods.dev/badge/skills/ncaq/konoka/partial-function/github.svg)](https://agentmods.dev/skills/ncaq/konoka/partial-function)
Your own site
<a href="https://agentmods.dev/skills/ncaq/konoka/partial-function"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/partial-function/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for partial-function

Your own site · 80×15
<a href="https://agentmods.dev/skills/ncaq/konoka/partial-function"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/partial-function.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 672 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00055 $0.00672
Opus 5.5 $0.00022 $0.00269
Sonnet 5.5 $0.00011 $0.00134
Haiku 4.5 $0.00006 $0.00067

Measured 1mo ago against content hash 8cf70d05ac2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

partial-function 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 1mo 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/partial-function/SKILL.md · 73 lines

What it actually says

部分関数の禁止

純粋関数であるにもかかわらず、 特定の入力に対して例外を投げる部分関数の使用は禁止します。

部分関数は型の上ではすべての入力を受け付けるように見えますが、 実際には一部の入力でしか正しく動作しません。 そのため型検査を通過しても実行時にクラッシュする原因になります。

純粋関数空間では安全な方法では例外を捕捉することが出来ないため、 エラーの処理が困難になります。

遅延評価と組み合わせると、 例外が発生するタイミングが予測できなくなり、 例外を捕捉しているはずなのに別の場所で評価された時に例外が発生することもあります。

全域関数や、 失敗をMaybeやEitherなどで返す関数に置き換えてください。

代表的な部分関数と代替

fromJust

Maybeの中身を取り出しますが、 Nothingに対しては例外を投げます。

fromMaybeでデフォルト値を与えるか、 maybeやパターンマッチでNothingの場合を明示的に処理してください。

read

文字列をパースしますが、 失敗すると例外を投げます。

readMaybeや、 導入されていればreadMayを使い、 失敗をMaybeとして受け取ってください。

head / tail / init / last

空リストに対して例外を投げます。

先頭要素が欲しいだけならlistToMaybeやパターンマッチを使ってください。

導入されていればheadMayなどのMaybeを返すバージョンを使ってください。

空でないことが事前条件であるなら、 NonEmptyで型として表現すれば、 NonEmpty.headは全域関数になります。

(!!)

範囲外のインデックスに対して例外を投げます。

Data.List.(!?)のように、 Maybeを返す添字アクセスを使ってください。

そもそもリストの添字アクセスはパフォーマンスが悪いので、 可能な限り走査するようなコードを書いてください。

maximum / minimum / foldr1 / foldl1

空のコンテナに対して例外を投げます。

NonEmpty版を使うか、 初期値を与える安全なバージョンを使ってください。

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. 1mo ago First seen · 73 lines · 55 tokens per session scan A 8cf70d05ac2a

Subscribe to this mod's changes

partial-function is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed yesterday), licensed Apache-2.0. It adds 55 tokens to every session and 672 once invoked, about $0.0002 per session on Opus 5.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

google-go-style

Use when writing, reviewing, or refactoring Go code; when handling errors (fmt.Errorf, %w, sentinel, errors.Is, errors.As); when deciding between panic, error return, and log.Fatal; when writing tests (table-driven, t.Helper, t.Fatal vs t.Error, goroutines); when designing API surface (option struct, variadic options…

cicdteam/google-go-style · 110 tokens

r-tidyverse-style

Use when the user asks to review or clean up R code for tidyverse style, standardize formatting or names, remove redundant comments or wrappers, or make a behavior-preserving style pass. Also use when writing substantial new R package code if the user requests tidyverse style or the package already follows it. Not for…

posit-dev/skills · 83 tokens

better-auth

Skill for integrating Better Auth - comprehensive TypeScript authentication framework for Cloudflare D1, Next.js, Nuxt, and 15+ frameworks. Use when adding auth, encountering D1 adapter errors, or implementing OAuth/2FA/RBAC features.

secondsky/claude-skills · 53 tokens

bun-bundler

This skill should be used when the user asks about "bun build", "Bun.build", "bundling with Bun", "code splitting", "tree shaking", "minification", "sourcemaps", "bundle optimization", "esbuild alternative", "building for production", "bundling TypeScript", "bundling for browser", "bundling for Node", or…

secondsky/claude-skills · 90 tokens

bun-hot-reloading

Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.

secondsky/claude-skills · 42 tokens

code-review

Code review practices with technical rigor and verification gates. Use for receiving feedback, requesting code-reviewer subagent reviews, or preventing false completion claims in pull requests.

secondsky/claude-skills · 35 tokens