with one click
finish
Finish feature with tests, commit, and session closure
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Finish feature with tests, commit, and session closure
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Start feature with branch and session tracking
Interactive wizard to configure the project
System-wide code audit with 8 modules
Environment-aware deployment with pre/post checks
Methodical codebase exploration and understanding
Bug fix workflow with 3-hypothesis debugging protocol
| name | finish |
| description | Finish feature with tests, commit, and session closure |
| allowed-tools | Bash(git:*), Bash(*test*), Bash(*lint*), Read, Write, Edit, Glob, Grep |
Capture immediately:
git branch --show-currentgit rev-list --count {mainBranch}..HEADRead .claude/project.config.json to get project configuration.
Variables to use:
{testCmd} = config.commands.test (default: npm test){lintCmd} = config.commands.lint (default: npm run lint){mainBranch} = config.git.mainBranch (default: main){coAuthoredBy} = config.git.coAuthoredBy (default: false){quarter} = current quarter (Q1-Q4){year} = current year{archiveRotationThreshold} = config.workflow.archiveRotationThreshold (default: 15){blockRotationThreshold} = config.workflow.blockRotationThreshold (default: 3){backlogMaxLines} = config.workflow.backlogMaxLines (default: 300){recentSessionsToKeep} = config.workflow.recentSessionsToKeep (default: 3){externalSkills} = config.quality.externalSkills (default: []){parallelEnabled} = config.parallel.enabled (default: true){sharedBranchEnabled} = config.parallel.sharedBranch.enabled (default: true){sharedBranchDirectory} = config.parallel.sharedBranch.directory (default: context/.parallel){atomicCommits} = config.parallel.sharedBranch.atomicCommits (default: true){baseBranch} = config.git.devBranch if set, otherwise config.git.mainBranch{testMaxWorkers} = config.workflow.testMaxWorkers (default: 2)Validation: If config.initialized === false, warn but continue with defaults.
If {parallelEnabled} is true:
./scripts/context-lock.sh acquire "{session-id}" "/finish"
Detect the type of changes made:
git diff --stat {mainBranch}..HEAD
quality.externalSkills has frontend-related skills:
.claude/skills/{skill-name}/SKILL.md exists (via symlink or direct){name} is installed but was not consulted. Run now? (recommended)"!git branch --show-current
Find active session in context/tmp/session-*.md matching the current branch.
IMPORTANT: If no active session exists, create one retroactively before continuing.
{testCmd} --maxWorkers={testMaxWorkers} # R19: limit CPU usage (default: 2)
{lintCmd} 2>/dev/null || echo "Lint not configured"
!git status
!git diff --stat
In the active session file, update:
COMPLETED## Final Summary
- **End**: {date and time}
- **Duration**: {calculated from start}
- **Objective**: {one-line objective from session}
- **Result**: {one-line what was achieved}
- **Commits**: {count}
- **Files modified**: {count}
- **Tests**: PASSED | FAILED (coverage: {%} if available)
- **BACKLOG items**: {N} completed, {M} partial
- **Link**: branch `{branch}`, session `{ID}`
IMPORTANT: Keep the COMPLETED block compact. Do NOT include exhaustive lists of changes — the git log has that detail.
Read context/BACKLOG.md and update items related to this session:
Completion markers:
[x] = Fully completed → Move to "Completed (Recent)" section with session reference[~] = Partially completed → Keep in current section, add note with progress[ ] = Not addressed → Leave as isFormat for completed items:
- [x] **[scope]** Description *(session-{ID})*
Format for partial items:
- [~] **[scope]** Description
- Progress: {what was done} *(session-{ID})*
- Remaining: {what's left}
After updating items:
[x] items from body sections (they're already in "Completed (Recent)"){backlogMaxLines} lines:
archive/COMPLETED.md{backlogMaxLines} linesVerify consistency between Session and BACKLOG:
If inconsistencies found:
If current branch is a fix branch (starts with fix/):
context/FIXES.mdsession-{ID}If current branch is NOT a fix branch but fixes were done:
Read context/ROADMAP.md and update if it exists:
If ROADMAP doesn't exist, skip silently.
Cross-section consistency: When a module completes, propagate across all tracking files:
❌ → ✅ (or equivalent marker)This ensures the dependency map stays accurate across BACKLOG, ROADMAP, and session files.
Evaluate BACKLOG + ROADMAP to suggest what to work on next:
Format:
### Suggested Next Session
1. **{item}** - {reason} (from BACKLOG/ROADMAP)
2. **{item}** - {reason}
3. **{item}** - {reason}
Add entry to context/archive/COMPLETED.md:
| {date} | {description} | {branch} | {session-id} | {impact} |
Evaluate overall feature completeness:
Identify scope: What % of the feature's BACKLOG items are done?
[x] items for this feature scopeIf 100% complete:
context/consolidated/{feature-name}.mdIf < 100%:
8.0. Detect if we're in parallel mode (shared branch):
# Check if THIS session is registered in parallel mode
# Use quotes for exact match (prevent "session-14" matching "session-142")
SESSION_ID="session-XXX" # Replace with actual session ID
if [ -f {sharedBranchDirectory}/state.json ] && grep -q "\"$SESSION_ID\"" {sharedBranchDirectory}/state.json; then
echo "PARALLEL"
else
echo "NORMAL"
fi
IMPORTANT: It's not enough that
state.jsonexists. THIS session must be registered in it. Ifstate.jsonexists but this session is NOT registered, follow the NORMAL flow (8.b).
8.a. If in parallel mode (shared branch):
Conventional Commits - determine type based on changes:
feat - New featurefix - Bug fixrefactor - Refactoringtest - Testsdocs - Documentationchore - MaintenanceIdentify files owned by this session (do NOT include files from other session):
# List modified/created files
git status --porcelain
Verify against state.json that files belong to this session's domain.
If files are outside this session's domain, ask user before including them.
Atomic commit (stage + commit in one command to avoid conflicts with other session):
git commit file1 file2 context/tmp/session-XXX.md -m "feat(scope): description"
git add . or git add -A in parallel modeWrite closing message in channel.md:
### [HH:MM] session-XXX → all
Session finished. Commits: {list of commits}. Feature: {name}.
Context files updated: BACKLOG, ROADMAP.
Update {sharedBranchDirectory}/state.json: remove this session from the sessions object.
If this session is the LAST in state.json (sessions object is empty or has no active sessions):
rm -rf {sharedBranchDirectory}
Ask user if they want to merge to {baseBranch} (like any feature branch):
git checkout {baseBranch}
git merge {branchPrefix}{A}--{B}
git branch -d {branchPrefix}{A}--{B}
If NOT the last session → do not merge, the other session is still working on the branch.
IMPORTANT on Co-Authored-By: Check config.git.coAuthoredBy:
true: Add Co-Authored-By: Claude <noreply@anthropic.com> to commit messagefalse (default): Do NOT include any AI attribution in the commit message8.b. Normal flow (no parallel, on feature branch):
Conventional Commits - determine type based on changes:
feat - New featurefix - Bug fixrefactor - Refactoringtest - Testsdocs - Documentationchore - Maintenancegit add file1 file2 # Specific files, do NOT use -A without reviewing
git commit -m "type(scope): description
- Main changes detail
- Session reference: {session-id}
"
IMPORTANT on Co-Authored-By: Check config.git.coAuthoredBy:
true: Add Co-Authored-By: Claude <noreply@anthropic.com> to commit messagefalse (default): Do NOT include any AI attribution in the commit messageAsk user if they want to merge to {baseBranch}:
git checkout {baseBranch}
git merge {branchPrefix}{feature}
git branch -d {branchPrefix}{feature}
Move session from context/tmp/ to context/archive/{year}-{quarter}/sessions/:
First create directory if not exists:
mkdir -p context/archive/{year}-{quarter}/sessions/
Then move:
mv context/tmp/session-{ID}.md context/archive/{year}-{quarter}/sessions/
Check rotation triggers (act on first exceeded):
| Trigger | Threshold | Action |
|---|---|---|
| Completed blocks in COMPLETED.md | > {blockRotationThreshold} (3) | Summarize oldest to quarterly SUMMARY.md |
| Sessions in quarter archive | > {archiveRotationThreshold} (15) | Keep {recentSessionsToKeep} recent, compress rest |
| BACKLOG lines | > {backlogMaxLines} (300) | Move oldest completed items to archive/COMPLETED.md |
Remove from "Active Sessions" in context/README.md.
Add closure metadata:
<!-- Last session: {ID} completed {date} on branch {branch} -->
Check if a plan file exists in .claude/plan/ for this feature:
Glob: .claude/plan/*$ARGUMENTS* , .claude/plan/*.md
If found:
completados/?".claude/plan/completados/Read context/.pending-commits.log and update entries for this branch:
PENDING → PROCESSED for all commits on this branchIf lock was acquired in step 0.3:
./scripts/context-lock.sh release
CRITICAL: This MUST execute even if previous steps failed. The lock protects context writes only.
Invoke session-tracker agent to create the documentation commit (filter commits by current branch for parallel safety):
docs(context): commit prefixCreate a separate commit for all context/documentation changes:
git add context/ .claude/
git commit -m "docs(context): close session {ID}
- Session archived to {year}-{quarter}
- BACKLOG updated
- COMPLETED updated
"
Note: This commit uses docs(context): prefix so the post-commit hook auto-marks it as DOCUMENTED.
Confirm:
.claude/project.config.json{testCmd}): PASSED{lintCmd}): OK{short hash} - {message}context/archive/{year}-{quarter}/sessions/{mainBranch} or continue development| Problem | Recovery |
|---|---|
| Tests fail | Fix tests before finishing. Do NOT skip with --no-verify |
| Commit created but archive failed | Manually move session: mv context/tmp/session-*.md context/archive/{Q}/sessions/ |
| Session not found | Create retroactive session, then continue /finish |
| BACKLOG update failed | Re-read BACKLOG, manually mark items, retry |
| Branch deleted before merge | Session is archived — recover from archive for context |
| Merge conflicts | Resolve conflicts, commit, then re-run /finish |
| Partial /finish (died mid-process) | Check which steps completed (commits? archive? BACKLOG?), resume from incomplete step |
| FIXES.md update failed | Manually update FIXES.md entries after /finish completes |
| Context lock not released | Run ./scripts/context-lock.sh release manually |
| Lock script not found | Skip lock (parallel protection unavailable) |
| Parallel session conflict on shared files | Verify domain in state.json, ask user before including disputed files |
| state.json corrupted | Delete {sharedBranchDirectory}/state.json, proceed as normal flow |
| Shared branch merge conflicts | Resolve conflicts, commit, then re-run /finish |