Shell & DevOps
Use when someone wants a repeated computer task turned into a script, or needs a container or CI/CD file. Scripts only preview unless run with --apply, and say how to undo each change.
Was dieser Skill macht
Die vollständigen Anweisungen, denen Ihr Agent folgt. Nichts davon liegt hinter einer Anmeldung.
Shell automation
Turn a repeated task into one file. A script shows exactly what it would do, changes nothing unless told to, and says how to undo each change.
When to use
Use it for a reusable script, a container file or a CI/CD workflow. Use git-management for one-off Git work, debugging to find why an existing script fails, and sop-writing for steps that people do by hand. Answer a question about one command in chat.
How to work
- List the goal, system, shell, versions, allowed places, targets, rules and limits. Keep the user's rule numbers, or use R1, R2… If the system or a version is missing, choose one, call it an assumption and use only its features. If you don't know what the script may change, ask and don't save a file.
- Give each target one action. Leave: a rule protects it, or no rule covers it. Check: the rules disagree or aren't clear, or the new name is taken, so a person must decide and nothing changes. Otherwise, name the change, such as Compress or Move. For ages, count whole days. The table uses the date the user gives; the script uses the system's date.
- Never delete for good, even if asked. Move targets to a separate folder on the same disk, and say that this frees no space. Copy a file before editing it. If something else can't be undone, write "Can't be undone". For that, or a step only a person can judge, the script must ask for a typed word, and stop if nobody can type it.
- Before any change, check the options, tools, versions, access, free space and that no other copy is running. Stop if a path is empty, relative,
/or the home folder, leads elsewhere through a link, or puts a move on another disk. - Handle any file name. Quote every path, put
--before it, use arrays or null-separated lists, and expect no matches. Don't readlsoutput, follow links or overwrite anything. Don't rely on strict mode: check the result of each change. Remove only temporary files this run made. It must be safe to run again, even after stopping halfway. - Use these exit codes. 0: finished, with nothing to look at. 1: something failed or needs a check. 2: wrong option. 3: a safety check stopped it before any change.
The result
If the task sets another format, use it with the same parts in the same order. Otherwise, save one file with save_output. Use the user's file name, or a short one with the normal ending, such as .sh, .ps1 or .yml. The file must hold code only, with no Markdown fences. If you can't save it, put the whole file in one code block at the end of the reply. Write comments, messages and the reply in the user's language, unless they ask for another.
The file always has these seven parts, in this order, each under a numbered comment. Only a required first line, such as #!, goes above them.
- About: purpose, system, usage, what it may change, what it never touches, what a second run does, exit codes, assumptions and "Not run". Then an action map, one line for each action:
rule | targets | action | undo. - Settings: every path and limit. Use them everywhere else.
- Safety checks: everything in step 4.
- Plan: one function chooses each target's action. Both modes use it.
- Preview: both modes print the reply's table and totals. Print unusual names safely.
- Apply: runs only with exactly
--apply. Just before each change, run the Plan function again. If the target or its action is different, don't change it and count it as failed. - Summary: how many were changed, failed, Check and Leave, then the exit code.
If a script only reads and prints, leave out --apply and say why in part 6. For a container or CI/CD file, keep all seven comments, and say why if a part doesn't apply. Don't add a fake --apply: show its planned changes in the reply. Deployment must be started by a person, unless the user asks otherwise.
The reply always has these parts, in this order:
- Verdict: one sentence saying what
--applywould change and what stays, with counts. - Preview:
Target | Action | Reason | Undo, with each size beside its target. Put Check first, then each kind of change, then Leave, and sort each group by name. Undo is an exact command, or "None" for Check and Leave. If there's no list of targets, use one row for each action. Below it, write "Calculated, not run" and list any folder the script would create, with its undo. - Totals:
Action | Items | Size, with a total row, then what happens to free space. - Commands: preview and apply in one code block. Then say how to undo changes in the right order, and whether the next run would make them again.
- How to test: make a copy, change only its Settings to a new folder of made-up files, and say what to expect. Include a syntax check and a script checker.
- Not checked: what wasn't run, assumptions, and what to confirm before
--apply. - Schedule: only if asked. Give the steps, but don't set it up.
If the user supplies real output, use it and name its source.
Before you finish
- Each supplied target is in the table once. Counts and sizes match the totals and verdict.
- Actions, messages, commands and exit codes are the same in the file and the reply.
- Follow the code for no targets, a name with spaces, a taken name, a failed check and a second run. Preview must never reach a command that changes something.
- Every quote, bracket, condition and loop is closed.
Never
- Use a broad pattern or a path that could be empty to choose what to change, run text as code, or send a download straight to a shell.
- Put passwords, tokens or personal data in the file, its output or a command.
- Say something ran, passed a check, was scheduled or freed space without real output that shows it.
- Invent a path, version, target or size.
Nach der Registrierung fügen Sie Shell & DevOps mit einem Klick zu Ihrem Agenten hinzu.