Cc Api Proxy Safety logo

Cc Api Proxy Safety

CommunityPopular
doccker
cc-api-proxy-safety

网关/代理/WAF/CDN 中间件响应判定与关键词匹配安全规范。适用于 proxy/gateway/waf/cdn/nginx/openresty/rewrite/redirect 等代码,防止把正常长正文中的 Cloudflare、502、bad gateway、error 等技术术语误判为上游错误。

Overview

Publisherdoccker
Repositorycc-use-exp
Skill namecc-api-proxy-safety
Stars
1.1K
Forks
116
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by doccker on GitHub. Read the source before you install it.

Installation

Install the Cc Api Proxy Safety AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/doccker/cc-use-exp/tree/main/.codex/skills/cc-api-proxy-safety
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/doccker/cc-use-exp.git /tmp/cc-use-exp
mkdir -p .claude/skills
cp -r /tmp/cc-use-exp/.codex/skills/cc-api-proxy-safety .claude/skills/cc-api-proxy-safety
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cc Api Proxy Safety in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cc Api Proxy Safety on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cc Api Proxy Safety is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

API 代理响应判定安全规范

网关、反向代理、WAF、CDN 中间件实现响应判定时,不要只靠正文关键词判断上游是否失败。关键词可以作为线索,不能替代 HTTP 状态、响应头、内容类型和业务响应结构。


核心原则

按以下优先级判定响应性质:

  1. 传输层和 HTTP 状态:连接失败、超时、非 2xx/3xx 状态码优先作为错误证据。
  2. 响应头和内容类型:Content-Type、Server、Via、CF-Ray、认证/限流头等比正文关键词更可靠。
  3. 业务响应结构:先解析 JSON envelope、error code、message、data 等契约字段。
  4. 正文启发式:只有在无法按结构判断时,才使用关键词或 HTML 片段,并限制长度和上下文。

禁止:对完整业务正文做纯 strings.Contains(lowerBody, "cloudflare") / "bad gateway" / "error" 判错。


强弱特征拆分

强特征

强特征应同时具备明确上下文,例如:

  • HTTP 状态为 502/503/504/429,且正文是上游错误页或错误 envelope。
  • Content-Type: text/html,正文包含错误页标题,且响应头或状态也指向 CDN/WAF/网关。
  • 结构化 JSON 明确给出上游错误字段,例如 {"error": {"type": "upstream_error"}}。

不要把单个短片段直接当强特征。<html、cf-ray:、cloudflare、502 bad gateway 都可能出现在技术文章、日志展示或用户输入中。

弱特征

以下内容只能作为弱证据:

  • CDN/网关品牌词:cloudflare、openresty、nginx
  • 短错误短语:bad gateway、502 bad gateway、upstream error
  • 通用错误词:error、reconnecting、too many requests

弱特征只有在满足以下条件时才可参与判错:

  • 响应体很短,例如 <= 512 字节。
  • 响应结构不是合法业务 payload。
  • 或者它和错误 HTTP 状态、错误响应头、错误 content-type 同时出现。

判定模板

go
func isUpstreamFailure(resp *http.Response, body []byte) bool {
    if resp == nil {
        return true
    }

    status := resp.StatusCode
    contentType := strings.ToLower(resp.Header.Get("Content-Type"))

    if status >= 500 || status == http.StatusTooManyRequests {
        low := strings.ToLower(string(body))
        return looksLikeGatewayError(contentType, low, len(body))
    }

    if isValidBusinessPayload(contentType, body) {
        return false
    }

    if len(body) > 512 {
        return false
    }

    low := strings.ToLower(string(body))
    if len(body) <= 512 && containsWeakGatewayKeyword(low) {
        return true
    }

    return false
}

实现时把 looksLikeGatewayError、isValidBusinessPayload、containsWeakGatewayKeyword 拆开测试,不要把所有条件写成一个大 if。


场景策略

场景策略
HTTP 非 2xx/3xx优先按状态码和响应头判错,正文用于补充分类
业务 JSON 响应先解析契约字段,不要因为 data 或正文里有技术词就判错
长文本/文章/模型输出不允许仅凭弱关键词判错
短错误消息可使用弱关键词,但仍应结合调用上下文
流式响应等待完整事件、完整 JSON chunk 或明确错误事件后再判定

回归测试

至少覆盖:

  • 长正文包含 Cloudflare / 502 Bad Gateway / bad gateway 技术术语时不误判。
  • 短响应体只有 502 Bad Gateway 且没有业务结构时判为错误。
  • status=200 且合法业务 JSON 中出现弱关键词时不误判。
  • status=502 且 HTML 错误页时判为错误。
  • streaming 半截 chunk 命中关键词时不立即判错。

与相关 skill 的边界

skill关系
cc-external-system-debugging上游方法论:遇到 CDN/WAF/代理异常时先抓真实 request/response
cc-api-design-safety本 skill 关注代理判定逻辑,不替代 API envelope 设计规范
cc-ops-safety本 skill 不处理运维审批、危险命令或生产配置变更

规则溯源

> 📋 本回复遵循:`cc-api-proxy-safety` - [章节]

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Cc Api Proxy Safety AI skill do?

网关/代理/WAF/CDN 中间件响应判定与关键词匹配安全规范。适用于 proxy/gateway/waf/cdn/nginx/openresty/rewrite/redirect 等代码,防止把正常长正文中的 Cloudflare、502、bad gateway、error 等技术术语误判为上游错误。

Why use Cc Api Proxy Safety on TypingMind?

Because you install it once and use it with any model. Cc Api Proxy Safety is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cc Api Proxy Safety in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/doccker/cc-use-exp/tree/main/.codex/skills/cc-api-proxy-safety. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Cc Api Proxy Safety?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cc Api Proxy Safety?

As many as you like. As long as a model supports skills, you can use Cc Api Proxy Safety with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cc Api Proxy Safety AI skill free?

It is published on GitHub by doccker. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇