claude code使用 实测开发一个助眠 白噪音的网站,方便各位在噪音环境下带耳机睡觉。

cluade code是一个命令行工具而非那种图形gui工具,和我之前以为的不一样。
Claude Code: Deep coding at terminal velocity \ Anthropic
安装node18+
Node.js 18+,
然后执行
npm install -g @anthropic-ai/claude-code

然后输入claude 即可,如果出现网络问题,则需要科学,然后设置环境变量:
cmd

set http_proxy=http://127.0.0.1:7897
set https_proxy=http://127.0.0.1:7897

powershell

$env:HTTP_PROXY="http://127.0.0.1:7897"; $env:HTTPS_PROXY="http://127.0.0.1:7897"

bash

export https_proxy=http://127.0.0.1:7897 http_proxy=http://127.0.0.1:7897 all_proxy=socks5://127.0.0.1:7897
image.png

随意选择样式

之后会选择用什么方式登录,选择后自动跳转浏览器授权

api的方式就算了,这个还需要搞定credits

image.png

所以选择第一个然后到了这里

image.png
image.png

实测开发一个助眠 白噪音的网站,方便各位在噪音环境下带耳机睡觉。
目录有问题,我换个目录重新输入。
ok,提问


image.png

他写了一分钟
这个英文就不翻译了,直接yes 创建 如下图的

image.png

然后我直接用vscode 或者jetbrain 的全家桶打开上面配置的目录, jetbrain的能记录本地历史记录,理论上我更推荐这个能自动记录本地历史的开发工具。
不然写入变更要自己手动提交git


image.png
image.png
image.png
image.png

最后我的助眠网站弄好了,各位睡不着打开这个 戴上那种睡觉的很软的耳机就行

助眠音乐播放器 x@lozn.top

命令的玩法
在交互模式
交互模式 - Anthropic --- Interactive mode - Anthropic

模式下 可以切命令模式恢复会话,比如突然提示limit reached
Claude usage limit reached. Your limit will reset at 6pm (Asia/Shanghai)
那么下次打开的时候需要恢复回话咋继续呢?

│ >                                                                                                                                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ! for bash mode       double tap esc to clear input      ctrl + _ to undo
  / for commands        alt + m to auto-accept edits
  @ for file paths      ctrl + r for verbose output
  # to memorize         backslash (\) + return (⏎) for 
                        newline

输入/
斜杠命令 - Anthropic --- Slash commands - Anthropic

命令模式菜单

就可以切换很多的命令的模式了

 /add-dir            Add a new working directory                                                                                                                                                                                   
  /agents             Manage agent configurations
  /bug                Submit feedback about Claude Code
  /clear (reset)      Clear conversation history and free up context
  /compact            Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]
  /config (theme)     Open config panel
  /cost               Show the total cost and duration of the current session
  /doctor             Diagnose and verify your Claude Code installation and settings
  /exit (quit)        Exit the REPL
  /export             Export the current conversation to a file or clipboard
  /help                   Show help and available commands
  /hooks                  Manage hook configurations for tool events
  /ide                    Manage IDE integrations and show status
  /init                   Initialize a new CLAUDE.md file with codebase documentation
  /install-github-app     Set up Claude GitHub Actions for a repository                                                                                                                                                             
  /login                  Sign in with your Anthropic account
  /logout                 Sign out from your Anthropic account
  /mcp                    Manage MCP servers
  /memory                 Edit Claude memory files
 /migrate-installer               Migrate from global npm installation to local installation
  /model                           Set the AI model for Claude Code
  /permissions (allowed-tools)     Manage allow & deny tool permission rules
  /pr-comments                     Get comments from a GitHub pull request
  /release-notes                   View release notes
  /resume                          Resume a conversation                                                                                                                                                                            
  /review                          Review a pull request
  /status                          Show Claude Code status including version, model, account, API connectivity, and tool statuses
  /upgrade                         Upgrade to Max for higher rate limits and more Opus
  /vim                             Toggle between Vim and Normal editing modes

命令模式之恢复回话

而我们需要的是输入/review
这样就可以继续上一次cmd关闭的窗口了。

image.png

esc取消

引用本地文件提问

当然也可以切换其他模式@ 引用文件
比如我@test_mcp.sh 这个是?
他就给我分析了

image.png
● The test_mcp.sh script is a testing utility for the SQL Server MCP server using MCP Inspector. It's a straightforward bash script that:

  1. Checks dependencies - Verifies npx is installed
  2. Provides user feedback - Shows configuration and instructions
  3. Launches MCP Inspector - Runs npx @modelcontextprotocol/inspector python main_modular.py                                                                                                                                       

  The script is clean and serves as a convenient way to test the modular MCP server with the inspector tool. It uses the main_modular.py entry point we've been working on, which is the token-optimized version with all the       
  security enhancements and functionality we implemented.

  This aligns perfectly with the MCP Inspector integration that was requested earlier in the conversation for testing the server's tools, prompts, and resources.

命令模式

!则是命令模式比如!之后输入ls可以列出目录文件

! ls                                                                                                                                                                                                                                
  ⎿  __pycache__/
     CLAUDE.md
     db_config.json
     … +18 lines (ctrl+r to expand)

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ >                                                                                                                                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ! for bash mode       double tap esc to clear input      ctrl + _ to undo
  / for commands        alt + m to auto-accept edits
  @ for file paths      ctrl + r for verbose output
  # to memorize         backslash (\) + return (⏎) for 
                        newline

image.png

记忆模式

没搞太懂,我问了个这是,他回答说他说他的待办事项已经完成了。

image.png

2025-7-31 09:10:43
其它参考
【建议收藏】最全Claude Code 斜杠命令全指南:高效用法与避坑心得_claude code 命令-CSDN博客

claude code 重载mcp相对简单 不需要重启 , 但是无法通过交互让他重启,只能通过输入mcp然后选择对应的server然后如下图选择重连即可修复,这样就能做到claude code开发mcp又能同时让claude code自己测试迭代修复

1753931849333.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容