运维同步
- 作者仓库星标 0
- 作者更新于 实时读取
- 作者仓库 sub2api
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @youxuanxue · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: tokenkey-stage0-edge-ip-rotation
description: >- The deploy workflow now owns rotation end-to-end; this skill is a thin wrapper that decides w…
category: 通用
runtime: 无特殊运行时
---
# tokenkey-stage0-edge-ip-rotation 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Why this is short now / One canonical invocation / Two operator steps left (intentional)”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Why this is short now / One canonical invocation / Two operator steps left (intentional)”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件。
先用一个小任务确认它会围绕“Why this is short now / One canonical invocation / Two operator steps left (intentional)”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: tokenkey-stage0-edge-ip-rotation
description: >- The deploy workflow now owns rotation end-to-end; this skill is a thin wrapper that decides w…
category: 通用
source: youxuanxue/sub2api
---
# tokenkey-stage0-edge-ip-rotation
## 什么时候使用
- 把通用方向的常用动作沉淀成 Agent 可调用的技能 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Why this is short now / One canonical invocation / Two operator steps left (intentional)」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "tokenkey-stage0-edge-ip-rotation" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Why this is short now / One canonical invocation / Two operator steps left (intentional)
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} TokenKey: rotate an edge gateway's egress EIP
EC2/CFN only. Lightsail Static IP 轮换见 tokenkey-stage0-edge-lightsail-ip-rotation(uk1 已迁 Lightsail,勿对本 skill dispatch rotate_egress_ip)。
v2 (OPC). Replaces the v1 manual multi-step nano-probe / CFN-IMPORT runbook. The deploy workflow now owns rotation end-to-end; this skill is a thin wrapper that decides which workflow input to pass, not a sequence of bash commands.
Polluted IP registry:
deploy/aws/stage0/edge-polluted-ips.json
(human-readable table in
docs/deploy/tokenkey-edge-ip-history.md).
Why this is short now
The earlier multi-step procedure existed because the CFN template treated the
EIP as a stack-managed resource (AWS::EC2::EIP + EIPAssociation with
Retain). Manual EIP swaps then desynced template-vs-live and required
detach + IMPORT to recover; that recovery sequence (specifically the IMPORT
step on the EIPAssociation) is what silently disconnected the SSM agent on
edge-uk1 on 2026-05-22.
The template has since been refactored so the EIP is an external
EipAllocationId parameter, not a resource. CloudFormation does
disassociate-old + associate-new natively when the parameter changes — the
instance, its IAM profile, and its SSM agent are never touched. The entire
class of "drift" disappears, and so does this skill's previous bulk.
One canonical invocation
gh workflow run deploy-edge-stage0.yml \
-f edge_id=<id> \
-f operation=rotate_egress_ip \
-f confirm_stack=tokenkey-edge-<id>-stage0 \
-f rotation_reason='<short reason>' \
[-f candidate_allocation_id=eipalloc-XXXX]
edge_id matches a key in
deploy/aws/stage0/edge-targets.json
with deployable=true (normalize edge-uk1 → uk1). If the edge is
Lightsail-authoritative (uk1 / us2 / … in
edge-targets-lightsail.json),
stop and use tokenkey-stage0-edge-lightsail-ip-rotation instead.
rotation_reason is required and ends up on
the new EIP's tokenkey:replaces-reason tag and in the run summary's
edge-polluted-ips.json snippet.
candidate_allocation_id is optional. If unset, the workflow allocates a
fresh EIP and refuses any allocation that lands on a known-polluted IP. Set
it only when the operator has pre-vetted a specific allocation outside the
workflow (rare — only useful if the auto path keeps drawing dirty IPs).
What the workflow does, in order:
- Reads the stack's current
EipAllocationId(= rollback target). - Allocates a fresh EIP unless
candidate_allocation_idis set; cross-checks againstedge-polluted-ips.jsonand re-allocates if dirty. aws cloudformation deploy --parameter-overrides EipAllocationId=<new>— atomic CFN swap.- Polls
ssm:DescribeInstanceInformationuntilPingStatus=Online(post-mutation invariant; uk1-2026-05-22 was the incident that motivated this gate). - Runs the pollution probe via SSM on the edge itself (no throwaway nano): confirms outbound IP, then curls Anthropic / OpenAI / Google with dummy keys looking for
403 + Cloudflare HTML(= polluted) vs401/400 + provider-shaped JSON(= clean). - On polluted → automatic revert (CFN update-stack back to OLD_ALLOC) + release the freshly-allocated EIP (only if the workflow itself allocated it).
- On clean → curl
https://<domain>/healthvia--resolve <domain>:443:<new_ip>to prove the data plane survives end-to-end on the new IP before DNS propagation. - Emits a step summary with: old/new IP, retired-IP JSON snippet ready to paste into
edge-polluted-ips.json, and the Porkbun A-record change to make.
Two operator steps left (intentional)
- DNS at Porkbun (or your provider): change the A record for
api-<id>.tokenkey.devto the new IP. The workflow does not automate this because the Porkbun API token is not in repo secrets; the run summary prints the exact transition. - Append the retired IP to
edge-polluted-ips.jsonso future rotations refuse to re-allocate it. The run summary prints a paste-ready JSON entry. After DNS has propagated (~1 hour) you mayaws ec2 release-addressthe old allocation and setreleased_on.
Everything else is mechanized.
First-time migration (per stack)
A stack that still has the v1 shape (ElasticIP + EIPAssociation with Retain,
no EipAllocationId parameter) cannot accept operation=rotate_egress_ip
yet. Migrate it once:
# Dry run (read-only):
bash deploy/aws/stage0/migrate-edge-eip-to-parameter.sh <edge_id>
# Apply (changes live CFN):
bash deploy/aws/stage0/migrate-edge-eip-to-parameter.sh <edge_id> --apply
The migration keeps the same physical EIP — the public IP does NOT change.
It only converts the CFN representation from "EIP is in the template" to "EIP
is referenced by allocation-id parameter". After the migration, the stack
accepts operation=rotate_egress_ip and the rest of this skill is in force.
Stop-the-line rules
The workflow itself enforces the data-plane invariants. This skill must still refuse when:
- The normalized
edge_idis not a key indeploy/aws/stage0/edge-targets.jsonwithdeployable=true, or the edge is Lightsail-authoritative inedge-targets-lightsail.json(use lightsail-ip-rotation skill). rotation_reasonis empty or only whitespace.- The target stack has not been migrated yet (
describe-stacksshows noEipAllocationIdparameter) — direct the operator tomigrate-edge-eip-to-parameter.shfirst. operation=rotate_egress_ipis requested againsttokenkey-prod-stage0(the production gateway). Prod IP rotation has different blast radius (active client connections) and is intentionally not covered by this skill.
The workflow handles the rest as mechanical gates — operator does not need this skill to babysit candidate allocation, probe results, or revert.
Reporting contract
The workflow's step summary is the contract. Nothing else needs to be produced. If you need to summarize for a chat caller, mirror the values from the summary:
edge_id: <id>
region: <aws-region>
old_ip / old_alloc: <ip> / <eipalloc-…>
new_ip / new_alloc: <ip> / <eipalloc-…>
status: rotated | reverted-polluted | revert-failed
follow_up:
- update DNS A-record at Porkbun: <domain> → <new_ip>
- append retired IP entry to deploy/aws/stage0/edge-polluted-ips.json
- (after ~1h DNS propagation) aws ec2 release-address --allocation-id <old_alloc>
Out of scope
- Production gateway IP rotation (
tokenkey-prod-stage0). - Cross-region "clean EIP pool" maintenance. If the auto path repeatedly draws polluted IPs in a region, the answer is a different region (or an upstream Trust & Safety ticket), not a pre-warmed pool — adding a pool is premature.
- DNS automation (Porkbun API). Documented as a known follow-up; would be a separate skill + a separate secret if/when wanted.
v1 (legacy) reference
Retired polluted IPs are recorded in
edge-polluted-ips.json
when dispatching rotate_egress_ip (same PR as the rotation).
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核