Skip to content

Add Hook System for Workflow Automation #343

@amondnet

Description

@amondnet

Summary

Propose adding a Git-style hook system to Spec Kit that allows users to run custom scripts at key points in the specification workflow, enabling powerful automation and integration capabilities.

Motivation

Currently, Spec Kit provides excellent templates and workflow structure, but lacks extensibility for team-specific automation needs. A hook system would allow teams to:

Integrate with existing tools (JIRA, GitHub Issues, Slack)
Automate repetitive tasks (ID generation, notifications, translations)
Enforce organizational policies and standards
Customize workflows without modifying core Spec Kit code

Proposed Solution

Hook Structure

.specify/
├── hooks/
│   ├── pre-specify*
│   ├── prepare-feature-num*
│   ├── post-checkout*
│   ├── post-specify*
│   ├── pre-plan*
│   ├── post-plan*
│   ├── pre-tasks*
│   └── post-tasks*
├── hooks/samples/
│   ├── pre-specify.sample
│   └── post-specify.sample
└── config/
    └── hooks.yaml

Hook Execution Points

  • pre-specify: Before spec generation
  • post-specify: After spec creation
  • pre-plan: Before plan generation
  • post-plan: After plan creation
  • pre-tasks: Before task breakdown
  • post-tasks: After task generation

Example Use Cases

Feature-Number Hook

bash#!/bin/sh
# Auto-generate feature number from server
FEATURE_NUMBER=$(curl -s "$SPEC_SERVER/api/next-number")
export FEATURE_NUMBER

# Create GitHub issue and link
ISSUE_URL=$(gh issue create --title "Spec: $1" --body "Specification development")
export GITHUB_ISSUE_NUMBER=$(echo $ISSUE_URL | grep -o '#[0-9]*' | cut -c2-)

# Set branch name
export BRANCH_NAME="${FEATURE_NUMBER}-$(echo $1 | tr ' ' '-' | tr '[:upper:]' '[:lower:]')"

Post-Specify Hook

bash#!/bin/sh
# Translate to multiple languages
if [ "$ENABLE_TRANSLATION" = "true" ]; then
    claude-translate "$1" "${1%.md}-ko.md" --target-lang ko
    claude-translate "$1" "${1%.md}-ja.md" --target-lang ja
fi

# Update issue tracker
gh issue edit $GITHUB_ISSUE_NUMBER --body-file "$1"
jira-cli update $JIRA_TICKET --description-file "$1"

# Notify team
slack-notify "#product" "New spec created: $(basename $1)"

Benefits

  • Extensibility: Teams can customize workflows without forking Spec Kit
  • Integration: Seamless connection with existing tools and systems
  • Automation: Reduce manual tasks and human error
  • Standardization: Enforce organizational policies and conventions
  • Localization: Support for multi-language teams through automated translation
  • Compliance: Automatic validation and approval workflows

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions