hexgate: Skill for Claude Code

.claude/skills/write-policy/SKILL.md

write-policy is a skill for Claude Code from HexamindOrganisation/hexgate. It costs 128 tokens per session (3,271 once invoked), scanned A, original, MIT.

A workflow for turning a plain-language request into a Hexgate YAML policy. The policy controls tool use, arguments, callers, budgets, network access, agent access, roles, and reusable policy modules.

In plain words
What is it for?
Use it to write or change Hexgate access policies, restrict tools and network connections, define roles, and verify policy decisions with test cases.
Why use it?
It helps turn security rules into a machine-checkable file instead of leaving them as informal instructions. It validates the result and uses dry-run cases to check that the rules behave as intended.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is HexamindOrganisation/hexgate's own configuration. It tells Claude Code how to work on hexgate 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 hexgate configures →

Reuse

Borrowing it

Nothing to install: this file belongs to HexamindOrganisation/hexgate. 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/HexamindOrganisation/hexgate/main/.claude/skills/write-policy/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/HexamindOrganisation/hexgate

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 write-policy

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/hexamindorganisation/hexgate/write-policy"><img src="https://agentmods.dev/badge/skills/hexamindorganisation/hexgate/write-policy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 128 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,271 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.00128 $0.03271
Opus 5.5 $0.00051 $0.01308
Sonnet 5.5 $0.00026 $0.00654
Haiku 4.5 $0.00013 $0.00327

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

Security

Grade A, and why

write-policy 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 8d 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/skills/write-policy/SKILL.md · 161 lines

How it starts

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

Write a Hexgate policy

The user describes intent in prose; you produce a policy YAML that validates, plus a set of dry-run cases that prove it does what they asked. A policy you have not run through the CLI is not finished.

Sources of truth — read the relevant one before using a feature you are unsure of, and prefer them over this file if they disagree:

Topic File
Document shape, modes docs/policy/yaml-shape.mdx
Constraint grammar (full reference) docs/policy/constraints.mdx
Worked condition examples docs/policy/writing-conditions.mdx
Roles, policies/ dir, inheritance docs/concepts/user-scope.mdx
Egress docs/concepts/egress.mdx
Admission / agent reach docs/concepts/agent-level-enforcement.mdx
Cross-run quotas, fail mode docs/policy/constraints.mdx (Agent usage), docs/adr/R-USAGE-001-cross-run-usage-is-soft-and-fails-open.md
Modules (boundaries / capabilities) docs/internals/policy-modules.md
CLI docs/cli/policy.mdx
Schema (authoritative) hexgate/security/models.py, hexgate/security/constraints.py
Examples examples/demo_policy.yaml, deploy/demo_policies/

Workflow

  1. Pin down the inputs. You need:

    • the tool names and their argument names/types. Take these from the agent code or its AgentManifest. Otherwise, use what the requester named in their prompt, or ask them;
    • the roles (who calls);
    • the caller attributes available as ctx.*;
    • the shape to write in: a single file, a policies/ dir, or modules.

    Never invent a tool or argument name. A typo'd tool is silently default-denied, and a typo'd arg fails closed. If a name is unknown, ask, or state the assumption explicitly. If the agent's manifest JSON is available, pass it to validate (step 4), which flags tool, skill and argument names the agent doesn't have.

  2. Restate the intent as a decision table before writing YAML. List role × tool × condition → ALLOW / DENY / APPROVAL_REQUIRED, plus what happens to anything unlisted. Surface every ambiguity here, e.g. "refunds up to 500 — inclusive? which currency?".

  3. Write the YAML. Start deny-by-default and grant the minimum. Put each constraint at the narrowest scope that works (see Where constraints live).

  4. Validate until clean:

    uv run hexgate policy validate <file> --max-severity warning [--manifest m.json]
    

    If uv fails building biscuit-python on Python 3.14, add --python 3.13. For a module tree, use uv run hexgate policy check --dir <root> [--manifest m.json] and uv run hexgate policy resolve --dir <root>.

  5. Prove it. Turn every row of the decision table into a policy test run, including the negative cases and the boundary values (== limit, limit + 1, missing arg, wrong type):

    uv run hexgate policy test <file> --role billing --tool refund_order \
        --args '{"amount": 500, "currency": "USD"}' [--attributes '{"department": "finance"}'] \
        [--agent-usage '{"invocations_1h": 100}'] [--user-usage '{"invocations_1h": 50}']
    

    Test a usage cap at limit - 1 and at limit, with --agent-usage for agent_usage.* and --user-usage for user_usage.* (a path left out reads zero). Also use --roles a,b to check a multi-role caller, where the most permissive role wins. Pass --engine wasm on every policy test run, since that engine matches production. If it fails because OPA itself is unusable (e.g. opa not found, HEXGATE_OPA_BIN points to…, below the tested floor), drop the flag and say in the report that the production engine went unchecked, and why; any other wasm error is a problem in the policy to fix. Every result must match the table. When one doesn't, fix the policy, not the table, unless the table was wrong.

  6. Report. Give the YAML, the decision table with each case's actual CLI result, and any assumptions or residual risks, e.g. "egress on HTTPS is host-level only".

Read the full file on GitHub · 161 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. 8d ago Changed · +6 lines · +3 tokens per session e4cf4b36e943
  2. 13d ago Changed · -1 lines d2c3ffb61829
  3. 14d ago Changed · +9 lines · +9 tokens per session 6f44f67ed662
  4. 16d ago Changed · +1 lines 21c60ac942ba
  5. 22d ago Changed 1d424587dc6b
  6. 23d ago Changed 53806fe1b4d3
  7. 1mo ago First seen · 146 lines · 116 tokens per session scan A 3f88b526978a

Subscribe to this mod's changes

write-policy is a skill published in the GitHub repository HexamindOrganisation/hexgate (23 stars, last pushed today), licensed MIT. It adds 128 tokens to every session and 3,271 once invoked, about $0.0005 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-09-25.

Related

Other skills, from other repositories

theauth

Install and use theAuth (@glinr/theauth), the TypeScript auth SDK for AI agents and humans. Use when adding agent identity, scoped permissions, delegation, audit logs, human sign-in plugins, or an MCP OAuth 2.1 authorization server to a Node, Bun, Deno or edge project.

glincker/theauth · 67 tokens

agent-harness-fault-injection

Use when an agent workflow needs deterministic recovery evidence for sandbox, MCP/tool, worker, checkpoint, memory, or orchestration failures.

sickn33/agentic-awesome-skills · 34 tokens

requirements-writer

Use when converting PM intake into a slice SPEC.md with observable acceptance outcomes, explicit scope, and advisory sibling build dependencies.

mvschwarz/openrig · 28 tokens

refocusing

Use when a long-running agent may have lost the product outcome, when context was compacted, when work has crossed a major boundary, or when a fresh path-based trace is needed before the next consequential action. Not for fresh-session orientation, waking an idle seat, or checkpoints.

mvschwarz/openrig · 59 tokens

orchestration-team

Use when coordinating assignments, selected review boundaries, or blocked work across a rig.

mvschwarz/openrig · 21 tokens

oversight-team

Use when you are a seat on the oversight pod (a standing monitor-mode rig that keeps OTHER rigs healthy), configuring or running the drift detectors, or choosing whether to intervene vs escalate. Covers the pull-not-poll posture, the v0 detectors (premature-park, process-drift, off-task, token-burn), the intervention…

mvschwarz/openrig · 117 tokens