invariant-extract

invariant-extract is a skill for Claude Code from XRenSiu/claude-code-forge. It costs 264 tokens per session (5,097 once invoked), scanned A, original, MIT.

A workflow for recovering the rules that a software area must always obey from records of past failures. These rules are checked across every run of the system.

In plain words
What is it for?
Use it to propose, review, and verify permanent system invariants based on failure history.
Why use it?
Important rules are often not written down, and code that has not failed yet does not prove that those rules are protected.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the ai-dlc plugin — 30 skills, 5 agents shipped together

Good fit Use it to propose, review, and verify permanent system invariants based on failure history.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xrensiu/claude-code-forge/invariant-extract
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 XRenSiu/claude-code-forge --skill invariant-extract
Clone the repo
git clone --depth 1 https://github.com/XRenSiu/claude-code-forge

Made for: Claude Code.

Or install ai-dlc, the plugin that ships this one along with the rest of its 30 skills, 5 agents.

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 invariant-extract

README.md
[![agentmods](https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/invariant-extract/github.svg)](https://agentmods.dev/skills/xrensiu/claude-code-forge/invariant-extract)
Your own site
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/invariant-extract"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/invariant-extract/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 invariant-extract

Your own site · 80×15
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/invariant-extract"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/invariant-extract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 264 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,097 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.00264 $0.05097
Opus 5.5 $0.00106 $0.02039
Sonnet 5.5 $0.00053 $0.01019
Haiku 4.5 $0.00026 $0.00510

Measured 1mo ago against content hash 56682728a778, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

invariant-extract 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.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/verify_card.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.

plugins/ai-dlc/skills/invariant-extract/SKILL.md · 263 lines

How it starts

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

invariant-extract

Recover a Territory's □ resident invariants — the rules every Run under it must hold, distinct from a single Run's done_when (◊). This skill describes the world those invariants live in, the criteria that tell a real one from a fake, the primitives that make extraction mechanical where it can be, and the gates a candidate must clear before it lands. It does not prescribe a step order — the engine sequences the work; what follows are the gaps to fill and the gates that must hold, in any order.

术语映射(在 AI-DLC 里怎么读这份文件)

本 skill 引自 qanat 仓库,正文保留其领域词汇;在 AI-DLC 里按下表读。Territory 与 Run 两行是承重的: 按字面读 dos.yaml 的 Run(一次 issue → PR 的交付)会把"这个插件自己被改"的那些失败全部投影为 ∅, 溯因通道当场掏空。

原文 AI-DLC 里的对应物
Territory(领地) 一块有单一责任的区域:一个 dos.yaml 的 bounded_contexts.current_context,或一个插件 / 一个环 / 一个 skill 族。"插件即领地"是合法读法——它有 name、有 kpi、有 scope
Territory.name / kpi 该区域的一句话责任 + 它的直接度量。插件领地:README 的一句话定位 + 它守的东西(每步产物可检或被人签的门挡住)
Run(一次执行) 该领地的任一次被调用,不只是交付。对插件领地有两类:① 交付 Run = .aidlc/<slug>/ 一个 slug;② dogfood Run = 用这套 skill 改这套 skill 自己的一次。□ 要活得过两类,这是 --cross-territory 之外最容易漏的宽度
失败记忆 failure.memory 见下面「接线」的清单:ledger.md 的 fail / deviation 行、escape-defects.md、G3 记录、dogfood 的 skill-issues.md。不含 gate.json 的 fix_list(那是登记的缺口,见下)
obstacle_ref 上面任一条的稳定 id:ledger:fail#3、trace 事件 id(ev-0005)、skill-issues.md 的 I-nn、逃逸缺陷编号
R001 / R002 / R00x dos.yaml rules 段的 id(AI-DLC:R001 单生产者、R002 单契约 schema …)。qanat 原文里 R001=评估者隔离、R002=闸门资产只能人签,在本插件里不要这样读——那两条在 AI-DLC 是「信息隔离」与「G2/G3 人签」,不是编号
立法收件箱 / 立法者签字 assets/change_proposal.md 变更提案 → G2(lock_done_when.py sign);账本 ledger.md 记 propose
MemoryAsset 归档目录 specs/<slug>/ 里的测试集 / rubric;failure_memory 见上
daemon / 运行时 本地测试与 CI;/ai-dlc 的 acceptance 阶段

The gap (why the engine can't just read them off the code)

A composite of three atoms: Judgment (what counts as a real □), Control (the propose-and-sign gate, role separation), Capability (the mechanical scan + the exit verifier). The Knowledge it needs (KAOS, Model Spec) it routes to, below.

Read the full file on GitHub · 263 lines

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. 1mo ago Changed · +15 lines 56682728a778
  2. 1mo ago Changed · +3 lines 14e248decb08
  3. 1mo ago Changed · +52 lines 1eaf74e0777e
  4. 2mo ago First seen · 193 lines · 264 tokens per session scan A 8294016cd087

Subscribe to this mod's changes

invariant-extract is a skill published in the GitHub repository XRenSiu/claude-code-forge (2 stars, last pushed 1mo ago), licensed MIT. It adds 264 tokens to every session and 5,097 once invoked, about $0.0011 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-31.

Related

Other skills, from other repositories

systematic-debugging

Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.

open-metadata/OpenMetadata · 37 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

cwv-optimizer

Diagnose and fix Core Web Vitals issues on AEM Edge Delivery Services pages. Goes deeper than generic CWV advice by understanding EDS-specific performance patterns including the 100KB LCP budget, E-L-D loading phases, block rendering behavior, and third-party script impact. Produces specific fixes for LCP, CLS, and…

adobe/skills · 112 tokens

incident-response-incident-response

Coordinate production incident triage, mitigation, investigation, recovery, and follow-up. Use when responding to outages or other incidents that require structured operational coordination.

rmyndharis/antigravity-skills · 36 tokens

ci-fixer

CI failures - read error, minimal fix, verify.

sipyourdrink-ltd/bernstein · 15 tokens

diagnosing-missing-recordings

Diagnoses why a session recording is missing or was not captured. Use when a user asks why a session has no replay, why recordings aren't appearing, or wants to troubleshoot session replay capture issues for a specific session ID or across their project. Covers SDK diagnostic signals, project settings, sampling…

PostHog/posthog · 76 tokens