STD-008: CLI Quality Standard
Every command written in documentation, runbooks, or AI-generated output MUST follow the verification pattern and meet quality criteria for idempotency, precision, and teachability.
Principles
-
Verify-before, change, verify-after. The atomic unit of change is three commands, not one. See STD-005 for the full change control standard.
-
Idempotent where possible. A command run twice MUST produce the same result as running it once.
-
Teach the tool’s affordance. When presenting a command, explain WHY this tool is the right choice — not just the syntax.
-
Placeholders have examples. Every
<placeholder>MUST be followed by a concrete example showing real values.
Requirements
-
Commands in documentation MUST follow the verify-change-verify pattern (STD-005).
-
Commands SHOULD be idempotent. Use
grep -qguards,test -fconditionals, andsystemctl is-activechecks. -
Every
<placeholder>in a command MUST be followed by a concrete example with real values. -
Separate commands when each warrants individual verification. Group ONLY when they form a single indivisible logical unit.
-
Use
git -C <path>instead ofcd && git. Parallel pushes with&+wait. -
Prefer
awkfor field extraction overcut. Preferawkpattern ranges overgrep | head/tailpipelines. Reduce pipe stages where a single tool suffices. -
Avoid useless use of cat (
cat file | grep→grep pattern file). -
Process substitution (
diff <(cmd1) <(cmd2)) SHOULD replace temp files for comparisons.
CLI Coaching Targets
When a user or document uses a basic approach, the preferred alternative SHOULD be demonstrated:
| Basic | Preferred |
|---|---|
|
|
|
|
|
|
|
|
temp files for comparison |
|
|
|
Compliance
| Check | Method | Pass Criterion |
|---|---|---|
Placeholders have examples |
Every |
No orphaned placeholders |
Idempotent where possible |
Commands use conditional guards |
Re-execution is safe |
No useless cat |
|
Zero unnecessary pipes from cat |
Verify-change-verify present |
Configuration change blocks include before/after verification |
Three-step pattern visible |
Exceptions
Interactive commands (bluetoothctl, nmtui, fdisk) cannot follow verify-change-verify within the interactive session. Document the before-state capture and after-state verification as separate commands outside the interactive block.
Related
-
STD-005: Change Control — the full verify-change-verify standard
-
Change Management Patterns — field notebook origins
-
AWK Codex — reference for preferred text processing
-
Pipes Codex — pipeline optimization reference