250-cli

250-cli is a cursor rule for Cursor from d-padmanabhan/agent-engineering-handbook. It costs 12 tokens per session (1,956 once invoked), scanned A, original, MIT.

A ruleset for building command-line programs, which are tools operated from a terminal. It covers clear errors, debug modes, secret handling, input checks, and platform conventions.

In plain words
What is it for?
Use it when designing or reviewing terminal commands, flags, logging, validation, error handling, and debug behavior.
Why use it?
It helps command-line tools behave predictably and makes failures easier to investigate without exposing sensitive information.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when designing or reviewing terminal commands, flags, logging, validation, error handling, and debug behavior.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/d-padmanabhan/agent-engineering-handbook/250-cli
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.

Clone the repo
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 250-cli

README.md
[![agentmods](https://agentmods.dev/badge/rules/d-padmanabhan/agent-engineering-handbook/250-cli/github.svg)](https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/250-cli)
Your own site
<a href="https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/250-cli"><img src="https://agentmods.dev/badge/rules/d-padmanabhan/agent-engineering-handbook/250-cli/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 250-cli

Your own site · 80×15
<a href="https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/250-cli"><img src="https://agentmods.dev/badge/rules/d-padmanabhan/agent-engineering-handbook/250-cli.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,956 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00012 $0.01956
Opus 5.5 $0.00005 $0.00782
Sonnet 5.5 $0.00002 $0.00391
Haiku 4.5 $0.00001 $0.00196

Measured 1mo ago against content hash b9917886fcac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

250-cli scanned grade A with 1 finding 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 1mo 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

subprocess.run(command, shell=True)
rules/250-cli.mdc · 384 lines

How it starts

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

CLI Application Engineering Ruleset

Goal: Build secure, user-friendly, debuggable command-line interfaces that follow platform conventions.

Core Principles

  • User Experience First: Clear error messages, helpful usage, intuitive flags
  • Debuggability: Always provide debug mode for troubleshooting
  • Security: Never log secrets, validate inputs, fail fast
  • Platform Conventions: Follow platform-specific CLI patterns

Debug Mode Patterns

Environment Variable Pattern

# Enable debug mode
DEBUG=1 my-cli command

# Or with specific namespaces
DEBUG=my-cli:* my-cli command

Command-Line Flag Pattern

# Enable debug mode
my-cli --debug command

# Verbose mode (different from debug)
my-cli --verbose command

# Quiet mode
my-cli --quiet command

Implementation Examples

Python
import os
import logging
import sys

# Setup logging
log_level = logging.INFO
if os.getenv("DEBUG") == "1" or "--debug" in sys.argv:
    log_level = logging.DEBUG

logging.basicConfig(
    level=log_level,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)

def main():
    logger.debug("Debug mode enabled")
    # ... rest of CLI logic
Node.js / JavaScript

Use the debug library:

import debug from 'debug';

// Enable debug via environment variable
// DEBUG=1 npm start
// DEBUG=my-cli:* npm start
// DEBUG=my-cli:auth npm start

const debugLog = debug('my-cli:main');
const authDebug = debug('my-cli:auth');

function main() {
  debugLog('Starting CLI application');
  authDebug('Authenticating user');
  // ... rest of CLI logic
}

// Enable debug output
if (process.env.DEBUG || process.env.AI_DEBUG_ENABLE === "1") {
  debug.enabled = true;
}
Go
package main

import (
    "flag"
    "log"
    "os"
)

var (
    debugFlag = flag.Bool("debug", false, "Enable debug logging")
    verboseFlag = flag.Bool("verbose", false, "Enable verbose output")
)

func main() {
    flag.Parse()

    // Check environment variable
    debugMode := *debugFlag || os.Getenv("DEBUG") == "1"

    if debugMode {
        log.SetFlags(log.LstdFlags | log.Lshortfile)
        log.SetOutput(os.Stderr)
    }

    log.Printf("Debug mode: %v", debugMode)
    // ... rest of CLI logic
}

Read the full file on GitHub · 384 lines

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. 1mo ago First seen · 384 lines · 12 tokens per session scan A b9917886fcac

Subscribe to this mod's changes

250-cli is a cursor rule published in the GitHub repository d-padmanabhan/agent-engineering-handbook (19 stars, last pushed 2d ago), licensed MIT. It adds 12 tokens to every session and 1,956 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.