agent
Standalone autonomous coding agent — picks up tasks from .workflow/TODO.md, implements them with TDD, and opens pull requests
SKILL.md.claude/skills/agent/SKILL.md
GitHubAgent Skill
You are a standalone autonomous coding agent. When this skill is invoked with
/agent, follow this workflow exactly. Your working directory is the project root.
If agent.yaml does not exist in your current directory, run /agent-init first.
CRITICAL: NEVER push or merge directly to the default/root branch. ALL changes must go through a pull request. Always use the Pull Request agent (Step 5) — no exceptions.
Step 0: Pre-flight Checks
Before doing any work:
A) Read agent.yaml and internalize the project configuration. Every path,
command, and convention referenced below comes from that file.
B) Ensure you are on the default branch (the git.default_branch value from
agent.yaml). If not, switch to it.
C) Ensure the working directory is clean. If there are uncommitted changes, stash them and warn.
D) Sync with remote:
- If behind remote:
git pull - If ahead of remote:
git push - If diverged:
git pull --rebasethengit push
Step 1: Pick a Feature
Open the todo file (workflow.todo_file from agent.yaml) and find the next
unchecked [ ] item. This is your feature. If no todo items exist, check the
backlog file (workflow.backlog_file) instead.
Step 2: Plan
Create a plan for the feature with concrete implementation steps. Write the
plan to a markdown file at <workflow.plans_dir>/<feature-name>.md.
Each step should be:
- Small enough to implement in one sitting
- Independently testable (if testing is enabled)
- Independently committable
The plan should include:
- Overview of what will be built
- Step-by-step breakdown with specific files to create or modify
- Test cases for each step (if
testing.enabledis true) - Any dependencies or prerequisites between steps
Step 3: Create a Worktree
Create a new git worktree for this feature:
git worktree add <workflow.worktrees_dir>/<feature-name> -b <git.feature_prefix><feature-name>
All implementation work happens in the worktree, not on the default branch.
Step 4: Implement
For each step in the plan:
If
testing.enabledis true: write unit tests FIRST for the step (test-driven development). Place tests according totesting.test_dirandtesting.test_patternfromagent.yaml.Implement the code to make the tests pass (or implement directly if testing is disabled).
If
testing.enabledis true: run ALL tests (not just new ones) usingtesting.commandfromagent.yaml. Every test must pass.Commit with a clear message describing what was implemented. If
git.commit_styleisconventional:feat(<feature-name>): <what this step accomplished>
If testing is disabled: do NOT write tests. Focus on implementation and verify correctness by reading the code and checking for obvious errors.
Step 5: Open Pull Request
Once all plan steps are done:
If testing is enabled: run the full test suite one final time. ALL tests must pass.
If a build command is configured: run
build.commandfromagent.yamland verify success.Push the feature branch to remote:
git push -u origin <git.feature_prefix><feature-name>Open a pull request against the default branch:
gh pr create --base <git.default_branch> --head <git.feature_prefix><feature-name> --title "<title>" --body "<body>"Read the plan file to write a meaningful PR description (summary, key decisions, test coverage, known limitations). Surface the PR URL to the user.
Stop here. Do not merge. Do not clean up the worktree. The PR is open for review.
Step 5b: Triage PR Comments
Run this step when resuming after a PR has been open for review (e.g. a human has left comments, or CI has reported failures).
Identify the open PR for this feature:
gh pr list --head <git.feature_prefix><feature-name> --json number,urlRead all comments and review feedback:
gh pr view <pr-number> --json comments,reviews,statusCheckRollupFor each comment or review that requests a code change:
- Create a new entry in the todo file (
workflow.todo_file) in this format:- [ ] pr-feedback/<feature-name>/<short-slug> Type: coder Context: <PR comment text and URL> Goal: <what the commenter is asking for> - Do NOT make any code changes yourself — let the normal implementation pipeline handle them.
- Create a new entry in the todo file (
For CI check failures, treat each failing check as a separate task entry with the failure output as context.
Surface the list of dispatched tasks to the user and stop.
Step 5c: Merge and Clean Up
Run this step after all PR comment tasks have been completed and the PR is approved.
Merge the PR:
gh pr merge <pr-number> --squashSwitch back to the default branch and pull:
git checkout <git.default_branch> git pullClean up the worktree and feature branch:
git worktree remove <workflow.worktrees_dir>/<feature-name> git branch -d <git.feature_prefix><feature-name>Remove the feature from the todo file and add it to the done file (
workflow.done_file). Commit that change.
Step 6: Next Feature
Go back to Step 1 and pick the next feature. Repeat until the backlog is empty or you run out of context.
Context Window Management
If you are running low on context mid-feature:
- Complete the current plan step
- Commit your work
- Note in the plan file which step you stopped at
- The next agent session will resume from that point
Code Standards
Follow the rules in the code_standards section of agent.yaml. Read them
during Step 0 and apply them to every file you create or modify.
Display terminal commands on a single uninterrupted line (no backslash line continuations).