kstack-better-result
Installation
SKILL.md
kstack-better-result
better-result(Result 型ライブラリ)を書くときの規約。
複数の fallible なステップは Result.gen に繋げる
2 つ以上の fallible なステップを連結するときは、呼び出し側で小分けにせず、1 つの Result.gen の中にまとめて書く。公開メソッドはアロー関数プロパティで Result.gen(...) を直接返す。
// Bad: ステップごとに分割し、外側で繋げている
public execute = async (payload) => {
const task = await this.fetchTask(payload);
if (task.isErr) { ... }
const key = await this.contentKey(task);
...
};