AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Optimize Prompt

skill-josephsanjaya-skills-optimize-prompt · by JosephSanjaya

Optimize Claude Code and LLM prompts for token efficiency, prefix caching compliance, positional recall, and execution correctness. Use when writing/reviewing prompts, debugging agent errors/failures, managing context windows, selecting effort levels, choosing MCP vs CLI tools, designing subagents, or editing CLAUDE.md. Triggers - optimize my prompt, prompt is too expensive, agent keeps reading w…

No reviews yet
0 installs
15 views
0.0% view→install

Install

$ agentstack add skill-josephsanjaya-skills-optimize-prompt

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-josephsanjaya-skills-optimize-prompt)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Optimize Prompt? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Optimize Prompt & Review Skill

This skill provides workflow guidance and automated tooling to audit, analyze, compress, and optimize LLM prompts, instructions, and Claude Code environments for maximum token efficiency and reasoning accuracy.

Delineate prompts with XML tags, enforce append-only prefix caching alignment, select iterative effort levels, utilize symbolic abbreviations/protocols, and implement Prism Prompting constraints.


1. Quick Decision Tree

What do you need?
├── Fix a bug → Bug Triage Protocol (references/prompt-framework.md)
├── Add a feature → Incremental First-Step pattern (references/examples.md)
├── Explore large codebase → Subagent delegation (references/subagents-and-scaling.md)
├── Session is getting slow/expensive → Context hygiene (references/context-management.md)
├── Agent ignoring instructions → Context decay recovery (references/edge-cases.md)
├── Run Heuristic Auditor → Run python tool (scripts/audit_prompt.py)
├── Analyze Token Usage → Run python tool (scripts/analyze_token_usage.py)
└── Compress Prompt/Code → Run python tool (scripts/compress_prompt.py)

2. Quick Start Workflow

To analyze and optimize a prompt:

  1. Run Automated Heuristic Audit:

Execute the Python auditor on the prompt string, stdin, or file: ``bash python scripts/audit_prompt.py `` For SKILL.md files, the auditor validates:

  • Frontmatter presence and structure (required --- markers)
  • Required fields: name and description
  • Proper YAML syntax (unquoted colons in values will trigger a failure)
  • Name format (lowercase kebab-case)
  1. Analyze Token/Session Cost:

Analyze token distribution of files or conversation history files (.json): ``bash python scripts/analyze_token_usage.py ``

  1. Compress Prompt / Apply Shorthand:

Compress prompt text by removing filler words, pleasantries (Caveman Mode), and optionally applying symbolic Less-Token-Language (LTL): ``bash python scripts/compress_prompt.py --symbolic --caveman ``

  1. Apply Automated Corrections:

Use the --fix parameter to programmatically clean up politeness, persona placebo, and caching order: ``bash python scripts/audit_prompt.py --fix ``

  1. Validate Bounded Context:

Ensure the prompt uses @file:line for targeting and !command for diagnostic output instead of prose.


3. Reference Documentation Index

For details on API configurations, token economics, and LLM constraints, read these references:

  • [knowledge.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/knowledge.md): Attention dilution, lost-in-the-middle positioning bias, prefix caching, and tokenization fertility.
  • [examples.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/examples.md): Copy-pasteable good/bad prompt layouts, Outlines CFGs, Pydantic AI models, Zod schemas, and vLLM/LMCache configurations.
  • [prompt-framework.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/prompt-framework.md): Five-pillar templates, bug triage protocols, XML tags, effort levels, context operators, and CLAUDE.md/MCP/commands structures.
  • [context-management.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/context-management.md): Token budgets, slash commands (/clear, /compact), CLAUDE.md size rules, compaction, and session reset guidelines.
  • [subagents-and-scaling.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/subagents-and-scaling.md): Subagent delegation config, horizontal project scaling, and MCP vs CLI token cost benchmarks.
  • [edge-cases.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/edge-cases.md): Context decay symptoms, lossy compaction, and sync conflicts.
  • [symbolic-languages.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/symbolic-languages.md): Mathematical operators, LTL (Less-Token-Language), Hieratic shorthand, Caveman protocol, and Wenyan-lang mode.
  • [algorithmic-compression.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/algorithmic-compression.md): Secondary model prompt compression (LLMLingua), Dynamic Memory Sparsification (DMS), and AST-aware Claw Compactor.
  • [architectural-patterns.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/architectural-patterns.md): Core architectural patterns for token efficiency including AtomicRAG, Spine Architecture, Subagent Forking, and Modular Context Loading.
  • [data-formats.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/data-formats.md): Token density comparison across Markdown, YAML, JSON, XML, and TOON (Token-Oriented Object Notation).
  • [caching-strategies.md](file:///Users/jsanjaya/Projects/skills/optimize-prompt/references/caching-strategies.md): Ephemeral prefix caching, semantic caching with embeddings, VectorQ adaptive thresholds, and hybrid multi-layer caching.

Developers must use this schema to verify cache alignments and format outputs before execution.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.