关于 cowork-setup
cowork-setup 是供团队在 Cowork 中使用 Digital Marketing Pro 的一次性配置技能。它将品牌数据和报告路由到共享 Drive 文件夹持久保存,并可在之后启动品牌设置。
主要功能
- 01检测 Cowork 环境
- 02检查已连接的 Drive MCP
- 03查找或创建共享 Drive 根目录
- 04配置团队专属存储路由
- 05可选启动品牌设置
适用场景
- 01为团队配置 Cowork 中的 Digital Marketing Pro
- 02在 Cowork 会话间保留品牌状态
- 03切换团队的 Drive 根目录
MCP 相关
该技能会检查 Google Drive MCP,并用它创建或查找文件夹、同步品牌数据和报告。也可将 Notion MCP 用作持久化目标。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ indranilbanerjee/ digital-marketing-pro --skill cowork-setup安装后在 Claude Code 中输入/cowork-setup确认已加载。
详细介绍
/digital-marketing-pro:cowork-setup
脚本位置。 如果宿主环境未设置
${CLAUDE_PLUGIN_ROOT},脚本位于此插件的scripts/文件夹中,与skills/同级。请使用 Python 3.10 或更高版本运行:使用python;如果找不到python,则使用python3(macOS 和许多 Linux 系统)。
一次性设置,让团队在 Cowork 中使用 Digital Marketing Pro,并使其保持持久化。配置 Cowork → Drive 路由,让品牌资料、营销活动计划、审计报告和运行记录在当前 Cowork 会话结束后继续保留。
团队首次在 Cowork 中安装 DMP、品牌资料不再能跨 Cowork 会话持久保存,或切换到其他团队的 Drive 根文件夹时,请运行此设置。例如:/digital-marketing-pro:cowork-setup、... --brand acme、... --drive-root "ACME DigitalMarketingPro"。
此技能的用途
Cowork 是 Anthropic 最适合营销人员的使用界面,面向不常使用终端的代理机构团队、企业内部营销人员和增长运营人员。团队的自然工作方式是“所有人都使用 Cowork;品牌状态和输出内容都保存在我们的共享 Drive 中”。但 DMP 的文件系统层是为本地 Claude Code 设计的(在宿主机上写入 ~/.claude-marketing/)。在 Cowork 中,该路径是每个会话独有的 Linux 沙盒,会在会话结束时消失,团队也无法访问。
${CLAUDE_PLUGIN_DATA} 在这里也无济于事。 Anthropic 的插件文档将其描述为每个插件的持久化存储路径。在 Cowork 中,它会解析为会话范围的 VM 挂载点,同样会消失(未解决的问题:claude-code#51398)。所有基于 OAuth 的 MCP 插件都会遇到同样的问题。
v3.12.0 通过感知环境的路由解决了这个问题:检测到 Cowork 且已配置 Drive MCP 时,品牌资料和报告会通过 Drive 往返传输,而不是存放在临时沙盒中。此技能用于一次性设置,确保在开始处理实际工作前满足这两个条件。
行为
步骤 1 — 验证 Cowork 环境
python "${CLAUDE_PLUGIN_ROOT}/scripts/plugin-metadata.py" --section environment
解析 JSON。分为以下三种情况:
environment == "cowork-sandbox" — 继续执行步骤 2。
environment == "claude-code-windows" / "-mac" / "-linux" — 告知用户:
“你当前运行的是本地 Claude Code,而不是 Cowork。这里不需要 Cowork 专用的 Drive 路由——品牌状态会按设计持久保存在宿主机的
~/.claude-marketing/中。如果你也想使用 Drive 备份,以便团队共享,仍然可以运行此技能,它会将状态镜像到 Drive 作为备份。要继续吗?”
仅在用户确认后继续。
environment == "unknown" — 显示 JSON 中的检测指标并询问用户当前的运行环境,然后假定为 Cowork 并继续(因为最有可能的情况是从 Cowork 中检测到未知环境)。
步骤 2 — 确认 Drive MCP 已连接
扫描可用工具,查找 Google Drive MCP。常见特征:
mcp__<id>__create_file、mcp__<id>__read_file_content、mcp__<id>__search_files、mcp__<id>__list_folder_items— Anthropic 平台的 Drive 集成(Cowork 中的 Settings → Integrations → Google Drive)mcp__pipedream-google-drive__*— Pipedream 聚合器mcp__composio-google-drive__*— Composiomcp__zapier-google-drive__*— Zapier- 名称中同时包含“drive”和“create”/“upload”/“search”的任何工具
如果找到了 Drive MCP: 告知用户找到的是哪个(“已找到:Anthropic 平台的 Google Drive 集成。我将使用此集成。”),然后继续执行步骤 3。
如果没有找到 Drive MCP: 以明确提示结束向导:
“Cowork 模式下的 DMP 需要先配置 Google Drive 集成,才能为你的团队持久保存品牌状态。最简单的设置方法(60 秒):
- 在 Cowork 中,点击个人资料菜单 → Settings → Integrations
- 在列表中找到 Google Drive → 点击 Connect
- 使用拥有团队共享 Drive 的 Google 账号登录
- 返回此处并重新运行
/digital-marketing-pro:cowork-setup另外,也可以使用 Notion MCP 作为持久化目标 — DMP 会将每个品牌视为一个 Notion 页面。如果你更喜欢这种方式,请在 Cowork 的 Integrations 面板中添加 Notion,然后重新运行此技能。”
步骤 3 — 确认或创建规范的 Drive 文件夹
默认文件夹名称:DigitalMarketingPro(位于“My Drive”下,或用户偏好的位置)。如果传入了 --drive-root <name>,则使用该名称。
使用 Drive MCP 执行以下操作:
- 搜索名为
DigitalMarketingPro(或用户指定的--drive-root)的顶层文件夹 - 如果文件夹存在,确认用户要使用该文件夹,并显示其 URL。
- 如果文件夹不存在,则创建该文件夹,并显示新文件夹的 URL。
然后创建以下子文件夹结构:
DigitalMarketingPro/
├── _brands/ <- brand profile JSONs persist here per brand
├── _runs/ <- per-run checkpoints (resume across sessions)
├── _plans/ <- yearly + quarterly + campaign plans
└── (brand folders created on first content/audit/campaign run)
└── <brand name>/
├── strategy/
├── seo/
├── campaigns/
├── audits/
└── reports/
暂时不要创建空的品牌子文件夹 — 首次为相应品牌运行时会自动创建。只需确保 _brands/、_runs/ 和 _plans/ 存在。
步骤 4 — 保存 Drive 根目录引用和团队命名空间
多团队隔离:询问用户“你的团队 Drive 根文件夹叫什么?”(默认值:DigitalMarketingPro)。不同团队使用不同的文件夹名称 → 自动隔离命名空间。例如:
- 个人/小团队:
DigitalMarketingPro(默认值) - 名为“ACME”的代理机构:
ACME DigitalMarketingPro - 共用一个 Drive 的两个独立团队:各自选择不同的名称
然后通过规范脚本写入配置(不要手动编写 JSON 文件 — 使用脚本可确保格式与工具链其余部分保持一致):
python "${CLAUDE_PLUGIN_ROOT}/scripts/drive-sync-state.py" --action write-config --data '{
"environment": "cowork-sandbox",
"drive_root_folder_name": "<team folder name chosen>",
"drive_root_folder_id": "<id from Step 3>",
"drive_root_folder_url": "<webViewLink from Step 3>",
"drive_mcp_tool_prefix": "<prefix detected in Step 2, e.g. mcp__abc123__>"
}'
脚本会写入 ~/.claude-marketing/_cowork-config.json,并自动添加 configured_at 时间戳。
后续 Cowork 会话中,每项 DMP 操作(brand-setup、status、seo-audit、campaign-plan 等)都会先读取此配置。如果配置存在且 Drive 文件夹仍然存在,所有输入/输出操作都会指向该根目录。如果另一个团队选择了不同的文件夹名称,他们的配置仍保存在同一路径,但指向不同位置 — 不会发生冲突。
验证配置是否正确写入:
python "${CLAUDE_PLUGIN_ROOT}/scripts/drive-sync-state.py" --action read-config
步骤 5 — 说明用户需要了解的事项
显示清晰的摘要:
Digital Marketing Pro is now wired for Cowork team usage:
Environment: Cowork sandbox (Linux)
Drive integration: <name>
Output root in Drive: My Drive/<folder name> (link)
Config saved at: ~/.claude-marketing/_cowork-config.json
What this means in practice:
- /digital-marketing-pro:brand-setup -> profile lands in
Drive/<folder>/_brands/<brand-slug>/profile.json (persists across sessions)
- /digital-marketing-pro:campaign-plan -> plan lands in
Drive/<folder>/<brand>/campaigns/<YYYY-MM>/<slug>/PLAN.md
- /digital-marketing-pro:seo-audit -> audit + intermediates land in
Drive/<folder>/<brand>/audits/<date>/
- /digital-marketing-pro:status -> reads brand state from Drive first,
falls back to local sandbox if Drive call fails
- /digital-marketing-pro:resume -> picks up an interrupted run by
pulling its checkpoint files from Drive/<folder>/_runs/
Your team accesses everything via Google Drive directly. No
Cowork-specific paths to remember.
Next step:
/digital-marketing-pro:brand-setup "Your Brand Name"
步骤 6 — 可选:启动品牌设置
如果传入了 --brand <name>,则在摘要后自动启动 /digital-marketing-pro:brand-setup "<name>"。这样首次运行就能“一条命令,完成全部设置”。
Cowork 感知型技能如何使用此配置
配置路由后,brand-setup 会在本地写入 ~/.claude-marketing/brands/{brand-slug}/profile.json,并通过 drive-sync-state.py --action add-pending-upload 记录待上传到 Drive 的文件。随后,Agent 会读取待上传列表,并使用其 Drive MCP 将文件推送到 <root>/_brands/{brand}/profile.json。在之后的 Cowork 会话中,Agent 会反向执行此流程:读取 _cowork-config.json,找到团队的 Drive 根目录,将 <root>/_brands/{brand}/profile.json 下载到本地沙盒,并将其标记为 profile-mark-downloaded,使本地哈希值与 Drive 副本一致。
具体来说,每次修改 DMP 状态后,Agent 都会运行:
python "${CLAUDE_PLUGIN_ROOT}/scripts/drive-sync-state.py" --action profile-needs-upload --brand <brand>
如果 needs_upload: true,Agent 会使用其 Drive MCP 上传文件,然后使用 MCP 返回的 Drive 文件 ID 运行 --action profile-mark-uploaded。
此技能不会做什么
- 不会更改 DMP 在本地 Claude Code 中的行为(此时使用主机文件系统没有问题)。
- 不会将现有的本地模式品牌迁移到 Drive。若要事后迁移,请在此技能运行完成后,于 Cowork 中重新运行
/digital-marketing-pro:brand-setup "<brand>"— brand-setup 技能会将本地配置文件上传到 Drive。 - 不会创建服务账号 JSON。Cowork 模式完全通过 MCP 路径运行(无需设置 Google Cloud)。
- 不会检查你的 Drive 是否有足够空间。品牌配置文件和计划文件都很小(通常小于 100KB),因此很少会遇到空间问题;但如果实际运行时遇到配额错误,请标记出来。
- 不会取代本地回退机制 — 如果 Drive 调用因任何原因失败,DMP 仍会在本地写入并重新将上传加入队列。
另请参阅
/digital-marketing-pro:status— 确认设置后已检测到 Cowork+Drive/digital-marketing-pro:brand-setup— 实际的品牌设置(现在在 Cowork 中默认使用 Drive)/digital-marketing-pro:doctor— 按操作检查就绪状态(现在也会报告 Cowork+Drive 路由情况)scripts/plugin-metadata.py --section environment— 底层探测工具- README 的“Cowork 团队使用”部分 — 关于使用哪个界面的权威文档