Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

optimize-agent-context优化 Agent 上下文

Agent Skill

optimize-agent-context 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

282

周安装

12

GitHub Stars

17

下载量

99
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:optimize-agent-context(优化 Agent 上下文)
来源仓库:https://github.com/jstarfilms/vibecode-protocol-suite
仓库路径:skills/optimize-agent-context
安装命令:
npx skills add https://github.com/jstarfilms/vibecode-protocol-suite --skill optimize-agent-context
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jstarfilms/vibecode-protocol-suite --skill optimize-agent-context

简介

optimize-agent-context 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于上下文窗口压缩、记忆机制设计与长程依赖处理等 LLM 应用场景。
  • 可按任务复杂度与历史深度选择摘要策略。
  • 安装命令:npx skills add https://github.com/jstarfilms/vibecode-protocol-suite --skill optimize-agent-context;需防止关键信息丢失。
  • 摘要生成应保留事实主干,避免主观裁剪扭曲原意。

SKILL.md

Optimize Agent Context

Enforce the Band-Aid Philosophy: an agent context file should only contain rules that fix mistakes the agent is actively making. Everything else is bloat that degrades performance and increases cost.

Core Rules (Non-Negotiable)

  1. NO BLOAT — Never include directory structures, file trees, dependency lists, or package inventories. The agent has tools to discover these.
  2. NO SUMMARIES — Never include vague app descriptions ("This is a video sharing app"). This distracts the model and triggers hallucinations.
  3. ONLY FIX KNOWN FAILURES — Every line must correct a specific, observed agent mistake or enforce an architectural constraint the agent cannot guess.
  4. USE NEGATIVE CONSTRAINTS — When the agent uses the wrong tool/library, explicitly state what NOT to use, then what TO use.
  5. BE MINIMAL — Target under 20 lines. Bullet points preferred. If a rule can be removed without the agent breaking, remove it.

Why This Matters

Studies show bloated, AI-generated context files:

  • Degrade agent performance by ~3%
  • Increase token costs by 20%+
  • Trigger hallucinations by surfacing legacy code the agent then tries to use ("pink elephants" effect)

Workflow

Mode A: Create New Agent File (Interview)

When the user wants to create a new context file from scratch:

  1. Ask these questions one at a time (do not dump all at once):

- "What specific mistakes has the AI agent been making repeatedly?" (e.g., wrong imports, forgetting to format, modifying wrong files) - "Are there legacy tools/libraries the agent keeps using but shouldn't?" (e.g., "We have Redux but use Zustand for new features") - "Any build/test/env quirks the agent can't figure out on its own?" (e.g., special env vars, non-standard test commands)

  1. Synthesize answers into a ruthlessly minimal bulleted markdown file.
  2. Validate the output against the Core Rules above. Strip anything that violates them.
  3. Present the file and ask: "Does this capture the mistakes? Anything to add or remove?"

Mode B: Audit Existing Agent File

When the user has an existing agent.md / claude.md / cursorrules and wants it optimized:

  1. Read the file using view_file.
  2. Classify every line into one of:

- ✅ KEEP — Fixes a known failure or states an ungessable constraint - ❌ BLOAT — Directory trees, dependency lists, file structures - ❌ SUMMARY — Vague app descriptions, project overviews - ❌ OBVIOUS — Things the agent can discover via tools (package.json, tsconfig, etc.) - ⚠️ MAYBE — Potentially useful but needs user confirmation

  1. Present the audit as a table showing each section and its classification.
  2. Generate the optimized version with only ✅ KEEP and confirmed ⚠️ MAYBE lines.
  3. Show before/after line count to demonstrate the reduction.

Mode C: Add a Band-Aid

When the user reports a specific agent mistake mid-session:

  1. Ask: "What did the agent do wrong?"
  2. Write a single, precise negative constraint: Do NOT [wrong thing]. Instead, [correct thing].
  3. Suggest appending it to the existing context file.

Output Format

The generated file should follow this structure:

# Agent Rules

- [Negative constraint or correction]
- [Negative constraint or correction]
- [Build/test quirk]
- [Architectural constraint]

No headers beyond the title. No explanations. No examples. Just rules.

Anti-Patterns to Reject

If the user or another agent tries to include any of these, push back:

Anti-PatternWhy It's Bad
Folder tree / file structureAgent has list_dir and find_by_name
Dependency listAgent reads package.json / requirements.txt
"This app is a..." summaryDistracts model, triggers hallucination
Tech stack overviewAgent reads config files
Code style rules already in linter configRedundant — linter enforces these
Long code examplesBloats context, agent writes its own code

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude

33.65%
按下载量换算33

Codex

32.66%
按下载量换算32

Cursor

20.48%
按下载量换算20

Gemini CLI

10.64%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills