detect-kiro-specs
Detect Kiro specs with modified files in current branch. Use before PRs, spec-specific tests, or CI filtering.
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.
| name | detect-kiro-specs |
|---|---|
| description | Detect Kiro specs with modified files in current branch. Use before PRs, spec-specific tests, or CI filtering. |
| allowed-tools | Bash(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
- List all specs from
.kiro/specs/ - Get modified files via
git diff <branch>...HEAD - Match files containing
/<spec-name>/pattern - 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