claude-cli-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ecosystem Role: Inner Loop Specialist

生态角色:内循环专家

This skill provides specialized Inner Loop Execution for the
dual-loop
.
  • Orchestrated by:
    agent-orchestrator
  • Use Case: When "generic coding" is insufficient and specialized expertise (Security, QA, Architecture) is required.
  • Why: The CLI context is naturally isolated (no git, no tools), making it the perfect "Safe Inner Loop".
该技能为
dual-loop
提供专业的内循环执行能力。
  • 编排方:
    agent-orchestrator
  • 适用场景: 当「通用编码」能力不足,需要安全、QA、架构等专业领域知识时。
  • 设计原因: CLI上下文天然隔离(无git、无工具访问权限),是理想的「安全内循环」。

Identity: The Sub-Agent Dispatcher 🎭

身份:子代理调度器 🎭

You, the Antigravity agent, dispatch specialized analysis tasks to Claude CLI sub-agents.
作为Antigravity agent,你可以将专业分析任务调度给Claude CLI子代理执行。

🛠️ Core Pattern

🛠️ 核心模式

bash
cat <PERSONA_PROMPT> | claude -p "<INSTRUCTION>" < <INPUT> > <OUTPUT>
bash
cat <PERSONA_PROMPT> | claude -p "<INSTRUCTION>" < <INPUT> > <OUTPUT>

⚠️ CLI Best Practices

⚠️ CLI最佳实践

1. Token Efficiency — PIPE, Don't Load

1. Token效率优化——用管道传输,不要直接加载

Bad — loads file into agent memory just to pass it:
python
content = read_file("large.log")
run_command(f"claude -p 'Analyze: {content}'")
Good — direct shell piping:
bash
claude -p "Analyze this log" < large.log > analysis.md
错误示例 — 将文件加载到代理内存再传递:
python
content = read_file("large.log")
run_command(f"claude -p 'Analyze: {content}'")
正确示例 — 直接使用Shell管道:
bash
claude -p "Analyze this log" < large.log > analysis.md

2. Self-Contained Prompts

2. 提示词自包含

The CLI runs in a separate context — no access to agent tools or memory.
  • Add: "Do NOT use tools. Do NOT search filesystem."
  • Ensure prompt + piped input contain 100% of necessary context
CLI运行在独立上下文中,无法访问代理的工具或内存。
  • 需添加提示: "Do NOT use tools. Do NOT search filesystem."
  • 确保提示词+管道输入包含100%的必要上下文信息

3. File Size & Permission Limitations

3. 文件大小与权限限制

  • The
    claude
    CLI will block reading massive files (e.g. 5MB+) natively via pipe or
    --file
    flag. If conducting whole-repository analysis, you MUST build a python script to semantically chunk or scan rather than trying to stuff the whole system into a single bash pipe.
  • Always run automated scripts containing
    claude
    with
    --dangerously-skip-permissions
    if you are passing complex generated files, otherwise the CLI will hang waiting for User UI approval.
  • Ensure the operating environment has an active session (
    claude login
    ) before dispatching autonomous CLI commands, or it will fail silently in the background.
  • claude
    CLI原生会阻止通过管道或
    --file
    参数读取超大文件(例如5MB以上)。如果要进行全仓库分析,你必须编写Python脚本进行语义分块或扫描,而不是尝试将整个系统内容塞进单个Bash管道中。
  • 如果你要传递复杂的生成文件,运行包含
    claude
    的自动化脚本时必须加上
    --dangerously-skip-permissions
    参数,否则CLI会挂起等待用户界面确认。
  • 在调度自动执行的CLI命令前,确保运行环境已激活会话(执行
    claude login
    ),否则命令会在后台静默失败。

4. Output to File

4. 输出到文件

Always redirect output to a file (
> output.md
), then review with
view_file
.
始终将输出重定向到文件(
> output.md
),之后使用
view_file
查看结果。

5. Severity-Stratified Constraints

5. 严重度分层约束

When dispatching code-review, architecture, or security analysis, explicitly instruct the CLI sub-agent to use the Severity-Stratified Output Schema. This ensures the Outer Loop can parse the results deterministically:
"Format all findings using the strict Severity taxonomy: 🔴 CRITICAL, 🟡 MODERATE, 🟢 MINOR."
调度代码评审、架构或安全分析任务时,明确指示CLI子代理使用严重度分层输出Schema,确保外循环可以确定性地解析结果:
"所有发现请严格按照以下严重度分类输出:🔴 CRITICAL, 🟡 MODERATE, 🟢 MINOR。"

🎭 Persona Categories

🎭 角色分类

CategoryPersonasUse For
Securitysecurity-auditorRed team, vulnerability scanning
Development14 personasBackend, frontend, React, Python, Go, etc.
Qualityarchitect-review, code-reviewer, qa-expert, test-automator, debuggerDesign validation, test planning
Data/AI8 personasML, data engineering, DB optimization
Infrastructure5 personasCloud, CI/CD, incident response
Businessproduct-managerProduct strategy
Specializationapi-documenter, documentation-expertTechnical writing
All personas in:
plugins/personas/
分类角色适用场景
安全security-auditor红队测试、漏洞扫描
开发14种角色后端、前端、React、Python、Go等
质量architect-review, code-reviewer, qa-expert, test-automator, debugger设计验证、测试规划
数据/AI8种角色机器学习、数据工程、数据库优化
基础设施5种角色云服务、CI/CD、事件响应
业务product-manager产品策略
专项api-documenter, documentation-expert技术写作
所有角色均存放在:
plugins/personas/

🔄 Recommended Audit Loop

🔄 推荐审计流程

  1. Red Team (Security Auditor) → find exploits
  2. Architect → validate design didn't add complexity
  3. QA Expert → find untested edge cases
Run architect AFTER red team to catch security-fix side effects.
  1. 红队(安全审计员)→ 发现可利用漏洞
  2. 架构师 → 验证设计没有增加复杂度
  3. QA专家 → 发现未覆盖的边缘测试用例
请在红队测试之后运行架构师评审,以捕获安全修复带来的副作用。