Token导航 LogoToken导航TokenDH.com
前端设计可写文件github未标认证来源可访问许可证需确认审计提醒

code-interpreter代码解释器

Agent Skill

code-interpreter 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,280

周安装

134

GitHub Stars

151

下载量

1,061
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/aws-samples/sample-strands-agent-with-agentcore --skill code-interpreter

简介

code-interpreter 提供基于 AWS Bedrock AgentCore 的沙箱代码执行环境,支持 Python、JS/TS 运行。

  • 适用于数据分析、文件处理或临时脚本调试,可在安全隔离环境中执行命令与文件操作。
  • 通过 execute_code、execute_command 等工具调用实现交互,结果可推送至共享工作区(S3)。
  • 使用前请确认 IAM 权限与 S3 路径配置正确,避免跨账户访问或资源泄露风险。
  • 沙箱有资源限制,长时间运行或高负载任务可能受限;建议在非关键路径测试后再投入生产使用。

SKILL.md

Code Interpreter

A general-purpose code execution environment powered by AWS Bedrock AgentCore Code Interpreter. Run code, execute shell commands, and manage files in a secure sandbox.

Available Tools

  • execute_code(code, language, output_filename): Execute Python, JavaScript, or TypeScript code.
  • execute_command(command): Execute shell commands.
  • file_operations(operation, paths, content): Read, write, list, or remove files in the sandbox.
  • ci_push_to_workspace(paths): Save sandbox files to the shared workspace (S3). Omit paths to save all files in the sandbox root.

Tool Parameters

execute_code

ParameterTypeRequiredDefaultDescription
codestringYesCode to execute. Use print() for text output.
languagestringNo"python""python", "javascript", or "typescript"
output_filenamestringNo""File to download after execution. Code must save a file with this exact name. Saved to workspace automatically.

execute_command

ParameterTypeRequiredDescription
commandstringYesShell command to execute (e.g., "ls -la", "pip install requests").

file_operations

ParameterTypeRequiredDescription
operationstringYes"read", "write", "list", or "remove"
pathslistFor read/list/removeFile paths. read: ["file.txt"], list: ["."], remove: ["old.txt"]
contentlistFor writeEntries with path and text: [{"path": "out.txt", "text": "hello"}]

tool_input Examples

execute_code — text output

{
  "code": "import pandas as pd\ndf = pd.DataFrame({'A': [1,2,3], 'B': [4,5,6]})\nprint(df.describe())",
  "language": "python"
}

execute_code — generate chart

{
  "code": "import matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport numpy as np\nx = np.linspace(0, 10, 100)\nplt.figure(figsize=(10,6))\nplt.plot(x, np.sin(x))\nplt.title('Sine Wave')\nplt.savefig('sine.png', dpi=300, bbox_inches='tight')\nprint('Done')",
  "language": "python",
  "output_filename": "sine.png"
}

execute_command — install a package

{
  "command": "pip install yfinance"
}

execute_command — check environment

{
  "command": "python --version && pip list | head -20"
}

file_operations — write a file

{
  "operation": "write",
  "content": [{"path": "config.json", "text": "{\"key\": \"value\"}"}]
}

file_operations — list files

{
  "operation": "list",
  "paths": ["."]
}

file_operations — read a file

{
  "operation": "read",
  "paths": ["output.csv"]
}

When to Use This Skill

Use code-interpreter as a sandbox for testing and prototyping code. For production tasks (creating documents, charts, presentations), prefer specialized skills.

Do NOT use for:

  • Formatting or displaying code examples (respond directly with markdown code blocks)
  • Explaining code or algorithms (respond directly with text)
  • Simple calculations you can do mentally (just provide the answer)
  • Any task that doesn't require actual code execution
TaskRecommended SkillNotes
Create charts/diagramsvisual-designUse this first for production charts
Create Word documentsword-documentsHas template support and styling
Create Excel spreadsheetsexcel-spreadsheetsHas formatting pipeline and validation
Create PowerPointpowerpoint-presentationsHas layout system and design patterns
Test code snippetscode-interpreterDebug, verify logic, check output
Prototype algorithmscode-interpreterExperiment before implementing
Install/test packagescode-interpreterCheck compatibility, test APIs
Debug code logiccode-interpreterIsolate and test specific functions
Verify calculationscode-interpreterQuick math or data checks

Code Interpreter vs Code Agent

Code InterpreterCode Agent
NatureSandboxed execution environmentAutonomous agent (Claude Code)
Best forQuick scripts, data analysis, prototypingMulti-file projects, refactoring, test suites
File persistenceOnly when output_filename is setAll files auto-synced to S3
Session stateVariables persist within sessionFiles + conversation persist across sessions
AutonomyYou write the codeAgent plans, writes, runs, and iterates
Use whenYou need to run a specific piece of codeYou need an engineer to solve a problem end-to-end

Workspace Integration

All files go to the code-interpreter/ namespace — a flat, session-isolated space separate from office documents.

Sandbox → Workspace (save outputs):

// Save a specific file after execution
{ "tool": "ci_push_to_workspace", "paths": ["chart.png", "results.json"] }

// Save everything in the sandbox root
{ "tool": "ci_push_to_workspace" }

// Alternative: save a single file inline during execute_code
{ "tool": "execute_code", "output_filename": "chart.png", "code": "..." }

Uploaded files (auto-preloaded):

Files uploaded by the user (e.g. ZIP archives) are automatically available in the sandbox — no manual loading needed. Just use them directly in execute_code.

Read saved files via workspace skill:

workspace_read("code-interpreter/chart.png")
workspace_read("code-interpreter/results.json")
workspace_list("code-interpreter/")
Text files (.py, .csv, .json, .txt, etc.) are transferred as-is. Binary files (.png, .pdf, .xlsx, etc.) are handled via base64 encoding automatically.

Environment

  • Languages: Python (recommended, 200+ libraries), JavaScript, TypeScript
  • Shell: Full shell access via execute_command
  • File system: Persistent within session; use file_operations to manage files
  • Session state: Variables and files persist across multiple calls within the same session
  • Network: Internet access available (can use requests, urllib, curl)

Supported Languages

  • Python (recommended) — 200+ pre-installed libraries covering data science, ML, visualization, file processing
  • JavaScript — Node.js runtime, useful for JSON manipulation, async operations
  • TypeScript — TypeScript runtime with type checking

Pre-installed Python Libraries

Data Analysis & Visualization

LibraryCommon Use
pandasDataFrames, CSV/Excel I/O, groupby, pivot
numpyArrays, linear algebra, random, statistics
matplotlibLine, bar, scatter, histogram, subplots
plotlyInteractive charts, 3D plots
bokehInteractive visualization
scipyOptimization, interpolation, signal processing
statsmodelsRegression, time series, hypothesis tests
sympyAlgebra, calculus, equation solving

Machine Learning & AI

LibraryCommon Use
scikit-learnClassification, regression, clustering, pipelines
torch / torchvision / torchaudioDeep learning, computer vision, audio
xgboostHigh-performance gradient boosting
spacy / nltk / textblobNLP, tokenization, NER, sentiment
scikit-imageImage processing, filters, segmentation

Mathematical & Optimization

LibraryCommon Use
cvxpyConvex optimization, portfolio optimization
ortoolsScheduling, routing, constraint programming
pulpLinear programming
z3-solverSAT solving, formal verification
networkx / igraphGraph algorithms, network analysis

File Processing & Documents

LibraryCommon Use
openpyxl / xlrd / XlsxWriterExcel read/write with formatting
python-docxWord document creation/modification
python-pptxPowerPoint creation/modification
PyPDF2 / pdfplumber / reportlabPDF read/write/generate
lxml / beautifulsoup4XML/HTML parsing
markitdownConvert various formats to Markdown

Image & Media

LibraryCommon Use
pillow (PIL)Image resize, crop, filter, conversion
opencv-python (cv2)Computer vision, feature detection
imageio / moviepyImage/video I/O and editing
pydubAudio manipulation
svgwrite / WandSVG creation, ImageMagick

Data Storage & Formats

LibraryCommon Use
duckdbSQL queries on DataFrames and files
SQLAlchemySQL ORM and database abstraction
pyarrowParquet and Arrow format processing
orjson / ujson / PyYAMLFast JSON/YAML parsing

Web & API

LibraryCommon Use
requests / httpxHTTP requests, API calls
beautifulsoup4Web scraping
fastapi / Flask / DjangoWeb frameworks

Utilities

LibraryCommon Use
pydanticData validation, schema definition
FakerTest data generation
richPretty printing, tables
cryptographyEncryption, hashing
qrcodeQR code generation
boto3AWS SDK
For the full list of 200+ libraries with versions, run: execute_command(command="pip list")

Usage Patterns

Pattern 1: Data Analysis

import pandas as pd
import numpy as np

df = pd.DataFrame({
    'date': pd.date_range('2024-01-01', periods=100),
    'revenue': np.random.normal(1000, 200, 100),
    'costs': np.random.normal(700, 150, 100),
})
df['profit'] = df['revenue'] - df['costs']

print("=== Summary Statistics ===")
print(df.describe())
print(f"\nTotal Profit: ${df['profit'].sum():,.2f}")
print(f"Profit Margin: {df['profit'].mean() / df['revenue'].mean() * 100:.1f}%")

Pattern 2: Visualization (with output_filename)

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np

fig, axes = plt.subplots(2, 2, figsize=(14, 10))

categories = ['Q1', 'Q2', 'Q3', 'Q4']
values = [120, 150, 180, 210]
axes[0,0].bar(categories, values, color='#2196F3')
axes[0,0].set_title('Quarterly Revenue')

x = np.linspace(0, 10, 50)
axes[0,1].plot(x, np.sin(x), 'b-', linewidth=2)
axes[0,1].set_title('Trend')

sizes = [35, 30, 20, 15]
axes[1,0].pie(sizes, labels=['A','B','C','D'], autopct='%1.1f%%')
axes[1,0].set_title('Market Share')

x = np.random.normal(50, 10, 200)
y = x * 1.5 + np.random.normal(0, 15, 200)
axes[1,1].scatter(x, y, alpha=0.5, c='#FF5722')
axes[1,1].set_title('Correlation')

plt.tight_layout()
plt.savefig('dashboard.png', dpi=300, bbox_inches='tight')
print('Dashboard saved')

Pattern 3: Machine Learning

from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from sklearn.datasets import load_iris

iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(
    iris.data, iris.target, test_size=0.3, random_state=42
)

model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)

print(classification_report(y_test, y_pred, target_names=iris.target_names))

Pattern 4: SQL with DuckDB

import duckdb
import pandas as pd

orders = pd.DataFrame({
    'order_id': range(1, 101),
    'customer': [f'Customer_{i%20}' for i in range(100)],
    'amount': [round(50 + i * 3.5, 2) for i in range(100)],
})

result = duckdb.sql("""
    SELECT customer, COUNT(*) as cnt, ROUND(SUM(amount), 2) as total
    FROM orders GROUP BY customer
    HAVING COUNT(*) >= 3 ORDER BY total DESC LIMIT 10
""").df()
print(result.to_string(index=False))

Pattern 5: Fetch Data from Web

import requests
import pandas as pd

response = requests.get("https://api.example.com/data")
data = response.json()
df = pd.DataFrame(data)
print(df.head())

Pattern 6: Multi-step Workflow (session state persists)

Call 1: execute_code → load and clean data, store in variable `df`
Call 2: execute_code → analyze `df`, generate chart, save as PNG
Call 3: execute_code → export results to CSV
Call 4: file_operations(operation="read") → download the CSV

Variables (df) and files persist across calls in the same session.

Important Rules

  1. matplotlib.use('Agg') before import matplotlib.pyplot — sandbox has no display.
  2. Use print() for text output — stdout is how results are returned.
  3. output_filename must match exactly — the filename in plt.savefig() or wb.save() must match the output_filename parameter.
  4. Use execute_command for shell tasksls, pip install, curl, etc.
  5. Use file_operations for file management — read/write/list/remove files explicitly.
  6. Session state persists — variables and files remain across calls. Use this for multi-step workflows.

Common Mistakes to Avoid

  • Forgetting matplotlib.use('Agg') before import matplotlib.pyplot as plt
  • Using plt.show() instead of plt.savefig() — there is no display
  • Typo in output_filename — must match the file saved by the code exactly
  • Using execute_code for shell tasks — use execute_command instead
  • Writing binary files via file_operations — use execute_code to generate binary files, then download with output_filename

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

32.48%
按下载量换算345

Claude

29.9%
按下载量换算317

Cursor

20.36%
按下载量换算216

Gemini CLI

9.25%
按下载量换算98

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

可写文件

该 Skill 可能写入或修改本地文件,使用前需要确认目标目录和修改范围。

安装前确认

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

来源信息

继续浏览同类 Skills