commit-push-pr
Commit Push PR
Workflow
Step 1: Check Current Branch
Run: git branch --show-current
If branch is main, master, develop, or any protected branch:
- Run
git branch -ato list all branches - If a feature branch exists (typically named like
feature/*,feat/*,bugfix/*,fix/*, or Jira ticket likePROJ-123-description):- Ask user: "I see you're on a protected branch. Switch to existing feature branch [branch-name]?"
- If yes, run
git checkout <branch-name>
- If no feature branch exists:
- Use question tool to ask user: "I see you're on a protected branch ([branch-name]). No feature branch detected. Do you want me to create a feature branch? If yes, what should I name it?"
- Wait for user response
- If user wants to create a branch:
- Run
git checkout -b <branch-name> - Continue to Step 2
- Run
Step 2: Check for Changes
Run: git status --porcelain
If no changes (empty output):
- Inform user: "No changes to commit."
- Stop here.
Step 3: Pre-commit Checks
Before staging, check for potential issues:
- Run
git statusto see changed files - If any file matches
.env,credentials.json,secrets.json,*.pem,*.key, or similar secret patterns:- Warn user: "I notice files that may contain secrets: [list them]. Should I exclude them from the commit?"
- If user says yes, exclude them:
git add <files> --exclude=<secret-files>
- If project has lint/typecheck scripts (check package.json, Makefile, or similar):
- Ask user: "I found lint/typecheck scripts. Run them before committing?"
- If yes, run them and report results
- If failures, ask user if they want to proceed anyway
Step 4: Stage Changes
Run: git add -A
Step 5: Generate Commit Message
Run: git diff --staged --stat to see what changed
Analyze changes and generate a good commit message following conventional commits:
- Format:
type(scope): description - Types:
feat,fix,refactor,docs,style,test,chore,build,ci - Description should be concise (under 72 chars)
- If multiple file types changed, use
choreorfeatwith scope
Examples based on file analysis:
- Only docs files →
docs: update README - Only code files →
feat: add new endpointorfix: resolve null pointer - Mixed →
feat: implement user authentication
Step 6: Commit
Run: git commit -m "<message>"
Step 7: Pull with Rebase
Run: git pull --rebase origin <branch-name>
If there are conflicts:
- Inform user: "There are merge conflicts after pulling. Please resolve them."
- After user resolves, run:
git add -A && git rebase --continue - If rebase is complex, ask user for help
Step 7: Push
Run: git push -u origin <branch-name>
Step 8: Offer PR Creation (Optional)
After successful push, ask user: "Changes pushed to <branch-name>. Would you like me to create a pull request? If so, which base branch should I target?"
More from ajaywadhara/agent-skills
design-doc
Generate complete engineering design documents with Mermaid diagrams from a single prompt. Creates architecture overviews (C4), data models (ERD), sequence diagrams, state machines, and decision logs. One-shot workflow with minimal back-and-forth. Use when designing systems, creating design docs, architecting features, or documenting architecture.
5spring-boot-4-migration
Migrate Spring Boot applications from 3.x to 4.x with step-by-step guidance. Covers all 10 migration phases including build files, Jackson 3, Security 7, testing, and observability. Use when upgrading Spring Boot, migrating to Boot 4, or modernizing Spring applications. Supports gradual (6 tracks) or all-at-once migration strategies.
4openapi-architect
Design and generate OpenAPI 3.1 specifications following REST best practices. Creates API specs from requirements, reviews existing specs for compliance, implements RFC 7807 error handling, designs security schemes, and structures pagination/filtering. Use when designing APIs, creating OpenAPI specs, reviewing API design, or architecting REST endpoints.
4figma-to-code
Convert Figma designs into production UI code. Accepts Figma JSON exports, screenshots, or dev-mode snippets. Detects the project's existing frontend framework, design system, and component patterns — generates code that matches. Use when the user wants to build UI from Figma, convert Figma to code, implement a Figma design, or mentions "figma pack".
2multi-module-scaffolder
Scaffold complete multi-module Gradle projects with Spring Boot 4, Java 21, and a production-grade exception handling architecture. Generates server, api-gateway, and common:exception modules with version catalog, GlobalExceptionHandler, ErrorCode enum, ErrorResponse record, and per-module exception hierarchy. Use when asked to scaffold a project, create a multi-module Gradle project, generate a new Spring Boot project, or set up a microservice skeleton.
2senior-eng-review
Mission-critical codebase audit for Senior Engineering Managers. Evaluates Reliability, Data Integrity (Payments), Architecture, and Quality against strict "Big Tech" standards (99.999% availability, Idempotency, Safety First).
1