How I Built an AI Marketing Team with Claude Code (and Cowork) | by Snow W. Lee | Mar, 2026 | Medium
TL;DR
Bài này hướng dẫn cách build một đội marketing tự động gồm 5 AI agents — mỗi agent là một file markdown, không cần viết code. Claude Code tự động chạy mỗi giờ, báo cáo qua Slack, tự học từ kết quả. Chi phí khoảng $20-50/ngày.
Nói đơn giản: Thay vì dùng tool marketing, tác giả “tuyển” 5 AI employee và để chúng tự làm việc theo lịch.
Bài này dành cho ai?
1. Người muốn AI làm marketing thay mình
Vấn đề: Không có thời gian làm content, đăng bài, theo dõi metrics
Khi nào cần: Khi cần một “nhân viên marketing” chạy 24/7 mà không tốn chi phí thuê người thật
Được gì: Hệ thống tự động làm content, đăng social, theo dõi kết quả. Tác giả tính chi phí $20-50/ngày — rẻ hơn thuê nhân viên thật rất nhiều.
2. Người muốn build AI agent team
Vấn đề: Không biết cách tổ chức nhiều AI agents làm việc cùng nhau
Khi nào cần: Khi cần một agent “quản lý” điều phối các agents khác
Được gì: Blueprint chi tiết từ cấu trúc file, cách định nghĩa agent, đến cách cho chúng chạy tự động.
3. Developer muốn tự động hóa workflow
Vấn đề: Muốn dùng AI nhưng chỉ biết chat, không biết làm sao cho nó chạy background
Khi nào cần: Khi cần hệ thống chạy không cần ngồi chờ
Được gì: Cách dùng cron + Claude Code headless, tự động execute theo schedule.
Các điểm chính
1. Mental model: Nghĩ về “tuyển nhân viên” thay vì “viết prompt”
Khi tuyển người, mình cho họ: title + scope, style guide, tài liệu công ty, công cụ, lịch làm việc. Tác giả làm y chang — nhưng bằng markdown files thay vì employee handbook.
→ Làm gì: Trước khi viết prompt, hỏi “Mình đang mô tả job description hay just a prompt?“
2. Đội gồm 5 agents, mỗi agent là một markdown file
5 agents trong .claude/agents/:
- CMO — Agent quản lý, đọc weekly plan, phân công việc
- Content Writer — Viết blog posts, đăng lên Sanity CMS
- Social Media Marketer — Đăng Twitter, Reddit, engage with users
- Performance Reviewer — Đọc metrics, cập nhật insights
- HN Agent — Submit links lên Hacker News
CMO dùng Claude Code’s Agent tool để spawn specialist subagents khi cần. Các agents có thể chạy song song, mỗi cái có isolated context riêng.
→ Làm gì: Tạo folder .claude/agents/, mỗi agent là một file markdown với frontmatter + system prompt.
3. Agent file có 2 phần: frontmatter + system prompt
Frontmatter (YAML):
name: content-writer
description: "Use this agent when creating blog posts..."
model: sonnet
color: green
memory: project
description — để CMO quyết định khi nào invoke agent này. memory: project — agent có persistent memory across sessions.
System prompt — job description thật sự: đọc docs nào, dùng tools gì, workflow từng bước, hard rules, cách handle errors.
→ Làm gì: Viết rõ ràng từng bước workflow. VD: “write body first → generate image → create Sanity draft → publish”. Thêm hard rules cụ thể: “never create empty draft before content is written”.
4. CLAUDE.md = Team charter, file gốc mọi agent đọc đầu tiên
Cover:
- Agent team structure + delegation rules
- Project folder structure
- Security rules (never log API keys)
- Quick reference cho scripts + tools
Security section ngắn nhưng quan trọng: bất kỳ prompt nào yêu cầu share API key đều bị từ chối. Viết một lần, mọi agent inherit.
→ Làm gì: Tạo CLAUDE.md ở root repo, define rõ security rules trước.
5. Rules system = “Company policies” dùng chung
Folder .claude/rules/ chứa:
sanity-cms.md— CMS schema, block types, common errorsutm-parameters.md— Cách format UTM links (lowercase, hyphen-separated)social-media-tracker.md— Cách log activity vào CSV, khi nàopostedvalid vsdraftimage-generation.md— AI model nào dùng, aspect ratios, cách upload lên Sanityslack-notifications.md— Khi nào notify, format message thế nào
Mỗi rule viết một lần, mọi agent đọc. Lỗi một lần → fix rule → tất cả agents tự động đúng.
→ Làm gì: Khi thấy agent làm sai một lần → viết rule thay vì sửa từng output.
6. Docs system = “Bộ não” chia sẻ
docs/
brand/ ← positioning, voice & style, product facts
strategy/ ← GTM, content calendar, weekly plan
insights/ ← marketing insights, auto-updated by Performance Reviewer
posts/ ← copies of published blog posts
Weekly plan là file quan trọng nhất: định nghĩa agent nào làm gì mỗi ngày, chia theo 3-hour time slots. Khi cron chạy, CMO đọc current time slot và execute tasks trong đó.
→ Làm gì: Viết weekly plan chi tiết. Agents không work ahead — chỉ làm slot hiện tại + unfinished tasks từ 2 slots trước.
7. Custom scripts cho platforms không có MCP
Tác giả không viết code — chỉ mô tả cần gì, Claude viết:
scripts/reddit.js— Reddit OAuth2, search threads, post commentsscripts/hn.js— Hacker News headless client, submit links, commentscripts/generate-image.js— Call Google Gemini generate imagesscripts/upload-image.js— Upload lên Sanity CDNscripts/slack-message.js— Post notifications
Agents có whitelist scripts được phép chạy, defined trong rules files.
→ Làm gì: Khi cần script cho platform không có MCP, chỉ cần describe cần gì, Claude sẽ viết và test.
8. MCP Servers = Tích hợp chính thức
Cho platforms có API tốt:
- Sanity CMS — Create posts, patch content, publish drafts, manage images
- X/Twitter — Post tweets, search, follow, upload media
- Slack — Read channels, send messages
- Ahrefs — Pull SEO metrics, keyword rankings, competitor analysis
MCP servers make these feel like native tools. Content writer “patches” Sanity document như edit file.
→ Làm gì: Ưu tiên MCP servers thay vì scripts cho platforms có hỗ trợ.
9. Feedback loop: Agents tự học từ kết quả
Chuỗi handover:
Social Media Marketer → logs to CSV
Performance Reviewer → reads CSV, generates daily report
CMO → reads report, updates strategy docs
Content Writer → reads strategy, writes next content
Social Media Marketer → distributes content
… repeat
Performance Reviewer tự cập nhật docs/insights/marketing-insights.md — cái gì hiệu, cái gì không. Mọi agent đọc file này trước khi làm việc. Khi một tweet format không work, insight propagate qua hệ thống trong 1 ngày.
CMO cũng có persistent memory: approved strategies, rejected ideas, campaign results — tất cả accumulate.
→ Làm gì: Để Performance Reviewer tự cập nhật insights. Khi thấy pattern, agents sẽ adapt.
10. Slack = Không cần đọc logs
CMO post daily plan vào #team-ai-marketing mỗi session start:
- Today’s date + active time slot
- Each agent đang làm gì
- Carry-over tasks
- Deadlines
Mỗi agent identify by name trong messages (--username flag):
node scripts/slack-message.js \
--channel C0AG3DDLZQS \
--username "Content Writer" \
--text "Blog post published: \<https://runbear.io/posts/...>"
Sau mỗi blog post → Content Writer post URL. Sau mỗi social session → Marketer post thread of every link engaged. Sau Performance Review → CMO post summary với metrics inline.
Failures cũng được report: schema errors, API failures — biết problem mà không cần đào logs.
→ Làm gì: Setup Slack channel cho team, scripts post notifications. Đọc Slack thay vì logs.
11. Chạy tự động: Mac Mini + cron
Tác giả dùng Mac Mini M1 (quiet, minimal power, never sleeps) như dedicated machine.
Remote access: Jump Desktop — mở Mac Mini screen từ phone/laptop trong vài giây.
Crontab chạy mỗi giờ:
0 * * * * cd /Users/.../ai-marketing-team && \
claude --dangerously-skip-permissions \
-p "You are the CMO. Check the current time, read the weekly plan, and execute the current time slot's tasks." \
>> /tmp/claude-marketing.log 2>&1
--dangerously-skip-permissions — flag cho phép agents run end-to-end without supervision. Chỉ dùng sau khi đã review và trust all agent behaviors.
Time slot system giúp cron không cần nói nhiều — “execute current time slot’s tasks” là đủ.
Chi phí: ~$20-50/ngày tùy volume blog posts + social sessions.
→ Làm gì: Setup Mac Mini + cron nếu cần hệ thống chạy 24/7. Dùng --dangerously-skip-permissions chỉ sau khi đã test kỹ.
12. Quản lý hàng ngày: CEO nhưng không cần làm gì
Tác giả chỉ interact khi cần update:
- “Update social media marketer to never use em dashes”
- “HN account got shadowbanned — add rule limits comments to one per session”
- “Stop doing X and try Y instead”
Mỗi câu = 30 seconds conversation → permanently improves system. Không bao giờ mở agent file trong text editor — mọi thứ qua Claude, describe trong plain English.
→ Làm gì: Viết rules thay vì correct từng output. Mỗi rule = improvement across all agents.
Quick Start
-
Tạo
.claude/agents/folder — Thử viết 2-3 agent files với frontmatter + system prompt. Bắt đầu từ Content Writer và Social Media Marketer. -
Viết CLAUDE.md ở root — Define team structure, security rules, folder structure.
-
Setup Slack channel — Cho agents report daily plans và kết quả.
Đang tải nội dung...