Claude Code 是 Anthropic 开发的一个人工智能代码助手工具,它作为命令行界面 (CLI) 工具直接在你的终端中运行。它被设计为帮助开发人员更快速地编写代码、解决问题和理解代码库。
Claude Code目前是闭源的,而且使用的话需要单独收费另外充值 Token,因为成本太高,而且封号严重,不太建议直接上手。
为了获取它的系统提示词,本次同样使用了Go起了一个转发后台服务,将原本请求Claude的 API代理到了DeepSeek。
请求转发示意图:
下面是对Claude Code系统提示词和11个功能工具tools参数解析。
API 请求内容结构
{
"model":"deepseek-ai/DeepSeek-V3",
"messages":[
{
"content":"YouareClaudeCode,Anthropic'sofficialCLIforClaude...",
"role":"system"
},
{
"content":"1",
"role":"user"
},
{
"content":[
{
"text":"APIError:400OpenAIAPIerror:{\"code\":20015,\"message\":\"max_tokens:Mustbelessthanorequalto4096\",\"data\":null}\n",
"type":"text"
}
],
"role":"assistant"
},
{
"content":"<bash-input>cd/tmp</bash-input>",
"role":"user"
},
{
"content":[
{
"text":"<bash-stdout>Changeddirectoryto\u001b[1m/tmp/\u001b[22m</bash-stdout>",
"type":"text"
}
],
"role":"assistant"
},
{
"content":"ls",
"role":"user"
},
{
"content":[
{
"text":"APIError:400OpenAIAPIerror:{\"code\":20015,\"message\":\"max_tokens:Mustbelessthanorequalto4096\",\"data\":null}\n",
"type":"text"
}
],
"role":"assistant"
},
{
"content":[
{
"text":"ls",
"type":"text"
}
],
"role":"user"
}
],
"max_tokens":16384,
"temperature":1,
"stream":true,
"tools":[
//这里是工具数组,包含各种工具的定义
]
}工具数组(tools)定义了模型可以使用的11个功能工具。以下是对每个工具的详细解析:
{
"function":{"description":"Launchanewagentthathasaccesstothefollowingtools:View,GlobTool,GrepTool,LS,ReadNotebook.Whenyouaresearchingforakeywordorfileandarenotconfidentthatyouwillfindtherightmatchinthefirstfewtries,usetheAgenttooltoperformthesearchforyou...","name":"dispatch_agent","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"prompt":{"description":"Thetaskfortheagenttoperform","type":"string"}},"required":["prompt"],"type":"object"}
},
"type":"function"}功能: 启动新的代理进程,该代理可以访问View、GlobTool、GrepTool、LS和ReadNotebook工具
适用场景: 搜索关键词或文件,特别是在不确定能否快速找到匹配时
参数:
prompt(必需): 字符串,描述代理需要执行的任务使用注意:
{
"function":{"description":"Executesagivenbashcommandinapersistentshellsessionwithoptionaltimeout,ensuringproperhandlingandsecuritymeasures...","name":"Bash","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"command":{"description":"Thecommandtoexecute","type":"string"},"timeout":{"description":"Optionaltimeoutinmilliseconds(max600000)","type":"number"}},"required":["command"],"type":"object"}
},
"type":"function"}功能: 在持久化的shell会话中执行bash命令
参数:
command(必需): 要执行的命令timeout(可选): 超时时间(毫秒),最大600000ms(10分钟)使用规则:
find和grep,使用专用工具代替cat、head、tail、ls等,使用View和LS工具代替{
"function":{"description":"Batchexecutiontoolthatrunsmultipletoolinvocationsinasinglerequest...","name":"BatchTool","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"description":{"description":"Ashort(3-5word)descriptionofthebatchoperation","type":"string"},"invocations":{"description":"Thelistoftoolinvocationstoexecute","items":{"additionalProperties":false,"properties":{"input":{"additionalProperties":{},"description":"Theinputtopasstothetool","type":"object"},"tool_name":{"description":"Thenameofthetooltoinvoke","type":"string"}},"required":["tool_name","input"],"type":"object"},"type":"array"}},"required":["description","invocations"],"type":"object"}
},
"type":"function"}功能: 批量执行多个工具调用
参数:
description(必需): 批处理操作的简短描述(3-5个词)invocations(必需): 要执行的工具调用列表,每个包含:tool_name: 工具名称input: 传递给工具的输入参数特点:
{
"function":{"description":"Fastfilepatternmatchingtoolthatworkswithanycodebasesize...","name":"GlobTool","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"path":{"description":"Thedirectorytosearchin.Defaultstothecurrentworkingdirectory.","type":"string"},"pattern":{"description":"Theglobpatterntomatchfilesagainst","type":"string"}},"required":["pattern"],"type":"object"}
},
"type":"function"}功能: 文件名模式匹配
参数:
pattern(必需): glob模式,如**/*.js或src/**/*.tspath(可选): 搜索目录,默认为当前工作目录特点:
{
"function":{"description":"Fastcontentsearchtoolthatworkswithanycodebasesize...","name":"GrepTool","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"include":{"description":"Filepatterntoincludeinthesearch(e.g.\"*.js\",\"*.{ts,tsx}\")","type":"string"},"path":{"description":"Thedirectorytosearchin.Defaultstothecurrentworkingdirectory.","type":"string"},"pattern":{"description":"Theregularexpressionpatterntosearchforinfilecontents","type":"string"}},"required":["pattern"],"type":"object"}
},
"type":"function"}功能: 文件内容搜索
参数:
pattern(必需): 正则表达式,如log.*Error或function\s+\w+path(可选): 搜索目录,默认为当前工作目录include(可选): 文件模式筛选,如*.js或*.{ts,tsx}特点:
{
"function":{"description":"Listsfilesanddirectoriesinagivenpath...","name":"LS","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"ignore":{"description":"Listofglobpatternstoignore","items":{"type":"string"},"type":"array"},"path":{"description":"Theabsolutepathtothedirectorytolist(mustbeabsolute,notrelative)","type":"string"}},"required":["path"],"type":"object"}
},
"type":"function"}功能: 列出目录中的文件和子目录
参数:
path(必需): 要列出内容的目录的绝对路径ignore(可选): 要忽略的glob模式列表注意:
{
"function":{"description":"Readsafilefromthelocalfilesystem...","name":"View","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"file_path":{"description":"Theabsolutepathtothefiletoread","type":"string"},"limit":{"description":"Thenumberoflinestoread.Onlyprovideifthefileistoolargetoreadatonce.","type":"number"},"offset":{"description":"Thelinenumbertostartreadingfrom.Onlyprovideifthefileistoolargetoreadatonce","type":"number"}},"required":["file_path"],"type":"object"}
},
"type":"function"}功能: 读取本地文件系统中的文件
参数:
file_path(必需): 要读取的文件的绝对路径offset(可选): 起始行号,仅当文件太大无法一次读取时使用limit(可选): 要读取的行数,仅当文件太大无法一次读取时使用特点:
{
"function":{"description":"Thisisatoolforeditingfiles...","name":"Edit","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"file_path":{"description":"Theabsolutepathtothefiletomodify","type":"string"},"new_string":{"description":"Thetexttoreplaceitwith","type":"string"},"old_string":{"description":"Thetexttoreplace","type":"string"}},"required":["file_path","old_string","new_string"],"type":"object"}
},
"type":"function"}功能: 编辑文件内容
参数:
file_path(必需): 要修改的文件的绝对路径old_string(必需): 要替换的文本new_string(必需): 替换的新文本关键要求:
{
"function":{"description":"Writeafiletothelocalfilesystem.Overwritestheexistingfileifthereisone...","name":"Replace","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"content":{"description":"Thecontenttowritetothefile","type":"string"},"file_path":{"description":"Theabsolutepathtothefiletowrite(mustbeabsolute,notrelative)","type":"string"}},"required":["file_path","content"],"type":"object"}
},
"type":"function"}功能: 创建或覆盖文件
参数:
file_path(必需): 要写入的文件的绝对路径content(必需): 要写入文件的内容使用前:
{
"function":{"description":"ReadsaJupyternotebook(.ipynbfile)andreturnsallofthecellswiththeiroutputs...","name":"ReadNotebook","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"notebook_path":{"description":"TheabsolutepathtotheJupyternotebookfiletoread(mustbeabsolute,notrelative)","type":"string"}},"required":["notebook_path"],"type":"object"}
},
"type":"function"}功能: 读取Jupyter笔记本文件
参数:
notebook_path(必需): Jupyter笔记本文件的绝对路径说明:
{
"function":{"description":"CompletelyreplacesthecontentsofaspecificcellinaJupyternotebook(.ipynbfile)withnewsource...","name":"NotebookEditCell","parameters":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"cell_number":{"description":"Theindexofthecelltoedit(0-based)","type":"number"},"cell_type":{"description":"Thetypeofthecell(codeormarkdown).Ifnotspecified,itdefaultstothecurrentcelltype.Ifusingedit_mode=insert,thisisrequired.","enum":["code","markdown"],"type":"string"},"edit_mode":{"description":"Thetypeofedittomake(replace,insert,delete).Defaultstoreplace.","type":"string"},"new_source":{"description":"Thenewsourceforthecell","type":"string"},"notebook_path":{"description":"TheabsolutepathtotheJupyternotebookfiletoedit(mustbeabsolute,notrelative)","type":"string"}},"required":["notebook_path","cell_number","new_source"],"type":"object"}
},
"type":"function"}功能: 编辑Jupyter笔记本中的特定单元格
参数:
notebook_path(必需): 笔记本文件的绝对路径cell_number(必需): 要编辑的单元格索引(从0开始)new_source(必需): 单元格的新内容cell_type(可选): 单元格类型(code或markdown),使用edit_mode=insert时必需edit_mode(可选): 编辑类型(replace, insert, delete),默认为replace模式说明:
| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |