Function programming conventions
Skill yend724/agent-skills/skills/function-programming-conventions
Functional programming conventions for TypeScript logic layers. Auto-triggers when writing utilities, services, domain logic, or data transformation logic to ensure pure functions, immutability, and proper side-effect isolation.From its SKILL.md
npx -y skills add yend724/agent-skills --skill function-programming-conventionsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.3 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
Functional Programming Conventions
TypeScript のロジック層における関数型プログラミング規約集。純粋関数、イミュータビリティ、副作用の分離を徹底し、テスタブルで予測可能なコードを実現する。
When to Apply
以下の作業時に自動で参照する:
- ロジック層のコード作成時
- データ変換・加工ロジックの実装
- 状態管理に関わるビジネスロジックの設計
- ユーティリティ関数の作成・リファクタリング
Compatibility
TypeScript 5.0+ / ES2022+
Rule Categories
| Category | Prefix |
|---|---|
| 副作用の分離 | sideeffect- |
| イミュータブル操作 | immutable- |
| 関数合成 | compose- |
| 型レベル不変性 | types- |
Quick Reference
副作用の分離
- sideeffect-push-to-boundary - 副作用をIO境界に押し出す
- sideeffect-pure-core - ビジネスロジックはpure functionとして書く
- sideeffect-explicit-dependency - 副作用の依存関係を引数で明示する
イミュータブル操作
- immutable-const-by-default - 変数宣言は const をデフォルトにする(var 禁止、let は最小限)
- immutable-no-mutate-array - 配列の非破壊操作を徹底する(push/splice禁止、spread/toSorted/toSpliced使用)
- immutable-no-mutate-object - オブジェクトを直接変更しない(Readonly + spread)
- immutable-derive-dont-accumulate - 導出可能な値を別途保持せず計算で求める
関数合成
- compose-small-functions - 関数は小さく、単一目的に保つ
- compose-pipeline-readable - データ変換はパイプライン的に読めるようにする
- compose-avoid-nested-ternary - ネストした三項演算子を避け、early returnやmatch的パターンを使う
型レベル不変性
- types-readonly-by-default - 型定義はReadonly/ReadonlyArrayをデフォルトにする
- types-as-const-literals - リテラル型にはas constを活用する
- types-discriminated-unions - 状態の網羅性チェックにDiscriminated Unionを使う
How to Use
個別ルールの詳細は rules/ ディレクトリ内のファイルを参照。上記 Quick Reference のリンクから各ルールにアクセスできる。
各ルールファイルには以下が含まれる:
- ルールの説明と根拠
- Bad: 間違ったコード例
- Good: 正しいコード例
- 判断基準・原則のガイダンス
What ships with it: 13 files
34.9 KB alongside SKILL.md
rules/
- compose-avoid-nested-ternary.md3.1 KB
- compose-pipeline-readable.md2.9 KB
- compose-small-functions.md2.8 KB
- immutable-const-by-default.md1.4 KB
- immutable-derive-dont-accumulate.md3.8 KB
- immutable-no-mutate-array.md2.5 KB
- immutable-no-mutate-object.md1.7 KB
- sideeffect-explicit-dependency.md2.6 KB
- sideeffect-pure-core.md2.6 KB
- sideeffect-push-to-boundary.md2.7 KB
- types-as-const-literals.md3.0 KB
- types-discriminated-unions.md3.7 KB
- types-readonly-by-default.md2.2 KB