Back to list
cuioss

phase-5-finalize

by cuioss

An orchestration layer for AI coding assistants (currently Claude Code) that enforces consistency, reliability, and more predictable outputs.

0🍴 0📅 Jan 17, 2026

SKILL.md


name: phase-5-finalize description: Complete plan execution with git workflow and PR management allowed-tools: Read, Bash, Glob, SlashCommand

Phase Finalize Skill

Role: Finalize phase skill. Handles git workflow (commit, push, PR) and plan completion. Reads configuration from config.toon written during init phase.

Key Pattern: Configuration-agnostic execution. All finalize behavior determined by config.toon values.

When to Activate This Skill

Activate when:

  • Execute phase has completed (all tasks done)
  • Ready to commit and potentially create PR
  • Plan is in finalize phase

Scripts

ScriptPurpose
pm-workflow:manage-config:manage-configConfig field access
pm-workflow:manage-references:manage-referencesReference file CRUD
pm-workflow:manage-lifecycle:manage-lifecyclePhase transitions
plan-marshall:manage-logging:manage-logWork log entries
pm-workflow:workflow-integration-git:git-workflowCommit, push, PR creation

Configuration Source

All finalize configuration is read from config.toon (written during init phase):

python3 .plan/execute-script.py pm-workflow:manage-config:manage-config get-multi \
  --plan-id {plan_id} \
  --fields create_pr,verification_required,verification_command,branch_strategy

Returns only the required finalize fields in a single call.

Config Fields Used:

FieldValuesDescription
create_prtrue/falseWhether to create a pull request
verification_requiredtrue/falseWhether verification must pass
verification_commandcommand/nullVerification command to run
branch_strategyfeature/directBranch strategy

Operation: finalize

Input: plan_id

Step 0: Log Phase Start

python3 .plan/execute-script.py plan-marshall:manage-logging:manage-log \
  work {plan_id} INFO "[STATUS] (pm-workflow:phase-5-finalize) Starting finalize phase"

Step 1: Read Configuration

python3 .plan/execute-script.py pm-workflow:manage-config:manage-config get-multi \
  --plan-id {plan_id} \
  --fields create_pr,verification_required,verification_command,branch_strategy

Returns: create_pr, verification_required, verification_command, branch_strategy in a single call.

Also read references context for branch and issue information:

python3 .plan/execute-script.py pm-workflow:manage-references:manage-references get-context \
  --plan-id {plan_id}

Returns: branch, base_branch, issue_url, build_system, and file counts in a single call.

After reading configuration, log the finalize strategy decision:

python3 .plan/execute-script.py plan-marshall:manage-logging:manage-log \
  work {plan_id} INFO "[DECISION] (pm-workflow:phase-5-finalize) Finalize strategy: verification={verification_required}, PR={create_pr}, branch={branch_strategy}"

Step 2: Run Verification (if required)

If verification_required == true and verification_command is set:

SlashCommand("{verification_command}")

Common verification commands:

  • /pm-dev-builder:builder-build-and-fix - Java/Gradle/Maven
  • /pm-dev-builder:builder-build-and-fix system=npm - JavaScript
  • /pm-plugin-development:plugin-doctor - Plugin development

If verification fails, report error and allow retry.

Step 3: Commit Workflow

Load the git-workflow skill for commit operations:

Skill: pm-workflow:workflow-integration-git

The git-workflow skill handles:

  • Artifact detection and cleanup (*.class, *.temp files)
  • Commit message generation following conventional commits
  • Stage, commit, and push operations

Parameters (from config and request):

  • message: Generated from request.md summary
  • push: true (always push in finalize)
  • create-pr: from create_pr config field

Step 4: Create PR (if enabled)

If create_pr == true, the git-workflow skill creates the PR with:

  • Title from request.md
  • Body using templates/pr-template.md
  • Issue link from references.toon (Closes #{issue} if present)

Step 5: PR Workflow (if PR created)

If PR was created and pr_workflow expected:

SlashCommand("/pm-workflow:pr-doctor")

This handles CI monitoring and review addressing.

Step 6: Mark Plan Complete

Transition to complete:

python3 .plan/execute-script.py pm-workflow:manage-lifecycle:manage-lifecycle transition \
  --plan-id {plan_id} \
  --completed 5-finalize

Step 7: Log Completion

python3 .plan/execute-script.py plan-marshall:manage-logging:manage-log \
  work {plan_id} INFO "[STATUS] (pm-workflow:phase-5-finalize) Plan completed: commit={commit_hash}, PR={pr_url|skipped}"

Output

Success:

status: success
plan_id: {plan_id}

actions:
  verification: {passed|skipped}
  commit: {commit_hash}
  push: success
  pr: {created #{number}|skipped}
  pr_workflow: {completed|skipped}

next_state: complete

Error:

status: error
plan_id: {plan_id}
step: {verification|commit|push|pr}
message: {error_description}
recovery: {recovery_suggestion}

Error Handling

On any error, first log the error to work-log:

python3 .plan/execute-script.py plan-marshall:manage-logging:manage-log \
  work {plan_id} ERROR "[ERROR] (pm-workflow:phase-5-finalize) {step} failed - {error_type}: {error_context}"

Verification Failure

status: error
step: verification
message: Build failed with errors
recovery: Fix errors and re-run finalize

Git Commit Failure

status: error
step: commit
message: Nothing to commit or merge conflict
recovery: Resolve conflicts, then re-run finalize

Push Failure

status: error
step: push
message: Remote rejected push
recovery: Pull changes, resolve conflicts, then re-run finalize

PR Creation Failure

status: error
step: pr
message: PR already exists or branch not pushed
recovery: Check existing PRs or push branch first

Resumability

The skill checks current state before each step:

  1. Has verification passed? Skip if already verified
  2. Are there uncommitted changes? Skip commit if clean
  3. Is branch pushed? Skip push if remote is current
  4. Does PR exist? Skip creation if PR exists
  5. Is plan already complete? Skip if finalize done

Finalize by Domain

Java / JavaScript

Full workflow:

  1. Verification (build/test)
  2. Commit
  3. Push
  4. Create PR
  5. PR workflow (/pr-doctor)

Plugin Development

Partial workflow:

  1. Verification (/plugin-doctor)
  2. Commit
  3. Push
  4. (No PR)

Generic

Minimal workflow:

  1. (No verification)
  2. Commit
  3. Push
  4. (No PR)

Standards (Load On-Demand)

Validation

Read standards/validation.md

Contains: Configuration requirements, step-by-step validation checklist, output format examples

Triage Integration

Read standards/triage-integration.md

Contains: How to load domain-specific triage extensions, findings routing, decision flow, iteration loop

Lessons Integration

Read standards/lessons-integration.md

Contains: How lessons inform triage decisions, lesson query before decisions, recording new triage lessons


Templates

TemplatePurpose
templates/pr-template.mdPR body format

Scripts Used

ScriptCommandPurpose
pm-workflow:manage-config:manage-configget-multiRead finalize config fields
pm-workflow:manage-references:manage-referencesget-contextRead branch, issue info
pm-workflow:manage-lifecycle:manage-lifecycletransitionPhase transition
plan-marshall:manage-logging:manage-logworkLog completion
pm-workflow:workflow-integration-git:git-workflowformat-commit, analyze-diffCommit message generation

Integration

Phase Routing

This skill is invoked when plan is in 5-finalize phase:

pm-workflow:manage-lifecycle route --phase 5-finalize → pm-workflow:phase-5-finalize

Command Integration

  • /plan-execute action=finalize - May invoke this skill
  • /pr-doctor - Used during PR workflow
  • git-workflow - Handles commit, push, and PR creation
  • plan-execute - Previous phase (executes tasks)
  • manage-lifecycle - Handles phase transitions
  • java-triage - Java triage extension (pm-dev-java)
  • javascript-triage - JavaScript triage extension (pm-dev-frontend)
  • plugin-triage - Plugin development triage extension (pm-plugin-development)

Score

Total Score

70/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon