$npx -y skills add opendatahub-io/ai-helpers --skill aipcc-commit-suggestGenerate AIPCC Commits style commit messages or summarize existing commits
| 1 | ## Name |
| 2 | odh-ai-helpers:aipcc-commit-suggest |
| 3 | |
| 4 | ## Synopsis |
| 5 | ``` |
| 6 | /aipcc:commit-suggest # Analyze staged changes |
| 7 | /aipcc:commit-suggest [N] # Analyze last N commits (1-100) |
| 8 | ``` |
| 9 | |
| 10 | ## Description |
| 11 | AI-powered command that analyzes code changes and generates commit messages following the project's AIPCC format requirements. |
| 12 | |
| 13 | **Modes:** |
| 14 | - **Mode 1 (no argument)** – Analyze staged changes (`git add` required) |
| 15 | - **Mode 2 (with N)** – Analyze last N commits to rewrite (N=1) or summarize for squash (N≥2) |
| 16 | |
| 17 | **Use cases:** |
| 18 | - Create AIPCC-formatted commit messages |
| 19 | - Improve or rewrite existing commits to meet project standards |
| 20 | - Generate squash messages for MR merges |
| 21 | |
| 22 | **Difference from `/git:summary`** – That command is read-only, while `aipcc:commit-suggest` generates actionable commit message suggestions for user review and manual use. |
| 23 | |
| 24 | ## Implementation |
| 25 | |
| 26 | The command operates in two modes based on input: |
| 27 | |
| 28 | **Mode 1 (no argument):** |
| 29 | 1. Collect staged changes via `git diff --cached` |
| 30 | 2. Analyze file paths and code content to determine appropriate AIPCC ticket reference |
| 31 | 3. Generate 3 AIPCC-formatted commit message suggestions (Recommended, Standard, Minimal) |
| 32 | 4. Display formatted suggestions and prompt user for selection |
| 33 | - Ask: "Which suggestion would you like to use? (1/2/3 or skip)" |
| 34 | - Support responses: `1`, `use option 2`, `commit with option 3`, `skip` |
| 35 | - Execute `git commit -s` with selected message if user requests (includes sign-off) |
| 36 | |
| 37 | **Mode 2 (with N):** |
| 38 | 1. Retrieve last N commits using `git log` |
| 39 | 2. Parse commit messages and analyze changes to maintain AIPCC format consistency |
| 40 | 3. For **N=1**: Suggest improved rewrite following AIPCC format |
| 41 | For **N≥2**: Merge commits into unified AIPCC-formatted squash message |
| 42 | 4. Generate 3 AIPCC-formatted commit message suggestions (Recommended, Standard, Minimal) |
| 43 | 5. Display formatted suggestions and prompt user for selection |
| 44 | - Ask: "Which suggestion would you like to use? (1/2/3 or skip)" |
| 45 | - Support responses: `1`, `use option 2`, `amend with option 3`, `skip` |
| 46 | - Execute `git commit --amend -s` (N=1) or squash operation (N≥2) if user requests |
| 47 | |
| 48 | ## Examples |
| 49 | |
| 50 | ```bash |
| 51 | # Generate message for staged files |
| 52 | git add src/auth.ts src/middleware.ts |
| 53 | /aipcc:commit-suggest |
| 54 | |
| 55 | # Rewrite last commit message |
| 56 | /aipcc:commit-suggest 1 |
| 57 | |
| 58 | # Summarize last 5 commits for squash |
| 59 | /aipcc:commit-suggest 5 |
| 60 | ``` |
| 61 | |
| 62 | ## Return Value |
| 63 | |
| 64 | Generates 3 AIPCC-formatted commit message suggestions: |
| 65 | - **Suggestion #1 (Recommended)** – Detailed with full body and Jira integration |
| 66 | - **Suggestion #2 (Standard)** – Concise with essential information |
| 67 | - **Suggestion #3 (Minimal)** – Brief description with required elements |
| 68 | |
| 69 | Each suggestion includes: |
| 70 | <!-- skillsaw-disable content-placeholder-text --> |
| 71 | - AIPCC format title (`AIPCC-XXX: description`) |
| 72 | - Blank line between title and body |
| 73 | - Body text explaining the changes in complete sentences |
| 74 | - Optional Jira integration (`Fixes AIPCC-XXX`) |
| 75 | - Required sign-off line |
| 76 | |
| 77 | **Example:** |
| 78 | ``` |
| 79 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 80 | Suggestion #1 (Recommended) |
| 81 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 82 | AIPCC-123: Add JWT authentication middleware |
| 83 | |
| 84 | Implement token-based authentication for API endpoints to enhance |
| 85 | security. The middleware verifies JWT tokens and extracts user |
| 86 | information for authorization decisions. |
| 87 | |
| 88 | Fixes AIPCC-123 |
| 89 | |
| 90 | Co-Authored-By: [AI_NAME] ([AI_MODEL]) |
| 91 | |
| 92 | Signed-off-by: Your Name <your.email@example.com> |
| 93 | |
| 94 | Which suggestion would you like to use? (1/2/3 or skip) |
| 95 | ``` |
| 96 | |
| 97 | ### Mode 2 Specifics |
| 98 | |
| 99 | - **N=1** – Suggest improved rewrite for the last commit in AIPCC format |
| 100 | - **N≥2** – Generate unified AIPCC-formatted squash message with footer: `Squashed from N commits:` + original commit list |
| 101 | |
| 102 | ## Commit Message Format Requirements |
| 103 | |
| 104 | ### AIPCC Format |
| 105 | All commits must follow this project-specific format: |
| 106 | ``` |
| 107 | AIPCC-XXX: Short description |
| 108 | |
| 109 | Longer explanation of what the commit does, written in at least one |
| 110 | complete sentence explaining the purpose and impact of the change. |
| 111 | |
| 112 | [Optional: Fixes AIPCC-XXX] |
| 113 | |
| 114 | [Optional: Co-Authored-By: [AI_NAME] ([AI_MODEL])] |
| 115 | |
| 116 | Signed-off-by: Your Name <your.email@example.com> |
| 117 | ``` |
| 118 | |
| 119 | ### Required Elements |
| 120 | <!-- skillsaw-disable content-placeholder-text --> |
| 121 | - **Title**: Must start with "AIPCC-XXX:" followed by a short description |
| 122 | - **Body**: Must explain what the commit does in at least one complete sentence |
| 123 | - **Sign-off**: All commits must include `Signed-off-by` line (use `git commit -s`) |
| 124 | |
| 125 | ### Optional Elements |
| 126 | - **Jira Integration**: Include "Fixes AIPCC-XXX" in the body to automatically close the Jira ticket when MR merges |
| 127 | - **Co-authors**: `Co-Authored-By: Name <email@example.com>` |
| 128 | - **AI Attribution**: `Co-Authored-By: [AI_NAME] ([AI_MODEL])` when AI assists with code generation |
| 129 | - **Breaking Changes**: Note significant API changes in the body |
| 130 | |
| 131 | ### Examples |
| 132 | ``` |
| 133 | AIPCC-456: Fix memory leak in authentication service |
| 134 | |
| 135 | Resolve |