96SEO 2026-08-09 05:37 3
你有没有遇到过这种情况——你让 Claude Code 写一个功能。它写到一半,你说“等等,先重构一下这个模块”,接下来之前的上下文全乱了。 或者你让它同时改三个文件,它一个一个来改完第一个忘了第二个。
使用者痛点:上下文丢失、任务拆解繁琐、需要频繁介入 AI 导致效率下降。

就在上周。Claude Code 发布了一项关键更新:子智能体模式默认开启,AI 可以在后台并行执行任务,而你继续做自己的事。
这个功能听起来很酷,但实际用起来怎么样?是不是真能提高效率,这篇文章从一个真实项目出发,完整记录了我的配置过程、使用体验和踩坑心得。
子智能体是 Claude Code 的主要能力之一:当主 Agent 识别到某个任务可以独立拆解时它会自动创建一个子智能体在后台运行完成后把结果汇报回来。
举个例子的观点是,你在写一个 Web 应用的后端 API。Claude Code 可以派一个子智能体去写单元测试,另一个去更新文档,而主 Agent 继续写业务逻辑。
子智能体默认就是开启的,无需额外配置。但如果你需要精细控制,可以在项目根目录的 .claude/settings.json 中调整:
{
"subAgent": {
"enabled": true,"maxConcurrency": 4。"timeoutSeconds": 300
}
}
或者通过 CLAUDE.md来定义子智能体的行为规则:
# Delegatable tasks
- 运行测试套件并报告结果
- 批量文件重构
- 生成重复性代码
子智能体的执行流程大致如下:
主 Agent 识别可并行的子任务
↓ 创建子智能体
↓ 子智能体独立执行
↓ 执行完成后汇报结果
↓ 主 Agent 整合子结果并继续
每个子智能体都有独立的推理上下文,不会和主 Agent 干扰。这代表着你可以让它跑耗时的代码库分析,而主 Agent 继续改代码——两不耽误。
为了测试子智能体的实际效果,我选了一个中等规模的项目来做实验:一个 Express.js + MongoDB 的 REST API 服务,大约 12 个文件、2500 行代码.
我给 Claude Code 下达了这样一个任务:
这个任务天然可以拆分:
开始分析项目结构...
发现 8 个路由文件包含 try-catch
创建子智能体 - 分析错误处理模式
识别出 3 种错误处理模式:
- 模式 A:controller 内 try-catch 直接返回
- 模式 B:controller 内 try-catch 调用 next
- 模式 C:未处理
报告完成
创建子智能体 - 实现统一错误中间件
创建 errorHandler.js
实现 AppError 类、NotFoundError 等业务异常类
配置 app.use
报告完成
创建子智能体 - 修改路由文件
并行修改 8 个路由文件...
/users.js 成功。/orders.js 有冲突...
完成
创建子智能体 - 编写测试 & 验证
再看运行测试,120 passed,0 failed
新增 15 个测试用例覆盖错误场景
耗时这方面,4 分 32 秒
重构前后代码对比:
# 重构前:
// userController.js
exports.getUser = async => {
try {
const user = await User.findById;话说回来,if {
return res.status.json;其实,}
res.json;} catch {
next;}
},
// userController.js
exports.getUser = async => {
const user = await User.findById;
if throw new NotFoundError;res.json,};
// errorHandler.js
class AppError extends Error {
constructor {
super;this.statusCode = statusCode;this.isOperational = true;Error.captureStackTrace;}
}
class NotFoundError extends AppError {
constructor {
super;}
}
const errorHandler = => {
const statusCode = err.statusCode || 500;res.status.json({
success: false。error: err.message,...
});},module.exports = errorHandler;
| 对比维度 | 无子智能体 | 有子智能体 | 提高幅度 |
|---|---|---|---|
| Total time | 8 min 12 s | 4 min 32 s | -44% |
| User interventions | 7 | 2 | -71% |
| Total context switches | 5 | 1 | -80% |
| Linter pass rate | 92% | 98% "+6%" | |
| Test coverage ↑ | 62% | 78% | +26% |
| 并行文件修改数 | 1 | 4 | |
| *实验基于同一套代码库与相同硬件环境。小型项目 差异有限,大型项目 效果更显著。 | |||
You may have experienced this – you ask Claude Code to write a feature。it stops halfway and you say “wait,refactor this module first”,n previous context gets scrambled. Or you ask it to modify three files at once;it does m one by one and forgets about second file.
User Pain Point: 上下文丢失 / 手动拆解任务导致频繁介入 / 开发节奏被 AI 阻塞。不过,
The week before last Claude Code released a major update: **Sub‑agent mode is now enabled by default**。allowing AI to run tasks in parallel while you keep working on or things.
This sounds cool—does it actually boost productivity?The following article walks through a real project,detailing configuration steps。usage experience and pitfalls.
A Sub‑agent is a core capability of Claude Code. When main agent detects that a task can be split into independent pieces,it **automatically spawns a child agent** that runs in background and reports results back once finished.
E.g.,while you are writing backend business logic。one Sub‑agent can generate unit tests while anor updates documentation.
.claude/settings.jsonjson
{
"subAgent": {
"enabled": true,"maxConcurrency":4,"timeoutSeconds":300
}
}
These fields let you limit how many agents run simultaneously and set a global timeout.
.
We need proper HTML for config snippet:
We'll use
blocks for JSON etc.
Continue:
作为专业的SEO优化服务提供商,我们致力于通过科学、系统的搜索引擎优化策略,帮助企业在百度、Google等搜索引擎中获得更高的排名和流量。我们的服务涵盖网站结构优化、内容优化、技术SEO和链接建设等多个维度。
| 服务项目 | 基础套餐 | 标准套餐 | 高级定制 |
|---|---|---|---|
| 关键词优化数量 | 10-20个核心词 | 30-50个核心词+长尾词 | 80-150个全方位覆盖 |
| 内容优化 | 基础页面优化 | 全站内容优化+每月5篇原创 | 个性化内容策略+每月15篇原创 |
| 技术SEO | 基本技术检查 | 全面技术优化+移动适配 | 深度技术重构+性能优化 |
| 外链建设 | 每月5-10条 | 每月20-30条高质量外链 | 每月50+条多渠道外链 |
| 数据报告 | 月度基础报告 | 双周详细报告+分析 | 每周深度报告+策略调整 |
| 效果保障 | 3-6个月见效 | 2-4个月见效 | 1-3个月快速见效 |
我们的SEO优化服务遵循科学严谨的流程,确保每一步都基于数据分析和行业最佳实践:
全面检测网站技术问题、内容质量、竞争对手情况,制定个性化优化方案。
基于用户搜索意图和商业目标,制定全面的关键词矩阵和布局策略。
解决网站技术问题,优化网站结构,提升页面速度和移动端体验。
创作高质量原创内容,优化现有页面,建立内容更新机制。
获取高质量外部链接,建立品牌在线影响力,提升网站权威度。
持续监控排名、流量和转化数据,根据效果调整优化策略。
基于我们服务的客户数据统计,平均优化效果如下:
我们坚信,真正的SEO优化不仅仅是追求排名,而是通过提供优质内容、优化用户体验、建立网站权威,最终实现可持续的业务增长。我们的目标是与客户建立长期合作关系,共同成长。
Demand feedback