build-iterated-agentic-loop

人工智能 / Agent Agent 与技能管理 9 文件 EN 原文 1 脚本

build a repo-local skill and install a matching

build a repo-local skill and install a matching iterated coding-agent GitHub Actions workflow, prompt, memory file, and reference templates

说明语言:英文

来源humanlayerskills ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/humanlayer/skills --skill build-iterated-agentic-loop

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: build-iterated-agentic-loop description: build a repo-local skill and install a matching iterated coding-agent GitHub Actions workflow, prompt, memory file, and reference templates ---

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:

Workflow

1. Explore the target repo

Read before asking setup questions:

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?
  4. Are there existing skills for doing this? (you can do research before asking the user this)
  5. Ask the user if you should look at recent PRs, git history, or other particular parts of the codebase for reference.
  6. Scope: which directories/packages the loop may change and which it may only inspect
  7. 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)
  8. 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.
  9. 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.
  10. The workflow uses a label (e.g., agent-<task-slug>) to identify PRs from each agent loop. Scheduled runs check gh pr list --label <label> --state open and skip if the count meets or exceeds the bound.
  11. Manual workflow_dispatch runs bypass the bound check, allowing forced runs when needed.
  12. PR metadata: label name, PR title prefix, and branch prefix.
  13. Suggest [MM/DD][Agent: <Agent Name>]: <Concise Description> as a template, e.g. [6/23][Agent: Effect Migrator]: Migrate XYZ module
  14. Response format: How should the CI agent format its final response (which becomes the PR body)?
  15. Show the user references/response-template.md for examples (fix/migration, generation, refactor).
  16. Ask what information reviewers need: summary stats, risk levels, verification steps, file lists, etc.
  17. Create a customized response template that the generated skill will reference in its references/ directory
  18. Iteration behavior: whether /iterate comments should update the existing PR.
  19. If enabled, install references/agent-iteration.ts to the repo. Ask the user's preferred location: .github/scripts/, ci-scripts/, or scripts/.
  20. The script has two modes: footer (adds the PR body marker) and prompt (builds the iteration prompt from PR context).
  21. If disabled, remove the issue_comment trigger 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?

What are we changing? What transformation does the agent apply to each target?

How do we validate? What proves the change is correct?

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:

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:

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:

Bad memory entries:

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:

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):
   on:
     push:
       branches:
         - <current-branch-name>  # Remove after first run
     schedule:
       - cron: "0 13 * * *"
     workflow_dispatch:
       # ...
  1. Commit and push all the new files (workflow, skill, memory file, scripts).
  1. The workflow will trigger on push. Watch the Actions tab to verify it runs successfully.
  1. 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.
  1. 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

同类技能
add-new-opc-skillagent-architectureagent-browseragent-governanceagent-owasp-complianceagent-skill-stackagent-supply-chainagentcore
本页内容来自开源项目 humanlayer, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。