AgentSkillsCN

finishing

当所有任务均已完成后,此方案会清晰呈现各项完成选项,并严格执行测试准入机制。确保每项工作都不会被搁置,而是有条不紊地推进至最终完成。

SKILL.md
--- frontmatter
name: finishing
description: Use when all tasks are complete. Presents completion options and enforces test gate. Work is never left in limbo.
version: 1.0.0

Finishing Skill

Core Principle: Tests must pass before completion. Work is never abandoned without explicit choice.

Pre-Completion Gate

[!CRITICAL] TESTS MUST PASS before presenting options.

Step 1: Run Full Test Suite

bash
[project test command]

Step 2: Check Results

ResultAction
All passProceed to options
Any failSTOP - fix first

DO NOT present completion options with failing tests.


The Five Options

After tests pass, present EXACTLY these options:

code
Work complete. Tests passing. Choose:

1. Merge locally     - Merge to [base] and delete branch
2. Create PR         - Push and open pull request
3. Keep as-is        - No action, branch remains
4. Partial rollback  - Undo selected recent tasks
5. Discard           - Delete all work (requires confirmation)

Option Details

Option 1: Merge Locally

bash
git checkout [base-branch]
git merge [feature-branch]
git branch -d [feature-branch]

Result: Work merged, feature branch deleted

Option 2: Create Pull Request

bash
git push -u origin [feature-branch]
gh pr create --title "[title]" --body "[body]"

Result: PR created, branch preserved for review

Option 3: Keep As-Is

No commands executed.

Result: Branch remains for future work

Option 4: Partial Rollback

For selective undo of recent work without discarding everything.

Step 1: List recent commits/tasks

code
Recent changes (newest first):

1. [commit-hash] [task-id] - [description]
2. [commit-hash] [task-id] - [description]
3. [commit-hash] [task-id] - [description]

Select commits to revert [comma-separated, e.g., 1,2]:

Step 2: Revert selected commits

bash
git revert [commit-hash-1] [commit-hash-2] --no-commit
git commit -m "Revert: [tasks reverted]"

Step 3: Re-run tests after revert

ResultAction
All passReturn to options menu
Any failWarn user, offer to abort revert

Result: Selected work undone, branch still exists


Option 5: Discard

Requires typed confirmation: "discard"

Only after confirmation:

bash
git checkout [base-branch]
git branch -D [feature-branch]

Result: All work deleted


Rules

RuleWhy
Never add explanationsKeep options scannable
Never default to an optionUser must explicitly choose
Never proceed without choicePrevents abandoned work
Discard requires confirmationPrevents accidental loss

Option Presentation Format

code
┌─────────────────────────────────────────────────┐
│ All tasks complete. Tests passing.              │
├─────────────────────────────────────────────────┤
│ 1. Merge locally     - Merge to main, cleanup   │
│ 2. Create PR         - Push and open PR         │
│ 3. Keep as-is        - Branch remains           │
│ 4. Partial rollback  - Undo selected tasks      │
│ 5. Discard           - Delete work (confirm)    │
└─────────────────────────────────────────────────┘

Choose [1-5]:

Deviation Logging

Work abandoned without finishing workflow:

yaml
- id: [auto]
  timestamp: [now]
  expected: "Finishing skill invoked after task completion"
  actual: "Session ended without completion choice"
  root_cause: incomplete_workflow
  fix: |
    Always invoke finishing skill after all tasks complete.
    Add reminder to orchestration skill chain.

Integration with Orchestration

This skill is the final step in the workflow chain:

code
orchestration → executor → verification → reviewer → finishing

The orchestration skill should invoke finishing when:

  • All tasks marked complete
  • All verifications passed
  • All reviews approved

Worktree Cleanup

If using git worktrees:

OptionWorktree Action
1. MergeRemove worktree
2. PRKeep worktree
3. KeepKeep worktree
4. Partial rollbackKeep worktree
5. DiscardRemove worktree
bash
# Remove worktree
git worktree remove [path]