From alfred-agent
Feature development workflow: pick up an issue, write code with tests, create PR, merge. Use when the user says "work on issue #X", "implement this", "pick up the next issue", "start developing", or when you need to make code changes that should go through a PR. This is the standard development procedure for all code changes in devbox environments.
How this skill is triggered — by the user, by Claude, or both
Slash command
/alfred-agent:developThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Standard workflow for implementing features in a devbox. Every code change follows this flow.
Standard workflow for implementing features in a devbox. Every code change follows this flow.
gh issue view {N}Role-switching modes: Some devboxes (e.g., project-manager) have multiple roles and the
switch-rolecommand installed. Most projects use a single-role devbox whereswitch-roleis not installed. To detect which mode applies:command -v switch-role >/dev/null 2>&1 && echo "multi-role" || echo "single-role"
- Multi-role devbox (e.g., project-manager):
switch-roleis installed; run role-switch commands as shown.- Single-role devbox (most projects):
switch-roleis not installed; skip role-switch steps and use the same token throughout.
If multi-role devbox (switch-role is installed):
switch-role build
git checkout main && git pull
git checkout -b feature/issue-{N}-{short-description}
If single-role devbox (switch-role is not installed — skip the role switch):
git checkout main && git pull
git checkout -b feature/issue-{N}-{short-description}
This is a single-role devbox — switch-role is not installed. Use the same token throughout.
Always branch from up-to-date main. Use feature/ prefix for new work, fix/ for bug fixes.
Before writing implementation code, write a test that describes the expected behavior.
Why tests first: Tests define what "done" looks like. Writing them first prevents implementing the wrong thing and ensures every feature has coverage. An untested feature is an unfinished feature.
Practical approach:
Run the test — it should fail (the feature doesn't exist yet):
npm test
Write the minimum code to make the test pass. Then:
npm test # All tests pass
npm run build # TypeScript compiles clean
If the feature needs multiple parts, iterate: test → implement → test → implement.
Use the /commit skill or follow commit conventions:
git add -A)git push -u origin feature/issue-{N}-{short-description}
gh pr create --title "{short title}" --body "Closes #{N}
## Changes
- {what changed}
## Testing
- {what was tested}"
Verify CI status before proceeding. After the PR is created, wait for CI to complete and query the result directly:
gh pr checks {PR} # quick per-check status view
gh run view {run-id} --log-failed # detail on a failed run
Never infer CI status from the diff. Phrases like "the change is small," "nothing could fail," "one-line fix," or "shouldn't be affected" are not substitutes for a check-status query. Always call gh pr checks and report what the tool returns.
If an API call appears unavailable, attempt it before claiming so. "Not visible in this context" is never an acceptable first-pass claim — try the call, report the actual error. The GitHub App token that authored the PR can read the PR's checks.
If CI is green, proceed to Step 7. If any check reports FAILURE / CANCELLED / TIMED_OUT, see Step 6.5.
Red CI blocks merge-ready, no exceptions. A PR with a failing check is not merge-ready regardless of merge-conflict status, diff size, or how unrelated the failure "seems." A mergeable-per-git PR with red CI is still not mergeable.
Your options when CI is red:
gh run view {run-id} --log-failed shows the actual failure — read it fully before deciding what to change.Never merge on red CI. Never declare the PR ready to merge while CI is red.
Scaffold-generated files (.github/workflows/*.yaml, k8s/base/*.yaml, Dockerfile, files with a .hbs template origin) encode intent that isn't obvious from a single failing line. Before editing, you MUST:
project-manager or a platform-owned repo). Fixing the template benefits every future scaffold; fixing only the local copy hides the bug. Apply a narrow local workaround only when urgent, and label it as a workaround referencing the upstream issue.Observed failure in CI:
ERROR: unauthorized: unauthenticated: User cannot be authenticated with the token provided.
at: pushing ghcr.io/<org>/<project>:pr-<N>-<SHA>
A diff-level / pattern-match reading of the error leads to this wrong fix:
- push: true
+ push: ${{ github.event_name != 'pull_request' }}
CI goes green — the push is skipped on PR events, no auth error. But the full workflow shows:
- name: Extract metadata
uses: docker/metadata-action@v5
with:
tags: |
type=ref,event=pr,prefix=pr-,suffix=-${{ github.event.pull_request.head.sha }}
The metadata step explicitly emits pr-<N>-<SHA> tags for PR events. Why? Because the platform's preview-environments ApplicationSet consumes those tags to spin up per-PR preview deployments. Gating push on non-PR means the preview Application has nothing to pull — no preview environment, no pre-merge validation. The symptom is hidden; the feature is broken silently.
The right fix reads the whole workflow first and preserves the feature:
- name: Log in to GHCR
- if: github.event_name != 'pull_request'
uses: docker/login-action@v3
The push on PR events is intended; the login conditional is the bug. Ungating the login lets the push succeed.
And since this file was scaffold-generated (from project-manager/templates/web-app/repo/.github/workflows/ci.yaml.hbs), the upstream bug gets filed too — every future project inherits the fix, not just this one.
Merge only if CI is green. Role-switching is conditional on devbox mode (see Step 2 for detection):
If multi-role devbox (switch-role is installed — switch to lead role to merge):
switch-role lead
gh pr merge --squash
If single-role devbox (switch-role is not installed — merge with the current token):
gh pr merge --squash
If CI is red, go back to Step 6.5. Never merge on red CI — no exceptions, regardless of urgency, diff size, or how confident you are the failure is unrelated.
Then clean up:
If multi-role devbox:
switch-role build
git checkout main && git pull
git branch -d feature/issue-{N}-{short-description}
If single-role devbox:
git checkout main && git pull
git branch -d feature/issue-{N}-{short-description}
npm run build clean before PR.switch-role is installed, never merge with the same role that created the PR. In single-role devboxes, use the same token throughout — this rule does not apply.switch-role build (or lead) to refresh. Try this first when git auth fails. In single-role devboxes, re-authenticate via the platform's normal token refresh path.gh pr checks {PR} before claiming a PR is merge-ready. NEVER reason from diff size, change complexity, or author intuition to CI outcome.docker run the image with the modified script bind-mounted, (b) execute the script directly in a shell with the right env vars and mounts, (c) kubectl apply a one-off pod manifest with the change inline. The full CI → image build → Image Updater → ArgoCD sync cycle takes ~10 minutes per iteration. A single local repro catches the same class of bugs without that latency. If you have already pushed a fix and the new pod fails, re-run locally before pushing the second attempt — do not iterate through CI more than once on the same fix.Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub screenfields/alfred-cc-tools --plugin alfred-agent