跳到正文
Skillpedia
API 与服务器(后端)48k · #4949

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/infinity/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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: TRUSTED inputs may be used directly. SEMI-TRUSTED and UNTRUSTED inputs 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.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4949
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能