infinity
它能做什么
这个工具确保程序从外部获取的数据在使用前经过检查。它会建立一道安全防线,防止出现错误和其他问题。
适用场景
- ✓当接收到用户输入的信息时。
- ✓当使用来自外部来源(API、文件)的数据时。
- ✓当你用变量配置程序时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/infinity/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在使用任何外部数据输入之前,先对它们进行验证。”
每周 5 个新技能,1 分钟读完。
工作原理
首先,它会找出外部数据在程序中从哪里进入。然后,把这些数据划分为可信或不可信。最后,对不可信的数据进行检查,确保它们在被使用之前是正确的。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
infinity — Input Boundary & Validation Protocol
Core Philosophy
Nothing untrusted ever reaches the core — it is stopped before contact. No external data touches the codebase raw. Every boundary where data enters the system must have a filter.
The #1 source of silent bugs, crashes, and vulnerabilities is external data that arrives in an unexpected shape and gets used directly without checking. This skill enforces a filter layer at every entry point, every time.
When to Use This Skill
- Use when you need to handle an API response
- Use when reading user input or adding a form handler
- Use when working with environment variables or CLI arguments
- Use when parsing webhooks or reading from the filesystem
- Use when any code calls
.body,.params,.query,.env,fs.read, or a third-party SDK response
The Four Phases
PHASE 1 — Boundary Detection
Before writing or modifying any code that involves external data, the AI must identify and list every entry point in scope:
- HTTP request bodies, headers, query params
- User form inputs and UI-submitted data
- Environment variables and config files
- Third-party API responses
- Webhook payloads
- File reads from disk
- CLI arguments
- Database query results from external sources
- WebSocket messages
The AI must not write any data-handling logic until every entry point in scope is listed.
PHASE 2 — Classify Each Input
For every entry point identified, the AI classifies it into one of three trust levels:
| Level | Definition | Examples |
|---|---|---|
TRUSTED |
Internal constants, hardcoded values, your own compile-time config | Enum values, hardcoded defaults, internal constants |
SEMI-TRUSTED |
Your own internal services, internal APIs, controlled infrastructure | Internal microservice responses, your own database reads |
UNTRUSTED |
Anything from users, the internet, third parties, or the filesystem | User input, external API responses, uploaded files, env vars, CLI args |
Rule:
TRUSTEDinputs may be used directly.SEMI-TRUSTEDandUNTRUSTEDinputs must pass through a filter layer before any use.
The AI outputs this classification before writing any handling code:
INFINITY — BOUNDARY MAP
─────────────────────────────────────────
Entry Point | Trust Level | Filter Required
─────────────────────────────────────────
req.body.email | UNTRUSTED | ✓ format + sanitize
process.env.API_KEY | UNTRUSTED | ✓ presence + non-empty
internalService.getData()| SEMI-TRUSTED | ✓ schema validate
PAGINATION_LIMIT = 20 | TRUSTED | ✗ none needed
─────────────────────────────────────────
PHASE 3 — Mandatory Filter Layer
Every UNTRUSTED and SEMI-TRUSTED input must pass through validation before it reaches any business logic, storage, or rendering. The AI must apply the right filter type for the right context:
Type Checking
- Verify the input is the expected type before using it
- Never assume a string is a string, a number is a number, or an array is an array
Schema Validation
- For objects and API responses, validate shape before accessing nested fields
- If a required field is missing, reject — do not use a fallback that hides the problem
Sanitization
- Strip or escape content before rendering to UI (prevent XSS)
- Normalize strings before storage (trim whitespace, consistent casing where appropriate)
Presence & Format Checks
- Env vars: must exist and be non-empty before use
- IDs and tokens: must match expected format before use
Rejection Rule
- On invalid input: reject explicitly and return a clear error
- Never silently use bad data with a fallback
- Never let bad data pass through to fix itself "downstream"
// WRONG — using raw input directly
const user = await db.find(req.params.id);
// RIGHT — validate before use
const id = req.params.id;
if (!id || typeof id !== 'string' || !isValidUUID(id)) {
return res.status(400).json({ error: 'Invalid ID format' });
}
const user = await db.find(id);
PHASE 4 — Self-Check Before Done
Before the AI declares any data-handling code complete, it traces each entry point and confirms:
INFINITY — VERIFICATION
─────────────────────────────────────────
Entry Point | Filter Exists | Filter Type
─────────────────────────────────────────
req.body.email | ✓ YES | format + sanitize
…
常见问题
为什么检查数据很重要?
意外的数据可能导致错误、让程序崩溃,甚至产生安全漏洞。
什么是“不可信数据”?
指那些不在你直接控制范围内的数据,比如用户输入的信息、其他 API 的响应,或系统配置。
如果数据未通过验证会怎样?
程序应该明确地报告错误,而不是继续使用错误的数据,从而引发更多问题。
详情
作者的原始描述
Enforces a strict input boundary protocol (detect, classify, filter, verify) to ensure untrusted data never reaches business logic raw.
热度
- GitHub 星标
- 48k
- 排名
- #4949
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。