Token导航 LogoToken导航

Agent Skill · 研究检索

prompt-compression(即时压缩)

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

prompt-compression 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 53,927。

总安装 519周安装 21GitHub Stars 公开资料未说明下载 163核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ofershap/prompt-compression --skill prompt-compression

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。适合让 Agent 规范任务边界、统一输出格式或优化提示词可复用性。通过安装命令添加,使用时需保留真实业务约束,避免将示例当硬规则。涉及自动执行或外部工具调用时,应在提示词中明确确认步骤和权限边界。

prompt-compression 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/prompt-compression

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/ofershap/prompt-compression --skill prompt-com…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

prompt-compression 怎么安装?

在终端执行 npx skills add https://github.com/ofershap/prompt-compression --skill prompt-compression。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

prompt-compression 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

prompt-compression 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

prompt-compression 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

prompt-compression 用的人多吗?

公开数据是累计安装 519 次,近一周安装 21 次,下载 163 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

prompt-compression 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
prompt-compression

即时压缩 · 本页

519—接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

When to use

Use this skill when compressing documentation, framework references, API indexes, coding guidelines, or any structured knowledge into a compact format for inclusion in AGENTS.md, CLAUDE.md, or system prompts. The goal is maximum information density with minimum token usage.

Background

Vercel's research (January 2026) showed that an 8KB compressed docs index in AGENTS.md achieved a 100% eval pass rate, compared to 53% baseline and 79% for skills with explicit trigger instructions. Passive context (always loaded) beats active retrieval (agent must decide to invoke) because it eliminates the decision point. Compression is the key enabler -- it makes passive context viable without blowing up the context window.

Critical Rules

1. Use Pipe-Delimited Index Format for File References

Wrong (agents do this):

## Documentation

- Getting Started: See docs/getting-started.md for installation instructions
- Routing: See docs/routing.md for route definitions
- API Routes: See docs/api-routes.md for API endpoint documentation

Correct:

[Docs Index]|root: ./docs |getting-started:{installation.md,project-structure.md}
|routing:{defining-routes.md,dynamic-routes.md,middleware.md}
|api:{endpoints.md,auth.md,validation.md}

Why: The pipe-delimited format cuts tokens by 70-80% while remaining parseable by every major LLM. Agents can still locate and read specific files when needed.

2. Compress Rules into Single-Line Directives

Wrong (agents do this):

## Coding Standards

### Import Organization

When writing imports, always organize them in the following order:

1. Built-in Node.js modules (fs, path, etc.)
2. External dependencies (react, express, etc.)
3. Internal modules (relative imports)
4. Type imports

Make sure to separate each group with a blank line.

Correct:

[Standards] |imports: builtin > external > internal > types (blank line between groups)

Why: Agents don't need conversational explanation. A compressed directive carries the same behavioral instruction in 5% of the tokens.

3. Strip Explanatory Prose, Keep Only Actionable Content

Wrong:

## Authentication

Our application uses JWT-based authentication. When a user logs in, the server generates a JWT token
that contains the user's ID and role. This token is sent back to the client and stored in an
httpOnly cookie. On subsequent requests, the middleware extracts the token from the cookie, verifies
it, and attaches the user object to the request.

The token expires after 24 hours, at which point the user must log in again. Refresh tokens are not
currently implemented but are planned for a future release.

Correct:

[Auth]|JWT in httpOnly cookie|24h expiry|no refresh tokens |middleware: extract token > verify >
attach user to req |login flow: validate creds > generate JWT(id,role) > set cookie

Why: Agents need the behavioral contract (what to do), not the narrative (why it was built this way). Remove history, motivation, and future plans.

4. Use Abbreviated Keys and Symbols

Wrong:

- Required: true
- Type: string
- Default value: "production"
- Minimum length: 3
- Maximum length: 50

Correct:

|env: required string="production" len:3-50

Why: Standard abbreviations (req, opt, str, int, bool, len, min, max, def) are universally understood by LLMs and compress structured metadata by 80%+.

5. Flatten Nested Hierarchies

Wrong:

## Project Structure

### Source Code

#### Components

##### UI Components

- Button.tsx
- Input.tsx
- Modal.tsx

##### Layout Components

- Header.tsx
- Footer.tsx
- Sidebar.tsx

Correct:

[Structure]|src/ |components/ui:{Button,Input,Modal}.tsx
|components/layout:{Header,Footer,Sidebar}.tsx

Why: Markdown heading hierarchy wastes tokens on whitespace and repetition. Brace expansion and path prefixes are denser and equally readable to agents.

6. Add Retrieval-Led Reasoning Directive

Always include this directive when the compressed context references retrievable files:

IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any [DOMAIN] tasks.

Why: Without this, agents default to training data (which may be stale). This single line shifts behavior from "guess from memory" to "look it up," which was the key factor in Vercel's 100% pass rate.

7. Preserve Structural Boundaries

Wrong:

routingdefiningdynamicmiddlewareapiendpointsauthvalidation

Correct:

|routing:{defining,dynamic,middleware} |api:{endpoints,auth,validation}

Why: Over-compression destroys parseability. Keep logical grouping with delimiters (pipes, braces, colons). The agent must be able to navigate to a specific file or section.

8. Target 8-15KB for Complete Framework Indexes

A full framework docs index (file tree pointing to retrievable docs) should compress to 8-15KB. This is the sweet spot where:

  • It fits comfortably in AGENTS.md alongside project-specific context
  • Token cost per request stays under 2-4K tokens
  • Agent accuracy reaches near-perfect on framework-specific tasks

If the compressed output exceeds 15KB, split into a primary index (most-used APIs) and a secondary index that the agent can read on demand.

Compression Process

  1. Identify the source - docs directory, API reference, coding guidelines, framework docs
  2. Extract actionable content - strip prose, motivation, history, examples that duplicate the rule
  3. Choose format - pipe-delimited index for file trees, single-line directives for rules, abbreviated keys for config/schema
  4. Compress - apply abbreviations, brace expansion, path prefixes, symbol shorthand
  5. Add retrieval directive - if output references readable files
  6. Validate - check that an agent can still locate any specific piece of information
  7. Measure - compare token count before/after, target 70-80% reduction

Output Formats

File Index (for docs directories)

[Topic Index]|root: ./path |IMPORTANT: Prefer retrieval-led reasoning over pre-training-led
reasoning for [TOPIC] |section-a/subsection:{file1.md,file2.md,file3.md}
|section-b:{file1.md,file2.md}

Rules/Standards (for coding guidelines)

[Standards] |naming: camelCase vars, PascalCase components, UPPER_SNAKE constants |imports:
builtin > external > internal > types |errors: always use Result<T,E>, never throw in library code
|tests: colocate with source, name: \*.test.ts, min coverage 80%

API Reference (for endpoint documentation)

[API]|base: /api/v2 |GET /users?page,limit -> User[]|auth:bearer |POST /users {name,email,role?} ->
User|auth:admin |DELETE /users/:id -> void|auth:admin

Config/Schema (for structured metadata)

[Config] |db: host=localhost port=5432 pool:5-20 timeout:30s |cache: redis ttl:5m max:1000
prefix:"app:" |auth: jwt secret=$JWT_SECRET exp:24h algo:HS256

Anti-Patterns

  • Compressing content that agents already know well (basic language syntax, standard library)
  • Removing code examples that demonstrate non-obvious API usage
  • Compressing error messages or edge case documentation (agents need these verbatim)
  • Creating compression so aggressive that a human can't review or maintain it
  • Putting full documentation content in AGENTS.md instead of an index pointing to files
  • Forgetting the retrieval-led reasoning directive

平台分布

Codex

37.11%
按下载量换算60

Claude

28.72%
按下载量换算47

Cursor

17.05%
按下载量换算28

Gemini CLI

10.41%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

继续浏览同类 Skills