/apiiro:guardian-setupfrom apiiro
Use to install, update, or authenticate the Apiiro CLI, verify its version and available features, offer the optional prevention hooks, or when an apiiro command fails with not found or auth errors.
Ships in apiiro. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are setting up Apiiro. Do the following in order and confirm each step.
Steps 1, 4, 6 and 7 make lasting changes to the user's machine. Before each one, tell the user what it will install or change and where, and run it only after they agree. If they decline, skip that step and continue with the next one. Steps 2, 3, 5 and 8 only sign in or read state.
The CLI keeps itself on the version the organization selects in Apiiro. Most apiiro commands, including the feature checks in step 5 and the dry run in step 6, can first download that version and refresh installed hooks, restoring any hook entry that is missing or outdated; login, auth, update and doctor never do. Before the first such command, tell the user this and continue only after they agree. If they would rather keep the current version, they can run apiiro update --disable first.
which apiiroapiiro logoutapiiro loginapiiro login --device and enter the printed code in any browser insteadapiiro auth statusapiiro update --checkapiiro update to install it now; an update also refreshes installed hook files. Saying no only skips updating now: other apiiro commands still update it unless automatic updates are offAPIIRO_AUTO_UPDATE=off or apiiro update --disable), say so; apiiro update --enable turns them back onProbe which features are enabled for the user's environment. Run these commands and collect results:
# Fast Scan (secrets + OSS) — fetches the tenant's scan configuration
apiiro fast-scan config 2>&1
# Guardian
apiiro ask "test" --global 2>&1
# Threat Modeling
apiiro threat-model "test" 2>&1
For each command, check the output:
-f/--file is an output flag on every command (it saves the result to a file), so do not pass it to probe a feature.
Present a summary table to the user showing which features are enabled and which are not. For disabled features, note: "Contact your Apiiro administrator to enable this feature."
apiiro init detects Claude Code, Cursor, GitHub Copilot CLI, OpenAI Codex, and opencode, and installs the skills and the prevention hooks (session context, prompt enrichment where the host supports it, and commit scanning) into each one's configuration. In Claude Code it adds the Apiiro marketplace and enables the Apiiro prevention plugins in ~/.claude/settings.json. The hooks send the user's prompts, the files a commit scan checks, and commit details to their Apiiro tenant (privacy: https://github.com/apiiro/marketplace#privacy--telemetry, support: https://support.apiiro.com). This is a lasting change to those agents, so offer it; never run it unasked:
apiiro init --dry-run and show the user which agents and files it would change. Ask whether to install, and for which agents (--claude, --cursor, --copilot, --codex, --opencode limit it to one host; --skills-only skips the hooks)apiiro init with the options they chose, then apiiro doctor to verify the result. Tell them apiiro uninstall removes what it installed. The Codex and Copilot CLI hooks need a 2026.09.09 or newer CLI — upgrade first if apiiro --version is oldercodex in a terminal, type /hooks, and trust each Apiiro entry. Until then Codex skips the hooks silently, and a changed or newly added entry (for example after apiiro hooks update) needs trusting againapiiro agents install instead and run it only after the user agrees (--agent claude|cursor|copilot|codex|opencode for one host, --all for every known host); apiiro agents status shows what is installedApiiro can add a 🛡️ shield to the Claude Code status line that appears when Apiiro Guardian is active.
Do NOT modify ~/.claude/settings.json or any scripts directly. Instead, explain what the status line does and ask the user if they'd like to set it up. If they agree, use the statusline-setup agent to configure it.
Tell the user:
statusLine entry to ~/.claude/settings.jsonIf the user wants to proceed, delegate to the statusline-setup agent with these details:
Earlier versions pointed statusLine.command at ${CLAUDE_PLUGIN_ROOT}/scripts/statusline.sh or statusline.ps1, which the plugin no longer ships, so that status line is now blank. Treat such a command as no status line: replace it with the one below.
Create the script that matches the user's OS, then add the statusLine entry to ~/.claude/settings.json.
macOS / Linux: write ~/.claude/apiiro-statusline.sh and make it executable (chmod +x):
#!/usr/bin/env bash
input=$(cat)
SESSION_ID=$(printf '%s' "$input" | jq -r '.session_id // empty' 2>/dev/null)
SESSION_FILE="$HOME/.apiiro/sessions/$SESSION_ID"
MAX_AGE=600
if [ -n "$SESSION_ID" ] && [ -f "$SESSION_FILE" ]; then
MTIME=$(stat -f %m "$SESSION_FILE" 2>/dev/null || stat -c %Y "$SESSION_FILE" 2>/dev/null || echo 0)
[ $(($(date +%s) - MTIME)) -lt $MAX_AGE ] && echo "🛡️ Apiiro Guardian Activated"
fi
{
"statusLine": {
"type": "command",
"command": "~/.claude/apiiro-statusline.sh"
}
}
Windows: write %USERPROFILE%\.claude\apiiro-statusline.ps1, then put its absolute path (for example C:\Users\<name>\.claude\apiiro-statusline.ps1) in the command:
$inputText = [Console]::In.ReadToEnd()
$SessionId = ''
try { $SessionId = ($inputText | ConvertFrom-Json -ErrorAction Stop).session_id } catch { }
if (-not $SessionId) { exit 0 }
$SessionFile = Join-Path $HOME ".apiiro/sessions/$SessionId"
if (Test-Path -LiteralPath $SessionFile -PathType Leaf) {
$age = (Get-Date).ToUniversalTime().Subtract((Get-Item -LiteralPath $SessionFile).LastWriteTimeUtc).TotalSeconds
if ($age -lt 600) { Write-Output ([char]::ConvertFromUtf32(0x1F6E1) + [char]0xFE0F + " Apiiro Guardian Activated") }
}
{
"statusLine": {
"type": "command",
"command": "powershell -ExecutionPolicy Bypass -File \"<absolute path of apiiro-statusline.ps1>\""
}
}
First, back up the existing script by copying it to <script-path>.bak before making any changes.
Then find the script file referenced in the existing statusLine.command setting and append the Apiiro shield check to the end of that script. The check should use the same stdin JSON variable the script already captures (commonly $input):
# Apiiro shield
SESSION_ID=$(echo "$input" | jq -r '.session_id // empty')
SESSION_FILE="$HOME/.apiiro/sessions/$SESSION_ID"
MAX_AGE=600
if [ -n "$SESSION_ID" ] && [ -f "$SESSION_FILE" ]; then
MTIME=$(stat -f %m "$SESSION_FILE" 2>/dev/null || stat -c %Y "$SESSION_FILE" 2>/dev/null || echo 0)
[ $(($(date +%s) - MTIME)) -lt $MAX_AGE ] && echo "🛡️ Apiiro Guardian Activated"
fi
Important: Claude Code pipes a JSON object to the status line script via stdin. The script must read stdin once (e.g., input=$(cat)) and parse fields from that variable. Do not read stdin again for the Apiiro check — reuse the existing variable. Check the script to confirm the variable name before appending.
apiiro doctor — checks CLI version, auth, per-agent skills, plugin status, hook integrity, pre-commit hook, and hook toggles in one reportTell the user they are all set! Summarize:
guardian-* skills they can invoke from the agent (ask the agent to list available skills if they want a tour)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub apiiro/marketplace --plugin apiiro9 skills in this plugin
/guardian-apiApiiro REST queries across repos or organizations, connectors, audit logs and exports. Policies, coverage, issues and reports have dedicated commands. Applications and application groups: guardian-inventory. Repo risks: guardian-risks./guardian-fixUse when the user wants to fix, remediate, or resolve a security risk or vulnerability ("how do I fix this risk", "remediate this finding"): Apiiro remediation prompts, Guardian AI fixes, and server-side AutoFix jobs. To list risks: guardian-risks./guardian-inventoryApiiro inventory: applications, application groups, teams, artifacts, APIs, dependencies, sensitive data, secrets, validity, technologies, modules, SBOMs, contributors, OSS, licenses, incidents, feed, advisories, repositories, SCM tags, monitoring./guardian-queryUse for freeform security questions about code ("is this code secure?", attack surface, auth flows) or org-wide posture ("top risks across the org", --global), answered by the Apiiro Guardian AI agent. One repo's risks: guardian-risks./guardian-risksUse when the user asks about known security risks or findings in this repo ("what risks does this repo have"), filters Apiiro risks, or wants to accept, ignore, re-level, tag or triage one. Org-wide: guardian-query --global; fixing: guardian-fix./guardian-scanUse to scan code with the Apiiro CLI for secrets, leaked credentials, or vulnerable OSS dependencies, set up pre-commit hooks, or diff-scan branches and PRs for CI gates ("check my code before I push", "scan this PR").