360 Secure SkillHub
360 安全技能中心

principle-boundary-discipline

该 Skill 提供编码原则:在 CLI 参数、配置、网络和外部 API 等系统边界集中进行校验与类型收窄,内部信任类型;业务逻辑写成纯函数,并在评审中标记领域模块引入框架或驱动依赖。仅文本指导,无脚本与工具。

分类:开发
mdsmithaustin
热度 0.00
最近更新 2026-11-26 11:31:35

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add mdsmithaustin/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.

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.

In review, flag a domain or policy module that imports a framework, driver, ORM, IO library, generated schema type, or adapter module, type-only imports included. It should receive that value from its caller as plain data.