From 6d351d621d27f4b12a689b43a9b9333a1a64cddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=98=81=EC=B0=BD=28piknow=29?= Date: Sun, 26 Oct 2025 00:55:34 +0900 Subject: [PATCH] agent: add intelligent shortening to make-branch command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requirement: The make-branch command was generating overly long branch names by converting entire issue titles verbatim (e.g., i21-agent/rename-custom-commands-to-shorter-aliases-for-easier-invocation). Users need concise, manageable branch names under 50-60 characters while preserving essential meaning. Implementation: - Updated template from action-description_with_underscores to shortened-description - Added comprehensive "Shortening Strategy" section with length guidelines, filler word list, and shortening techniques - Enhanced examples section with "Basic" and "Shortening" subsections showing real shortening results - Modified implementation steps to include intelligent shortening (step 4) before formatting - Defined filler words to remove (the, a, for, to, of, with, in, on, at, by, from, that, this, using, instead, etc.) - Specified 50-char target, 60-char max with word-boundary truncation only - Added edge case handling for very short and already concise titles 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude/commands/make-branch.md | 73 +++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/.claude/commands/make-branch.md b/.claude/commands/make-branch.md index e345edd..5426b83 100644 --- a/.claude/commands/make-branch.md +++ b/.claude/commands/make-branch.md @@ -19,9 +19,11 @@ Generate consistent branch names from GitHub issue information. ## Template ``` -i{issue-index}-{type}/{action-description_with_underscores} +i{issue-index}-{type}/{shortened-description} ``` +The description is intelligently shortened to keep the total branch name under 50 characters while preserving the core intent. + ## Supported Types - `feat` - New features @@ -36,9 +38,7 @@ i{issue-index}-{type}/{action-description_with_underscores} ## Examples -- Input: `/make-branch [config]: issue template, pr template, claude commend -#5` -- Output: `i5-config/issue-template-pr-template-claude-commend` +### Basic Examples - Input: `/make-branch [feat]: implement Button component #15` @@ -46,22 +46,77 @@ i{issue-index}-{type}/{action-description_with_underscores} - Input: `/make-branch [fix]: resolve styling issues in Dialog #23` -- Output: `i23-fix/resolve-styling-issues-in-dialog` +- Output: `i23-fix/resolve-styling-issues` - Input: `/make-branch [doc]: add component usage examples #42` - Output: `i42-doc/add-component-usage-examples` +### Shortening Examples + +- Input: `/make-branch [config]: issue template, pr template, claude commend +#5` +- Output: `i5-config/issue-pr-template` + +- Input: `/make-branch [agent]: rename custom commands to shorter aliases for easier invocation +#21` +- Output: `i21-agent/rename-commands-to-aliases` + +- Input: `/make-branch [agent]: update make-task-issue to use prompt-based input instead of editor +#19` +- Output: `i19-agent/prompt-based-input` + +## Shortening Strategy + +Branch names should be concise and easy to work with while preserving the core intent of the issue. + +### Length Guidelines +- **Target**: 50 characters total (including prefix) +- **Maximum**: 60 characters (only if essential meaning requires it) +- **Format**: `i{index}-{type}/{description}` where the description portion is shortened + +### Filler Words to Remove +Common words that can be safely removed without losing meaning: +- Articles: the, a, an +- Prepositions: for, to, of, with, in, on, at, by, from +- Conjunctions: and, or, but +- Relative pronouns: that, this, which +- Helping phrases: using, instead, etc. + +### What to Keep +- **Action verbs**: add, create, update, fix, remove, implement, refactor, etc. +- **Key nouns**: Specific components, features, or concepts being modified +- **Critical context**: Terms that distinguish this work from similar changes + +### Shortening Techniques +1. Remove filler words first +2. Identify the core action and target +3. Use abbreviations for well-known terms (e.g., "config" for "configuration") +4. Combine related terms (e.g., "issue-pr-template" instead of "issue-template-pr-template") +5. Truncate at word boundaries only (never cut mid-word) +6. Verify the shortened name is still meaningful and specific + +### Edge Cases +- **Very short titles**: Don't over-shorten; maintain clarity +- **Already concise titles**: Keep them as-is if under 50 characters +- **Special characters**: Convert to hyphens as part of standard formatting + ## Implementation Parse the input to: 1. Extract the issue index from # 2. Extract the type from [] 3. Extract the description after the colon -4. Convert spaces to hyphens -5. Convert commas and special characters to hyphens -6. Remove duplicate hyphens -7. Format as i{index}-{type}/{description} +4. **Shorten the description intelligently:** + - Remove filler words (the, a, an, for, to, of, with, in, on, at, by, from, that, this, using, instead, etc.) + - Keep action verbs and key nouns that convey core intent + - Target 50 characters total for the branch name (allow up to 60 if needed) + - Use context from the issue to determine essential terms + - Truncate at word boundaries only (never mid-word) +5. Convert spaces to hyphens +6. Convert commas and special characters to hyphens +7. Remove duplicate hyphens +8. Format as i{index}-{type}/{shortened-description} ## Workflow