constitutional-ai

constitutional-ai is a skill for Claude Code, Codex from davila7/claude-code-templates. It costs 58 tokens per session (1,993 once invoked), scanned A, original, MIT.

A training method for making AI systems less harmful through self-criticism and revision. It uses a set of principles, called a constitution, followed by feedback generated by another AI system.

In plain words
What is it for?
Use it to plan safety-alignment training, self-critique workflows, and reinforcement learning from AI feedback.
Why use it?
It reduces the need for people to label every harmful example by having models review and revise their own answers. It gives a structured way to train for helpful, honest, and harmless behaviour.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to plan safety-alignment training, self-critique workflows, and reinforcement learning from AI feedback.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davila7/claude-code-templates/safety-alignment-constitutional-ai
About the project

Claude Code Templates is a command-line tool and catalogue for configuring Anthropic’s Claude Code with agents, commands, settings, hooks, integrations, skills, and project templates. Developers use it to browse and install reusable components for their coding workflows. The catalogue includes many of these Claude Code components.

davila7/claude-code-templates · 30,566 stars · on GitHub · aitmpl.com

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 davila7/claude-code-templates --skill safety-alignment-constitutional-ai
Clone the repo
git clone --depth 1 https://github.com/davila7/claude-code-templates

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 constitutional-ai

README.md
[![agentmods](https://agentmods.dev/badge/skills/davila7/claude-code-templates/safety-alignment-constitutional-ai/github.svg)](https://agentmods.dev/skills/davila7/claude-code-templates/safety-alignment-constitutional-ai)
Your own site
<a href="https://agentmods.dev/skills/davila7/claude-code-templates/safety-alignment-constitutional-ai"><img src="https://agentmods.dev/badge/skills/davila7/claude-code-templates/safety-alignment-constitutional-ai/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 constitutional-ai

Your own site · 80×15
<a href="https://agentmods.dev/skills/davila7/claude-code-templates/safety-alignment-constitutional-ai"><img src="https://agentmods.dev/badge/skills/davila7/claude-code-templates/safety-alignment-constitutional-ai.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,993 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 pass 7 Sept 2026
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.00058 $0.01993
Opus 5 $0.00029 $0.00996
Sonnet 5 $0.00012 $0.00399
Haiku 4.5 $0.00006 $0.00199

Measured 6d ago against content hash 186267074ebd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

constitutional-ai 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 6d 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.

Origin

Copies of this mod

5 near-identical copies found in the catalogue:

cli-tool/components/skills/ai-research/safety-alignment-constitutional-ai/SKILL.md · 291 lines

How it starts

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

Constitutional AI - Harmlessness from AI Feedback

Quick start

Constitutional AI (CAI) trains models to be harmless through self-critique and AI feedback, without requiring human labels for harmful outputs.

Key concept: Models learn to critique and revise their own responses using a "constitution" (set of principles).

Two phases:

  1. Supervised Learning (SL): Self-critique + revision
  2. Reinforcement Learning (RL): RLAIF (RL from AI Feedback)

Constitution example:

Principles:
1. Choose the response that is most helpful, honest, and harmless
2. Avoid responses that are toxic, racist, or sexist
3. Prefer responses that explain objections rather than refuse
4. Choose responses that are thoughtful and nuanced

Common workflows

Workflow 1: Supervised learning phase (self-critique + revision)

Step 1: Generate initial responses:

from transformers import pipeline

generator = pipeline("text-generation", model="base-model")

prompts = [
    "How do I hack a website?",
    "Write something offensive about a group.",
    "Help me cheat on my exam."
]

initial_responses = generator(prompts, max_length=200)

Step 2: Self-critique with constitution:

critique_prompt = """
Given the question:
{question}

And the response:
{response}

Constitution:
1. Choose responses that are helpful, honest, and harmless
2. Avoid toxic, racist, or sexist content
3. Explain objections rather than refuse

Identify any ways this response violates the constitution:
"""

critiques = generator(
    [critique_prompt.format(q=q, r=r) for q, r in zip(prompts, initial_responses)]
)

Step 3: Revision based on critique:

revision_prompt = """
Question: {question}
Original response: {response}
Critique: {critique}

Please revise the response to better align with the constitution:
"""

revised_responses = generator(
    [revision_prompt.format(q=q, r=r, c=c)
     for q, r, c in zip(prompts, initial_responses, critiques)]
)

Read the full file on GitHub · 291 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. 6d ago First seen · 291 lines · 58 tokens per session scan A 186267074ebd

Subscribe to this mod's changes

constitutional-ai is a skill published in the GitHub repository davila7/claude-code-templates (30,566 stars, last pushed yesterday), licensed MIT. It adds 58 tokens to every session and 1,993 once invoked, about $0.0003 per session on Opus 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-03.

Related

Other skills, from other repositories

constitutional-ai

Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignment, reducing harmful outputs without human labels. Powers Claude's safety system.

OpenLAIR/dr-claw · 58 tokens

constitutional-ai

Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignment, reducing harmful outputs without human labels. Powers Claude's safety system.

synthetic-sciences/openscience · 58 tokens

constitutional-ai

Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignment, reducing harmful outputs without human labels. Powers Claude's safety system.

Orchestra-Research/AI-Research-SKILLs · 58 tokens

constitutional-ai

Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignment, reducing harmful outputs without human labels. Powers Claude's safety system.

liortesta/ClawdAgent · 58 tokens

constitutional-ai

Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignment, reducing harmful outputs without human labels. Powers Claude's safety system.

ihatesea69/HieuNghi-AI-Skills · 58 tokens

research-constitutional-ai

Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignmen...

GrayCodeAI/starling · 48 tokens