sudo-handoff
Skill0 starsChanged 10 days agoMITView on GitHub
Hand privileged (root/admin) commands to the user to run, instead of failing on sudo. Use whenever the agent needs sudo/root/elevated privileges — "sudo", "root", "password required", "needs admin", "EACCES", "permission denied", pfctl/launchctl/systemd as root, restarting a root daemon, privileged installs — or when the user asks to be given the command to run and paste back the output.
In this repository34 other files it gives its agents.
- chatgpt/AGENTS.mdAGENTS.md
- opencode/AGENTS.mdAGENTS.md
- zcode/AGENTS.mdAGENTS.md
- claude/CLAUDE.mdCLAUDE.md
- agent-doc-authoringSkill
- agent-experienceSkill
- ai-image-promptsSkill
- api-behavior-flowSkill
- architecture-and-performanceSkill
- behavioral-testingSkill
- behavior-auditSkill
- browser-tabs-uiSkill
- code-qualitySkill
- context-compactSkill
- design-principlesSkill
- design-to-deliverySkill
- design-validationSkill
- e2e-test-authoringSkill
- engineering-reviewSkill
- excalidrawSkill
- external-ai-consultSkill
- google-omni-videoSkill
- llm-agent-tool-disciplineSkill
- parallel-subagentsSkill
- qa-test-scenariosSkill
- reliable-executionSkill
- research-and-reuseSkill
- server-security-hardeningSkill
- session-handoffSkill
- shadcn-librarySkill
- task-intakeSkill
- tauri-v2-docsSkill
- test-failure-triageSkill
- user-behavior-flowSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Interpret and continue: Read the pasted output, extract the fact you needed (e.g.
- Distinctive: line 33
If the output shows a problem, hand a follow-up command and iterate.
- Distinctive: line 43
If the task genuinely can't proceed without root and the user is unavailable, say exactly what is blocked and what command would unblock it …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sudo Handoff
Purpose
When a task needs root privileges and the agent has no passwordless sudo, the correct move is NOT to give up or silently skip the step. It is to hand the exact command to the user in a code block, wait for them to run it and paste the output, then continue. The user is the privileged shell; the agent is the analyst.
When to use
- Any command that returns
sudo: a password is required(this is the trigger, not a dead end). - Any operation that structurally needs root: binding privileged ports,
pfctlanchor load/inspect,launchctl bootstrap/bootoutin the system domain, restarting a root daemon, editing system files, privileged installs. - The user explicitly says: "give me the command to run" / "run it and paste the output" (or the equivalent in the user's language).
Preconditions
- Distinguish OS privilege from a filesystem sandbox, ordinary ownership or missing file.
EACCESalone does not justify sudo. Do not bypass client permission boundaries by handing an otherwise unauthorized command to the user; explain the actual required access and preserve existing approval controls. - The command you hand over must be complete and self-contained — absolute paths, no reliance on the agent's shell state, no
cdchains. - You must be able to say what the command does and why it is needed in one or two sentences.
Workflow
- Detect the need.
sudo -nfails with "a password is required", or the task's nature requires root. - Do not retry
sudo -nin a loop or declare the task blocked. - Prepare one command. Single command, absolute paths, properly quoted. Prefer the simplest command that answers the question — split compound
sudo bash -c '...'into a single obvious command when possible. - Present it to the user as a fenced code block, preceded by one short sentence of what it does and why it's needed. Follow the current conversation's language instructions; do not impose a project's English-only preference globally.
- Wait. The user runs it and pastes the output back.
- Interpret and continue. Read the pasted output, extract the fact you needed (e.g. anchor rules present/absent, exit code, service label), and proceed with the task.
- If the output shows a problem, hand a follow-up command and iterate.
Rules
- "a password is required" is a handoff signal, never a failure. Say "I need you to run this:" and give the command.
- One command at a time. Multiple
sudocalls in one line obscure which one failed; the user can't see your intent. If several steps are needed, run them one handoff at a time. - Absolute paths, no shell state.
/Users/.../siteblockernot./siteblocker; the user's shell starts in an unknown directory. - Explain before you ask. The user should never run a privileged command blind. One sentence: what it does, why it's needed.
- Never embed the user's password in a command. Their own
sudoprompts them. - Prefer reversible/inspectable commands.
pfctl -s/-a ... -s nat(read) over mutating rules without review; state what a mutating command changes. - If the task genuinely can't proceed without root and the user is unavailable, say exactly what is blocked and what command would unblock it — don't silently skip it.
Common mistakes
- Treating
sudo: a password is requiredas "can't do it" and ending the task. - Retrying
sudo -nhoping it magically works. - Handing
sudo bash -c 'complex; chain; of; commands'— the user can't verify it and the output is ambiguous. Prefer one clear command. - Assuming the user's working directory or environment matches the agent's.
- Forgetting to say WHY — the user pastes output blindly and can't help interpret it.
- Handing a destructive command (delete, bootout, restore) without stating what it changes or that it's reversible.
Validation
- The user runs the command and pastes output containing the expected marker (exit code, a rule line, a status string, a file listing).
- You confirm the output answers the question and continue the task; if the output is unexpected, ask for the corrected command's output.
- A handoff is only "done" when the user's pasted output confirms the effect — never assume it ran.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

