Skip to content

Conversation

jcastillopino
Copy link

@jcastillopino jcastillopino commented Sep 25, 2025

Overview

Enhanced the .specify workflow to support explicit feature names while maintaining backward compatibility with description-based branch naming. This change allows users to provide precise, meaningful branch names when needed while keeping automatic slug generation for simple cases.
Note: GitHub Copilot was used to understand the codebase, to get advices to improve the prompt and to write most of this comment.

Fixes #518

Changes Made

1. PowerShell and Bash Scripts Enhancement (.specify/scripts/powershell/create-new-feature.ps1, .specify/scripts/bash/create-new-feature.sh).

Note: bash file was generated using Copilot and was tested by myself.

New Parameter:

  • Added optional -FeatureName parameter to accept explicit feature names
  • Parameter is trimmed and sanitized through the same slug generation process

Enhanced Helper Function:

  • Updated Get-FeatureSlug with configurable WordLimit parameter (defaults to 3)
  • When WordLimit = 0, preserves all words from the input
  • When WordLimit > 0, caps output to specified number of words
  • Added proper documentation matching existing function comment style

Branch Name Logic:

  • Explicit feature names use unlimited word count (WordLimit = 0)
  • Description-based fallback maintains 3-word limit (WordLimit = 3)
  • Preserves numeric prefix system (001-, 002-, etc.)
  • Handles empty slug scenarios gracefully (falls back to numeric prefix only)

2. Prompt Workflow Updates (.github/prompts/specify.prompt.md)

Feature Name Detection:

  • Parses user input for explicit feature name directives
  • Supports multiple formats: feature-name:, feature name:, branch-name:, branch name: (case-insensitive)
  • Strips directive lines from feature description

Enhanced Agent Instructions:

  • When no explicit name provided, agent synthesizes 3-5 word Title Case feature name
  • Always passes -FeatureName argument to script (either explicit or synthesized)
  • Maintains "run exactly once" requirement
  • Preserves all existing workflow steps

Behavior Examples

Before (Description Only)

./create-new-feature.ps1 -Json "Implement asynchronous processing for uploads with validation and error handling"
# Result: 002-implement-asynchronous-processing

After (Explicit Feature Name)

./create-new-feature.ps1 -Json -FeatureName "Massively Parallel Upload Coordinator" "Implement asynchronous processing..."
# Result: 002-massively-parallel-upload-coordinator

After (Agent Synthesized Name)

User input: Upload Processing Enhancement
Agent synthesizes: "Upload Processing Enhancement"

./create-new-feature.ps1 -Json -FeatureName "Upload Processing Enhancement" "Implement asynchronous processing..."
# Result: 002-upload-processing-enhancement

Backward Compatibility

  • Existing scripts and workflows continue to work unchanged
  • Description-only invocations produce same branch names as before
  • All existing parameters and JSON output format preserved
  • Fallback behavior identical to previous implementation

Testing Performed

  • ✅ Description-only branch creation (3-word limit maintained)
  • ✅ Explicit feature name (all words preserved)
  • ✅ Empty/whitespace feature name handling
  • ✅ Special character sanitization in feature names
  • ✅ JSON output format consistency
  • ✅ Git branch creation and cleanup

Impact

This enhancement provides greater control over branch naming while maintaining the automatic, sensible defaults that make the workflow easy to use. Users can now specify precise, meaningful branch names when working on complex features while still benefiting from automatic slug generation for routine work.

- Add `-FeatureName` parameter to `.specify/scripts/powershell/create-new-feature.ps1`
- Update `Get-FeatureSlug` helper with configurable word limit
- Modify `.github/prompts/specify.prompt.md` to parse feature name directives
- Explicit feature names retain all words while descriptions cap at 3 words
- Maintain backward compatibility when no feature name provided
… script

- Add support for explicit feature name parameter (--feature-name)
- Implement get_feature_slug() function with configurable word limits
- Prioritize explicit feature names over description-derived names
- Add HAS_GIT field to JSON output for consistency with PowerShell version
- Enhance argument parsing with proper error handling
- Match feature parity with PowerShell version of the script
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 12:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enhanced the .specify workflow to support AI-driven feature name generation alongside explicit feature names, providing users greater control over branch naming while maintaining backward compatibility.

  • Added explicit feature name parameter support to both PowerShell and Bash scripts
  • Updated prompt workflow to parse feature name directives and synthesize meaningful names when none provided
  • Refactored slug generation logic into reusable functions with configurable word limits

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
templates/commands/specify.md Updated prompt instructions to parse feature name directives and synthesize names when needed
scripts/powershell/create-new-feature.ps1 Added FeatureName parameter and refactored slug generation into Get-FeatureSlug function
scripts/bash/create-new-feature.sh Added feature-name parameter parsing and get_feature_slug function implementation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jcastillopino
Copy link
Author

@localden This PR is ready for review. Is there anything else that I have to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/specify new branch problems
1 participant