Fullstack Dev、iOS Reverse Engineering、小红书逆向培训

这份Claude Code速查表非常实用,可以帮助学习常见的快捷键、命令、文件位置、MCP、钩子等内容!

我开发了一个生活在Claude Code状态栏中的虚拟宠物,它会反映你的AI使用模式。
宠物的能量会随时间衰减(大约3天从满血到死亡),你通过在Claude
Code中消耗token来喂养它。随着能量下降,宠物会显示不同的表情:开心时(^_^),饥饿
时(o_o),生病时(u_u),死亡时(x_x)。
最有趣的是死亡机制——当你的宠物死掉时(能量降到0),所有统计数据都会重置为零,
你要完全重新开始。
设置很简单:只需在你的Claude Code状态栏配置中添加"command": "npx
ccpet@latest"。宠物会在会话间保持状态,并实时显示你当前会话的统计信息(输入/输
出/缓存token)。
它用TypeScript编写,经过完整测试,并发布到了npm。我发现在编程时保持"宠物"存活
竟然很有动力!

与ccusage状态栏相比,似乎还不够准确,但是它也显示了MCP工具和CLAUDE.md内存文件的使用情况,这会更加有用!

不要定义太多子代理, 每一个子代理都占用上下文
在子目录中添加 CLAUDE.md 文件。
这是让Claude Code变得不那么“笨”的无名英雄做法。与其写一个巨大的规则文件,不如让每个目录各有一个:
/src/components/CLAUDE.md
/src/db/CLAUDE.md
这样可以让Claude Code拥有更精准的上下文,并且效果会有非常显著的提升。
我开发ccshell是为了解决经常忘记Shell命令语法的痛点。不用再去搜索"如何批量重命
名文件加时间戳"或"如何压缩视频保持画质",直接用自然语言描述就行:
• npx ccshell "查找所有大于100MB的文件"
• npx ccshell "将所有HEIC照片转换为JPEG"
• npx ccshell "帮我下载视频: https://xxx.com/watch?v=LQY-NLgOh1k, 下载格式为mp4格式"
基于Claude Code CLI和智能提示工程实现:
- 自动检测并安装合适的工具(通过brew等)
- 显示实时进度和执行状态
- 处理复杂的长时间运行任务
- 安全地处理文件操作
无需安装即可试用:
npx ccshell "列出当前目录下的所有文件"
目前专为macOS优化,但这个方法可以扩展到跨平台。
三层策略(本地命令 → 工具安装 → 自定义脚本)。

ccusage 现在已经与Claude Code的新状态栏功能集成, 你的状态栏会显示:
• 当前会话的费用
• 今天的总费用
• 当前活跃的 5 小时区块费用 & 剩余时间
• 实时消耗速率(带颜色指示)
快速设置
在你的 ~/.claude/settings.json 中添加:
{
"statusLine": {
"type": "command",
"command": "bun x ccusage statusline"
}
}
就这样!你就能在状态栏中实时查看使用情况了。
今天,我们要聊一个激动人心的话题——Anthropic 为其 AI 编程助手 Claude Code 推出了一个强大的新功能:sub-agents(子智能体)。
这项功能可不仅仅是简单的升级,它可能会彻底改变我们与 AI 协作编程的方式。准备好了吗?让我们一探究竟!
什么是 sub-agents?
简单来说,sub-agents 是特种兵式的 AI 助手。
你可以把 Claude Code 看作一个项目经理,当它遇到一个具体、专业的任务时(比如,“检查这段代码是否符合我们的编码规范”或“将这个组件的文档翻译成日文”),它不再需要事事亲为,而是可以“召唤”一个专门负责这项任务的 sub-agent 来处理。
每个 sub-agent 都拥有自己独立的上下文窗口、一套专属的工具集和独特的系统提示 (System Prompt),这让它们成为了特定领域的高效专家。
完成任务后,sub-agent 会将结果交还给主对话线程,而不会用繁杂的执行过程干扰你的主工作流程。
为什么要使用 sub-agents?
你可能会问,这听起来不错,但它具体好在哪里?
- 上下文“减负” (Context Preservation): 这是最核心的优势之一。通过将特定任务隔离出去,sub-agents 可以防止主对话的上下文窗口被无关信息填满,让你的主会话始终聚焦于更高层次的战略目标。再也不用担心“聊着聊着 AI 就忘了前面说过啥”了!
- 专业的人做专业的事 (Specialized Expertise): 你可以为 sub-agents 精心设计非常具体的指令和系统提示,让它们在特定任务上表现得远超通用模型。例如,你可以创建一个只负责数据库迁移脚本生成的 sub-agent,并为它提供所有相关的背景知识和规范。
- 可复用与团队共享 (Reusability & Collaboration): 一旦你创建了一个高效的 sub-agent,它就可以在不同的项目中重复使用。更棒的是,你可以将项目级的 sub-agents纳入版本控制(如 Git),与团队成员共享,确保整个团队工作流的一致性和高效性。
- 灵活的权限控制 (Flexible Permissions): 你可以精确控制每个 sub-agent 能访问哪些工具。比如,你可以只授权给“代码审查” sub-agent 读取文件的权限,而不给它执行代码的权限,从而实现更精细化的安全管理。
如何创建和使用 sub-agents?
创建和管理 sub-agents 非常灵活,主要有两种方式:
- 使用
/agents
命令 (推荐): 在 Claude Code 中输入/agents
,会弹出一个交互式界面。你可以在这里轻松地查看、创建、编辑和删除 sub-agents,整个过程都有引导,非常方便。 - 直接管理文件: sub-agents 本质上是存储在特定目录下的 Markdown 文件(带有 YAML frontmatter)。
- 项目级 sub-agents: 存储在项目目录的
.claude/agents/
下,仅对该项目有效。 - 用户级 sub-agents: 存储在
~/.claude/agents/
下,对你的所有项目都有效。
- 项目级 sub-agents: 存储在项目目录的
一个 sub-agent 的配置文件大概长这样:
---
name: code-reviewer
description: Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.
tools: Read, Grep, Glob, Bash
---
You are a senior code reviewer ensuring high standards of code quality and security.
When invoked:
1. Run git diff to see recent changes
2. Focus on modified files
3. Begin review immediately
Review checklist:
- Code is simple and readable
- Functions and variables are well-named
- No duplicated code
- Proper error handling
- No exposed secrets or API keys
- Input validation implemented
- Good test coverage
- Performance considerations addressed
Provide feedback organized by priority:
- Critical issues (must fix)
- Warnings (should fix)
- Suggestions (consider improving)
Include specific examples of how to fix issues.
使用时,Claude Code 会根据你的指令自动判断是否需要委派任务给某个 sub-agent。当然,你也可以明确指定:> 让 code-reviewer 检查我最近的提交
。
最佳实践
- 从生成开始: 让 Claude Code帮你生成第一个 sub-agent,然后在此基础上进行修改和完善。
- 保持专注: 设计功能单一、职责明确的 sub-agent。
- 详细的指令: 系统提示写得越详细、越清晰,sub-agent 的表现就越好。
- 限制工具: 按需授权,只给 sub-agent 完成任务所必需的工具。
- 拥抱版本控制: 将项目级的 sub-agents 加入 Git,与团队一起维护和迭代。
总结
sub-agents 功能的推出,标志着 AI 编程助手正从一个“无所不知的通才”向一个“由众多专家组成的协作团队”转变。
这不仅提升了 AI 处理复杂任务的能力和效率,也为我们开发者提供了前所未有的灵活性和控制力。我们可以像组建一个真实的开发团队一样,去“搭建”和“管理”我们的 AI 助手团队。
AI 编程的未来,正朝着更模块化、更专业化、更智能化的方向大步迈进。快去试试 Claude Code 的 sub-agents 功能,亲自感受一下这场正在发生的变革吧!
你有没有遇到过这种情况?
晚上熬夜用 Claude Code 写代码,正写到关键时刻,突然弹出:"Claude usage limit reached. 恢复时间:凌晨 3 点"😭
这时候你可能已经困得睁不开眼,但又舍不得放弃手头的工作进度...
💡 解决方案来了!
今天给大家推荐一个开源神器:Claude Auto Resume,让你的 Claude Code 可以"自动续命"!
🔧 它是怎么工作的?
- 智能检测:自动监控 Claude 使用限制
- 倒计时等待:显示实时倒计时,让你知道还要等多久
- 自动恢复:时间一到,立即恢复任务执行
- 零人工干预:整个过程完全自动化
🎯 核心特性
🔄 智能恢复
- 自动解析限制时间
- 精确计算等待时长
⏰ 实时反馈
- 倒计时显示:
恢复倒计时 02:15:30...
- 清晰的状态提示
🛡️ 安全提醒
- 内置安全警告机制
- 建议在隔离环境使用
📦 安装超简单
# 一键安装
sudo make install
# 或者直接使用
./claude-auto-resume.sh "继续完成用户认证功能"
💎 使用示例
# 基础用法
claude-auto-resume "继续实现登录页面"
# 继续上次对话
claude-auto-resume -c "请继续之前的任务"
# 使用参数形式
claude-auto-resume -p "写单元测试"
# 查看帮助
claude-auto-resume --help
🎬 工作流程演示
$ claude-auto-resume "实现用户注册功能"
Claude usage limit detected. Waiting until 2024-01-15 03:00:00...
Resuming in 02:15:30...
Resuming in 02:15:29...
...
Resume time has arrived. Retrying now.
Automatically starting new Claude session with prompt: '实现用户注册功能'
Task has been automatically resumed and completed.
⚠️ 重要提醒
由于脚本使用了 --dangerously-skip-permissions
参数,Claude 会自动执行命令而不询问权限。建议:
- 🔒 只在开发环境使用
- 📝 仔细检查提示词内容
- 💾 做好代码备份
- 🎯 使用具体的提示词(如:"继续实现 src/auth.js 中的登录功能")
🔧 技术特点
- 零依赖:只需要标准的 Unix 工具
- 跨平台:支持 Linux 和 macOS
- 轻量级:单个 Shell 脚本,不到 200 行代码
🎉 总结
有了 Claude Auto Resume,再也不用担心深夜编程被使用限制打断了!让 AI 助手真正成为你的 24/7 编程伙伴。
特别适合:
- 🌙 夜猫子程序员
- 🔧 重构狂人
- 📚 AI 学习爱好者
- ⚡ 效率提升控
项目地址:GitHub - claude-auto-resume
觉得有用的话,给个 ⭐️ 支持一下开源作者吧!
How a simple YAML configuration built for Claude Code and Playwright MCP transformed our testing workflow and made automation accessible to everyone on the team
If you've ever maintained a large Playwright test suite, you know the pain. Hundreds of lines of JavaScript scattered across dozens of files. Hardcoded values that break when environments change. Test logic so complex that only the original author dares to modify it.
What if I told you there's a better way? A way to write tests that are readable by anyone, maintainable by design, and powerful enough to handle complex workflows?
Enter YAML-based Playwright testing for Claude Code — a paradigm shift that's changing how teams approach test automation by leveraging the power of Claude Code's AI capabilities and Playwright MCP's browser automation.
The Problem with Traditional Playwright Tests
Let's be honest about traditional Playwright tests:
// Traditional Playwright test - 50+ lines of code
test('complete order flow', async ({ page }) => {
await page.goto('https://example.com');
await page.fill('[data-testid="username"]', 'user123');
await page.fill('[data-testid="password"]', 'pass456');
await page.click('[data-testid="login-btn"]');
await expect(page.locator('h1')).toContainText('Dashboard');
// ... 40+ more lines of clicking, filling, asserting
// ... hardcoded values everywhere
// ... no reusability between tests
});
Problems:
- ❌ Verbose and complex — Simple actions buried in boilerplate
- ❌ Hardcoded values — Environment changes break everything
- ❌ Poor reusability — Copy-paste leads to maintenance nightmares
- ❌ Technical barrier — Only developers can write/modify tests
- ❌ Scattered logic — Related tests live in different files
The YAML Revolution: Tests That Make Sense
Now imagine the same test written in YAML:
# test-cases/order.yml
tags:
- smoke
- order
- checkout
steps:
- include: "login"
- "Click Add to Cart button for first product"
- "Click Add to Cart button for second product"
- "Click shopping cart icon in top right"
- "Enter First Name"
- "Enter Last Name"
- "Enter Postal Code"
- "Click Continue button"
- "Click Finish button"
- "Verify page displays Thank you for your order!"
- include: "cleanup"
Immediate benefits:
- ✅ Crystal clear intent — Anyone can understand what this test does
- ✅ Natural language — Steps read like user stories
- ✅ Reusable components — Login and cleanup are shared across tests
- ✅ Environment agnostic — No hardcoded values in sight
The Magic Behind the Simplicity
1. Reusable Step Libraries
Common workflows become building blocks:
# steps/login.yml
steps:
- "Open {{BASE_URL}} page"
- "Fill username field with {{TEST_USERNAME}}"
- "Fill password field with {{TEST_PASSWORD}}"
- "Click login button"
- "Verify page displays Swag Labs"
Write once, use everywhere. No more copy-paste madness.
2. Environment Variable Magic
Different environments? No problem:
# .env.dev
BASE_URL=https://dev.example.com
TEST_USERNAME=dev_user
# .env.prod
BASE_URL=https://example.com
TEST_USERNAME=prod_user
Same tests, different environments. Automatically.
3. Intelligent Tag Filtering
Run exactly what you need:
# Run only smoke tests
/run-yaml-test tags:smoke
# Run order AND checkout tests
/run-yaml-test tags:order,checkout
# Run smoke OR critical tests
/run-yaml-test tags:smoke|critical
No more running the entire suite when you only changed the login flow.
4. Smart Reporting
Automatically generated HTML reports with:
- ✅ Step-by-step execution details
- ✅ Environment configuration
- ✅ Screenshots and artifacts
- ✅ Success/failure statistics
Real-World Impact: A Case Study
Before YAML testing:
- 📊 2,000+ lines of Playwright JavaScript
- ⏱️ 3 days to onboard new QA team members
- 🐛 15+ test failures per environment change
- 👥 Only 3 developers could modify tests
After YAML testing:
- 📊 200 lines of readable YAML
- ⏱️ 30 minutes to onboard new team members
- 🐛 0 test failures during environment changes
- 👥 Entire team can write and modify tests
Why This Matters for Your Team
For Developers:
- Less time writing boilerplate, more time building features
- Tests that actually document your application's behavior
- No more "let me just quickly fix this test" rabbit holes
For QA Engineers:
- Focus on test strategy, not JavaScript syntax
- Rapid test creation and modification
- Clear visibility into test coverage
For Product Managers:
- Tests that read like acceptance criteria
- Easy to verify that tests match requirements
- Confidence that important flows are covered
For DevOps:
- Predictable test execution across environments
- Clear failure reporting and debugging
- Easy integration with CI/CD pipelines
Technical Architecture: How It Works
This YAML Playwright testing framework is specifically designed for Claude Code and Playwright MCP. The framework consists of several key components:
Claude Code Integration
- AI-Powered Execution: Claude Code's AI interprets natural language test steps and converts them to Playwright actions
- Smart Step Recognition: Advanced understanding of testing intent from plain English descriptions
- Context Awareness: Maintains context across test steps for more intelligent automation
Playwright MCP Foundation
- Browser Automation: Leverages Playwright MCP for reliable cross-browser testing
- Element Detection: Intelligent element finding and interaction
- Screenshot & Reporting: Built-in capture and documentation capabilities
Multi-Environment Configuration
├── .env.dev # Development environment
├── .env.test # Test environment
├── .env.prod # Production environment
Reusable Step Libraries
├── steps/
│ ├── login.yml # Authentication flows
│ ├── cleanup.yml # Cleanup procedures
│ └── navigation.yml # Common navigation
Test Cases with Natural Language
├── test-cases/
│ ├── order.yml # E-commerce order flow
│ ├── user.yml # User management
│ └── search.yml # Search functionality
Intelligent Execution Engine
The framework automatically:
- Loads environment-specific configuration
- Expands
include
references from step libraries - Substitutes environment variables (
{{BASE_URL}}
) - Executes tests using Playwright MCP
- Generates comprehensive reports
Getting Started: Your First YAML Test
The beauty of YAML-based testing is its simplicity. Here's how to get started:
1. Prerequisites
# Install Claude Code (if not already installed)
# Follow instructions at: https://claude.ai/code
# Install Playwright MCP for Claude Code
claude mcp add playwright -- npx -y @playwright/mcp@latest
# Clone the YAML testing framework
git clone https://github.com/terryso/claude-code-playwright-mcp-test.git
cd claude-code-playwright-mcp-test
2. Project Structure
your-project/
├── .env.dev # Environment config
├── steps/ # Reusable step libraries
├── test-cases/ # Your test cases
├── screenshots/ # Test artifacts
└── reports/ # Generated reports
3. Write Your First Test
# test-cases/login.yml
tags:
- smoke
- auth
steps:
- "Open {{BASE_URL}} page"
- "Fill username with {{TEST_USERNAME}}"
- "Fill password with {{TEST_PASSWORD}}"
- "Click login button"
- "Verify successful login"
4. Execute and Iterate
# In Claude Code, use the built-in commands
/run-yaml-test file:test-cases/login.yml env:dev
# Or run with tag filtering
/run-yaml-test tags:smoke env:dev
Within hours, you'll have tests that are more maintainable than anything you've written before. The magic happens through Claude Code's AI understanding your natural language steps and Playwright MCP executing them as browser actions.
Advanced Features
Complex Tag Filtering
# Multiple conditions
/run-yaml-test tags:smoke,login|critical
# Environment-specific execution
/run-yaml-test tags:order env:prod
Dynamic Step Parameters
steps:
- "Add product {{PRODUCT_NAME}} to cart"
- "Set quantity to {{QUANTITY}}"
- "Apply discount code {{DISCOUNT_CODE}}"
Comprehensive Reporting
- HTML Reports: Beautiful, interactive test reports
- JSON/XML Output: For CI/CD integration
- Screenshot Capture: Automatic failure documentation
- Performance Metrics: Execution timing and statistics
The Future is Readable
We're moving toward a world where:
- Tests are documentation that executes
- Anyone can contribute to test automation
- Maintenance is a joy, not a chore
- Environments are just configuration
YAML-based Playwright testing isn't just a tool — it's a philosophy. It's the belief that tests should be clear, maintainable, and accessible to everyone on the team.
Common Questions Answered
Q: How does this compare to existing solutions like Cucumber?
A: While Cucumber requires learning Gherkin syntax and step definitions, this YAML testing framework uses natural language directly with Claude Code's AI interpreting the intent. No step definition mapping needed - Claude Code understands what you want to do.
Q: What about test debugging?
A: Claude Code provides detailed execution logs, Playwright MCP captures screenshots on failure, and you get clear error messages that map back to your YAML steps. The AI context helps identify issues quickly.
Q: Can I integrate this with CI/CD?
A: Absolutely. The framework generates standard exit codes and multiple report formats (HTML, JSON, XML) for seamless CI/CD integration.
Q: How do you handle complex assertions?
A: Claude Code's AI makes natural language assertions surprisingly powerful: "Verify page contains 'Thank you'", "Verify cart total equals $43.18", "Verify 2 items in cart". The AI understands context and intent.
Take Action Today
The question isn't whether this approach is better. The question is: How much time are you willing to waste on brittle, complex tests?
Start your YAML testing journey:
- Get Claude Code: Install Claude Code and Playwright MCP
- Try the demo: Clone the project from https://github.com/terryso/claude-code-playwright-mcp-test and run your first YAML test
- Convert one test: Take your most complex Playwright test and rewrite it in YAML
- Share with your team: Show them how readable tests can be
- Scale gradually: Convert more tests as you see the benefits
Ready to transform your testing workflow with Claude Code and Playwright MCP? The future of test automation is readable, maintainable, and accessible to everyone.
🔗 Get Started: https://github.com/terryso/claude-code-playwright-mcp-test
What's your biggest pain point with current Playwright tests? How would YAML-based testing with Claude Code solve it for your team?