Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/zuoyebang/aiweavenpx agentmods add skills/zuoyebang/aiweave/new-middlewareWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/zuoyebang/aiweave/new-middleware)<a href="https://agentmods.dev/skills/zuoyebang/aiweave/new-middleware"><img src="https://agentmods.dev/badge/skills/zuoyebang/aiweave/new-middleware/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/zuoyebang/aiweave/new-middleware"><img src="https://agentmods.dev/badge/skills/zuoyebang/aiweave/new-middleware.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00016 | $0.00905 |
| Opus 5.5 | $0.00006 | $0.00362 |
| Sonnet 5.5 | $0.00003 | $0.00181 |
| Haiku 4.5 | $0.00002 | $0.00090 |
Grade A, and why
new-middleware scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
根据 $ARGUMENTS 生成认证中间件。
公共步骤模板见 skills-spec/01_skill_authoring_guide.md §A-§E。本 Skill 特定内容如下。
第 0 步:拒绝规则与依赖前置
- ⛔ 拒绝(§A.1):N/A(中间件通常不触发暂不实现模块)
- 状态检查(§A.2):读
BUILD_STATUS.md§2 中 middleware 行 - 依赖(§A.3):依赖的 helpers / Redis Key / 配置项必须就绪
第 1 步:读取设计文档(公共必读见 §B)
- 主文档:
docs/architecture/middleware.md对应中间件规格 - 额外必读:
docs/architecture/routing.md§1 中间件链- 签名类中间件 →
docs/architecture/{核心校验链}_flow.md§1 签名算法 docs/architecture/render_functions.md(错误响应格式)
第 2 步:识别中间件类型
| 类型 | 关键逻辑 |
|---|---|
| 内网 IP 白名单 | 检查 ctx.ClientIP() 是否属于内网段 |
| 签名校验 | MD5 / HMAC + 时间窗口校验 |
| 角色权限 | 提取 X-{Actor}-Role + 接口权限矩阵 |
第 3 步:生成中间件文件
文件路径:middleware/{name}.go
package middleware
import (
"{project}/components"
"{project}/helpers"
"{project}/pkg/gin"
"{project}/pkg/golib/v2/tlog"
)
func {Name}() gin.HandlerFunc {
return func(ctx *gin.Context) {
// 1. {步骤 1}
// 2. {步骤 2}
// ...
// N. ctx.Set("{key}", {value})
ctx.Next()
}
}
错误响应处理(关键):
- 与外部协议对齐的路由组(Internal)→
ctx.AbortWithStatusJSON(200, gin.H{"status":...,"message":...,"data":nil}) - 标准内部路由组(UserSelf/Admin)→
base.RenderJsonAbort(ctx, components.ErrorXxx) - 不要混用!
第 4 步:文档同步(公共项见 §C)
- 确认
middleware.md规格与实现一致 - 确认
routing.md§1 中间件链描述一致 - 更新 BUILD_STATUS 状态
第 5 步:测试同步(4 类用例标准见 §D)
中间件本身不对应单接口测试,必须通过覆盖该路由组的下游接口测试间接覆盖:
| 中间件类型 | 测试覆盖 |
|---|---|
| 签名校验类 | test/cases/internal/{module}_{action}_test.go(含签名错误 / 时间过期 / 缺参数等) |
| 调用方身份注入类 | test/cases/operator/common_test.go(IP 白名单 / {actor-id} 注入) |
| 角色权限校验类 | test/cases/admin/common_test.go(多角色权限矩阵) |
第 6 步:验证(公共格式见 §E)
go build ./middleware/...
go vet ./middleware/...
cd test && go test -v ./cases/{scope}/...
🧩 AIWeave 骨架 · 作者 XuRuibo [email protected] · Apache-2.0 · 模板文件,复制到工程后按业务语义填充
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 93 lines · 16 tokens per session scan A e2d8fa2b4fb5
new-middleware is a skill published in the GitHub repository zuoyebang/aiweave (20 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 16 tokens to every session and 905 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
build-teaql-app
Build or change a TeaQL application in Java, Rust, Go, Swift, Python, C#/.NET, or TypeScript, including Kotlin/JVM applications that consume Java-generated libraries. Mandatory order: first draft and save a complete KSML model, then verify the client and evaluate that saved model, repair it through repeated evaluation…
compact-error-handling
Reduce repeated exception-handling code with language-appropriate constructs while preserving error propagation and diagnostics.
api-runtime-verify
Verify a built backend HTTP surface at runtime: per route, record the response, assert it against the slice's acceptance behavior, and decide PASS/FAIL/BLOCKED. Do not use to review a contract before implementation (use api-contract-review or graphql-contract-review), write code (use implement-approved-slice), triage…
api-contract-review
Review an API contract (shapes, errors, auth model) BEFORE implementation for naming, versioning, pagination, idempotency, and fit with existing endpoints. Use when designing or changing endpoints. Do not use when the API is already implemented (use review-hard or repo-consistency-sweep).
backend-system-design
Produce a staff-grade backend system-design RFC: a 12-section document for a new service, endpoint, or feature. Composes with slo-define, performance-budget, api-contract-review, release-plan. Use when a backend feature needs architecture-level design before planning. Do not use to slice a designed change (use…
graphql-contract-review
Review a GraphQL schema and a Backend-for-Frontend (BFF) contract BEFORE implementation against a GraphQL checklist (nullability, N+1, cost limits, federation, BFF thinness). Use when designing or modifying a GraphQL schema, a federated subgraph, or a BFF contract. Do not use for a REST contract (use…