build-iterated-agentic-loop
humanlayer/skills · Agent Skill
建立一個本地技能儲存庫並設定相應的迭代編碼代理GitHub Actions工作流程、提示、記憶檔案和參考模板。
前往安裝 ↓總覽
| 發布者 | |
|---|---|
| 儲存庫 | humanlayer/skills ↗ |
| 技能資料夾 | build-iterated-agentic-loop |
| 星 | 5,466 |
| 分支 | 180 |
| 附帶檔案 | 9 |
| 授權 | MIT |
| 最近更新 | 2026年10月8日 |
| 連結 | 技能原始碼 ↗ · 儲存庫 ↗ |
Mozgi 檢查
我們在技能檔案中發現的內容。詳細資訊需訂閱。
安裝
技能就是一個含 SKILL.md 的資料夾。選擇你的代理,在專案根目錄的終端機(macOS、Linux 或 Windows 的 Git Bash)執行指令。
把提示貼到 Claude、Codex 或其他助理:它會自行檢查並安裝技能。
Install the “build-iterated-agentic-loop” skill from mozgi.io (https://mozgi.io/skills/humanlayer-build-iterated-agentic-loop/) for me. 1. Download the archive: https://mozgi.io/skills/humanlayer-build-iterated-agentic-loop/download If it fails, take the skill folder from the source: https://github.com/humanlayer/skills/tree/main/plugins/build-iterated-agentic-loop/skills/build-iterated-agentic-loop 2. Read SKILL.md and the other files. Check the skill is safe: no hidden commands, no sending data elsewhere, no scripts doing something other than described. If anything looks suspicious, stop and tell me. 3. Put the “build-iterated-agentic-loop” folder into your agent's skills folder: .claude/skills/ for Claude Code, .agents/skills/ for Codex, .cursor/skills/ for Cursor, .gemini/skills/ for Gemini CLI. Inside the project if we are in one, otherwise in the home folder (~/.claude/skills/ etc.). 4. Make sure <skills folder>/build-iterated-agentic-loop/SKILL.md exists. 5. Briefly tell me what this skill does and offer to try it on my task. If you cannot do a step yourself, tell me what to click or type.
git clone --depth 1 --branch main https://github.com/humanlayer/skills.git /tmp/skills mkdir -p .claude/skills cp -r /tmp/skills/plugins/build-iterated-agentic-loop/skills/build-iterated-agentic-loop .claude/skills/build-iterated-agentic-loop
重新啟動 Claude Code — 技能就會出現在清單中,手動呼叫:/build-iterated-agentic-loop。要套用到所有專案,請放在 ~/.claude/skills。
git clone --depth 1 --branch main https://github.com/humanlayer/skills.git /tmp/skills mkdir -p .agents/skills cp -r /tmp/skills/plugins/build-iterated-agentic-loop/skills/build-iterated-agentic-loop .agents/skills/build-iterated-agentic-loop
Codex 會從目前資料夾往上到儲存庫根目錄,在 .agents/skills 中尋找技能;用 /skills 或 $build-iterated-agentic-loop 呼叫。所有專案:~/.agents/skills。
git clone --depth 1 --branch main https://github.com/humanlayer/skills.git /tmp/skills mkdir -p .cursor/skills cp -r /tmp/skills/plugins/build-iterated-agentic-loop/skills/build-iterated-agentic-loop .cursor/skills/build-iterated-agentic-loop
Cursor 啟動時會載入技能;在 Agent 聊天輸入「/」呼叫。Cursor 也會讀取 .claude/skills 與 .agents/skills。所有專案:~/.cursor/skills。
git clone --depth 1 --branch main https://github.com/humanlayer/skills.git /tmp/skills mkdir -p .gemini/skills cp -r /tmp/skills/plugins/build-iterated-agentic-loop/skills/build-iterated-agentic-loop .gemini/skills/build-iterated-agentic-loop
任務符合時,Gemini CLI 會提議啟用技能,由你確認。所有專案:~/.gemini/skills。
安裝前請先檢視 SKILL.md 與相關檔案。點擊檔案即可預覽。
SKILL.md 內容
作者原文 · 唯讀Build Iterated Agentic Loop
Use this skill when the user wants to turn a repeatable agent task into a repo-local skill plus a GitHub Actions workflow that runs a coding agent on a schedule, manually, or both.
The target shape is an iterated agentic loop: a focused skill defines the agent's judgement, a workflow invokes a coding agent with a repo-specific prompt, an agent-memory file carries standing feedback between runs, and each workflow labels its PRs so only one open PR exists per loop. The narrow-react-prop-types skill is the concrete reference pattern.
Outputs
Create or update these files in the target repo:
.claude/skills/<skill-name>/SKILL.mdfor the repo-local agent behavior..github/workflows/agent-<task-name>.ymlfor the recurring coding-agent automation..github/agent-memory/<task-name>.mdfor stable feedback and scope constraints.- Optional references under
.claude/skills/<skill-name>/references/when the skill needs templates, examples, or long supporting material.
Workflow
1. Explore the target repo
Read before asking setup questions:
- Existing
.github/workflows/*.ymland.github/actions/**to understand runner, checkout, dependency install, cache, and PR patterns. - Package manager files such as
package.json,bun.lock,pnpm-lock.yaml,yarn.lock,package-lock.json,pyproject.toml,go.mod, orCargo.toml, or other package management-related files - Existing validation scripts, especially typecheck, lint, test, quality, format, and package-scoped commands.
- Existing
.claude/skillsand.agents/skillsto avoid duplicating conventions.
Completion criterion: you can name the repo's package manager, install command, likely validation commands, and existing workflow conventions.
2. Ask setup questions
Walk the user through these decisions. Recommend defaults from repo evidence instead of presenting a blank form.
1. Coding Agent: Claude Code, Codex, OpenCode, or CodeLayer. Explain the required secret and headless command for the recommended choice. Use references/agent-runner-templates.md. CodeLayer is Humanlayer's ultra-lightweight agent harness.
2. Cadence: daily, weekly, weekdays, monthly, manual-only, or custom cron. Recommend a cadence based on task risk and review burden - most likely weekdays, daily, or weekly.
3. Task: What task should the agent loop accomplish?
- Are there existing skills for doing this? (you can do research before asking the user this)
- Ask the user if you should look at recent PRs, git history, or other particular parts of the codebase for reference.
4. Scope: which directories/packages the loop may change and which it may only inspect
5. Validation: which commands must pass before the agent commits (You should propose this to the user based on your earlier research and ask them to confirm)
6. PR bounding: Ask if scheduled runs should no-op when open PRs from this agent already exist, and if so, how many open PRs to allow before blocking new runs.
- Recommended: Yes, bound to 1 open PR per agent loop. This prevents the agent from creating unbounded work that piles up faster than humans can review. Without bounding, a daily agent could generate 5+ unreviewed PRs in a week, creating review fatigue and merge conflicts.
- The workflow uses a label (e.g.,
agent-<task-slug>) to identify PRs from each agent loop. Scheduled runs checkgh pr list --label <label> --state openand skip if the count meets or exceeds the bound. - Manual
workflow_dispatchruns bypass the bound check, allowing forced runs when needed.
7. PR metadata: label name, PR title prefix, and branch prefix.
- Suggest
[MM/DD][Agent: <Agent Name>]: <Concise Description>as a template, e.g.[6/23][Agent: Effect Migrator]: Migrate XYZ module
8. Response format: How should the CI agent format its final response (which becomes the PR body)?
- Show the user
references/response-template.mdfor examples (fix/migration, generation, refactor). - Ask what information reviewers need: summary stats, risk levels, verification steps, file lists, etc.
- Create a customized response template that the generated skill will reference in its
references/directory
9. Iteration behavior: whether /iterate comments should update the existing PR.
- If enabled, install
references/agent-iteration.tsto the repo. Ask the user's preferred location:.github/scripts/,ci-scripts/, orscripts/. - The script has two modes:
footer(adds the PR body marker) andprompt(builds the iteration prompt from PR context). - If disabled, remove the
issue_commenttrigger and iteration-only steps from the workflow.
Completion criterion: every placeholder in the workflow, prompt, and memory template has a chosen value or an explicit default.
3. Define the agent job
Extract the smallest repeatable job the agent should perform. Work through these three questions with the user:
What are we finding? How does the agent identify targets for this run?
- A CLI tool that reports issues (e.g.,
bunx react-doctor,eslint --format json) - A search pattern (e.g., files matching
*.test.tswithout coverage, components using deprecated APIs) - A diff or changelog (e.g., new dependencies since last release, changed files in a PR)
- An old pattern that should be replaced with a new pattern or migrated to a new framework
- A flaky test based on previous CI runs
What are we changing? What transformation does the agent apply to each target?
- Fix: resolve a reported issue in place
- Migrate: update code from one pattern to another
- Generate: create new files based on existing sources
- Refactor: restructure without changing behavior
How do we validate? What proves the change is correct?
- Build/typecheck passes
- Tests pass (or a specific subset)
- The same tool that found the issue now reports it resolved
- Linting or formatting checks pass
Completion criterion: you can state the job in one sentence, e.g., "Find 5 react-doctor violations, fix them, and verify typecheck and quality pass."
4. Write the skill
Write a repo-local skill that captures the agent's judgement for this task. The skill can include repo-specific paths, package names, and conventions since it lives in this repository.
Use these skill-writing rules:
- Put ordered behavior in
SKILL.mdin the skill directory (.claude/skill-slug-hereor.agents/skill-slug-heredepending on repo patterns and user preferences) steps with checkable completion criteria - Move long templates and examples into sibling reference files, then point to them from
SKILL.md. - Keep one source of truth for each rule; do not repeat the same guidance in the skill, prompt, and memory file.
- Include a response template as a reference file (e.g.,
references/response-template.mdunder the skill directory) that defines how the CI agent should format its final output. The skill should instruct the agent to read and follow this template when formatting its final response which will be used as the PR body. - Use the skill template in
references/skill-template.md. An EXAMPLE skill can be found inreferences/example-skill.md - You may refer to https://agentskills.io/specification to understand skill specification.
IMPORTANT: the name field in the SKILL.md frontmatter must match the skill slug - e.g. a skill with name fix-eslint-issues must be in .claude/skills/fix-eslint-issues/SKILL.md or .agents/skills/fix-eslint-issues/SKILL.md
Completion criterion: the skill explains how to do the job clearly enough that the agent can follow it without additional prompting, including how to format the final response.
5. Write the workflow prompt
Put repo-specific targeting in the GitHub Actions prompt, not in the generic skill. Include:
Begin by using the <skill-name> skill.- Scope: directories/packages the agent may change and may inspect.
- Instructions: the reviewable unit of work, what to avoid, and how to validate.
- Validation commands in fenced bash if applicable
- Agent memory interpolation from
.github/agent-memory/<task-name>.md. - Finishing requirements: validate, commit, push, and return a PR-ready summary.
Use references/workflow-template.yml as the base template. Use references/prompt-template.md when drafting the embedded prompt.
Completion criterion: the prompt contains all repo-specific constraints needed for an unattended run.
6. Install the memory file
Create .github/agent-memory/<task-name>.md using references/memory-template.md as a starting point. The memory file carries standing feedback that should affect future runs. Keep it short.
Good memory entries:
- Permanent scope exclusions.
- Known false-positive areas.
- Review feedback that should change future agent selection.
Bad memory entries:
- One-off task instructions.
- Validation output from a single run.
- Rules already stated in the skill.
Completion criterion: deleting the memory file would lose useful future-run context, not just history.
7. Create the workflow
Create .github/workflows/agent-<task-name>.yml from references/workflow-template.yml and replace every placeholder.
Required customizations:
- Workflow name, cron, branch prefix, workflow id, agent label, PR title.
- Runner label and setup steps for the repo.
- Dependency install command.
- Coding-agent install, secret, and headless run command (from
references/agent-runner-templates.md). - Response extraction step: each agent outputs differently (JSON, stream-json, plain text). Use the agent-specific extraction from
references/agent-runner-templates.mdto get the final response into/tmp/pr-body.mdfor the PR body. - Skill name, scope, validation commands, and memory path.
- PR bounding gate: the workflow checks for open PRs with the agent label before running. Configure the bound based on the user's choice from step 2 (default: 1). The gate uses
gh pr list --label "$AGENT_LABEL" --state openand compares the count. If bounding is disabled, remove the gate step entirely. - If
/iterateis enabled: installreferences/agent-iteration.tsto the user's preferred location and update the workflow paths to match. The script handles both PR footer generation and iteration prompt building. This file can be run with the user's preferred typescript toolchain (node with type-stripping, Bun (recommended), Deno, tsx, etc) or can at the user's request be rewritten into another language.
If /iterate is disabled, remove the issue_comment trigger, the iteration-only steps, and skip installing agent-iteration.ts.
Completion criterion: the workflow can run from workflow_dispatch without relying on files that do not exist.
8. Validate and verify
Validate workflow YAML: Before committing, parse the workflow file to catch syntax errors early. Use one of:
# Node.js / bun (js-yaml)
bunx js-yaml .github/workflows/agent-<task-name>.yml > /dev/null && echo "Valid YAML"
# Python
python -c "import yaml; yaml.safe_load(open('.github/workflows/agent-<task-name>.yml'))"
# yq (if installed)
yq eval '.name' .github/workflows/agent-<task-name>.yml
If the parser fails, fix the YAML syntax before proceeding.
Verify references and paths: Check that every path named by the skill, workflow, and memory file exists or is intentionally created by this task.
Completion criterion: the workflow YAML parses without errors and all referenced files exist.
9. Dry-run the workflow
GitHub Actions workflows cannot be manually dispatched via workflow_dispatch until they have run at least once. To bootstrap the workflow:
1. Temporarily add a push trigger for the current branch (if not main):
```yaml
on:
push:
branches:
- <current-branch-name> # Remove after first run
schedule:
- cron: "0 13 * * *"
workflow_dispatch:
# ...
```
2. Commit and push all the new files (workflow, skill, memory file, scripts).
3. The workflow will trigger on push. Watch the Actions tab to verify it runs successfully.
4. After the first successful run, remove the temporary push trigger and push again. The workflow can now be dispatched manually via the Actions UI or gh workflow run.
5. If the dry-run creates a PR, review it to verify the agent behavior, then close or merge as appropriate.
Completion criterion: the workflow appears in the Actions tab and can be triggered via workflow_dispatch.
Reference Files
references/workflow-template.yml- coding-agent GitHub Actions workflow skeleton.references/agent-runner-templates.md- headless commands and secrets for Claude Code, Codex, OpenCode, and CodeLayer.references/agent-iteration.ts- helper script for/iteratesupport (PR footer and iteration prompt building). Install to.github/scripts/,ci-scripts/, orscripts/based on user preference.references/prompt-template.md- embedded prompt structure for the workflow.references/memory-template.md- agent-memory file skeleton.references/skill-template.md- skill skeleton for the generated task skill.references/response-template.md- examples for how the CI agent should format its final response (PR body).references/example-skill.md- example skill
常見問題
build-iterated-agentic-loop 技能有什麼用途?
建立一個本地技能儲存庫並設定相應的迭代編碼代理GitHub Actions工作流程、提示、記憶檔案和參考模板。
如何安裝 build-iterated-agentic-loop?
打開本頁的「安裝」區塊並選擇你的代理 — Claude Code、Codex、Cursor 或 Gemini CLI:那裡有把技能資料夾複製到正確位置的現成指令。也可以複製「透過助理」分頁中的提示,讓助理自行檢查並安裝技能。
build-iterated-agentic-loop 適用哪些 AI 模型?
技能是純 Markdown 指示(Agent Skills 格式),因此 build-iterated-agentic-loop 適用任何讀取 SKILL.md 的代理:Claude Code、Codex、Cursor、Gemini CLI、GitHub Copilot、OpenCode 等。只有在任務符合技能描述時,模型才會載入指示。
build-iterated-agentic-loop 是免費的嗎?
此技能由 humanlayer 公開發布,採用 MIT 授權。技能本身免費 — 你只需向 AI 供應商支付實際使用的 token 費用。
安裝技能安全嗎?
技能是代理會遵循的指示,安裝前請閱讀 SKILL.md 及相關檔案。技能資料夾中的腳本只有在代理執行時才會運行 — 留意它的動作,不要授予多餘權限。
技能和 MCP 伺服器或外掛有何不同?
MCP 伺服器或外掛為模型提供新工具 — 會執行並回傳結果的程式碼。技能提供的是知識與流程:如何處理任務、要遵循哪些步驟、好的成果長什麼樣子。它不需要伺服器或 API 金鑰。