跳到正文
Skillpedia
智能体280k · #266

autonomous-loops

它能做什么

这个工具可以帮你创建自动化工作流,让 AI 能够反复完成编程任务,而不需要你在每一步都介入。它提供了多种组织任务的方式,从简单的顺序执行,到由多个代理协同工作的复杂系统都有。

适用场景

  • ✓自动化重复性的代码开发任务。
  • ✓把一个编程项目拆分成若干个按顺序执行的小步骤。
  • ✓搭建持续的开发流水线,类似 CI/CD。

技能链接

https://github.com/affaan-m/ECC/blob/main/skills/autonomous-loops/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/affaan-m/ECC/blob/main/skills/autonomous-loops/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“帮我创建一个工作流:先实现一个新功能,然后测试它,最后清理代码。”

每周 5 个新技能,1 分钟读完。

工作原理

你需要定义一系列命令或步骤,让 AI 按顺序执行。每一步可以是一个具体任务,比如编写代码、测试或审查,AI 会依次执行它们。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Autonomous Loops Skill

Compatibility note (v1.8.0): autonomous-loops is retained for one release. The canonical skill name is now continuous-agent-loop. New loop guidance should be authored there, while this skill remains available to avoid breaking existing workflows.

Patterns, architectures, and reference implementations for running Claude Code autonomously in loops. Covers everything from simple claude -p pipelines to full RFC-driven multi-agent DAG orchestration.

When to Use

  • Setting up autonomous development workflows that run without human intervention
  • Choosing the right loop architecture for your problem (simple vs complex)
  • Building CI/CD-style continuous development pipelines
  • Running parallel agents with merge coordination
  • Implementing context persistence across loop iterations
  • Adding quality gates and cleanup passes to autonomous workflows

Loop Pattern Spectrum

From simplest to most sophisticated:

Pattern Complexity Best For
Sequential Pipeline Low Daily dev steps, scripted workflows
NanoClaw REPL Low Interactive persistent sessions
Infinite Agentic Loop Medium Parallel content generation, spec-driven work
Continuous Claude PR Loop Medium Multi-day iterative projects with CI gates
De-Sloppify Pattern Add-on Quality cleanup after any Implementer step
Ralphinho / RFC-Driven DAG High Large features, multi-unit parallel work with merge queue

1. Sequential Pipeline (claude -p)

The simplest loop. Break daily development into a sequence of non-interactive claude -p calls. Each call is a focused step with a clear prompt.

Core Insight

If you can't figure out a loop like this, it means you can't even drive the LLM to fix your code in interactive mode.

The claude -p flag runs Claude Code non-interactively with a prompt, exits when done. Chain calls to build a pipeline:

#!/bin/bash
# daily-dev.sh — Sequential pipeline for a feature branch

set -e

# Step 1: Implement the feature
claude -p "Read the spec in docs/auth-spec.md. Implement OAuth2 login in src/auth/. Write tests first (TDD). Do NOT create any new documentation files."

# Step 2: De-sloppify (cleanup pass)
claude -p "Review all files changed by the previous commit. Remove any unnecessary type tests, overly defensive checks, or testing of language features (e.g., testing that TypeScript generics work). Keep real business logic tests. Run the test suite after cleanup."

# Step 3: Verify
claude -p "Run the full build, lint, type check, and test suite. Fix any failures. Do not add new features."

# Step 4: Commit
claude -p "Create a conventional commit for all staged changes. Use 'feat: add OAuth2 login flow' as the message."

Key Design Principles

  1. Each step is isolated — A fresh context window per claude -p call means no context bleed between steps.
  2. Order matters — Steps execute sequentially. Each builds on the filesystem state left by the previous.
  3. Negative instructions are dangerous — Don't say "don't test type systems." Instead, add a separate cleanup step (see De-Sloppify Pattern).
  4. Exit codes propagate — set -e stops the pipeline on failure.

Variations

With model routing:

# Research with Opus (deep reasoning)
claude -p --model opus "Analyze the codebase architecture and write a plan for adding caching..."

# Implement with Sonnet (fast, capable)
claude -p "Implement the caching layer according to the plan in docs/caching-plan.md..."

# Review with Opus (thorough)
claude -p --model opus "Review all changes for security issues, race conditions, and edge cases..."

With environment context:

# Pass context via files, not prompt length
echo "Focus areas: auth module, API rate limiting" > .claude-context.md
claude -p "Read .claude-context.md for priorities. Work through them in order."
rm .claude-context.md

With --allowedTools restrictions:

# Read-only analysis pass
claude -p --allowedTools "Read,Grep,Glob" "Audit this codebase for security vulnerabilities..."

# Write-only implementation pass
claude -p --allowedTools "Read,Write,Edit,Bash" "Implement the fixes from security-audit.md..."

…
常见问题

不同的循环类型有什么区别?

循环的复杂程度各不相同。“顺序流水线”(Sequential Pipeline)就是一个简单的任务列表。“无限代理循环”(Infinite Agentic Loop)则会让多个代理并行工作,遵循更精细的计划。

每个步骤可以使用不同的 AI 模型吗?

可以。你可以根据工作流中每一步的复杂度或任务类型,配置使用不同的模型,比如 Opus 或 Sonnet。

如果某一步失败了会怎样?

如果系统设置正确(使用了 `set -e`),一旦某一步失败,整个任务序列就会停止,避免后续步骤在出错的情况下继续运行。

详情

作者的原始描述

Patterns and architectures for autonomous Claude Code loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems. Retained for compatibility only: when new autonomous loop guidance is needed, use continuous-agent-loop instead.

repo: affaan-m/ECC

热度

GitHub 星标
280k
排名
#266
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能