draft-auto-mode-rules
Draft a paste-ready `autoMode` classifier block by interviewing the user about what should and should not be auto-approved, each entry in the shape the classifier reads well and every section keeping `$defaults`. Use when: 'help me write auto mode rules', 'draft an autoMode block', 'set up auto mode', 'add an auto-mode rule for X', 'my auto mode rules are too vague', 'rewrite this classifier entry', or an audit shows rules dropped or ignored. Prints only, never writes a settings file.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 30
- Forks
- 7
01 前言 Front Matter
- metadata
- { "summary": "Interview and draft a paste-ready autoMode block, never writing settings", "workflow-stage": "anytime" }
- description
- Draft a paste-ready `autoMode` classifier block by interviewing the user about what should and should not be auto-approved, each entry in the shape the classifier reads well and every section keeping `$defaults`. Use when: 'help me write auto mode rules', 'draft an autoMode block', 'set up auto mode', 'add an auto-mode rule for X', 'my auto mode rules are too vague', 'rewrite this classifier entry', or an audit shows rules dropped or ignored. Prints only, never writes a settings file.
- argument-hint
- [environment|allow|soft_deny|hard_deny] [--unattended]
- user-invocable
- true
- disable-model-invocation
- false
02 资源文件 4
- 参考文档evals/evals.json3.5 KB
- 参考文档reference/native-auto-mode-setup.md2.3 KB
- 脚本scripts/draft-automode-block.sh7.1 KB
- 脚本scripts/draft-automode-block.test.sh11.3 KB
03 SKILL.md 正文
Purpose
The autoMode block is a natural-language prompt for a classifier, not a rule list the harness
matches, so it fails in ways a config file does not. We write each condition as its own short entry
the classifier can see, never buried in a long paragraph, because a condition deep in prose is the
one a single classifier pass is likeliest to miss.
This skill applies that at authoring time instead of reporting it afterwards, the job
claude auto-mode critique does after the fact.
- Pointer: when deciding how the classifier reads entries, fetch auto mode config: override the block and allow rules and, for the critique command, auto mode config: inspect the defaults and your effective config live.
Report-only, permanently
This skill writes nothing, in any scope, under any flag. It prints a block; you paste it. Editing a consumer's settings file would be making a permission decision on their behalf, which is the one thing this plugin exists not to do.
Scope boundary (route out)
- What is in effect now, what auto mode drops, what a section discards →
harness-config:audit-permission-state. Run it first. Drafting against rules you have not read is how a block ends up contradicting itself. - Grant portability and auto-mode durability →
harness-config:audit-permission-grants. - Whether an existing block is any good →
claude auto-mode critique, surfaced byaudit-permission-state --critique. It owns the semantic judgment; this skill owns composition.
Boundary, the built-in /auto-mode-setup command
Both surfaces help a person write auto mode classifier content, so a request to "set up auto mode" can mean either.
/auto-mode-setup(built-in command): the person runs it; this skill never invokes it. What it drafts, reads and saves is read from auto mode config: generate environment entries live.- This skill (marketplace plugin). Interviews for entries in every section (
environment,allow,soft_deny,hard_deny), each with stated exclusions and a transcript-visible condition, and prints the block without writing anything.
Routing. At the start of the run, offer it to the person:
If /auto-mode-setup is available in your session (gate basis: its row of the commands reference;
records in reference/native-auto-mode-setup.md), you can
run it instead of or alongside this skill to have the environment section drafted from your sessions
and saved for you; this interview then covers the allow and deny sections. If they take it, run
Phase 1 again after it saves so the draft builds on what it wrote. When the caller passes
--unattended, the run records the offer in its output instead of asking;
without that flag it asks.
Mutation gate. We treat /auto-mode-setup as writing user settings once the person accepts its
draft. This skill writes nothing and never chains into /auto-mode-setup on the person's behalf.
Availability is never assumed. Offer the command when it resolves in this session, never assume it is present. Read what gates it from its row of commands: all commands live. The four-part records live in reference/native-auto-mode-setup.md.
Inputs, and one deliberate omission
The draft is built from the interview plus the effective merge (audit-permission-state), and
nothing else. An optional argument, environment, allow, soft_deny, or hard_deny, names one
section to focus the interview on. --unattended, anywhere in the arguments, is not a section: it is the caller
declaring that nobody is present, which governs the /auto-mode-setup offer under "Routing". Take
it out first, then read the rest.
There is no history input: a read of "the repo's observed prompt and denial history" names no actual location, and an unnamed read surface in a skill shipped to consumers is unreviewable.
Phase 1: Read what already exists
Before asking anything, run the audit sibling and read its output:
bash "${CLAUDE_PLUGIN_ROOT}/skills/audit-permission-state/scripts/automode-block-lint.sh"
Three things there change what you should ask:
- A section missing
"$defaults"drops the built-in rules by the docs' account (pointer in Phase 3), though forsoft_denythe behavior probes observed them kept, git and non-git rules alike (/harness-ops:behavior-probesrecord 6). Say both, and add the token before adding to that section: it is correct under either behavior. - A
C2b-contradictionorC3-shadowedfinding means the block already disagrees with itself. Resolving that comes before adding an entry that would deepen it. - A
status=skippedorstatus=unavailableresult means you could not read the block. Draft anyway if asked, but say plainly that you are drafting blind.
Phase 2: Interview
<!-- fresh-eyes-exempt: external-input -- the material judged here is the consumer's stated intent and their own existing configuration; no step judges output this skill authored -->
Ask about one entry at a time. For each, you need four things, and the fourth is where drafts fail:
-
Which section.
allow(auto-approve),soft_deny(block, overridable),hard_deny(never),environment(facts the classifier needs: organization, repositories, trusted domains). Ahard_denyentry is a classifier judgment. When the answer is an action that must never happen (it cannot be undone, exposes a secret, or sends data outside), say that it belongs inpermissions.denyor aPreToolUsehook, which the harness applies every time, and keep thehard_denyentry as a second layer. For a Bash action prefer the hook; read what a Bash deny rule matches in permission rule syntax before recommending one. -
A short label: the subject, two or three words. It is what a reader scans for.
-
What is covered, and what is explicitly not. Both. An entry with no stated exclusions is one the classifier will over-apply.
-
A condition visible in the transcript. The critique's finding was that "uncheckable conditions are the biggest weakness". Entries state preconditions the classifier cannot evaluate from the command text, so it either allows blindly (the condition is decorative) or blocks (the grant is inoperable), with no stated disposition.
Some answers name something the classifier cannot see: a person's intent, a fact about the build server, whether a change was reviewed. Say so and ask for the observable form instead. "Only when the deploy is approved" is not checkable; "only when the command names the staging endpoint" is.
Stop when they say stop. A short correct block beats a long vague one.
Phase 3: Compose
Feed the answers to the drafter, one record per line:
section allow
label Test Execution
covered running the repository's own test suite via its documented runner
not installing new dependencies as a side effect
why the runner is named in the command text
bash "${CLAUDE_PLUGIN_ROOT}/skills/draft-auto-mode-rules/scripts/draft-automode-block.sh" < answers
It prints a JSON object carrying only the sections that got entries. An unknown section name
is a hard failure, exiting 2 with nothing on stdout rather than warning beside partial output,
because a caller capturing both streams together would otherwise get unparsable JSON. Every section opens with
"$defaults". We keep the token in every section so a customized section never loses the shipped
rules (Pointer: when deciding what a section without the token keeps, fetch
auto mode config: define trusted infrastructure
and
auto mode config: override the block and allow rules
live. As of: 2026-10-11. Recheck trigger: that section changes what customizing a section does to
the built-in list, or retires $defaults).
Phase 4: Hand it over
Print the block. Say exactly where it goes: the autoMode key of
${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json. Then stop.
Two things to say while handing it over:
- Project and local settings will not work. The classifier reads
autoModefrom user settings, managed settings, and inline--settings/SDK JSON only. A block pasted into.claude/settings.jsonis silently inert. - Merging into an existing block is theirs to do. If they already have an
autoModesection, the drafted sections replace what they paste over. Point them at the audit sibling to confirm the result rather than assuming it merged.
Gotchas
- Do not offer to write the file. Not with
--fix, not "shall I apply this", not as a follow-up. The no-write posture is the skill's contract, not a default someone can opt out of. - A drafted block is not a reviewed block. After they paste it,
claude auto-mode critiqueis what judges it. Say that rather than implying the draft is validated. claude auto-mode resetis never run. On a chezmoi-managed home what it removes is not recoverable from the settings file alone. Read what it removes from CLI reference: CLI commands live.- Prose provenance does not belong in an entry. Dates, issue numbers, and prior-draft archaeology cost classifier attention and buy nothing; the critique names stripping them explicitly. Version control owns that history.
04 同仓库更多 Skills
track
Backlog reads through the bound tracker: search open and closed items, view one item with its comments and state history. Use when another skill searches or reads tracker items.
reviewer-media
Reviewer media for one pull request: decides whether it needs a narrated walkthrough, builds the storyboard from /review:explain-change's digest, has /explainer-video:produce render it and hands the manifest to /source-control:pull-request media. Use when asked for 'reviewer media', 'a walkthrough video for this PR', 'a produced video of this change', or when pull-request ready or monitor hands a PR over.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
principles
Module-design vocabulary for architecture findings, and the checks built on it. Use when: 'what is a deep module', 'what is a seam', 'deep vs shallow module', 'what is the deletion test', 'leverage and locality', 'module design vocabulary', 'which word do we use for X in architecture findings'. Scanning a codebase for friction is /architecture:improve.
write
Structured five-field bug report (title, steps to reproduce, expected vs actual, justified severity, suggested fix location) from an informal description, read-only. Use when the user names a defect they observed, or asks for one written up ('report a bug', 'file a bug', 'write this up as a bug').