Sign in
Explore
Prompts · PromptEveryday codingTesting & SecurityReviewed

speckit.git.validate

Checks that the current branch follows the feature branch naming convention.

Kind
Prompt
Works with
Claude Code, Codex, GitHub Copilot, Cursor, Windsurf / Devin, Cline
Source
github/spec-kit @ c00dc0551583
Path
extensions/git/commands/speckit.git.validate.md
License
MIT
Jobs
Git workflow
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
# Validate Feature Branch

Validate that the current Git branch follows the expected feature branch naming conventions.

## Prerequisites

- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
- If Git is not available, output a warning and skip validation:
  ```
  [specify] Warning: Git repository not detected; skipped branch validation
  ```

## Validation Rules

Get the current branch name:

```bash
git rev-parse --abbrev-ref HEAD
```

The branch name's final path segment must start with one of these feature markers:

1. **Sequential**: `[0-9]{3,}-` (e.g., `001-feature-name`, `042-fix-bug`, `1000-big-feature`, `jdoe/web/008-guided-tour`)
2. **Timestamp**: `[0-9]{8}-[0-9]{6}-` (e.g., `20260319-143022-feature-name`, `jdoe/web/20260319-143022-feature-name`)

## Execution

If on a feature branch (matches either pattern):
- Output: `✓ On feature branch: <branch-name>`
- Check if the corresponding spec directory exists under `specs/`:
  - For sequential branches, look for `specs/<prefix>-*` where prefix matches the numeric portion, regardless of branch namespace prefixes
…