Token导航 LogoToken导航

Agent Skill · 研究检索

code-mode(编码模式)

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

code-mode 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 57,638。

总安装 428周安装 18GitHub Stars 20下载 150核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/chenhunghan/code-mode-skill --skill code-mode

这个 Skill 是做什么的

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

code-mode 将大 API 响应转为小型处理脚本执行,减少 LLM 上下文 token 消耗与性能下降。适用于 Kubernetes、GitHub、Stripe 等海量数据源的查询场景,仅将脚本 stdout 送入模型。MCP 服务器在沙箱中运行用户脚本,支持 Python/JS/TS,确保原始数据不出本地环境。

使用前请确认 MCP 服务端已启用 code mode 并配置好安全策略,避免任意代码执行风险。本模式显著降低 token 开销,但对脚本编写能力要求较高;建议封装常用查询模板供团队复用。

来源仓库内路径:skills/code-mode

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

code-mode 怎么安装?

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

code-mode 支持哪些 AI 工具?

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

code-mode 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

code-mode 是免费的吗?

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

code-mode 用的人多吗?

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

code-mode 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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调用外部服务未明确有提醒
code-mode

编码模式 · 本页

42820调用外部服务未明确有提醒

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

SKILL.md 原文

Code Mode for MCP Servers

What is Code Mode?

When an MCP tool returns a large API response (e.g. listing 500 Kubernetes pods, 200 SCIM users, or thousands of GitHub issues), that entire payload enters the LLM's context window — consuming tokens and degrading performance.

Code mode flips the approach: instead of dumping raw data into context, the LLM writes a small processing script. The MCP server runs the script in a sandboxed runtime against the raw data, and only the script's stdout enters context.

This works especially well with well-known APIs (SCIM, Kubernetes, GitHub, Stripe, Slack, AWS, etc.) because the LLM already knows the response schema from training data — it can write the extraction script in one shot without inspecting the data.

Typical results: 65–99% context reduction.

Inspiration


How This Skill Works

This is an interactive planning skill. Work with the user step-by-step:

  1. Understand their MCP server (language, framework, what tools return large data)
  2. Select a sandbox that fits their server language and security needs
  3. Plan the implementation together
  4. Implement the code mode tool, sandbox executor, and benchmark
  5. Verify with benchmarks comparing before/after context sizes

Do not jump ahead. Confirm each step with the user before proceeding.


Step 1: Understand the Existing MCP Server

Ask the user (or discover by reading their codebase):

  • Server language: TypeScript/JavaScript, Python, Go, Rust, or other?
  • MCP framework: XMCP, FastMCP, mcp-go, custom, etc.?
  • Which tools return large responses? (e.g. list users, get pods, search issues)
  • What APIs do they call? Well-known APIs (SCIM, K8s, GitHub, Stripe) are ideal candidates because the LLM already knows the schema.
  • What languages should the sandbox support for script execution? Usually JavaScript is sufficient. Python is a common second choice.

Summarize your understanding back to the user and confirm before moving on.


Step 2: Select a Sandbox

The sandbox must be isolated from the host filesystem and network by default and secure by default. Present the user with options that match their server language, using the reference in references/sandbox-options.md.

Quick Selection Guide

If the server is TypeScript/JavaScript:

SandboxScript LanguageIsolationSizeNotes
quickjs-emscriptenJavaScriptWASM (no fs/net)~1MBLightweight, actively maintained, best default
pyodidePythonWASM (no fs/net)~20MBFull CPython in WASM, heavier
isolated-vmJavaScriptV8 isolate (no fs/net)~5MB nativeFast, separate V8 heap, not WASM

If the server is Python:

SandboxScript LanguageIsolationSizeNotes
RestrictedPythonPythonAST-restricted compileTinyCompiles to restricted bytecode, no I/O by default
pyodide (in-process WASM)PythonWASM~20MBHeavier but stronger isolation than RestrictedPython
quickjs (via quickjs PyPI)JavaScriptWASM/nativeSmallRun JS from Python

If the server is Go:

SandboxScript LanguageIsolationSizeNotes
gojaJavaScriptPure Go interpreterZero CGONo fs/net, widely used (used by Grafana)
WazeroWASM guest (JS/Python compiled to WASM)WASM runtime, pure GoZero CGOStrongest isolation, runs any WASM module
starlark-goStarlark (Python dialect)Pure Go interpreterZero CGODeterministic, no I/O, used by Bazel

If the server is Rust:

SandboxScript LanguageIsolationSizeNotes
boa_engineJavaScriptPure Rust interpreterNo unsafe depsES2024 support, embeddable
wasmtime / wasmerWASM guestWASM runtimeStrongRun any WASM module, strongest isolation
deno_coreJavaScript/TypeScriptV8-basedLargerFull V8, powerful but heavier
rustpythonPythonPure Rust interpreterModerateLess mature but functional

Read references/sandbox-options.md for detailed tradeoffs on each option.

Present 2–3 options to the user (filtered to their server language), explain the tradeoffs briefly, and let them choose. If they're unsure, recommend the lightest WASM-based option for their language.


Step 3: Plan the Implementation

Once the sandbox is selected, create a concrete plan with the user. The plan should cover these components:

3a. Code Mode Tool

A new MCP tool (e.g. code_mode or <domain>_code_mode) that accepts:

  • command or args: The underlying API call / query to execute (e.g. kubectl args, SCIM endpoint + params, GraphQL query)
  • code: The processing script the LLM writes
  • language (optional): Script language, defaults to javascript

The tool handler:

  1. Executes the underlying API call (reusing existing logic)
  2. Passes the raw response as a DATA variable into the sandbox
  3. Runs the script in the sandbox
  4. Returns only the script's stdout, plus a size measurement line: [code-mode: 18.0KB -> 6.2KB (65.5% reduction)]

3b. Sandbox Executor

A utility module that:

  • Initializes the chosen sandbox runtime
  • Injects DATA (the raw API response as a string) into the sandbox
  • Executes the user-provided script
  • Captures stdout and returns it
  • Enforces a timeout (e.g. 10 seconds)
  • Handles errors gracefully (script syntax errors, runtime errors)

3c. Wiring

  • Register the new tool in the MCP server's tool list
  • Optionally gate behind an env var (ask the user if they want this)

3d. Benchmark

A benchmark script that compares tool output size vs. code-mode output size across realistic scenarios. See references/benchmark-pattern.md for the template.

Present the plan to the user and confirm before implementing.


Step 4: Implement

Follow the confirmed plan. Implement in this order:

  1. Install the sandbox dependency (e.g. npm i quickjs-emscripten)
  2. Create the executor module — the sandbox wrapper
  3. Create the code mode tool — the MCP tool handler
  4. Wire it into the server — register the tool
  5. Create the benchmark script

Keep the implementation minimal — don't over-abstract. The executor and tool can each be a single file.

Implementation Tips

  • The DATA variable should always be a string (JSON-serialized). The script is responsible for parsing it if needed (JSON.parse(DATA) in JS, json.loads(DATA) in Python).
  • Include the reduction measurement in every response so the user/LLM can see the savings: [code-mode: {before}KB -> {after}KB ({pct}% reduction)]
  • Set a reasonable default timeout (10s) and memory limit if the sandbox supports it.
  • Return clear error messages if the script fails — the LLM will use the error to fix its script on the next call.

Step 5: Benchmark and Verify

After implementation, run the benchmark to verify code mode actually reduces context size. Read references/benchmark-pattern.md for the full template.

The benchmark should:

  1. Generate or fetch realistic test data — use faker/mock data if no live API is available, or hit a real endpoint if the user has one.
  2. Run each scenario through both paths:

- Regular tool response (full JSON) - Code mode with a representative extraction script

  1. Print a comparison table showing before/after sizes and reduction %
  2. Print a total across all scenarios

Present the benchmark results to the user. Typical expectations:

  • Simple list extractions: 60–80% reduction
  • Filtered queries (e.g. "only inactive users"): 90–99% reduction
  • Aggregations (e.g. "count per department"): 95–99% reduction

Reference Files

  • references/sandbox-options.md — Detailed comparison of all sandbox options by server language, with security analysis and setup instructions
  • references/benchmark-pattern.md — Benchmark script template and methodology

平台分布

Codex

33.81%
按下载量换算51

Claude

31.21%
按下载量换算47

Cursor

20.04%
按下载量换算30

Gemini CLI

9.65%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

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

继续浏览同类 Skills