本文へスキップ
Skillpedia
一般的なプログラミング15k · #10974

principle-boundary-discipline

できること

このスキルは、コードのどこにチェックとエラー処理を置くべきかについての規則を、アシスタントに与えます。冗長なガードを減らし、テストしやすいコードにしたい開発者向けです。

使う場面

  • ✓プログラムに入力の検証やエラー処理を組み込んでいるとき。
  • ✓同じチェックが多くの内部関数で繰り返されているとき。
  • ✓ビジネスロジックを、テストしやすい純粋な関数に保ちたいとき。

スキルのリンク

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-boundary-discipline/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-boundary-discipline/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このサービスの設定とAPIのレスポンスは、どこで検証すべきですか。残りのコードを単純に保つにはどうすればよいですか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

アシスタントは、検証を境界に置きます。例えばコマンドライン引数、設定ファイル、外部の呼び出しです。その後、型付きの内部データを信頼します。ビジネスロジックは、フレームワークなしで動く純粋な関数に保ちます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Boundary Discipline

Place validation, type narrowing, and error handling at system boundaries. Trust internal code unconditionally. Business logic lives in pure functions. The shell is thin and mechanical.

Why: Scattered validation is noisy, redundant, and gives a false sense of safety. Keep logic out of framework wiring so it can be tested without the framework.

The pattern:

  • At boundaries (CLI args, config files, external APIs, network protocols): validate, return errors, handle defensively.
  • Inside the system: typed data, error propagation, no re-validation. Trust the types.
  • Across the boundary. Expose domain concepts, not the boundary's private representation. Keep general-purpose mechanism inside and special-purpose policy at the edge.

Applications:

Validation and error handling:

  • Validate config at parse time (the boundary), not inside business logic
  • Parse raw data into domain types at the boundary
  • Do not re-export transport, storage, framework, or wire types through the public surface
  • No redundant nil checks deep in call chains if the boundary already validated

Code organization:

  • Business logic in pure functions with no framework dependencies
  • Parse functions: pure transforms from raw bytes to typed state
  • Prompt construction: structured state in, string out
  • Scoring and assessment: pure transforms from state to results

The tests:

  • "Is this data crossing a system boundary right now?" If not, validation is redundant.
  • "Can this be a pure function that the shell just calls?" If yes, extract it.
よくある質問

なぜどこでも検証しないのですか?

散らばったチェックは雑然とし、繰り返しになり、安全だという誤った感覚を与えるからです。

システムの内側には何がありますか?

型付きのデータとエラーの伝播です。境界が既に検証した値を、もう一度チェックすることはありません。

なぜロジックをフレームワークの外に置くのですか?

フレームワークを起動しなくてもテストできるようにするためです。

詳細

作者による元の説明

Apply when wiring validation, error handling, or framework adapters. Concentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions.

repo: cursor/plugins

人気

GitHubのスター
15k
ランキング
#10974
ライセンス
—
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル