360 Secure SkillHub
360 安全技能中心

principle-boundary-discipline

该 Skill 提供边界纪律原则:在命令行参数、配置、网络和外部 API 等系统边界处校验并收窄类型、处理错误;系统内部信任已定义类型、避免重复校验;将业务逻辑提取为无框架依赖的纯函数,由薄外壳调用。

分类:开发
backnotprop
热度 69.60
最近更新 2026-11-24 05:23:49

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add backnotprop/pstack/principle-boundary-discipline
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
principle-boundary-discipline
description
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.
disable-model-invocation
true

Boundary Discipline

Validate, narrow types, and handle errors where data crosses a system boundary (CLI args, config files, external APIs, network). Inside, trust the types: no re-validation and no redundant nil checks. Parse raw data into domain types at the boundary, and keep transport and framework types out of the public surface. Business logic lives in pure functions with no framework dependencies. The shell that calls them is thin.

Two tests. Is this data crossing a boundary right now? If not, the validation is redundant. Can this be a pure function the shell just calls? If yes, extract it.