agentic-workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI Agent Workflow (Workflow & Productivity)

AI Agent工作流(工作流与生产力)

When to use this skill

什么时候使用这个技能

  • Optimize everyday AI agent work
  • Integrate Git/GitHub workflows
  • Use MCP servers
  • Manage and recover sessions
  • Apply productivity techniques

  • 优化日常AI Agent工作
  • 集成Git/GitHub工作流
  • 使用MCP服务器
  • 管理和恢复会话
  • 应用生产力技巧

1. Key commands by agent

1. 按Agent分类的核心命令

Claude Code commands

Claude Code命令

CommandFunctionWhen to use
/init
Auto-generate a CLAUDE.md draftStart a new project
/usage
Show token usage/reset timeStart of every session
/clear
Clear conversation historyWhen context is polluted; start a new task
/context
Context window X-RayWhen performance degrades
/clone
Clone the entire conversationA/B experiments; backups
/mcp
Manage MCP serversEnable/disable MCP
!cmd
Run immediately without Claude processingQuick status checks
命令功能适用场景
/init
自动生成CLAUDE.md草稿启动新项目时
/usage
显示Token用量/重置时间每次会话开始时
/clear
清空对话历史上下文被污染时;开启新任务时
/context
上下文窗口X光检测性能下降时
/clone
克隆整个对话A/B实验;备份时
/mcp
管理MCP服务器启用/禁用MCP时
!cmd
无需Claude处理直接运行命令快速状态检查时

Gemini CLI commands

Gemini CLI命令

CommandFunction
gemini
Start a conversation
@file
Add file context
-m model
Select model
命令功能
gemini
开启对话
@file
添加文件上下文
-m model
选择模型

Codex CLI commands

Codex CLI命令

CommandFunction
codex
Start a conversation
codex run
Run a command

命令功能
codex
开启对话
codex run
运行命令

2. Keyboard shortcuts (Claude Code)

2. 键盘快捷键(Claude Code)

Essential shortcuts

核心快捷键

ShortcutFunctionImportance
Esc Esc
Cancel the last task immediatelyHighest
Ctrl+R
Search prompt historyHigh
Shift+Tab
x2
Toggle plan modeHigh
Tab
/
Enter
Accept prompt suggestionMedium
Ctrl+B
Send to backgroundMedium
Ctrl+G
Edit in external editorLow
快捷键功能重要程度
Esc Esc
立即取消上一个任务最高
Ctrl+R
搜索提示词历史
Shift+Tab
按2次
切换计划模式
Tab
/
Enter
接受提示词建议
Ctrl+B
发送到后台运行
Ctrl+G
在外部编辑器中编辑

Editor editing shortcuts

编辑器编辑快捷键

ShortcutFunction
Ctrl+A
Move to start of line
Ctrl+E
Move to end of line
Ctrl+W
Delete previous word
Ctrl+U
Delete to start of line
Ctrl+K
Delete to end of line

快捷键功能
Ctrl+A
移动到行首
Ctrl+E
移动到行尾
Ctrl+W
删除前一个单词
Ctrl+U
删除内容到行首
Ctrl+K
删除内容到行尾

3. Session management

3. 会话管理

Claude Code sessions

Claude Code会话

bash
undefined
bash
undefined

Continue the last conversation

Continue the last conversation

claude --continue
claude --continue

Resume a specific session

Resume a specific session

claude --resume <session-name>
claude --resume <session-name>

Name the session during the conversation

Name the session during the conversation

/rename stripe-integration
undefined
/rename stripe-integration
undefined

Recommended aliases

推荐别名配置

bash
undefined
bash
undefined

~/.zshrc or ~/.bashrc

~/.zshrc or ~/.bashrc

alias c='claude' alias cc='claude --continue' alias cr='claude --resume' alias g='gemini' alias cx='codex'

---
alias c='claude' alias cc='claude --continue' alias cr='claude --resume' alias g='gemini' alias cx='codex'

---

4. Git workflow

4. Git工作流

Auto-generate commit messages

自动生成提交信息

"Analyze the changes, write an appropriate commit message, then commit"
"Analyze the changes, write an appropriate commit message, then commit"

Auto-generate draft PR

自动生成PR草稿

"Create a draft PR from the current branch's changes.
Make the title summarize the changes, and list the key changes in the body."
"Create a draft PR from the current branch's changes.
Make the title summarize the changes, and list the key changes in the body."

Use Git worktrees

使用Git工作树

bash
undefined
bash
undefined

Work on multiple branches simultaneously

Work on multiple branches simultaneously

git worktree add ../myapp-feature-auth feature/auth git worktree add ../myapp-hotfix hotfix/critical-bug
git worktree add ../myapp-feature-auth feature/auth git worktree add ../myapp-hotfix hotfix/critical-bug

Independent AI sessions per worktree

Independent AI sessions per worktree

Tab 1: ~/myapp-feature-auth → new feature development Tab 2: ~/myapp-hotfix → urgent bug fix Tab 3: ~/myapp (main) → keep main branch
undefined
Tab 1: ~/myapp-feature-auth → new feature development Tab 2: ~/myapp-hotfix → urgent bug fix Tab 3: ~/myapp (main) → keep main branch
undefined

PR review workflow

PR评审工作流

1. "Run gh pr checkout 123 and summarize this PR's changes"
2. "Analyze changes in src/auth/middleware.ts. Check for security issues or performance problems"
3. "Is there a way to make this logic more efficient?"
4. "Apply the improvements you suggested and run tests"

1. "Run gh pr checkout 123 and summarize this PR's changes"
2. "Analyze changes in src/auth/middleware.ts. Check for security issues or performance problems"
3. "Is there a way to make this logic more efficient?"
4. "Apply the improvements you suggested and run tests"

5. Using MCP servers (Multi-Agent)

5. MCP服务器使用(多Agent)

Key MCP servers

核心MCP服务器

MCP serverFunctionUse case
PlaywrightControl web browserE2E tests
SupabaseDatabase queriesDirect DB access
FirecrawlWeb crawlingData collection
Gemini-CLILarge-scale analysis1M+ token analysis
Codex-CLIRun commandsBuild, deploy
MCP服务器功能适用场景
Playwright控制网页浏览器E2E测试
Supabase数据库查询直接访问数据库
Firecrawl网页爬虫数据收集
Gemini-CLI大规模分析百万级Token分析
Codex-CLI运行命令构建、部署

MCP usage examples

MCP使用示例

bash
undefined
bash
undefined

Gemini: large-scale analysis

Gemini: large-scale analysis

ask-gemini "@src/ Analyze the structure of the entire codebase"
ask-gemini "@src/ Analyze the structure of the entire codebase"

Codex: run commands

Codex: run commands

shell "docker-compose up -d" shell "npm test && npm run build"
undefined
shell "docker-compose up -d" shell "npm test && npm run build"
undefined

MCP optimization

MCP优化

bash
undefined
bash
undefined

Disable unused MCP servers

Disable unused MCP servers

/mcp
/mcp

Recommended numbers

Recommended numbers

- MCP servers: fewer than 10

- MCP servers: fewer than 10

- Active tools: fewer than 80

- Active tools: fewer than 80


---

---

6. Multi-Agent workflow patterns

6. 多Agent工作流模式

Orchestration pattern

编排模式

[Claude] Plan → [Gemini] Analysis/research → [Claude] Write code → [Codex] Run/test → [Claude] Synthesize results
[Claude] 制定计划 → [Gemini] 分析/调研 → [Claude] 编写代码 → [Codex] 运行/测试 → [Claude] 汇总结果

Practical example: API design + implementation + testing

实际示例:API设计 + 实现 + 测试

1. [Claude] Design API spec using the skill
2. [Gemini] ask-gemini "@src/ Analyze existing API patterns" - large-scale codebase analysis
3. [Claude] Implement code based on the analysis
4. [Codex] shell "npm test && npm run build" - test and build
5. [Claude] Create final report
1. [Claude] 使用技能设计API规范
2. [Gemini] ask-gemini "@src/ Analyze existing API patterns" - 大规模代码库分析
3. [Claude] 基于分析结果实现代码
4. [Codex] shell "npm test && npm run build" - 测试与构建
5. [Claude] 生成最终报告

TDD workflow

TDD工作流

"Work using TDD. First write a failing test,
then write code that makes the test pass."
"Work using TDD. First write a failing test,
then write code that makes the test pass."

The AI:

人工智能执行步骤:

1. Write a failing test

1. 编写失败的测试用例

2. git commit -m "Add failing test for user auth"

2. git commit -m "Add failing test for user auth"

3. Write minimal code to pass the test

3. 编写最少代码让测试通过

4. Run tests → confirm they pass

4. 运行测试 → 确认通过

5. git commit -m "Implement user auth to pass test"

5. git commit -m "Implement user auth to pass test"


---

---

7. Container workflow

7. 容器工作流

Docker container setup

Docker容器配置

dockerfile
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \
    curl git tmux vim nodejs npm python3 python3-pip
RUN curl -fsSL https://claude.ai/install.sh | sh
WORKDIR /workspace
CMD ["/bin/bash"]
dockerfile
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \
    curl git tmux vim nodejs npm python3 python3-pip
RUN curl -fsSL https://claude.ai/install.sh | sh
WORKDIR /workspace
CMD ["/bin/bash"]

Safe experimentation environment

安全实验环境

bash
undefined
bash
undefined

Build and run the container

Build and run the container

docker build -t ai-sandbox . docker run -it --rm
-v $(pwd):/workspace
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY
ai-sandbox
docker build -t ai-sandbox . docker run -it --rm
-v $(pwd):/workspace
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY
ai-sandbox

Do experimental work inside the container

Do experimental work inside the container


---

---

8. Troubleshooting

8. 问题排查

When context is overloaded

上下文过载时

bash
/context  # Check usage
/clear    # Reset context
bash
/context  # 检查用量
/clear    # 重置上下文

Or create HANDOFF.md and start a new session

Or create HANDOFF.md and start a new session

undefined
undefined

Cancel a task

取消任务

Esc Esc  # Cancel the last task immediately
Esc Esc  # 立即取消上一个任务

When performance degrades

性能下降时

bash
undefined
bash
undefined

Check MCP/tool counts

Check MCP/tool counts

/mcp
/mcp

Disable unnecessary MCP servers

Disable unnecessary MCP servers

Reset context

Reset context


---

---

Quick Reference Card

快速参考卡

=== Essential commands ===
/clear      reset context
/context    check usage
/usage      check tokens
/init       generate project description file
!command    run immediately

=== Shortcuts ===
Esc Esc     cancel task
Ctrl+R      search history
Shift+Tab×2 plan mode
Ctrl+B      background

=== CLI flags ===
--continue  continue conversation
--resume    resume session
-p "prompt" headless mode

=== Multi-Agent ===
Claude      plan/code generation
Gemini      large-scale analysis
Codex       run commands

=== Troubleshooting ===
Context overloaded → /clear
Cancel task → Esc Esc
Performance degradation → check /context
=== 核心命令 ===
/clear      重置上下文
/context    检查用量
/usage      检查Token
/init       生成项目描述文件
!command    立即运行

=== 快捷键 ===
Esc Esc     取消任务
Ctrl+R      搜索历史
Shift+Tab×2 计划模式
Ctrl+B      后台运行

=== CLI参数 ===
--continue  继续对话
--resume    恢复会话
-p "prompt" 无头模式

=== 多Agent ===
Claude      制定计划/生成代码
Gemini      大规模分析
Codex       运行命令

=== 问题排查 ===
上下文过载 → /clear
取消任务 → Esc Esc
性能下降 → 检查 /context