brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
build-iterated-agentic-loopbuild a repo-local skill and install a matching iterated coding-agent GitHub Actions workflow, prompt, memory file, and reference templates
Independent GitHub snapshot · Automated classification · Original documentation governs
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.
Create or update these files in the target repo:
.claude/skills/<skill-name>/SKILL.md for the repo-local agent behavior..github/workflows/agent-<task-name>.yml for the recurring coding-agent automation..github/agent-memory/<task-name>.md for stable feedback and scope constraints..claude/skills/<skill-name>/references/ when the skill needs templates, examples, or long supporting material.Read before asking setup questions:
.github/workflows/*.yml and .github/actions/** to understand runner, checkout, dependency install, cache, and PR patterns.package.json, bun.lock, pnpm-lock.yaml, yarn.lock, package-lock.json, pyproject.toml, go.mod, or Cargo.toml, or other package management-related files.claude/skills and .agents/skills to avoid duplicating conventions.Completion criterion: you can name the repo's package manager, install command, likely validation commands, and existing workflow conventions.
Walk the user through these decisions. Recommend defaults from repo evidence instead of presenting a blank form.
references/agent-runner-templates.md. CodeLayer is Humanlayer's ultra-lightweight agent harness.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.workflow_dispatch runs bypass the bound check, allowing forced runs when needed.[MM/DD][Agent: <Agent Name>]: <Concise Description> as a template, e.g. [6/23][Agent: Effect Migrator]: Migrate XYZ modulereferences/response-template.md for examples (fix/migration, generation, refactor).references/ directory/iterate comments should update the existing PR.references/agent-iteration.ts to the repo. Ask the user's preferred location: .github/scripts/, ci-scripts/, or scripts/.footer (adds the PR body marker) and prompt (builds the iteration prompt from PR context).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.
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?
bunx react-doctor, eslint --format json)*.test.ts without coverage, components using deprecated APIs)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."
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:
SKILL.md in the skill directory (.claude/skill-slug-here or .agents/skill-slug-here depending on repo patterns and user preferences) steps with checkable completion criteriaSKILL.md.references/response-template.md under 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.references/skill-template.md. An EXAMPLE skill can be found in references/example-skill.mdIMPORTANT: 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.
Put repo-specific targeting in the GitHub Actions prompt, not in the generic skill. Include:
Begin by using the <skill-name> skill..github/agent-memory/<task-name>.md.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.
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.
Create .github/workflows/agent-<task-name>.yml from references/workflow-template.yml and replace every placeholder.
Required customizations:
references/agent-runner-templates.md).references/agent-runner-templates.md to get the final response into /tmp/pr-body.md for the PR body.gh pr list --label "$AGENT_LABEL" --state open and compares the count. If bounding is disabled, remove the gate step entirely./iterate is enabled: install references/agent-iteration.ts to 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.
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.
GitHub Actions workflows cannot be manually dispatched via workflow_dispatch until they have run at least once. To bootstrap the workflow:
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:
# ...
Commit and push all the new files (workflow, skill, memory file, scripts).
The workflow will trigger on push. Watch the Actions tab to verify it runs successfully.
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.
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.
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 /iterate support (PR footer and iteration prompt building). Install to .github/scripts/, ci-scripts/, or scripts/ 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