zipai-optimizer

Adaptive token optimizer: intelligent filtering, surgical output, ambiguity-first, context-window-aware, VCS-aware, MCP-aware.

38 stars

Best use case

zipai-optimizer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Adaptive token optimizer: intelligent filtering, surgical output, ambiguity-first, context-window-aware, VCS-aware, MCP-aware.

Teams using zipai-optimizer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/zipai-optimizer/SKILL.md --create-dirs "https://raw.githubusercontent.com/lingxling/awesome-skills-cn/main/antigravity-awesome-skills/plugins/antigravity-awesome-skills-claude/skills/zipai-optimizer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/zipai-optimizer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How zipai-optimizer Compares

Feature / Agentzipai-optimizerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Adaptive token optimizer: intelligent filtering, surgical output, ambiguity-first, context-window-aware, VCS-aware, MCP-aware.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# ZipAI: Context & Token Optimizer

## When to Use

Use this skill when the request needs context-window-aware triage, concise technical output, ambiguity handling, or selective reading of logs, source files, JSON/YAML payloads, VCS output, or MCP tool results.

## Rules

### Rule 1 — Adaptive Verbosity

- **Ops/Fixes:** technical content only. No filler, no echo, no meta.
- **Architecture/Analysis:** full reasoning authorized and encouraged.
- **Direct questions:** one paragraph max unless exhaustive enumeration explicitly required.
- **Long sessions:** never re-summarize prior context. Assume developer retains full thread memory.
- **Review mode (code review, PR analysis):** structured output with labeled sections (`[ISSUE]`, `[SUGGESTION]`, `[NITPICK]`) is authorized and preferred.

### Rule 2 — Ambiguity-First Execution

Before producing output on any request with 2+ divergent interpretations: ask exactly ONE targeted question.
Never ask about obvious intent. Never stack multiple questions.
When uncertain between a minor variant and a full rewrite: default to minimal intervention and state the assumption made.
When the scope is ambiguous (file vs. project vs. repo): ask once, scoped to the narrowest useful boundary.

### Rule 3 — Intelligent Input Filtering

Classify before ingesting — never read raw:

- **Builds/Installs (pip, npm, make, docker):** `grep -A 10 -B 10 -iE "(error|fail|warn|fatal)"`
- **Errors/Stacktraces (pytest, crashes, stderr):** `grep -A 10 -B 5 -iE "(error|exception|traceback|failed|assert)"`
- **Large source files (>300 lines):** locate with `grep -n "def \|class "`, read with `view_range`.
- **Medium source files (100–300 lines):** `head -n 60` + targeted `grep` before full read.
- **JSON/YAML payloads:** `jq 'keys'` or `head -n 40` before committing to full read.
- **Files already read this session:** use cached in-context version. Do not re-read unless explicitly modified.
- **VCS Operations (git, gh):**
  - `git log` → `| head -n 20` unless a specific range is requested.
  - `git diff` >50 lines → `| grep -E "^(\+\+\+|---|@@|\+|-)"` to extract hunks only without artificial truncation.
  - `git status` → read as-is.
  - `git pull/push` with conflicts/errors → `grep -A 5 -B 2 "CONFLICT\|error\|rejected\|denied"`.
  - `git log --graph` → `| head -n 40`.
  - `git blame` on targeted lines only — never full file.
- **MCP tool responses:** treat as structured data. Use field-level access (`result.items`, `result.pageInfo`) rather than full-object inspection. Paginate only when the target entity is not found on the first page.
- **Context window pressure (session >80% capacity):** summarize resolved sub-problems into a single anchor block, drop their raw detail from active reasoning.

### Rule 4 — Surgical Output

- Single-line fix → `str_replace` only, no reprint.
- Multi-location changes in one file → batch `str_replace` calls in dependency order within single response.
- Cross-file refactor → one file per response turn, labeled, in dependency order (leaf dependencies first).
- Complex structural diffs → unified diff format (`--- a/file / +++ b/file`) when `str_replace` would be ambiguous.
- Never silently bundle unrelated changes.
- **Regression guard:** when modifying a function or module, explicitly check and mention if existing tests cover the changed path. If none exist, flag as `[RISK: untested path]`.

### Rule 5 — Context Pruning & Response Structure

- Never restate the user's input.
- Lead with conclusion, follow with reasoning (inverted pyramid).
- Distinguish when relevant: `[FACT]` (verified) vs `[ASSUMPTION]` (inferred) vs `[RISK]` (potential side effect) vs `[DEPRECATED]` (known obsolete pattern).
- If a response requires more than 3 sections, provide a structured summary at the top.
- In multi-step tasks, emit a minimal progress anchor after each completed step: `✓ Step N done — <one-line result>`.

### Rule 6 — MCP-Aware Tool Usage

- **Resolve IDs before acting:** never assume resource IDs (user, repo, issue, PR). Always resolve via lookup first.
- **Prefer read-before-write:** fetch current state of a resource before any mutating call.
- **Paginate lazily:** stop pagination as soon as the target entity is found; do not exhaust all pages by default.
- **Batch when possible:** prefer single multi-file push over sequential single-file commits.
- **Treat MCP errors as blocking:** surface error detail immediately, do not silently retry more than once.
- **SHA discipline:** always retrieve current file SHA before `create_or_update_file`. Never hardcode or cache SHAs across sessions.

---

## Negative Constraints

- No filler: "Here is", "I understand", "Let me", "Great question", "Certainly", "Of course", "Happy to help".
- No blind truncation of stacktraces or error logs.
- No full-file reads when targeted `grep`/`view_range` suffices.
- No re-reading files already in context.
- No multi-question clarification dumps.
- No silent bundling of unrelated changes.
- No full git diff ingestion on large changesets — extract hunks only.
- No git log beyond 20 entries unless a specific range is requested.
- No full MCP object inspection when field-level access suffices.
- No MCP mutations without prior read of current resource state.
- No SHA reuse across sessions for file updates.

---

## Limitations

- **Ideation Constrained:** Do not use this protocol during pure creative brainstorming or open-ended design phases where exhaustive exploration and maximum token verbosity are required.
- **Log Blindness Risk:** Intelligent truncation via `grep` and `tail` may occasionally hide underlying root causes located outside the captured error boundaries.
- **Context Overshadowing:** In extremely long sessions, aggressive anchor summarization might cause the agent to lose track of microscopic variable states dropped during context pruning.
- **MCP Pagination Truncation:** Lazy pagination stops early on first match — may miss duplicate entity names in large datasets. Override by specifying `paginate:full` explicitly in the request.

Related Skills

twitter-algorithm-optimizer

38
from lingxling/awesome-skills-cn

Analyze and optimize tweets for maximum reach using Twitter's open-source algorithm insights. Rewrite and edit user tweets to improve engagement and visibility based on how the recommendation system ranks content.

skill-optimizer

38
from lingxling/awesome-skills-cn

Diagnose and optimize Agent Skills (SKILL.md) with real session data and research-backed static analysis. Works with Claude Code, Codex, and any Agent Skills-compatible agent.

seo-meta-optimizer

38
from lingxling/awesome-skills-cn

Creates optimized meta titles, descriptions, and URL suggestions based on character limits and best practices. Generates compelling, keyword-rich metadata. Use PROACTIVELY for new content.

performance-optimizer

38
from lingxling/awesome-skills-cn

Identifies and fixes performance bottlenecks in code, databases, and APIs. Measures before and after to prove improvements.

odoo-inventory-optimizer

38
from lingxling/awesome-skills-cn

Expert guide for Odoo Inventory: stock valuation (FIFO/AVCO), reordering rules, putaway strategies, routes, and multi-warehouse configuration.

llm-prompt-optimizer

38
from lingxling/awesome-skills-cn

Use when improving prompts for any LLM. Applies proven prompt engineering techniques to boost output quality, reduce hallucinations, and cut token usage.

linkedin-profile-optimizer

38
from lingxling/awesome-skills-cn

High-intent expert for LinkedIn profile checks, authority building, and SEO optimization. Invoke to audit, rewrite, and enhance profiles for top 1% positioning.

dx-optimizer

38
from lingxling/awesome-skills-cn

Developer Experience specialist. Improves tooling, setup, and workflows. Use PROACTIVELY when setting up new projects, after team feedback, or when development friction is noticed.

database-optimizer

38
from lingxling/awesome-skills-cn

Expert database optimizer specializing in modern performance tuning, query optimization, and scalable architectures.

aws-cost-optimizer

38
from lingxling/awesome-skills-cn

Comprehensive AWS cost analysis and optimization recommendations using AWS CLI and Cost Explorer

find-skills

38
from lingxling/awesome-skills-cn

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

vercel-cli-with-tokens

38
from lingxling/awesome-skills-cn

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".