write-detection-rule

write-detection-rule is a skill for Claude Code, Codex from akasecurity/ai-tc. It costs 0 tokens per session (3,559 once invoked), scanned A, original, Apache-2.0.

A guide for creating and changing JSON security rules for an AI traffic-control rule engine. These rules describe what to detect, how serious it is, and which text or code patterns match.

In plain words
What is it for?
Writing detection rules for personal data, financial information, secrets, health information, code flaws, configuration issues, and other categories.
Why use it?
It helps authors follow the exact rule format, so misspelled or unsupported fields are caught instead of silently ignored.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code.

Good fit Writing detection rules for personal data, financial information, secrets, health information, code flaws, configuration issues, and other categories.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/akasecurity/ai-tc/write-detection-rule
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 akasecurity/ai-tc --skill write-detection-rule
Clone the repo
git clone --depth 1 https://github.com/akasecurity/ai-tc

Made for: Claude Code, Codex.

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 write-detection-rule

README.md
[![agentmods](https://agentmods.dev/badge/skills/akasecurity/ai-tc/write-detection-rule/github.svg)](https://agentmods.dev/skills/akasecurity/ai-tc/write-detection-rule)
Your own site
<a href="https://agentmods.dev/skills/akasecurity/ai-tc/write-detection-rule"><img src="https://agentmods.dev/badge/skills/akasecurity/ai-tc/write-detection-rule/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 write-detection-rule

Your own site · 80×15
<a href="https://agentmods.dev/skills/akasecurity/ai-tc/write-detection-rule"><img src="https://agentmods.dev/badge/skills/akasecurity/ai-tc/write-detection-rule.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,559 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Prompt Injection · line 198
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
How audits are shown
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.00000 $0.03559
Opus 5.5 $0.00000 $0.01424
Sonnet 5.5 $0.00000 $0.00712
Haiku 4.5 $0.00000 $0.00356

Measured 13d ago against content hash 9dd92b07e27c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

write-detection-rule 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 13d 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.

skills/write-detection-rule/SKILL.md · 249 lines

How it starts

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

Skill: write-detection-rule

This skill teaches Claude Code how to write detection rules for the AI Traffic Control rule engine. Read this before creating or modifying anything in rules/. The full rule schema is Rule in packages/schema/src/zod/rule.ts — it is the source of truth for every field below.

Rule file format (specVersion 1)

Every rule is a JSON file named <rule-name>.json inside a pack directory:

{
  "specVersion": 1,
  "id": "<pack-id>/<rule-name>",
  "name": "Human-readable name",
  "category": "pii|financial|secret|phi|code_context|code_flaw|custom|config",
  "severity": "critical|high|medium|low",
  "matcher": { ... },
  "postValidators": ["luhn"],
  "examples": ["example matching string"]
}

A misspelled key fails the parse — it is not dropped

Every object in the rule tree is strict: an unrecognized key is a parse error naming the key, at whatever depth it sits. This holds for the rule itself, for matcher, appliesTo, requiresNearby, the object form of a postValidators entry, and for fixture files including each entry of expectedSpans.

The reason is that the old behaviour was to strip the key and carry on, which is the worst outcome available: the rule still parses, still loads and still fires, with whatever the key was meant to configure simply gone. postValidator for postValidators dropped a false-positive guard. capture_group for captureGroup widened the redacted span from the value to the whole match. windowChar for windowChars left a proximity gate at the 160-character default while the author believed they had narrowed it. None of these produce a failing fixture, so nothing caught them.

So a rule that parses is a rule whose every key was understood. If you get Unrecognized key, check the spelling against Rule in packages/schema/src/zod/rule.ts — the field is real but named something else, or it belongs one level up or down.

Matcher types

keyword — fast literal or phrase match, good for high-recall low-precision terms:

Read the full file on GitHub · 249 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. 13d ago Changed · +15 lines 9dd92b07e27c
  2. 20d ago Changed · +14 lines 3555ba6f33f0
  3. 23d ago Changed · +13 lines a7aae0535125
  4. 26d ago Changed · +3 lines ecffc926b8ed
  5. 1mo ago First seen · 204 lines · 0 tokens per session scan A 54afb528bf6a

Subscribe to this mod's changes

write-detection-rule is a skill published in the GitHub repository akasecurity/ai-tc (13 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 3,559 tokens. 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

OCR Review-to-Approval Loop

Drive a PR to an approved code review by looping OCR's multi-agent review and address steps. Runs /ocr:review then /ocr:address repeatedly until the review verdict is APPROVE, then one final /ocr:address for leftover suggestions, posting every review and every address round to the GitHub PR as comments. Use when the…

spencermarx/open-code-review · 178 tokens

librarian

A memory-maintenance role that reviews temporary notes and promotes well-supported facts into longer-term memory files. It also keeps shared knowledge concise and records what changed.

ryanzhao1011/workframe · 176 tokens

module-init

A setup tool for creating the standard folder and document structure for modules, submodules, and requirements in a project. A module is a group of related functionality; a requirement is a defined piece of work or product need.

ryanzhao1011/workframe · 151 tokens

code-review

A code-review skill that examines changes for requirement fit, correctness, security, maintainability, and performance. It reports findings with risk levels.

ryanzhao1011/workframe · 264 tokens

test-case-design

A test-case planning process that turns acceptance criteria—the conditions a feature must meet—into structured test cases. It covers normal use, expected failures, and edge conditions.

ryanzhao1011/workframe · 223 tokens

material-intake

A planning tool for sorting existing project files into a suitable structure and suggesting a basic and submodule tree. It inventories files, recommends where each group should go, and produces a plan without moving anything.

ryanzhao1011/workframe · 192 tokens