Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

Policy Authoring

Skill by LuthienResearch

Guides developers in writing and changing Luthien gateway policies that intercept and transform Anthropic API traffic. It covers base classes, lifecycle hooks, request state, configuration and tests.

  • Score 67
  • 34 stars
  • Apache-2.0
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install Policy Authoring

Built from the published package, never by AI.

git clone --depth 1 https://github.com/LuthienResearch/luthien-proxy /tmp/luthien-proxy && mkdir -p ~/.claude/skills && cp -r /tmp/luthien-proxy/.claude/skills/policy-authoring ~/.claude/skills/policy-authoring

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install Policy Authoring in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill is an authoring guide for Luthien gateway policies. Policies intercept and transform Anthropic API traffic flowing through the gateway. They are created once at startup and shared across concurrent requests. They implement four lifecycle hooks that the executor calls around backend I/O.

The guide explains how to choose a base class: TextModifierPolicy, SimplePolicy, or BasePolicy with AnthropicHookPolicy. It covers request-scoped state through PolicyContext, Pydantic configuration, YAML setup, streaming event rules, and pytest patterns. It is aimed at developers writing or changing policies for the Luthien gateway.

Written from the project's SKILL.md and checked against it.

What it can do

  • Base class selectionExplains when to use TextModifierPolicy, SimplePolicy, or BasePolicy with AnthropicHookPolicy.
  • Lifecycle hooksDescribes the request, response, stream event and stream complete hooks called around backend I/O.
  • Request-scoped stateShows how to store per-request data with PolicyContext instead of on the policy instance.
  • Pydantic configurationShows how to define policy config models and load them from YAML.
  • Streaming event handlingExplains filtering, passing through and expanding Anthropic streaming events.
  • Critical rulesLists protocol rules such as block ordering, single finish_reason and preflight detection.
  • Test patternsProvides pytest examples for testing policies with PolicyContext.for_testing.
  • File placementLists where policy modules, tests and config entries belong in the project.

What you need

  • Python
  • uv
  • Luthien gateway

Try asking

  • Write a Luthien policy that blocks a specific tool call
  • Show me how to create a TextModifierPolicy that uppercases text
  • Explain how PolicyContext stores request state in a policy

Good to know

  • Policies are singletons, so request data must not be stored on self
  • Mutable list, dict and set containers on the policy instance are rejected

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .claude/skills/policy-authoring/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to Policy Authoring

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

Policy Authoring: common questions

What base class should I use for a Luthien policy?

Use TextModifierPolicy for text-only changes, SimplePolicy when complete content blocks such as tool calls are needed, and BasePolicy with AnthropicHookPolicy for per-event streaming control.

Where should request-specific data go in a policy?

It should go in PolicyContext through get_request_state, not on self, because policies are shared across all concurrent requests.

Does the guide include example policies?

Yes. It references uppercase_policy.py as a simple TextModifierPolicy and first_turn_banner_policy.py as a SimplePolicy with request-scoped state.

How do I install Policy Authoring?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is Policy Authoring free?

The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.

Is Policy Authoring safe to use?

It scores 67 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to Policy Authoring?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

Policy Authoring Install

Add to stack

Loading.