免费POC, 零成本试错
AI知识库

53AI知识库

学习大模型的前沿技术与行业应用场景


我要投稿

Claude Code 全流程配置与提示词优化

发布日期:2026-01-18 19:36:03 浏览次数: 1534
作者:石云升

微信搜一搜,关注“石云升”

推荐语

轻松掌握Claude Code全流程配置,从安装到优化一步到位!

核心内容:
1. Node.js环境搭建与Claude Code安装验证
2. settings.json关键配置项详解与参数优化
3. 多模型路由管理方案与实战配置技巧

杨芳贤
53AI创始人/腾讯云(TVP)最具价值专家

安装 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",
  "PORT": 3456,
  "APIKEY": "",
  "API_TIMEOUT_MS": "600000",
  "PROXY_URL": "",
  "transformers": [],
  "Providers": [
    {
      "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里运行的模型会自动更新。

内置提示词配置

使用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都是进阶,用起来之后再学不迟。


53AI,企业落地大模型首选服务商

产品:场景落地咨询+大模型应用平台+行业解决方案

承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业

联系我们

售前咨询
186 6662 7370
预约演示
185 8882 0121

微信扫码

添加专属顾问

回到顶部

加载中...

扫码咨询