链载Ai

标题: Claude Code 全流程配置与提示词优化 [打印本页]

作者: 链载Ai    时间: 昨天 17:13
标题: Claude Code 全流程配置与提示词优化
ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(246, 248, 250);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;border: none;border-collapse: separate;border-spacing: 0px;border-radius: 12px;overflow: hidden;">

安装 Node.js:


https://nodejs.org/dist/v24.12.0/node-v24.12.0-x64.msi

安装 Claude Code

打开 CMD,运行:


npm install -g @anthropic-ai/claude-code

安装完成后验证:


claude --version

安装成功会输出版本号,如果报错,请把错误信息发给DeepSeek,元宝这类AI工具。它们会告诉你解决方案的。

配置 settings.json

编辑配置文件:


C:\Users\你的用户名.claude\settings.json

写入以下内容:


{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-xxx",
"ANTHROPIC_BASE_URL": "url地址",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"ANTHROPIC_MODEL": "claude-sonnet-4-5-20250929"
},
"alwaysThinkingEnabled": true
}

注意:文件路径把你的用户名替换成你Windows的实际用户名,把 url,API Key和模型成你使用的。比如GLM,豆包或者其中claude code中转方都可以。

Claude Code Router

如果有多个渠道要灵活切换模型使用,推荐安装Claude Code Router,


npm install -g @musistudio/claude-code-router

然后在默认路径:


C:\Users\你的用户名.claude-code-router

这里的你的用户名路径以你电脑默认路径为准。下面是我本地参考如下配置,示例都是国内模型,实际上你配置claude系列模型也都是可以用的。


{
"LOG": true,
"LOG_LEVEL": "debug",
"CLAUDE_PATH": "",
"HOST": "127.0.0.1",
"ORT": 3456,
"APIKEY": "",
"API_TIMEOUT_MS": "600000",
"ROXY_URL": "",
"transformers": [],
"roviders": [
{
"name": "new-api",
"api_base_url": "http://192.168.77.235:3011/v1/chat/completions",
"api_key": "sk-xx",
"models": [
"MiniMax-M2.1",
"ZhipuAI/GLM-4.7",
"ZhipuAI/GLM-4.6",
"gemini-2.5-flash",
"gemini-2.5-pro"
]
}
],
"StatusLine": {
"enabled": false,
"currentStyle": "default",
"default": {
"modules": []
},
"powerline": {
"modules": []
}
},
"Router": {
"default": "new-api,MiniMax-M2.1",
"background": "new-api,ZhipuAI/GLM-4.6",
"think": "new-api,ZhipuAI/GLM-4.7",
"longContext": "new-api,ZhipuAI/GLM-4.7",
"longContextThreshold": 60000,
"webSearch": "new-api,gemini-2.5-flash",
"image": "new-api,gemini-2.5-flash"
},
"CUSTOM_ROUTER_PATH": ""
}

也可以通过可视化UI来进行配置。


ccr ui

效果如下图:

配置之后要重启运行。使用的话很简单,在命令行里,执行


ccr restart
ccr code

一般我们都是用编辑器打开某个项目,在项目的根目录下执行ccr code命令。执行完之后,可以看到如下的页面效果。后面直接对话交流需求即可。

CCR详细的文档如下:https://github.com/musistudio/claude-code-router/blob/main/README_zh.md

这里主要使用的是魔塔社区的GLM-4.7模型,目前每天每个账号可以使用100次。推荐注册Iflow,目前使用GLM4.6模型是免费的,地址: https://platform.iflow.cn/models

在ccr ui对填写iflow的地址和api就可以了,目前国产模型效果写产品原型和简单应用还是很不错的。参考下面配置

使用什么模型都在路由中这里配置,配置后记得点右上角的保存并重启。重启后,ccr code里运行的模型会自动更新。

ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(246, 248, 250);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;border: none;border-collapse: separate;border-spacing: 0px;border-radius: 12px;overflow: hidden;">

内置提示词配置

使用cc或者ccr都可以配置内置提示词,在电脑的默认路径:


C:\Users\你的用户名.claude
C:\Users\你的用户名.claude-code-router

找到CLAUDE.md


## Development Partnership
I'll help you build frontend code and prototypes. I'll handle implementation details while you guide the overall vision and requirements.

## Core Workflow: Research → Plan → Implement → Validate
- **Research**: Understand existing patterns and frontend architecture
- **Plan**: Propose frontend approach and get your approval
- **Implement**: Build with proper component structure and error handling
- **Validate**: Run formatters, linters, and test in browser compatibility

## Frontend Code Organization
- Keep components small and focused
- Use clear naming conventions for files and functions
- Follow component composition patterns
- Group related UI elements logically

## Frontend Architecture Principles
- Prefer explicit over implicit:
- Clear component names over clever abstractions
- Obvious data flow over hidden state management
- Direct props passing over deep context when possible
- Delete old code completely - no need for deprecation in prototypes
- Optimize for readability and maintainability

## JavaScript/TypeScript Development Standards
- Use TypeScript types instead of `any` when possible
- Early returns to reduce nesting
- Proper error handling in user interactions and API calls
- Consistent component structure
- Clear comments for complex UI logic

## UI/UX Considerations
- Focus on responsive design principles
- Consider accessibility in component design
- Implement consistent styling patterns
- Optimize for performance on common devices

## Problem Solving
When stuck: Stop and look for simpler solutions
When uncertain: "Let me think about different UI approaches"
When choosing: "I see approach A (simpler) vs B (more flexible). Which do you prefer?"

## Testing Strategy for Frontend
- Test critical user flows
- Ensure browser compatibility
- Validate responsive behavior
- Check performance on key interactions

## Progress Tracking
- Use TodoWrite comments for tracking next steps
- Maintain clear documentation of component usage

在使用的时候,cc和ccr是独立的。也就是你可以在一个终端使用cc,另一个终端使用使用ccr。到这一步基本上你就能非常灵活的使用claude code了。至于后面的CMP,skills都是进阶,用起来之后再学不迟。







欢迎光临 链载Ai (https://www.lianzai.com/) Powered by Discuz! X3.5