ai-command-rules

A set of rules for writing shell commands and scripts in coding-agent environments. It checks the operating system, shell, runtime, and available permissions before suggesting commands.

In plain words
What is it for?
It helps write environment-aware commands for terminals, Docker, CI/CD, SSH sessions, virtual environments, and Git or Python tasks. When the environment is unclear, it provides detection steps first.
Why use it?
It reduces failures caused by commands that work on one computer or shell but behave differently on another.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/russodope/ai-cli-kit/ai-command-rules
Any agent
npx skills add russodope/ai-cli-kit --skill ai-command-rules
Clone the repo
git clone --depth 1 https://github.com/russodope/ai-cli-kit

Made for: Claude Code, Codex.

Per session 151 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,785 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 3 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00151 $0.01785
Opus 5 $0.00076 $0.00892
Sonnet 5 $0.00030 $0.00357
Haiku 4.5 $0.00015 $0.00178

Measured 2d ago against content hash 1577355f3cf0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade D, and why

ai-command-rules scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

| Privileges | Root/sudo available? Admin on Windows? |

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

| `rm -rf dist/` | `rm -rf ./dist/` | Protects against accidental root deletion |

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

5. **Network** — check if egress is allowed before running `curl`, `pip install`, `npm install`
ai-command-rules/SKILL.md · 178 lines

How it starts

The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI Command Rules

A skill for writing precise, environment-aware shell commands and scripts that work correctly the first time across Windows, Linux, macOS, sandboxes, virtual environments, and containers.

Core Principle

Always detect the environment before writing a command. Never assume. A command that works on Linux bash will silently fail or behave differently on Windows CMD, PowerShell, or macOS zsh. When in doubt, ask or emit environment-adaptive commands.


Step 1: Detect the Environment

Before writing any command, identify:

Signal How to detect
OS User mentions, file paths (C:\ vs /), or ask explicitly
Shell bash / zsh / fish / PowerShell / CMD / sh
Runtime context Local terminal, Docker container, CI/CD, sandbox, SSH session
Python env venv, conda, pipenv, poetry, system Python, Docker
Privileges Root/sudo available? Admin on Windows?

If uncertain, emit a detection snippet first:

# Universal OS+shell detector (paste in terminal first)
echo "OS: $(uname -s 2>/dev/null || echo Windows)"
echo "Shell: $SHELL"
echo "Python: $(python --version 2>&1 || python3 --version 2>&1)"

Step 2: Environment-Specific Rules

Read the relevant reference file before emitting commands:

  • Linux / macOS / bash / zshreferences/unix.md
  • Windows CMD / PowerShell / WSLreferences/windows.md
  • Docker / containers / sandboxesreferences/containers.md
  • Python / virtual environmentsreferences/python-env.md
  • SSH / remote executionreferences/ssh-remote.md
  • Gitreferences/git.md

For cross-platform tasks, read all relevant files.


Step 3: Command Writing Checklist

Before emitting any command block, verify:

✅ Shell Compatibility

  • Correct quoting style for target shell (single vs double vs backtick)
  • Path separator correct (/ vs \)
  • Line continuation correct (\ bash vs ` PowerShell)
  • Variable syntax correct ($VAR bash vs $env:VAR PowerShell vs %VAR% CMD)
  • Logical operators correct (&& / || bash vs -and / -or PowerShell)

Read the full file on GitHub · 178 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 178 lines · 151 tokens per session scan D 1577355f3cf0

Subscribe to this mod's changes

ai-command-rules is a skill published in the GitHub repository russodope/ai-cli-kit (2 stars, last pushed 6mo ago), licensed MIT. It adds 151 tokens to every session and 1,785 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it D with 3 findings (asks for root, recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

shell-scripting

Use this skill when writing bash or zsh scripts, parsing arguments, handling errors, or automating CLI workflows. Triggers on bash scripting, shell scripts, argument parsing, process substitution, here documents, signal trapping, exit codes, and any task requiring portable shell script development.

alibaba/anolisa · 60 tokens

tirith

Terminal security analysis for shell environments. This skill should be used when checking commands for supply-chain attacks before execution, scanning repositories for hidden content or config poisoning, scoring URLs for homograph attacks, setting up AI tool protection, inspecting Python package artifacts, governing…

sheeki03/tirith · 205 tokens

terminal-helper

Assists with terminal commands, shell scripting, and system administration tasks.

termlnk/termlnk · 16 tokens

huiyu-safe-ai

Lightweight AI security guard that intercepts risky install/download commands (npm, npx, pip, cargo, git clone) to block known malicious packages and scan for suspicious code. Invoke ONLY when user runs install/download/clone commands.

huiyu9144/huiyu-safe-ai · 52 tokens

github-pr-description

Generate and create pull request descriptions automatically using GitHub CLI. Use when the user asks to create a PR, generate a PR description, make a pull request, or submit changes for review. Analyzes git diff and commit history to create comprehensive, meaningful PR descriptions that explain what changed, why it…

tailcallhq/forgecode · 72 tokens

git-commit

Generate well-formatted git commit messages following conventional commit standards.

ThinkInAIXYZ/deepchat · 15 tokens