Back to skills
SKILL.md
Module Split
ASecuritySplit Haskell code into small modules, with one module per validated type and exception types in dedicated modules separate from the code that throws them. Use when creating Haskell modules, defining exception types or validated newtypes, or reviewing module structure.
- 3 stars
- 0 votes
- 0 copies
- 0 views
- Added December 3, 2026
Security analysis
100/100npx -y skills add ncaq/konoka --skill module-split --agent claude-codeAre you the author of Module Split?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ncaq-module-split)---
name: module-split
description: Split Haskell code into small modules, with one module per validated type and exception types in dedicated modules separate from the code that throws them. Use when creating Haskell modules, defining exception types or validated newtypes, or reviewing module structure.
user-invocable: false
---
# モジュールを細かく分ける
モジュールはなるべく細かく分割してください。
1つのモジュールに複数の関心ごとを詰め込むと、
importから依存関係が読み取れなくなり、
変更したときの再コンパイルの範囲も広がるためです。
## 検証済みの型は型ごとに1つのモジュールにする
スマートコンストラクタで検証した値だけを持つ型は、
型ごとに1つのモジュールにします。
例えば`RemoteUrl`、`WorktreePath`、`BranchName`のそれぞれにモジュールを作ります。
Haskellでコンストラクタを隠せる単位はモジュールです。
複数の型を同じモジュールに置くと、
そのモジュールの中の関数は他の型の検証を迂回して値を作れてしまいます。
コンストラクタはexportせず、
検証する関数だけをexportします。
exportの方針は[haskell-tasuke:export](../export/SKILL.md)に書いています。
## 例外型は専用のモジュールに置く
`Exception`のインスタンスを持つ例外型は、
それを投げる処理のモジュールに同居させず、
`Failure`のような専用のモジュールに置きます。
例外を捕まえる側やテストは、
例外型だけをimportすればよく、
投げる処理のモジュールに依存せずに済みます。
複数のモジュールから同じ例外型を投げることもできます。
例外型の数が少なければ1つのモジュールにまとめて構いません。
循環importが起きる場合は、まず例外型のモジュールを分けて解消します。
それでも循環が残る場合は、[haskell-tasuke:exception](../exception/SKILL.md)の通り、
例外を投げる側で`Text`に変換します。
## テストもモジュールごとに分ける
テストもテスト対象のモジュールごとに分けます。
テストモジュールの名前は[haskell-tasuke:test-module-name](../test-module-name/SKILL.md)に従います。
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.