
XGuard Policy Manager
FreeEfficiently manage XGuard policies with ease.
Free · Opens the source repo
What XGuard Policy Manager does
The XGuard Policy Manager skill allows developers and designers to effectively manage XGuard policy options through the orchestrator's admin endpoints. This skill is particularly useful for inspecting, modifying, and backing up policies that dictate how text and prompt scans are handled. It provides a structured workflow for refining policies, enabling users to fetch current options, edit them, and track the performance of the changes made. With a focus on safety, it ensures that destructive operations are not executed without explicit user consent, thereby minimizing the risk of unintended consequences.
The skill operates primarily through a command-line interface using Node.js, making it accessible for users familiar with terminal commands. It supports various operations such as fetching current policy options, resetting to defaults, and exporting or importing policies in bulk. The commands are designed to be straightforward, with clear requirements for when the --writable flag is needed, ensuring that users are aware of the implications of their actions. This is particularly important in environments where policy changes can have widespread effects on system behavior.
Ideal for teams working with XGuard, this skill streamlines the process of policy management, allowing for quick adjustments and refinements based on real-time feedback from text and prompt evaluations. Users can easily back up their current configurations before making changes, ensuring that they can restore previous states if necessary. The integration with the audit log further supports ongoing policy evaluation, enabling users to monitor the effectiveness of their adjustments over time.
In summary, the XGuard Policy Manager skill is a vital tool for managing the intricacies of XGuard policies, offering a clear and safe approach to policy refinement that can enhance the overall effectiveness of text and prompt scanning operations.
When to use it
Use this skill when you need to inspect, modify, or back up XGuard policies for text or prompt scans.
When not to use it
Avoid using this skill if you do not have XGuard implemented or if you require real-time monitoring of policy impacts without making changes.
What you can build with it
Inspect Current Policies
Quickly fetch and review the current XGuard policy settings to understand how they are configured.
Backup Policies Before Changes
Export existing policies to a file to ensure you have a restore point before making any modifications.
Refine Policy for Better Performance
Edit and update policies based on feedback from text scans to improve accuracy and reduce false positives.
How to install XGuard Policy Manager
View source1. Install with the skills CLI
npx skills add civitai/civitai/xguard-manager --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by civitaiXGuard Policy Manager
Use this skill to manage XGuard policy options against the orchestrator's /v1/manager/xguard/* admin endpoints.
Each label's policy is the natural-language prompt text + threshold + action that the orchestrator applies when evaluating an XGuard call. See docs/features/scanner-prompt-tuning.md for how this fits into the scanner refinement lifecycle. Phase 4 (refine policy) is the typical use of this skill: fetch the current options, edit a policy, PUT the new version, then track FP/FN rates against the new policyHash in the audit log.
Setup
The skill reads ORCHESTRATOR_ENDPOINT and ORCHESTRATOR_ACCESS_TOKEN from the project .env (or .claude/skills/xguard-manager/.env if you want skill-specific overrides). No additional setup beyond having those env vars set.
Commands
node .claude/skills/xguard-manager/manage.mjs <command> [args] [options]
| Command | Description |
|---|---|
get <mode> | GET current options for the mode (text or prompt) |
defaults <mode> | GET hardcoded defaults baked into the orchestrator |
put <mode> | PUT new options for the mode (requires --writable + --file) |
reset <mode> | POST reset back to defaults (requires --writable) |
export | GET bulk export across all modes |
import | PUT bulk import across all modes (requires --writable + --file) |
Options
| Flag | Description |
|---|---|
--writable | Allow destructive operations (PUT / POST). Required for put, reset, import. |
--file <path>, -f <path> | Read the request body (JSON) from a file. Required for put and import. |
--output <path>, -o <path> | Save response to a file (instead of printing to stdout). |
--quiet, -q | Only print the response body, no connection headers. |
--timeout <s>, -t <s> | Request timeout in seconds (default: 30). |
Examples
# Inspect current prompt-mode options
node .claude/skills/xguard-manager/manage.mjs get prompt
# Save the current prompt-mode options to a file you can edit
node .claude/skills/xguard-manager/manage.mjs get prompt -o /tmp/prompt-policies.json
# See what the defaults look like (useful for scaffolding a new label)
node .claude/skills/xguard-manager/manage.mjs defaults prompt
# Ship an edited policy
node .claude/skills/xguard-manager/manage.mjs put prompt -f /tmp/prompt-policies.json --writable
# Wipe prompt-mode policies back to defaults (destructive)
node .claude/skills/xguard-manager/manage.mjs reset prompt --writable
# Back up the entire policy registry before a risky edit
node .claude/skills/xguard-manager/manage.mjs export -o /tmp/xguard-backup.json
# Restore from a backup
node .claude/skills/xguard-manager/manage.mjs import -f /tmp/xguard-backup.json --writable
Safety
- Read-only by default:
get,defaults, andexportalways work without--writable. - Destructive operations require explicit
--writable:put,reset, andimportchange orchestrator state and refuse to run without the flag. - Always ask the user before using
--writable: policy changes are global — every subsequent scan will use the new policy text. Confirm the intent before running. - Back up before editing: run
export -o backup.jsonbefore any non-trivial change so you canimportto restore if needed.
Typical workflow for refining a policy (Phase 4)
# 1. Snapshot current state for safe rollback
node .claude/skills/xguard-manager/manage.mjs export -o /tmp/xguard-backup-$(date +%Y%m%d).json
# 2. Pull the current options for the mode you're editing
node .claude/skills/xguard-manager/manage.mjs get prompt -o /tmp/prompt-current.json
# 3. Edit /tmp/prompt-current.json with the refined policy text
# 4. Ship it (after user confirms)
node .claude/skills/xguard-manager/manage.mjs put prompt -f /tmp/prompt-current.json --writable
# 5. Track FP/FN rate of new policyHash via the audit log + focused review
Why this is separate from the postgres-query / clickhouse-query skills
Those query the audit data (verdicts, scores, matched terms). This skill manages the policy itself — the prompt text the orchestrator hands to XGuard. A typical tuning loop uses both: query data to identify FP patterns, edit the policy here, then re-query after new scans land under the new policyHash.
Frequently asked questions about XGuard Policy Manager
Similar skills
Turborepo
Optimized build system for JavaScript/TypeScript monorepos.
Azure Pipelines Validation
Streamline your Azure DevOps pipeline changes locally.
Azure Developer CLI
Streamline your Azure project workflows with best practices.
Azure Container Registry CLI
Manage Azure Container Registry resources with ease.
Aspire
Build and orchestrate polyglot distributed applications seamlessly.
Vercel CLI
Manage and deploy Vercel projects from the command line.
