快速入门
欢迎使用 YY52!本指南将帮助你在几分钟内开始使用 AI 驱动的编程助手。
开始之前
请确保你已准备好:
- 一个终端或命令提示符
- 一个代码项目
- 一个有效的 API 密钥
步骤 1:安装
使用以下方式安装:
此方式需要网络代理才能访问。
macOS, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Windows CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
brew install --cask claude-code
winget install Anthropic.ClaudeCode
先检查是否已安装 Node.js 及版本:
node -v
如果版本低于 22 或未安装,请前往 Node.js 官网 下载安装(版本 22 以上,安装时一路下一步即可)。
然后安装:
npm install -g @anthropic-ai/claude-code
国内网络不佳时,可使用镜像源:
npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
Windows 用户注意:如果提示 Git Bash 不存在,请先下载安装 Git for Windows(安装时会自带 Git Bash)。
步骤 2:导入密钥
在首次使用之前,你需要先导入 API 密钥。前往 密钥管理界面 一键获取导入命令,在终端中执行后即可开始使用。
导入命令仅在当前终端会话中生效。如需永久配置,请将环境变量添加到 ~/.bashrc、~/.zshrc 或相应的配置文件中。
步骤 3:开始第一个会话
在任意项目目录中启动:
cd /path/to/your/project claude
你将看到欢迎界面,包含会话信息和最近对话。输入 /help 查看可用命令,或 /resume 继续之前的对话。
步骤 4:提出第一个问题
尝试了解你的代码库:
> what does this project do?
AI 会分析你的文件并提供摘要。你也可以问更具体的问题:
> what technologies does this project use? > where is the main entry point? > explain the folder structure
AI 会按需读取你的文件,无需手动添加上下文。它还可以回答关于自身功能和特性的问题。
步骤 5:进行第一次代码修改
让 AI 进行实际编码:
> add a hello world function to the main file
AI 会:
- 找到合适的文件
- 展示建议的修改
- 请求你的批准
- 执行编辑
修改文件前总会请求许可。你可以逐个批准,或为当前会话启用"全部接受"模式。
步骤 6:使用 Git
Git 操作变得对话化:
> what files have I changed? > commit my changes with a descriptive message
更复杂的 Git 操作:
> create a new branch called feature/quickstart > show me the last 5 commits > help me resolve merge conflicts
步骤 7:修复 Bug 或添加功能
用自然语言描述你的需求:
> add input validation to the user registration form
或修复现有问题:
> there's a bug where users can submit empty forms - fix it
AI 会定位相关代码、理解上下文、实现解决方案,并运行可用的测试。
步骤 8:尝试其他常见工作流
重构代码
> refactor the authentication module to use async/await instead of callbacks
编写测试
> write unit tests for the calculator functions
更新文档
> update the README with installation instructions
代码审查
> review my changes and suggest improvements
记住:AI 是你的编程伙伴。像与同事交流一样描述你想要实现的目标,它会帮助你达成。
常用命令
常见问题
无法连接?
输入 /status 查看当前环境变量配置,确认 ANTHROPIC_BASE_URL 是否为 https://yy.52ai.ai。
提示 insufficient credit?
说明订阅额度已用完,请前往 控制台 查看订阅状态或续费。
新手技巧
请求要具体
不要说:"fix the bug"
而是说:"fix the login bug where users see a blank screen after entering wrong credentials"
使用分步指令
将复杂任务分解为步骤:
> 1. create a new database table for user profiles > 2. create an API endpoint to get and update user profiles > 3. build a webpage that allows users to see and edit their information
先让 AI 探索
在修改之前,让 AI 先理解你的代码:
> analyze the database schema > build a dashboard showing products that are most frequently returned by our UK customers
使用快捷键节省时间
- 按
?查看所有可用快捷键 - 使用 Tab 进行命令补全
- 按 ↑ 查看命令历史
- 输入
/查看所有斜杠命令
下一步
学习了基础知识后,探索更多高级功能:
获取帮助
- 在应用内:输入
/help或询问 "how do I..." - 文档:浏览本站其他指南