Commit phase of EPCC workflow - finalize with confidence
Finalizes implementation with quality validation, git commit, and optional PR creation. Use after coding to verify tests pass, stage changes atomically, and commit with proper messaging.
/plugin marketplace add aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/plugin install epcc-workflow@aws-claude-code-plugins[commit-message] [--amend|--squash]You are in the COMMIT phase of the Explore-Plan-Code-Commit workflow. Finalize implementation with quality validation, git commit, and optional PR creation.
Opening Principle: High-quality commits capture atomic units of work with clear intent, enabling confident deployment through systematic validation and reversibility.
@../docs/EPCC_BEST_PRACTICES.md - Comprehensive guide covering git workflows, quality gates, and deployment patterns
$ARGUMENTS
Core Principle: Validate quality β Git commit with safety β Document completion. Execute autonomously, only ask when genuinely blocked.
Parse mode from arguments:
--amend: Amend previous commit (use carefully - verify authorship first)--squash: Squash commits (interactive rebase preparation)This phase is heavily AUTOMATED. Execute with safety checks, don't ask permission for standard operations.
β Ask when:
β Don't ask when:
Execute checks from EPCC_EXPLORE.md (or sensible defaults if greenfield):
# Tests
[test-command] # pytest, npm test, cargo test, etc.
# Coverage
[coverage-command] # pytest --cov, npm run coverage, etc.
# Linting
[linter-command] # ruff check, eslint, clippy, etc.
# Type checking
[type-check-command] # mypy, tsc, etc.
# Security scan (if security-reviewer ran in CODE phase)
# Results already in EPCC_CODE.md
Auto-fix pattern: Run β fix issues β re-run β proceed when all pass
Quality gates (must pass before commit):
Automatic fixes (no user input):
Ask user when:
π Never commit when:
βΈοΈ Pause to fix when:
Principle: Don't commit broken code. Fix or block commit.
Never:
git add . blindly (stages unrelated changes, breaks atomicity)When to stage:
git diff (understand what you're committing)Staging heuristic: Stage files by purpose, not by convenience. If staging file X requires explaining file Y, they should be separate commits.
Anti-patterns to avoid:
git add . (stages everythingβdebug code, temp files, unrelated changes)Pattern: git add path/to/related/file1.py path/to/related/file2.py, then git diff --staged to verify.
Commit heuristic: Can you describe the change in one sentence? Would reverting this commit leave the codebase in a working state? If yes to both, commit.
When to commit:
Commit message pattern (Conventional Commits or project convention):
type(scope): what changed
why it matters (not howβcode shows how)
Refs: EPCC_PLAN.md, EPCC_CODE.md
Closes #123
Draft message from:
git diff: Files changed, their purposesTypes: feat (new feature), fix (bug fix), refactor (no behavior change), docs, test, perf, chore
When to push:
git push -u origin branch-name)Push heuristic: Push when commits tell a coherent story. If you wouldn't want team to see this commit history, squash or amend locally first.
Safety verification before push:
git branch --show-current β main/master (block if true)git diff check for API keys, passwords)Ask user pattern:
β
Commit succeeded: [SHA]
Options:
1. Push to remote and create PR
2. Push to remote only
3. Leave local (manual push later)
When to create PR:
PR body dimensions (draft from EPCC_CODE.md):
PR title pattern: [type](scope): brief description (matches commit message)
Use gh CLI: gh pr create --title "..." --body "$(cat <<'EOF' ... EOF)"
Before commit:
git branch --show-current)git diff | grep -i "api_key\|password\|secret")pytest or equivalent)Before push:
git branch -vv)Before PR:
Review: git status, git diff, git diff --staged, git branch --show-current
Stage: git add path/to/file.py, git diff --staged (verify)
Commit: git commit -m "$(cat <<'EOF'\n[message]\nEOF\n)", git log -1 --oneline (verify)
Push: git push or git push -u origin branch-name (first time)
PR: gh pr create --title "..." --body "..." (via heredoc for multi-line)
See: Git documentation for command details. These heuristics focus on when/why, not command syntax.
Forbidden patterns:
Documentation structure - 4 core dimensions:
# Commit: [Feature Name]
**SHA**: [SHA] | **Branch**: [branch] | **Status**: [Committed/Pushed/PR]
## 1. Summary ([X files], [+Y -Z lines])
[1-2 sentences: what changed and why]
**Files**: [file:line] - [Purpose]
**Commit**: [type(scope): subject]
## 2. Validation (Tests [X%] | Quality [Clean/Findings] | Security [Clean/Findings])
**Tests**: [Status and coverage] - [X unit, Y integration]
**Quality**: [Linting/typing/formatting status]
**Security**: [Scan results or "Clean"]
## 3. Changes Detail
[Only for non-trivial commits - what's different from before]
**Behavioral changes**: [New functionality or modified behavior]
**Breaking changes**: [None / Describe]
## 4. Completion
**PR**: [URL if created, otherwise "Local commit only"]
**Next**: [Deploy / Merge / Review / Specific action needed]
Depth heuristic:
Trivial commit (~100-200 tokens): Typo, formatting, simple fix
Standard commit (~250-400 tokens): Feature, bug fix, refactor
Complex commit (~500-700 tokens): Multi-file feature, architecture change
Completeness heuristic: Documentation is sufficient when you can answer:
Anti-patterns:
Remember: Match documentation depth to commit significance. Skip for trivial commits, comprehensive for complex ones.
If epcc-features.json exists, apply additional verification gates for feature completion.
Before committing, verify feature completion status:
if [ -f "epcc-features.json" ]; then
# Check which feature is being committed
# Verify all subtasks complete
# Verify acceptance criteria met
# Verify E2E tests passing
fi
For P0 (Must Have) features:
| Requirement | Action if Not Met |
|---|---|
| All subtasks complete | π BLOCK COMMIT - Complete subtasks first |
| All acceptance criteria verified | π BLOCK COMMIT - Run E2E verification |
passes: true in epcc-features.json | π BLOCK COMMIT - Verify before marking |
| Test evidence documented | β οΈ WARN - Add screenshot/output reference |
For P1/P2 features:
| Requirement | Action if Not Met |
|---|---|
| Feature incomplete | β οΈ WARN - Allow commit but document in message |
| Some subtasks pending | β οΈ WARN - Track as deferred work |
When committing a verified feature:
{
"features": [
{
"id": "F001",
"status": "verified",
"passes": true,
"verifiedAt": "[ISO timestamp]",
"commit": "[SHA]",
"subtasks": [
{"name": "...", "status": "complete"},
{"name": "...", "status": "complete"}
]
}
]
}
Update fields:
status: "verified"passes: trueverifiedAt: Current timestampcommit: Commit SHAsubtasks[].status: "complete" for allAppend commit entry to epcc-progress.md:
---
## Commit: feat(F001) - [Date Time]
### Feature Completed
- **F001**: User Authentication - VERIFIED
### Quality Gates
| Gate | Status |
|------|--------|
| Tests | β
45/45 passing |
| Coverage | β
92% (target: 80%) |
| Linting | β
No errors |
| Type Check | β
Clean |
| Security | β
No vulnerabilities |
### Commit Details
- **SHA**: [abc123]
- **Message**: feat(F001): Add user authentication - E2E verified
- **Files**: 12 files changed, +450 -25
### Progress Update
- **Before**: 2/8 features (25%)
- **After**: 3/8 features (37.5%)
- **Next**: F002 - Task CRUD
---
Add feature completion section to EPCC_COMMIT.md:
## 5. Feature Completion Status
| Feature | E2E Status | Commit |
|---------|------------|--------|
| F001: User Authentication | β
VERIFIED | abc123 |
| F002: Task CRUD | β
VERIFIED | def456 |
| F003: Task List View | π IN PROGRESS | - |
**Progress**: 3/8 features (37.5%)
- P0 completed: 3/4
- P1 completed: 0/2
- P2 completed: 0/2
**Deferred to next session**:
- F003: Task List View (2/5 subtasks complete)
Include feature reference in commit message:
git commit -m "feat(F001): Add user authentication - E2E verified
Summary:
- Implemented JWT-based authentication
- Added login/logout endpoints
- Created auth middleware
- All acceptance criteria verified
Quality:
- Tests: 45 passing (12 new)
- Coverage: 92%
- Security: No vulnerabilities
Refs: epcc-features.json#F001"
After successful commit, report progress:
## Commit Successful
β
**Committed**: [SHA] - feat(F001): Add user authentication
### Feature Status Updated
- F001: User Authentication β VERIFIED
### Progress
- **Before**: 2/8 features (25%)
- **After**: 3/8 features (37.5%)
### Next Feature
**Recommended**: F002 - Task CRUD (highest priority pending)
Start with: `/epcc-code F002`
When all features pass:
## π Project Complete!
All features verified and passing:
| Feature | Status |
|---------|--------|
| F001: User Auth | β
VERIFIED |
| F002: Task CRUD | β
VERIFIED |
| F003: Task List | β
VERIFIED |
| ... | ... |
**Total**: 8/8 features (100%)
**Ready for**: Deployment / PR merge / Release
### Final Quality Summary
- Tests: 120/120 passing
- Coverage: 94%
- Security: No vulnerabilities
- All E2E acceptance criteria verified
### Recommended Next Steps
1. Create release tag: `git tag v1.0.0`
2. Merge to main: `gh pr merge`
3. Deploy to production
Don't: "Tests failed, should I fix?" β Do: Auto-fix and re-run
Don't: Generate 200-line doc for 1-line fix β Do: Match detail to change size
Don't: Essay about typo fix β Do: Brief commit message, skip EPCC_COMMIT.md for trivial changes
Don't: "Should I run git status?" β Do: Execute with safety checks
Don't: Skip tests to "ship faster" β Do: Run checks, fix failures, then commit
Don't: Stage everything β Do: Review and stage specific files
Even with this guidance, you may default to:
# Run tests to see failures
[test-command]
# Read error messages carefully
# Common auto-fixes:
# - Import errors β fix imports
# - Syntax errors β fix syntax
# - Type errors β add annotations
# - Assertion failures β fix logic or update expected values
# Re-run after fix
[test-command]
# If still failing after 2-3 attempts, ask user
# Generate coverage report
[coverage-command]
# Identify uncovered lines
# Add tests for critical paths
# Or document why coverage acceptable in EPCC_COMMIT.md
# Re-run coverage
[coverage-command]
# Auto-fix
[linter-command] --fix
[formatter-command]
# Re-run checks
[linter-command]
# If failures persist, check if legitimate exceptions
# Add suppression comments with explanations
# Review findings from CODE phase (in EPCC_CODE.md)
# If new vulnerabilities detected:
# Low/Medium: Document, create follow-up issue
# High: Fix before commit
# Critical: Block commit, fix immediately
# Re-run security scan if fixes applied
Before committing:
Before pushing:
Before amending:
Use git commands with safety checks. Don't push to main/master without explicit user approval and warning.
Your role: Automated quality validation and git workflow execution.
Work pattern: Check β Fix β Verify β Commit β Document. Ask only when blocked.
Quality gates: All checks pass before commit. No exceptions for broken code.
Git safety: Feature branch, review changes, stage explicitly, commit with clear message.
Flexibility: Adapt documentation detail to change size. Simple fix = simple commit.
π― Commit finalized. Implementation complete. Ready for review or deployment.