coding: Command for Claude Code

.claude/commands/constraints.md

constraints is a command for Claude Code from fwornle/coding. It costs 75 tokens per session (722 once invoked), scanned A, original, MIT.

A command-line interface for viewing and editing this project's coding rules, called constraints, and checking files against them.

In plain words
What is it for?
Use it to list active rules, check a file or code snippet, review violation history, and add or amend project constraints.
Why use it?
It shows why a coding action was blocked and lets you find violations before writing or changing files.

Command for Claude Code

Written for Claude Code: PreToolUse hook event.

This is fwornle/coding's own configuration. It tells Claude Code how to work on coding itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything coding configures →

Reuse

Borrowing it

Nothing to install: this file belongs to fwornle/coding. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/fwornle/coding/main/.claude/commands/constraints.md
Clone the repo
git clone --depth 1 https://github.com/fwornle/coding

Made for: Claude Code.

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 constraints

README.md
[![agentmods](https://agentmods.dev/badge/commands/fwornle/coding/constraints/github.svg)](https://agentmods.dev/commands/fwornle/coding/constraints)
Your own site
<a href="https://agentmods.dev/commands/fwornle/coding/constraints"><img src="https://agentmods.dev/badge/commands/fwornle/coding/constraints/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 constraints

Your own site · 80×15
<a href="https://agentmods.dev/commands/fwornle/coding/constraints"><img src="https://agentmods.dev/badge/commands/fwornle/coding/constraints.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 722 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.00075 $0.00722
Opus 5.5 $0.00030 $0.00289
Sonnet 5.5 $0.00015 $0.00144
Haiku 4.5 $0.00007 $0.00072

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

Security

Grade A, and why

constraints 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 16d 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.

.claude/commands/constraints.md · 64 lines

How it starts

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

/constraints

The constraints CLI (bin/constraints) is the query and authoring surface for this project's guardrails. It runs in-process on the host, reusing ConstraintEngine — the same code the PreToolUse / UserPromptSubmit hooks run — so it works even when coding-services is down.

  • Rules: $CODING_REPO/config/constraints/constraint-monitor.yaml (single canonical file, no cwd-walking; its own directory so the container mounts the dir, not the file)
  • Enforcement: the hooks, not this CLI. This CLI inspects; the hooks block.

When to use

  • Before writing a file you suspect touches a rule (parallel versions, console.*, PlantUML naming, backup files) — cheaper than being blocked and retrying.
  • After a hook blocks a tool call, to read the rule text and decide whether to fix or override.
  • When the user asks "what constraints are active?", "why did that get blocked?", or asks to add or amend a rule.

Commands

constraints list                       # every rule: ● enabled / ○ disabled, severity, message
constraints list --enabled-only

constraints check --file src/foo.ts    # read the file, check it, print violations
constraints check --file src/foo.ts --content 'const a = 1'   # check a snippet, keep the path label
cat buffer.ts | constraints check --file src/foo.ts           # stdin wins; --file is the path label

constraints status                     # compliance score, risk level, active violation count
constraints violations --limit 20      # recent violations and their metrics

constraints update rules.json          # array of {id, pattern, message, severity, enabled}
constraints update -                   # ...or the same JSON on stdin

--json on any command emits the raw payload. --verbose re-enables the engine's stderr logging.

Reading the output

check exits 1 when it finds an error or critical violation and 0 otherwise, so it composes directly:

constraints check --file src/foo.ts || echo "fix before writing"

Read the full file on GitHub · 64 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. 16d ago Changed ae9edddbdf9d
  2. 1mo ago First seen · 64 lines · 75 tokens per session scan A 3009653539db

Subscribe to this mod's changes

constraints is a command published in the GitHub repository fwornle/coding (2 stars, last pushed today), licensed MIT. It adds 75 tokens to every session and 722 once invoked, about $0.0003 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.