# finish-task > Complete a task - verify all criteria, commit, push, create PR, and update Jira - Author: Simon - Repository: itsimonfredlingjack/grupp-ett-github - Version: 20260128095713 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/itsimonfredlingjack/grupp-ett-github - Web: https://mule.run/skillshub/@@itsimonfredlingjack/grupp-ett-github~finish-task:20260128095713 --- --- name: finish-task description: Complete a task - verify all criteria, commit, push, create PR, and update Jira args: none (uses current task from CURRENT_TASK.md) --- # Finish Task Skill This skill handles the completion workflow for a Ralph Loop task. ## Prerequisites - Active task in `CURRENT_TASK.md` - All tests must pass - All linting must pass - Changes must be committed ## Workflow ### Step 1: Read Current Task ``` Read CURRENT_TASK.md Extract: JIRA_ID, branch_name ``` ### Step 2: Verify Exit Criteria Run verification checks: ```bash # Check tests pass pytest -xvs # Check linting ruff check . ``` 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: ```bash git add -A git commit -m "{JIRA_ID}: Final implementation - all tests pass Co-Authored-By: Claude Code " ``` ### Step 5: Push to Remote ```bash git push -u origin {branch_name} ``` ### Step 6: Create Pull Request Use gh CLI to create PR: ```bash 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}](https://your-domain.atlassian.net/browse/{JIRA_ID}) --- 🤖 *Generated by Claude Code Agent*" ``` ### Step 7: Update Jira **IMPORTANT: Use direct Jira API, NOT MCP tools.** Transition to "In Review": ```bash source venv/bin/activate && python3 -c " from dotenv import load_dotenv load_dotenv() from src.grupp_ett.jira_client import get_jira_client client = get_jira_client() try: client.transition_issue('{JIRA_ID}', 'In Review') print('✅ Transitioned to In Review') except Exception as e: print(f'⚠️ Could not transition: {e}') " ``` Add completion comment: ```bash source venv/bin/activate && python3 -c " from dotenv import load_dotenv load_dotenv() from src.grupp_ett.jira_client import get_jira_client client = get_jira_client() comment = '''🤖 Implementation complete! **Branch:** {branch_name} **PR:** {pr_url} All tests pass. Ready for review.''' try: client.add_comment('{JIRA_ID}', comment) print('✅ Added comment to Jira') except Exception as e: print(f'⚠️ Could not add comment: {e}') " ``` ### Step 8: Update CURRENT_TASK.md Mark task as complete: ```markdown ## Active Task **Jira ID:** {JIRA_ID} **Status:** ✅ Complete - In Review **Branch:** {branch_name} **PR:** {pr_url} **Completed:** {timestamp} ``` ### Step 9: Output Completion Promise Only after ALL steps are verified: ``` DONE ``` ### Step 10: Deactivate Ralph Loop Remove the loop flag file to allow normal exit: ```bash 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: 1. All acceptance criteria are met 2. All tests pass 3. All linting passes 4. The agent is confident the implementation is complete The `DONE` output triggers the stop-hook to allow exit.