Token导航 LogoToken导航

Agent Skill · 研究检索

coding-agent-patterns(编码 Agent 模式)

coding-agent-patterns 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

coding-agent-patterns 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 65,612。

总安装 279周安装 12GitHub Stars 2下载 98核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:coding-agent-patterns(编码 Agent 模式)
来源仓库:https://github.com/cycleuser/skills
仓库路径:skills/coding-agent-patterns
安装命令:
npx skills add https://github.com/cycleuser/skills --skill coding-agent-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cycleuser/skills --skill coding-agent-patterns

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

coding-agent-patterns 提炼自主流 AI 编码 Agent 的实践模式,帮助优化任务拆解、工具调用与上下文管理流程。适用于构建可扩展的 Agent 架构,提升代码生成、调试与协作效率,尤其适合复杂项目或多步推理场景。基于核心循环:询问是否需要工具 → 执行 → 反馈结果 → 重复,直至任务完成。

建议结合具体宿主环境测试工具兼容性,注意权限边界与潜在副作用,避免未经授权的文件操作或网络请求。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/coding-agent-patterns

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/cycleuser/skills --skill coding-agent-patterns;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

coding-agent-patterns 怎么安装?

在终端执行 npx skills add https://github.com/cycleuser/skills --skill coding-agent-patterns。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

coding-agent-patterns 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

coding-agent-patterns 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/cycleuser/skills --skill coding-agent-patterns 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

coding-agent-patterns 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

coding-agent-patterns 用的人多吗?

公开数据是累计安装 279 次,近一周安装 12 次,下载 98 次,GitHub 2 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

coding-agent-patterns 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
coding-agent-patterns

编码 Agent 模式 · 本页

2792执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Coding Agent Development Patterns

Core patterns distilled from Claude Code (70k stars), Codex (62k), Cline (58k), Aider (41k), and OpenCode (114k).

The Core Loop: while(true)

All AI coding agents share the same fundamental loop. The loop follows the pattern: ask LLM if it needs tools, use them, feed results back, and repeat until done. The implementation builds context with tools and conversation history, calls the LLM with messages and tool definitions, checks for tool calls and returns content if none, executes tools and appends results to history, then loops back with tool results.

Core Tools: All agents have six fundamental tools. The read tool reads file contents. The write tool creates or overwrites files. The edit tool performs precise string replacement in files. The bash tool executes shell commands. The glob tool finds files by pattern. The grep tool searches file contents. A minimal viable agent requires approximately 1000-2000 lines with these six tools plus the loop.

Challenge 1: Context Window Management

The biggest engineering challenge. A real project has thousands of files, but LLMs have limited context (128K - 2M tokens).

Strategies: Different agents use different strategies. Aider uses Repo Map with tree-sitter scanning that only passes signatures and loads details on demand. Claude Code uses Auto-compaction where the LLM summarizes history when context fills. OpenCode uses a two-level approach that prunes old tool results (keeping 40K recent) and then compresses.

Compression Pattern

def compress_context(history: list, budget: int) -> list:
    """Compress history when approaching context limit."""
    usage = count_tokens(history)

    if usage < budget * 0.8:
        return history

    # Keep recent turns, summarize older ones
    recent = history[-10:]  # Last 10 turns
    older = history[:-10]

    summary = llm.summarize(older)
    return [{"role": "system", "content": f"Previous context summary:\n{summary}"}] + recent

Repo Map Pattern (Aider)

def build_repo_map(repo_path: Path) -> str:
    """Build a 'map' of the codebase with just signatures."""
    import tree_sitter

    map_lines = []
    for file in repo_path.rglob("*.py"):
        # Parse and extract: class names, function signatures, imports
        signatures = extract_signatures(file)
        map_lines.append(f"{file}:\n{signatures}")

    return "\n".join(map_lines)  # Much smaller than full code

Challenge 2: Tool Execution Safety

Three Safety Models

Three safety models represent different trade-offs. The hard sandbox model used by Codex (Rust) provides maximum safety with OS-level isolation. The per-step approval model used by Cline is safe but tedious due to too many popups. The tiered plus hooks model used by Claude Code provides balance with read/write/execute tiers.

Sandboxing (Codex/Rust approach)

// Use landlock + seccomp for OS-level sandboxing
fn sandbox_restrict(allowed_paths: &[PathBuf]) -> Result<()> {
    // Limit file access to allowed paths
    // Block dangerous syscalls
    // Three modes: suggest-only, auto-edit, full-auto
}

Tiered Tools (Claude Code approach)

TOOL_TIERS = {
    "read": "safe",       # No approval needed
    "write": "needs_approval",  # User confirms
    "bash": "restricted", # Blacklist + approval
}

def execute_tool(name: str, args: dict) -> Result:
    tier = TOOL_TIERS.get(name, "safe")

    if tier == "needs_approval":
        if not user_approves(name, args):
            return Result(cancelled=True)

    if tier == "restricted":
        if is_dangerous(args):
            return Result(error="Command blocked")

    return run_tool(name, args)

Doom Loop Detection (OpenCode unique feature)

def detect_doom_loop(history: list) -> bool:
    """Detect if agent is stuck repeating the same action."""
    if len(history) < 3:
        return False

    last_three = history[-3:]
    # Check if same tool called 3 times with identical args
    if all_same_tool_and_args(last_three):
        return True  # Pause and ask user

    return False

Challenge 3: Multi-Provider Abstraction

Each LLM provider has different APIs for message formats, tool calling, and streaming. OpenAI uses content: string with function_call for tools. Anthropic uses content: blocks[] with tool_use for tools. Google uses parts[] with function_call for tools. Ollama is OpenAI-compatible.

Two approaches exist for multi-provider abstraction. OpenCode uses the Vercel AI SDK which provides free abstraction for over 20 providers. Cline uses manual adapters which supports 44 providers with full control.

Unified Client Pattern

class BaseLLMClient(ABC):
    @abstractmethod
    def chat(self, messages: list, tools: list) -> Response: ...

    @abstractmethod
    def chat_stream(self, messages: list, tools: list) -> Iterator[Chunk]: ...

class OpenAIClient(BaseLLMClient):
    def chat(self, messages, tools):
        return self.client.chat.completions.create(
            model=self.model, messages=messages, tools=tools
        )

class AnthropicClient(BaseLLMClient):
    def chat(self, messages, tools):
        return self.client.messages.create(
            model=self.model, messages=messages, tools=tools
        )

def get_client(provider: str, model: str) -> BaseLLMClient:
    clients = {
        "openai": OpenAIClient,
        "anthropic": AnthropicClient,
        "ollama": OllamaClient,
    }
    return clients[provider](model)

Challenge 4: Error Recovery

Long execution chains fail often: API limits, expired keys, network, context overflow.

Layered Retry Pattern

async def agent_loop_with_retry(max_retries: int = 32):
    for attempt in range(max_retries):
        try:
            return await agent_loop()
        except RateLimitError:
            await sleep(60 * (2 ** attempt))  # Exponential backoff
        except AuthError:
            rotate_api_key()  # Inner retry
        except ContextOverflowError:
            compress_context()  # Middle retry
        except NetworkError:
            continue  # Immediate retry
        except FatalError:
            rebuild_session()  # Outer retry

Challenge 5: Session Persistence

Different agents use different storage approaches. OpenCode uses SQLite which provides ACID guarantees and no corruption on crash. Other agents use JSONL which is simple and human-readable.

JSONL Pattern

def save_session(session_id: str, event: dict):
    """Append event to session log file."""
    log_file = Path.home() / ".agent" / "sessions" / f"{session_id}.jsonl"
    with open(log_file, "a") as f:
        f.write(json.dumps(event) + "\n")

def load_session(session_id: str) -> list:
    """Load all events from session."""
    log_file = Path.home() / ".agent" / "sessions" / f"{session_id}.jsonl"
    events = []
    with open(log_file) as f:
        for line in f:
            events.append(json.loads(line))
    return events

Shadow Git Pattern (Cline unique)

def init_shadow_git(project_path: Path):
    """Create hidden git repo for undo history."""
    shadow_path = project_path / ".agent-shadow-git"
    run(["git", "init"], cwd=shadow_path)

def snapshot_after_tool(shadow_path: Path):
    """Auto-commit after each tool execution."""
    run(["git", "add", "-A"], cwd=shadow_path)
    run(["git", "commit", "-m", "snapshot"], cwd=shadow_path)

def undo_to_snapshot(shadow_path: Path, commit_hash: str):
    """Restore to any previous state."""
    run(["git", "checkout", commit_hash], cwd=shadow_path)

Memory Systems

Project Rules Loading

Different agents use different approaches for loading project rules. Claude Code uses CLAUDE.md plus .claude/rules/ directory with auto-memory and per-file-type rules. OpenCode uses .opencode/skills/ plus agents directory with on-demand skill loading and markdown agents. Cline uses .clinerules with 7 lifecycle hooks. Aider uses CONVENTIONS.md with simple /read loading. Codex uses AGENTS.md plus Skills for deterministic workflows.

Skill System Pattern (OpenCode)

.opencode/
├── skills/
│   ├── git-release/
│   │   └── SKILL.md
│   └── code-review/
│       └── SKILL.md
└── agents/
    └── reviewer.md   # Specialized agent definition
<!-- .opencode/agents/reviewer.md -->
---
description: Code review agent, read-only
mode: subagent
tools:
  write: false
  edit: false
---
You are a code review expert. Analyze code, suggest improvements, never modify files.

Auto-Memory Pattern (Claude Code)

def learn_from_correction(user_feedback: str, context: dict):
    """Store user corrections for future reference."""
    memory_file = Path.home() / ".claude" / "auto_memory.json"

    memories = json.loads(memory_file.read_text())
    memories.append({
        "feedback": user_feedback,
        "context": context,
        "timestamp": datetime.now().isoformat(),
    })

    memory_file.write_text(json.dumps(memories, indent=2))

def build_system_prompt() -> str:
    """Include learned preferences in system prompt."""
    memory_file = Path.home() / ".claude" / "auto_memory.json"
    if memory_file.exists():
        memories = json.loads(memory_file.read_text())
        return f"User preferences:\n{format_memories(memories)}"
    return ""

Rules

Key Takeaways

Five key principles guide agent development. First, start with the loop by writing the while(true) first and getting tool calling working. Second, implement context management early since this is the number one cause of agent failures. Third, provider abstraction matters because locking into one LLM vendor creates vendor lock-in. Fourth, layer safety with sandbox plus approval plus detection. Fifth, recognize that memory equals context since rules are injected into prompts rather than being separate config.

平台分布

Codex

34.38%
按下载量换算34

Claude

30.19%
按下载量换算30

Cursor

20.35%
按下载量换算20

Gemini CLI

10.13%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/cycleuser/skills --skill coding-agent-patterns 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills