x-adversarial-risk

x-adversarial-risk is a skill for Claude Code, Codex from KtKID/x-dev-pipeline. It costs 85 tokens per session (1,847 once invoked), scanned A, original, MIT.

A focused adversarial review of a software specification. It tries to find small counterexamples that would expose incorrect implementations, such as invalid state changes, crashes, duplicate actions, permission mistakes, or concurrent events.

In plain words
What is it for?
Use it to challenge a reviewed specification, update its risk assessment, add high-value failure scenarios, and report evidence gaps before task planning begins.
Why use it?
A specification can look complete while leaving important failure cases untested. This review adds or reuses scenarios that distinguish the intended behavior from common wrong behavior, then validates the change.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present. Also seen: $skill-name invocation.

Part of the x-dev-pipeline plugin — 22 skills shipped together

Good fit Use it to challenge a reviewed specification, update its risk assessment, add high-value failure scenarios, and report evidence gaps before task planning begins.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ktkid/x-dev-pipeline/x-adversarial-risk
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add KtKID/x-dev-pipeline --skill x-adversarial-risk
Clone the repo
git clone --depth 1 https://github.com/KtKID/x-dev-pipeline

Made for: Claude Code, Codex.

Or install x-dev-pipeline, the plugin that ships this one along with the rest of its 22 skills.

Wrote 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.

agentmods badge for x-adversarial-risk

README.md
[![agentmods](https://agentmods.dev/badge/skills/ktkid/x-dev-pipeline/x-adversarial-risk/github.svg)](https://agentmods.dev/skills/ktkid/x-dev-pipeline/x-adversarial-risk)
Your own site
<a href="https://agentmods.dev/skills/ktkid/x-dev-pipeline/x-adversarial-risk"><img src="https://agentmods.dev/badge/skills/ktkid/x-dev-pipeline/x-adversarial-risk/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.

agentmods 80×15 button for x-adversarial-risk

Your own site · 80×15
<a href="https://agentmods.dev/skills/ktkid/x-dev-pipeline/x-adversarial-risk"><img src="https://agentmods.dev/badge/skills/ktkid/x-dev-pipeline/x-adversarial-risk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,847 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00085 $0.01847
Opus 5 $0.00043 $0.00924
Sonnet 5 $0.00017 $0.00369
Haiku 4.5 $0.00009 $0.00185

Measured 2d ago against content hash ed60a193328a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

x-adversarial-risk 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 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/risk_contract.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

evals/x-pipeline-efficiency-workspace/iteration-6/skills/x-adversarial-risk/SKILL.md · 143 lines

How it starts

The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.

x-adversarial-risk

x-spec3 → x-req3 之间执行一次增量审查。目标是找出少量能区分正确实现与常见错误实现的反例,同时保持已有需求语义和 Scenario ID 稳定。

输入与边界

输入为一个 docs/spec/<spec-name>/spec.md。本轮只修改该文件。

Spec 是本轮唯一事实输入。Spec 证据不足以支持新行为时保留现有契约,并在回执中报告证据缺口。项目文件、任务原文、实现代码、QA 报告和脚本源码留给后续独立流程。

references/risk-mistakes.md 是五类通用风险的短示例卡。deepfull 在读取轮次中与 Spec 一起读取;示例卡只提供候选构造方法,适用性与可观察结果均由当前 Spec 决定。

对抗性定义

对抗性检查按以下算法生成候选:

  1. 选择损失最高或最容易被错误实现破坏的不变量。
  2. 写出该不变量成立依赖的前提。
  3. 每次只破坏一个前提,构造最小输入、状态、时序或故障窗口。
  4. 比较正确实现与最可能错误实现的可观察结果。
  5. 现有 Scenario 已能区分两者时复用;仍有区分缺口时才新增。

候选按“影响 × 发生可能性 × 区分能力”排序,优先覆盖状态跳跃、崩溃窗口、重复或乱序、权限边界、敏感数据、并发交错、资源耗尽和部分失败。

风险预算

根据 Spec 已记录事实独立重算 complexity、importance、risk_average 和 review_budget,以重算结果更新 Spec:

分数 complexity 锚点 importance 锚点
1 单点数据改写或简单 CRUD 本地、单用户、内部非核心工具
2 单体校验或少量顺序分支 小范围内部日常能力
3 状态机、复杂分支或外部交互 全用户可用的非核心能力
4 核心高损失链路或多组件一致性 全用户核心链路
5 锁、幂等、跨进程并发、崩溃恢复、多阶段持久化提交或核心算法任一项 资金、隐私、合规或生命线

本地单用户内部 CLI 归入 importance 1;“所有调用者都依赖”描述依赖强度,用户影响范围仍按实际受众评分。预算映射为:

  • average < 3standard
  • 3 <= average < 4deep
  • average >= 4full
  • 任一维度为 4 → 至少 deep
  • 任一维度为 5 → full

预算决定单次推理中的候选搜索深度:

  • standard:由 x-spec3 直接完成,不调用本 skill。
  • deep:逐张检查五类短示例卡,聚焦适用的最高损失不变量,统一生成、去重和排序候选。
  • full:逐张检查五类短示例卡,并增加一个由当前 Spec 独立推导的故障假设,再统一去重和排序。

Scenario 数量由区分缺口决定。已有 Scenario 足够区分正确实现与常见错误实现时直接复用;存在缺口时只增加可改变实现或验证决策的最小 Scenario 集合。

对每张适用示例卡,必须记录一个已有或新增 Scenario ID。候选不适用时记录当前 Spec 中缺少该卡触发信号的具体理由。示例卡 ID 用于追踪覆盖,卡片内容本身不产生需求。

四轮执行契约

第 1 轮:一次读取

调用方使用一个批量工具调用完整读取以下三份内容:

  1. SKILL.md
  2. 目标 Spec。
  3. 与本 skill 同目录的 references/risk-mistakes.md

该批量调用是对抗审查唯一读取轮次。已经由调用方放入本轮上下文的内容直接复用,skill 内不再读取。

这一轮直接读取正文,省略 wcfindrg 索引、分段预览和路径探测。相同文件在本轮保持单次读取。

读取完成后在当前推理中完成:

  • 评分一致性复核。
  • 模板头部格式复核:前七个元数据字段保持 > key: value 形式。
  • 现有 Scenario 覆盖判断。
  • 五张示例卡的适用性、候选反例、覆盖 Scenario、去重和排序。
  • 最终修改集合设计。

第 2 轮:一次集中修改

使用一个 patch 完成全部变化。修改范围只包含:

  1. 评分字段及“风险评分依据”中的必要纠正。
  2. 新 Scenario 直接依赖的不变量或 J-ID。
  3. 对应验收项与测试驱动顺序。
  4. 对抗性审查记录和状态。
  5. 区分缺口要求的最小新增 Scenario 集合。

Read the full file on GitHub · 143 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. 2d ago First seen · 143 lines · 85 tokens per session scan A ed60a193328a

Subscribe to this mod's changes

x-adversarial-risk is a skill published in the GitHub repository KtKID/x-dev-pipeline (12 stars, last pushed 2d ago), licensed MIT. It adds 85 tokens to every session and 1,847 once invoked, about $0.0004 per session on Opus 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-09-09.

Related

Other skills, from other repositories

maintainer-preflight

Use before claiming work is done, before committing, and before opening a PR in this repo — runs the mcp-server test/typecheck/build gates and the committed-bundle rule. Trigger on "done", "ready to commit", "open a PR", or any completion claim.

xzawed/claude-grok-build-plugin · 61 tokens

app-user-story-qa

End-to-end app feature inventory and user-story testing workflow with a canonical tracker. Use when the user asks to audit every feature, derive expected behavior from code, test user journeys, or explicitly fix and retest documented UX or logistical defects.

majiayu000/spellbook · 54 tokens

elegant-architecture

Guides clean architecture design with strict 200-line file limits. Use when starting new features, refactoring large files, or planning module structure. Enforces modular design and real testing.

majiayu000/spellbook · 43 tokens

agent-session-format-check

Verify agent session format compatibility for Agent Sessions. Use when any agent CLI updates, when monitoring flags drift, or when bumping max verified versions (fixtures + docs + tests). Covers session schema, usage/limits tracking, storage backends, and discovery path contracts for all supported agents.

jazzyalex/agent-sessions · 62 tokens

skill-lifeguard

Use when a skill is brittle, drifting, repeatedly failing, or needs a Reliable Skill Contract. Trigger for phrases like skill lifeguard, reliable skill, self-maintaining skill, negative examples, verification checkpoints, drift signals, replay hooks, or failure log to skill patch. Audits or patches skills so…

majiayu000/spellbook · 92 tokens

test-driven-development

Enforces TDD discipline with RED-GREEN-REFACTOR cycle. Use when writing new features, fixing bugs, or refactoring code. Ensures tests genuinely verify behavior.

majiayu000/spellbook · 40 tokens