From ftitos-claude-code
Patterns and architectures for autonomous Claude Code loops -- from simple sequential pipelines to RFC-driven multi-agent DAG systems.
npx claudepluginhub nassimbf/ftitos-claude-codeThis skill uses the workspace's default tool permissions.
Patterns, architectures, and reference implementations for running Claude Code autonomously in loops.
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Patterns, architectures, and reference implementations for running Claude Code autonomously in loops.
| Pattern | Complexity | Best For |
|---|---|---|
| Sequential Pipeline | Low | Daily dev steps, scripted workflows |
| Infinite Agentic Loop | Medium | Parallel content generation, spec-driven work |
| Continuous PR Loop | Medium | Multi-day iterative projects with CI gates |
| De-Sloppify Pattern | Add-on | Quality cleanup after any Implementer step |
| RFC-Driven DAG | High | Large features, multi-unit parallel work |
claude -p)Break daily development into a sequence of non-interactive claude -p calls:
#!/bin/bash
set -e
# Step 1: Implement the feature
claude -p "Read the spec. Implement the feature with TDD."
# Step 2: Cleanup pass
claude -p "Review changes. Remove unnecessary checks, test slop, debug statements."
# Step 3: Verify
claude -p "Run build + lint + tests. Fix any failures."
# Step 4: Commit
claude -p "Create a conventional commit for all staged changes."
set -e stops the pipeline on failureclaude -p --model opus "Analyze architecture and write plan..."
claude -p "Implement according to plan..."
claude -p --model opus "Review all changes for security issues..."
A two-prompt system that orchestrates parallel sub-agents for specification-driven generation:
Don't rely on agents to self-differentiate. The orchestrator assigns each agent a specific creative direction and iteration number.
A shell script that runs Claude Code in a continuous loop, creating PRs, waiting for CI, and merging automatically:
1. Create branch (continuous-claude/iteration-N)
2. Run claude -p with enhanced prompt
3. (Optional) Reviewer pass
4. Commit changes
5. Push + create PR
6. Wait for CI checks
7. CI failure? -> Auto-fix pass
8. Merge PR
9. Return to main -> repeat
A SHARED_TASK_NOTES.md file persists across iterations, bridging the context gap between independent claude -p invocations.
Claude can signal "I'm done" by outputting a magic phrase. Three consecutive iterations signaling completion stops the loop.
An add-on for any loop. Add a dedicated cleanup step after each Implementer step:
# Step 1: Implement (let it be thorough)
claude -p "Implement the feature with full TDD."
# Step 2: De-sloppify (separate context, focused cleanup)
claude -p "Review all changes. Remove test slop, redundant checks, debug statements. Keep business logic tests. Run test suite after cleanup."
Key Insight: Rather than adding negative instructions which have downstream quality effects, add a separate cleanup pass. Two focused agents outperform one constrained agent.
The most sophisticated pattern. An RFC-driven, multi-agent pipeline:
| Tier | Pipeline Stages |
|---|---|
| trivial | implement -> test |
| small | implement -> test -> code-review |
| medium | research -> plan -> implement -> test -> review -> fix |
| large | research -> plan -> implement -> test -> review -> fix -> final-review |
Is the task a single focused change?
+-- Yes -> Sequential Pipeline
+-- No -> Is there a written spec/RFC?
+-- Yes -> Need parallel implementation?
| +-- Yes -> RFC-Driven DAG
| +-- No -> Continuous PR Loop
+-- No -> Need many variations?
+-- Yes -> Infinite Agentic Loop
+-- No -> Sequential Pipeline + De-Sloppify