بنقرة واحدة
implement-feature
Self-evaluating agentic workflow: plan → validate → implement with blocker handling → learn
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Self-evaluating agentic workflow: plan → validate → implement with blocker handling → learn
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | implement-feature |
| description | Self-evaluating agentic workflow: plan → validate → implement with blocker handling → learn |
| argument-hint | <issue-number> |
| disable-model-invocation | true |
| allowed-tools | Read, Grep, Glob, Write, Edit, Bash(git *), Bash(gh *), Bash(just *), Bash(uv run *), CronCreate, CronDelete, CronList, ToolSearch |
Implement story for GitHub issue #$ARGUMENTS using the self-evaluating agentic loop.
Read the story from .meta/:
# Find story file by issue number
STORY_FILE=$(grep -rl "issue_number: $ARGUMENTS" .meta/stories/ .meta/epics/*/stories/ 2>/dev/null | head -1)
cat "$STORY_FILE"
Verify epic lock — if this story belongs to an epic, the epic MUST have status: in_progress
(meaning the lock PR was already merged). If the epic is not locked, HALT and report:
# Check parent epic lock status
EPIC_DIR=$(dirname "$(dirname "$STORY_FILE")")
EPIC_FILE="$EPIC_DIR/epic.md"
if [ -f "$EPIC_FILE" ]; then
EPIC_STATUS=$(grep '^status:' "$EPIC_FILE" | awk '{print $2}')
[ "$EPIC_STATUS" != "in_progress" ] && {
echo "HALT: Parent epic is not locked (status: $EPIC_STATUS). Run epic lock first."
exit 1
}
fi
Then:
ROADMAP.md to confirm scope and priority — do NOT expand scope beyond the storysrc/hyperadmin/ to understand existing patternsDecompose the issue into ordered sub-tasks. Each sub-task must state:
Order MUST follow this strict bottom-up sequence — no exceptions:
core/, adapters/)views/, routing.py)templates/, tests/e2e/)Evaluate every item below. Label each PASS or FAIL:
Architecture — CONSTITUTION.md
core/ (dependency direction: views/ → core/ → adapters/)utils.py, helpers.py, misc.py, or common.pyauth/, actions/, uploads/) unless the issue explicitly targets Phase 3Ordering — planning-playbook.md
Code style — code-style.md
selectinload(); large collections use paginationpass, no TODO, no commented-out blocks in final codeTesting — testing.md
get_by_role > get_by_label > get_by_text > get_by_test_idpage.locator('.ha-*') or positional CSS selectorsGit — git-workflow.md
user.name="Claude Code", user.email="noreply+claude-code@anthropic.com"Co-Authored-By trailers on any committype(scope): description (#$ARGUMENTS)GH_TOKEN="$CLAUDE_GH_TOKEN" — verify token is set before proceedingIf ALL items are PASS → proceed to Phase B.
If ANY item is FAIL:
gh issue comment $ARGUMENTS --body "$(cat <<'EOF'
## Planning Gate — Questions Before Implementation
Before I can proceed, the following items in my plan are ambiguous or blocked:
<list each failing checklist item and your specific question>
Please update the issue with your answers and re-run `/implement-feature $ARGUMENTS`.
EOF
)"
STOPPED: Questionnaire posted on issue #$ARGUMENTS. Re-run this skill after the issue is updated.Run /wt feat/issue-$ARGUMENTS to create an isolated worktree branched from develop.
Then sync the environment:
uv sync --all-extras
All subsequent commands (file edits, just lint, just test, uv run, etc.) run from inside
the worktree.
If a draft PR already exists for this branch, resume from the rebased worktree state — do not restart.
For each sub-task in the plan, in strict order:
tests/unit/ or E2E in tests/e2e/just testAfter completing all backend sub-tasks (before moving to UI), run an early lint check:
just lint
Fix any issues before continuing to UI sub-tasks.
When you encounter a blocker (failing test you cannot fix, missing dependency, unclear requirement, architectural ambiguity, or any issue that prevents moving forward):
Step 1 — Search memory for prior solutions:
Read your project memory index (MEMORY.md) and any files whose description
matches the blocker topic. The auto-memory system provides the concrete path
at runtime.
If a relevant solution is found → apply it and continue. Update the memory entry if you discovered a refinement.
If no solution is found → proceed to Step 2.
Step 2 — Document, commit WIP, and halt:
# Commit everything in-progress (skip pre-commit hooks — this is a WIP save)
git -c user.name="Claude Code" -c user.email="noreply+claude-code@anthropic.com" \
commit -n -m "wip: partial implementation, blocked (#$ARGUMENTS)"
git push origin HEAD
# Create draft PR (or update existing one)
GH_TOKEN="$CLAUDE_GH_TOKEN" gh pr create --draft --fill
# If draft already exists: GH_TOKEN="$CLAUDE_GH_TOKEN" gh pr ready --undo
Post blocker details as an issue comment:
gh issue comment $ARGUMENTS --body "$(cat <<'EOF'
## Implementation Blocker
**What was attempted:** <describe what you tried>
**The blocker:** <precise description of the error, ambiguity, or missing piece>
**What is needed to unblock:** <specific ask — e.g., clarify X, provide Y, decide between A and B>
Draft PR with current progress is open. Re-run `/implement-feature $ARGUMENTS` after the blocker is resolved.
EOF
)"
Print: STOPPED: Blocker documented on issue #$ARGUMENTS. Draft PR contains current progress.
HALT.
Once a blocker is resolved (either by memory lookup or by human input on the issue), write a memory entry before continuing:
Create a new file in your project memory directory (the directory containing MEMORY.md).
Name it descriptively (e.g., feedback_sqlmodel_inspector.md). Use this format:
---
name: <short descriptive name>
description: <one-line summary — used to match against future blockers>
type: feedback
---
<Lead with the rule or pattern that resolves the blocker>
**Why:** <what caused the blocker and why this solution works>
**How to apply:** <concrete steps or code snippet; when to apply this>
Then update MEMORY.md to add a pointer:
- [filename.md](filename.md) — one-line hook matching the memory description
just lint # must pass with zero errors
just test # all unit + E2E tests must pass
Do not proceed until both pass. Fix every failure before continuing.
Confirm each item before committing:
selectinload() used for every relationship queryTODO or pass placeholders.ha-* CSS class selectors in E2E testsRebase onto the latest develop before committing. This project uses rebase-merge: merged PRs
rewrite hashes on develop, so the branch must be current to produce a clean diff.
git fetch origin develop
git rebase origin/develop
git -c user.name="Claude Code" -c user.email="noreply+claude-code@anthropic.com" \
commit -m "feat: <description> (#$ARGUMENTS)"
git push origin HEAD
If a draft PR already exists (from a prior blocker stop):
GH_TOKEN="$CLAUDE_GH_TOKEN" gh pr ready
If no PR exists yet:
GH_TOKEN="$CLAUDE_GH_TOKEN" gh pr create --fill
If CLAUDE_GH_TOKEN is not set: STOP and tell the user — do not create the PR under their identity.
Write a memory entry summarizing what was learned — focus on non-obvious decisions and patterns that future implementations should reuse:
---
name: issue-$ARGUMENTS-learnings
description: <one-line summary of the key pattern or decision made>
type: project
---
<Lead with the key decision or pattern>
**Why:** <what drove this decision — constraint, architectural rule, tradeoff>
**How to apply:** <when and how future implementations should use this pattern>
Add the entry to MEMORY.md.
Register a cron job that watches the PR every 10 minutes and drives it through its full lifecycle: CI failures → review changes → approved → merged → close issue. All states are handled autonomously.
PR_NUMBER=$(GH_TOKEN="$CLAUDE_GH_TOKEN" gh pr view --json number -q .number)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
echo "Monitoring PR #$PR_NUMBER on branch $BRANCH_NAME for issue #$ARGUMENTS"
Use CronList to see if a monitor for this issue is already registered. If a cron whose name
matches pr-monitor-$ARGUMENTS already exists, skip D3 — it is already running.
Use CronCreate with:
pr-monitor-$ARGUMENTS*/10 * * * *$ARGUMENTS and $PR_NUMBER substituted at registration time):You are the PR lifecycle monitor for issue #$ARGUMENTS in yevheniidehtiar/hyper-admin.
Run every step in order. Do not skip steps.
## Step 1 — Fetch full PR state
Run both commands:
gh pr view $PR_NUMBER --json number,state,reviewDecision,mergedAt,headRefName \
--repo yevheniidehtiar/hyper-admin
gh pr checks $PR_NUMBER --repo yevheniidehtiar/hyper-admin
Collect:
- `state` (OPEN / MERGED / CLOSED)
- `reviewDecision` (null / REVIEW_REQUIRED / APPROVED / CHANGES_REQUESTED)
- `failingChecks` — list of check names where status is FAIL or ERROR
## Step 2 — Merged → close issue and stop
If `state == "MERGED"`:
1. Close the issue:
gh issue close $ARGUMENTS --reason completed \
--comment "Closed: merged via PR #$PR_NUMBER." \
--repo yevheniidehtiar/hyper-admin
2. Delete this cron using CronDelete (name: pr-monitor-$ARGUMENTS).
3. Print: "PR #$PR_NUMBER merged. Issue #$ARGUMENTS closed. Monitor stopped."
HALT.
## Step 3 — Failing CI checks → diagnose and fix
If `failingChecks` is non-empty:
1. For each failing check, fetch the log:
gh run list --branch $BRANCH_NAME --repo yevheniidehtiar/hyper-admin \
--json databaseId,name,conclusion --limit 5
gh run view <run-id> --log-failed --repo yevheniidehtiar/hyper-admin
2. Check out the branch and rebase onto latest develop:
git fetch origin
git checkout $BRANCH_NAME
git rebase origin/develop
Rebase is required because this project uses rebase-merge — merged PRs rewrite hashes
on develop, and a stale branch produces a misleading diff and may fail CI on tree conflicts.
3. Read the error output carefully. Diagnose root cause (lint error, type error,
failing test, import error, etc.) and apply the minimal fix using Edit/Write.
4. Run the same check locally to confirm the fix:
just lint (if lint check failed)
just test (if test check failed)
Do not proceed until the local check passes.
5. Commit and push (force-with-lease because rebase rewrites history):
git -c user.name="Claude Code" -c user.email="noreply+claude-code@anthropic.com" \
commit -m "fix(ci): fix failing checks (#$ARGUMENTS)"
git push --force-with-lease origin HEAD
6. Comment on the PR:
gh pr comment $PR_NUMBER \
--body "CI fix pushed: $(git rev-parse --short HEAD) — re-running checks." \
--repo yevheniidehtiar/hyper-admin
7. Print: "CI fixes pushed. Continuing to monitor."
Continue (do NOT stop the cron — wait for checks to go green).
## Step 4 — Changes requested → apply review feedback
If `reviewDecision == "CHANGES_REQUESTED"` (and no failing checks from Step 3):
1. Fetch all review comments:
gh api repos/yevheniidehtiar/hyper-admin/pulls/$PR_NUMBER/reviews
gh api repos/yevheniidehtiar/hyper-admin/pulls/$PR_NUMBER/comments
2. Check out the branch and rebase onto latest develop:
git fetch origin
git checkout $BRANCH_NAME
git rebase origin/develop
Rebase is required because this project uses rebase-merge — merged PRs rewrite hashes
on develop, and a stale branch produces a misleading diff.
3. Read each review comment and apply the requested change using Edit/Write.
4. Run quality gates locally:
just lint
just test
Fix any failures before committing.
5. Commit and push (force-with-lease because rebase rewrites history):
git -c user.name="Claude Code" -c user.email="noreply+claude-code@anthropic.com" \
commit -m "fix(review): address review feedback (#$ARGUMENTS)"
git push --force-with-lease origin HEAD
6. Re-request review from the reviewer(s) who left change requests:
gh pr edit $PR_NUMBER --add-reviewer <reviewer-login> \
--repo yevheniidehtiar/hyper-admin
7. Comment on the issue:
gh issue comment $ARGUMENTS \
--body "Review feedback addressed in $(git rev-parse --short HEAD). Re-requested review." \
--repo yevheniidehtiar/hyper-admin
8. Print: "Review changes applied. Re-requested review. Continuing to monitor."
Continue (do NOT stop the cron).
## Step 5 — Approved and checks green → enable auto-merge
If `reviewDecision == "APPROVED"` and `failingChecks` is empty and `state == "OPEN"`:
1. Enable squash auto-merge:
GH_TOKEN="$CLAUDE_GH_TOKEN" gh pr merge $PR_NUMBER --auto --squash \
--repo yevheniidehtiar/hyper-admin
2. Comment on the PR:
gh pr comment $PR_NUMBER \
--body "Auto-merge enabled — all checks green and review approved." \
--repo yevheniidehtiar/hyper-admin
3. Print: "PR #$PR_NUMBER approved and checks green. Auto-merge enabled."
Continue (do NOT stop the cron — next cycle detects the merge).
## Step 6 — Waiting
If `state == "OPEN"` and no action was taken in Steps 3–5:
Print: "PR #$PR_NUMBER is open — checks: <summary>, review: <reviewDecision>. Next check in 10 min."
HALT (cron fires again automatically).
After CronCreate succeeds, print:
Monitor registered: pr-monitor-$ARGUMENTS (every 10 min)
PR: #$PR_NUMBER
Issue: #$ARGUMENTS
Branch: $BRANCH_NAME
Will fix failing CI checks, address review changes, enable auto-merge on approval,
close issue on merge, and stop itself automatically.
DONE. The workflow is now fully autonomous until the issue is closed.