fallback-model-setup — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited fallback-model-setup (Agent Skill) and scored it 96/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are configuring Claude Code for production resilience. Work autonomously — do not ask questions.
TARGET: $ARGUMENTS (defaults to current project if not specified)
============================================================ PHASE 1: AUDIT CURRENT CONFIGURATION ============================================================
Find all active settings files in order of precedence:
For each file found, record:
model valuefallbackModel is already set (and its current value)autoMode is configuredRun: claude --version
fallbackModel, --safe-mode, and /cd all require v2.1.166 or higher. If the installed version is older, output the upgrade command and stop:
npm install -g @anthropic-ai/claude-code@latestCheck environment variables for CI context: CI, GITHUB_ACTIONS, CIRCLECI, BUILDKITE, JENKINS_URL, TRAVIS.
Record environment type:
============================================================ PHASE 2: CONFIGURE FALLBACKMODEL CHAIN ============================================================
Read model from the effective settings.json. If unset, the runtime default is claude-opus-4-8.
Apply to the project-level .claude/settings.json (create if absent). Use descending capability — most capable first, Haiku as the budget safety net:
If primary is claude-opus-4-8:
{
"model": "claude-opus-4-8",
"fallbackModel": [
"claude-sonnet-4-6",
"claude-haiku-4-5-20251001"
]
}If primary is claude-sonnet-4-6:
{
"model": "claude-sonnet-4-6",
"fallbackModel": [
"claude-haiku-4-5-20251001"
]
}If primary is already Haiku — no fallback exists. Flag this and recommend upgrading to Sonnet or Opus as the primary for any autonomous pipeline, then adding Haiku as the fallback.
Check whether the project uses tools that not all models support:
If a mismatch is found, remove the incompatible model from the chain and add a comment explaining why in the settings file.
After writing settings.json, verify it parses:
node -e "JSON.parse(require('fs').readFileSync('.claude/settings.json','utf8'))" && echo OKFix and re-validate if the check fails.
============================================================ PHASE 3: INSTALL SAFE-MODE TROUBLESHOOTING PROTOCOL ============================================================
Create .claude/DEBUGGING.md (or append to it if it already exists):
## Claude Code — Troubleshooting Protocol
### Step 1: Safe mode isolation
If Claude Code behaves unexpectedly (loops, crashes, wrong tool use,
unexpected prompts):
claude --safe-mode
Safe mode disables ALL customizations: CLAUDE.md, hooks, plugins,
bundled skills. If the problem disappears → the culprit is in your
config stack.
### Step 2: Layer bisect (when safe mode is clean)
Re-enable layers one at a time, testing after each:
1. Hooks (most common source of loops — check PreToolCall first)
2. Plugins
3. CLAUDE.md / nested .claude/ directories
4. Bundled skills (`disableBundledSkills: false`)
### Step 3: Hook log inspection
Hooks write to stderr by default. To capture hook output during a
session, temporarily add verbose logging:
"hooks": {
"PreToolCall": [{
"matcher": ".*",
"hooks": [{"type": "command", "command": "echo \"[hook] $CLAUDE_TOOL_NAME\" >&2"}]
}]
}
### Step 4: Change directory without restarting
To switch project root mid-session without losing context or cache:
/cd <new-directory>
Prompt cache is fully preserved. /cd does not rebuild context from
scratch. Use it instead of opening a new session.
### Step 5: Fallback model verification
If you suspect a fallbackModel switch caused unexpected behavior,
check the session log (~/.claude/logs/) for lines containing
"fallback" to confirm which model was active at each point.For any existing hook command, confirm it writes actionable output to stderr on failure. A hook that silently exits non-zero is harder to debug than one that prints a clear error message. Update any silent hooks to log to stderr:
<your-hook-command> || echo "[hook failed] <hook-name>" >&2============================================================ PHASE 4: AUDIT NESTED SUB-AGENT DEPTH (IF APPLICABLE) ============================================================
Check .claude/agents/*.md for sub-agent definitions. If no agent files exist, skip this phase and note "no agent files found."
With v2.1.166+, sub-agents nest up to 5 levels deep. For each agent file found:
justified with a comment)
Recommended depth budget:
For each sub-agent that spawns children, verify its system prompt includes explicit failure handling. If it doesn't, add:
If any child sub-agent fails its acceptance criteria, halt immediately
and surface the child's transcript to the parent. Do not auto-retry.Auto-retry masks real problems. Hard-fail with transcript is the correct default.
============================================================ OUTPUT ============================================================
Produce a concise audit report:
Claude Code version: [installed version] — [OK ≥ 2.1.166 / UPGRADE REQUIRED]
fallbackModel chain:
Safe mode: [available / not available — old version] Debugging runbook: [created at .claude/DEBUGGING.md / updated / already exists]
Sub-agent audit:
Files modified:
Next steps (manual):
============================================================ SELF-HEALING VALIDATION (max 2 iterations) ============================================================
After producing output, validate:
If any check fails:
After 2 iterations, note any remaining gaps and stop.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.