detect-kiro-specs

reedom's avatarfrom reedom

Detect Kiro specs with modified files in current branch. Use before PRs, spec-specific tests, or CI filtering.

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 22, 2025

When & Why to Use This Skill

This Claude skill automates the detection of modified Kiro specifications within a Git branch by analyzing file changes against the base branch. It streamlines the development workflow by identifying exactly which specs are impacted by code updates, enabling targeted testing and more efficient CI/CD filtering to reduce build times and resource consumption.

Use Cases

  • Pre-PR Validation: Automatically identify and run only the relevant Kiro specs before submitting a pull request to ensure changes are verified without running the entire test suite.
  • CI/CD Pipeline Optimization: Integrate the script into CI pipelines to dynamically filter and execute specific test suites based on modified files, significantly speeding up feedback loops.
  • Local Development Efficiency: Help developers quickly determine which specifications require re-verification after making local changes, improving productivity during the coding phase.
  • Change Impact Analysis: Provide a clear list of affected functional areas (specs) for better code review context and risk assessment.
namedetect-kiro-specs
descriptionDetect Kiro specs with modified files in current branch. Use before PRs, spec-specific tests, or CI filtering.
allowed-toolsBash(ls:*)

Modified Kiro Specs Detection

IMPORTANT: Check .kiro/specs exists via ls before start. If absent, quit immediately with empty list.

Usage

./scripts/main.sh [-b|--branch <branch>]

Options:

  • -b, --branch: Base branch (default: repo default)

Output

Newline-separated spec names, sorted:

user-auth
product-listing

Empty if no modified specs.

main.sh Internal Detection Logic

  1. List all specs from .kiro/specs/
  2. Get modified files via git diff <branch>...HEAD
  3. Match files containing /<spec-name>/ pattern
  4. Return distinct matches sorted alphabetically

Examples

# Default branch
./scripts/main.sh

# Specific branch
./scripts/main.sh -b develop

# Count
./scripts/main.sh | wc -l

# CI loop
for spec in $(./scripts/main.sh); do
  run_tests "$spec"
done