Finish Task Skill
This skill handles the completion workflow for a Ralph Loop task.
Prerequisites
- •Active task in
docs/CURRENT_TASK.md - •All tests must pass
- •All linting must pass
- •Changes must be committed
Workflow
Step 1: Read Current Task
Read docs/CURRENT_TASK.md Extract: JIRA_ID, branch_name
Step 2: Verify Exit Criteria
Run verification checks:
# Check tests pass pytest || npm test # Check linting ruff check . || npm run lint
If any check fails, DO NOT proceed. Fix the issues first.
Step 3: Verify Acceptance Criteria
Review each acceptance criterion in CURRENT_TASK.md. All checkboxes must be checked.
Step 4: Final Commit
If there are uncommitted changes:
git add -A
git commit -m "{JIRA_ID}: Final implementation - all tests pass"
Step 5: Push to Remote
git push -u origin {branch_name}
Step 6: Create Pull Request
Use gh CLI to create PR:
gh pr create \
--title "[{JIRA_ID}] {summary}" \
--body "## Summary
Implements {JIRA_ID}
## Changes
{list of commits}
## Testing
- [x] Unit tests pass
- [x] Integration tests pass
- [x] Linting passes
## Jira
[{JIRA_ID}]($JIRA_URL/browse/{JIRA_ID})
---
🤖 *Generated by Claude Code Agent*"
Step 7: Update Jira
Transition to "In Review":
python3 .claude/utils/jira_api.py transition-issue "{JIRA_ID}" "In Review"
Add completion comment:
python3 .claude/utils/jira_api.py add-comment "{JIRA_ID}" "🤖 Implementation complete!\n\n**Branch:** `{branch_name}`\n**PR:** {pr_url}\n\nAll tests pass. Ready for review."
Step 8: Update CURRENT_TASK.md
Mark task as complete:
## Active Task
**Jira ID:** {JIRA_ID}
**Status:** ✅ Complete - In Review
**Branch:** {branch_name}
**PR:** {pr_url}
**Completed:** {timestamp}
Step 8b: Notify Monitor - PR Created
Update the monitor to show the Jules Review step:
python3 -c "
import sys; sys.path.insert(0, '.claude/utils')
from monitor_client import send_task_update
send_task_update('{JIRA_ID}', step=4, step_name='Jules Review', step_desc='PR created, awaiting review...')
import time; time.sleep(0.5)
"
If monitor is offline, ignore and continue (non-blocking).
Step 9: Output Completion Promise
Only after ALL steps are verified:
<promise>DONE</promise>
Step 10: Deactivate Ralph Loop
Remove the loop flag file to allow normal exit:
rm -f .claude/.ralph_loop_active
This signals to the stop-hook that we're no longer in an active task loop.
Error Handling
- •Tests fail: Do not proceed, fix tests first
- •Lint fails: Do not proceed, fix linting issues
- •Push fails: Check for conflicts, resolve and retry
- •PR creation fails: Check gh auth status
- •Jira update fails: Log warning but continue (non-blocking)
Important
This skill should ONLY be invoked when:
- •All acceptance criteria are met
- •All tests pass
- •All linting passes
- •The agent is confident the implementation is complete
The <promise>DONE</promise> output triggers the stop-hook to allow exit.