llm-cli

A setup pattern for command-line programs that send prompts to large language models, such as llm, sgpt, or an API command. It uses a reusable PROMPT.md file as the model's standing instructions.

In plain words
What is it for?
Use it to create a reusable refactoring role, send source files through an LLM from the terminal, or configure an OpenAI or Anthropic API request with shared instructions.
Why use it?
It avoids pasting the same instructions into every request and makes the assistant behave consistently across supported command-line tools.

Agent

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 agents/muhiminosim/code-refactoring-skill/llm-cli
Clone the repo
git clone --depth 1 https://github.com/MuhiminOsim/code-refactoring-skill
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 798 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 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.00000 $0.00798
Opus 5 $0.00000 $0.00399
Sonnet 5 $0.00000 $0.00160
Haiku 4.5 $0.00000 $0.00080

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

Security

Grade B, and why

llm-cli scanned grade B with 2 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 3d 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.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

curl http://localhost:11434/api/generate -d "{

Makes network callslowCapability

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

curl https://api.anthropic.com/v1/messages \
agents/llm-cli.md · 119 lines

How it starts

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

Setup: llm, sgpt, shell_gpt, and other LLM CLIs

For any CLI tool that calls an LLM, the pattern is the same: provide PROMPT.md as the system prompt.


llm (Simon Willison's llm)

# Install once globally
pip install llm

# Create a reusable template
llm --system "$(cat PROMPT.md)" --save refactor

# Use it
llm -t refactor "Refactor the processOrder function in orders.py"

# Or pipe a file
cat src/orders.py | llm -t refactor "This function is too long, extract the discount logic"

sgpt / shell_gpt

pip install shell-gpt

# Set as a role
sgpt --create-role refactor
# When prompted for instructions, paste PROMPT.md contents

# Use it
sgpt --role refactor "Refactor src/orders.ts"

openai (official CLI)

openai api chat.completions.create \
  -m gpt-4o \
  --message system "$(cat PROMPT.md)" \
  --message user "Refactor the processOrder function"

Anthropic Claude CLI

# Using the Anthropic API directly
curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d "{
    \"model\": \"claude-sonnet-4-6\",
    \"system\": $(jq -Rs . < PROMPT.md),
    \"messages\": [{\"role\": \"user\", \"content\": \"Refactor this function\"}],
    \"max_tokens\": 4096
  }"

Ollama (local models)

# Start a session with system prompt
ollama run codellama --system "$(cat PROMPT.md)"

# Or via API
curl http://localhost:11434/api/generate -d "{
  \"model\": \"codellama\",
  \"system\": $(jq -Rs . < PROMPT.md),
  \"prompt\": \"Refactor the processOrder function\"
}"

LM Studio (local models)

In the LM Studio chat interface:

  1. Click the system prompt field
  2. Paste contents of PROMPT.md
  3. Start chatting

Via LM Studio's OpenAI-compatible API:

from openai import OpenAI

client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio")

response = client.chat.completions.create(
    model="local-model",
    messages=[
        {"role": "system", "content": open("PROMPT.md").read()},
        {"role": "user", "content": "Refactor processOrder in orders.py"}
    ]
)

Read the full file on GitHub · 119 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. 3d ago First seen · 119 lines · 0 tokens per session scan B 849aa2a7f7b9

Subscribe to this mod's changes

llm-cli is an agent published in the GitHub repository MuhiminOsim/code-refactoring-skill (5 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 798 tokens. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

prompting-tutorials

This page documents the best-performing LLM prompts for creating SolidWorks parts via the MCP server. Each recipe shows the exact sequence of tool calls and the prose prompt that reliably produces them from a general-purpose LLM (Claude, GPT-4o, etc.).

andrewbartels1/SolidworksMCP-python · 0 tokens

prompt_engineer

Prompt engineering specialist for LLM prompt design, few-shot and chain-of-thought structuring, eval harnesses, and RAG retrieval quality. Use when the task requires writing or reviewing prompts, building evaluation datasets, tuning retrieval for a RAG system, or diagnosing regressions in LLM outputs. For example…

josstei/maestro-orchestrate · 98 tokens

ai-ml-prompt-engineering-agent

Agent "ai-ml-prompt-engineering-agent" from girijashankarj/cursor-handbook, covering prompt engineering agent, invocation, scope, expertise and when to use.

girijashankarj/cursor-handbook · 0 tokens

t-800-prompt-craft

Промпт-инженерия под vendor: Claude / GPT (Cookbook) / Gemini / Perplexity / Cursor. Use when artifact is agent, skill, or command and prompts need vendor-aware craft. Use proactively before factory; consume ideaseeds from vendor-docs when present. Do NOT when artifact is only rule/hook/script without prompt body.

Khar-AG/t-800-agent · 81 tokens

hyv-veo-prompt-smith

The generative-prompt writer for HearYourVOICE (Phase 4). Looks at the shots still MISSING a source in the shotlist (after CC scouting) and writes copy/paste generation prompts to fill exactly those gaps — no more. Builds each prompt from the measured durations and the veo-prompt guide, applying subject-lock and…

killernay/HearYourVOICE · 124 tokens

prompting

Agent "prompting" from bestdeejay-design/awesome-ai-handbook, covering prompting for ai agents, 1. how agent prompting differs, 2. system prompt structure, role and tools.

bestdeejay-design/awesome-ai-handbook · 0 tokens