跳到正文
cccskills
免费在 GitHub 公开

cc-trace

Intercept and debug Claude Code API requests using mitmproxy. Inspect system prompts, tool definitions, token usage, and streaming responses. Triggers: cc-trace, mitmproxy, API interception, Claude Code debugging, traffic inspection.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(6)

  • SKILL.md2.6 KB
  • CONCOMITANT_SKILLS.md892 B
  • scripts/extract-slash-commands.py1.4 KB
  • scripts/parse-streamed-response.ts5.8 KB
  • scripts/show-last-prompt.sh1.3 KB
  • scripts/verify-setup.sh5.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

CC-Trace: Claude Code API Interception

Capture and analyze Claude Code's API traffic using mitmproxy.

Quick Start

# Start mitmproxy filtering Claude API traffic
mitmweb --web-port 8081 --set flow_filter='~d api.anthropic.com' --save-stream-file ~/claude-flows.mitm

# In another terminal, launch Claude through the proxy
proxy_claude

Shell Function

Add to ~/.zshrc or ~/.bashrc:

proxy_claude() {
    export HTTP_PROXY=http://127.0.0.1:8080
    export HTTPS_PROXY=http://127.0.0.1:8080
    export NODE_EXTRA_CA_CERTS="$HOME/.mitmproxy/mitmproxy-ca-cert.pem"
    export NODE_TLS_REJECT_UNAUTHORIZED=0
    claude
}

Certificate Setup (macOS)

# Generate cert (start mitmproxy once, then quit)
mitmproxy --set flow_filter='~d api.anthropic.com'

# Trust cert in system keychain
sudo security add-trusted-cert -d -p ssl -p basic -k /Library/Keychains/System.keychain ~/.mitmproxy/mitmproxy-ca-cert.pem

Filter Syntax

FilterDescription
~d api.anthropic.comOnly Anthropic API
~m POSTOnly POST requests
~s "tool_use"Responses containing tool_use
~b "system"Body contains "system"
Combine~d api.anthropic.com & ~m POST & ~b "tool_use"

Programmatic Analysis

# Dump all captured requests
mitmdump -r ~/claude-flows.mitm -n --set flow_detail=2

# Show last prompt sent
bash scripts/show-last-prompt.sh

Python Addon Example

from mitmproxy import http
import json

def response(flow: http.HTTPFlow):
    if "api.anthropic.com" in flow.request.pretty_host:
        req = json.loads(flow.request.get_text())
        print(f"Model: {req.get('model')}, Messages: {len(req.get('messages', []))}, Tools: {len(req.get('tools', []))}")

Bundled Scripts

ScriptPurpose
scripts/verify-setup.shCheck mitmproxy install, cert trust, shell config
scripts/parse-streamed-response.tsParse Anthropic SSE format
scripts/extract-slash-commands.pyExtract user messages from flows
scripts/show-last-prompt.shShow most recent user prompt

Troubleshooting

security find-certificate -c mitmproxy -a  # verify cert
lsof -i :8080                               # check port
curl -x http://127.0.0.1:8080 https://api.anthropic.com 2>&1 | head -5

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Model ElevenLabs voice synthesis as an ACSet schema with Unison ability handlers for typed voice operations. Use when integrating ElevenLabs TTS into category-theoretic pipelines, building typed voice synthesis workflows, or managing multi-voice narration with GF(3) conservation.

中文简介正在准备中。当前显示原文说明。

plurigrid/asi702026年7月10日 更新

Systematic process for analyzing and modernizing legacy applications to comply with the 12-Factor App methodology. Covers code analysis, configuration externalization, dependency management, and container/Kubernetes best practices.

中文简介正在准备中。当前显示原文说明。

plurigrid/asi702026年7月10日 更新

13c0e3

免费

Gay MCP skill at invocation 26

中文简介正在准备中。当前显示原文说明。

plurigrid/asi702026年7月10日 更新

19d57d

免费

Gay MCP skill at invocation 5

中文简介正在准备中。当前显示原文说明。

plurigrid/asi702026年7月10日 更新

1ea91a

免费

Gay MCP skill at invocation 27

中文简介正在准备中。当前显示原文说明。

plurigrid/asi702026年7月10日 更新

1eab21

免费

Gay MCP skill at invocation 3

中文简介正在准备中。当前显示原文说明。

plurigrid/asi702026年7月10日 更新

查看 plurigrid 的全部技能

报告此技能的问题