feat: add /speckit.retro command — sprint retrospective & metrics#2042
feat: add /speckit.retro command — sprint retrospective & metrics#2042arunt14 wants to merge 2 commits intogithub:mainfrom
Conversation
Add a new core command for structured retrospective analysis covering: - Specification accuracy scoring - Plan effectiveness analysis - Implementation quality metrics (from review + QA data) - Git-based development metrics (commits, lines, duration) - What went well / what could improve - Actionable improvement suggestions ranked by impact - Historical trend analysis across cycles - Optional constitution updates with learned principles Inspired by GStack's /retro command.
63a572f to
a05d52d
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new core /speckit.retro workflow command and a corresponding retrospective report template, intended to close the loop after shipping by summarizing cycle metrics, learnings, and improvement actions.
Changes:
- Added
templates/commands/retro.mdto define the retrospective command workflow (including extension hooks). - Added
templates/retro-template.mdas the markdown output structure for generated retrospectives.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| templates/commands/retro.md | New command template describing how to gather artifacts, compute metrics, and generate the retro report (with before/after hook support). |
| templates/retro-template.md | New report template defining the retrospective markdown layout and metric sections. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
templates/commands/retro.md
Outdated
| Load all available artifacts from the development cycle: | ||
| - **REQUIRED**: Read `spec.md` — original specification and requirements | ||
| - **REQUIRED**: Read `tasks.md` — task breakdown and completion status | ||
| - **IF EXISTS**: Read `plan.md` — technical plan and architecture decisions |
There was a problem hiding this comment.
In the artifact list, plan.md is marked as “IF EXISTS”, but this command’s prerequisite script (check-prerequisites with --require-tasks) fails if plan.md is missing. To avoid the agent treating it as optional, mark plan.md as REQUIRED here (or relax the prerequisite script args if it truly should be optional).
| - **IF EXISTS**: Read `plan.md` — technical plan and architecture decisions | |
| - **REQUIRED**: Read `plan.md` — technical plan and architecture decisions |
templates/commands/retro.md
Outdated
| # Commit count for the feature | ||
| git rev-list --count origin/{target_branch}..HEAD | ||
|
|
||
| # Files changed | ||
| git diff --stat origin/{target_branch}..HEAD | ||
|
|
||
| # Lines added/removed | ||
| git diff --shortstat origin/{target_branch}..HEAD | ||
|
|
||
| # Number of authors | ||
| git log origin/{target_branch}..HEAD --format='%an' | sort -u | wc -l | ||
|
|
||
| # Date range (first commit to last) | ||
| git log origin/{target_branch}..HEAD --format='%ai' | tail -1 | ||
| git log origin/{target_branch}..HEAD --format='%ai' | head -1 |
There was a problem hiding this comment.
The git metric commands rely on an undefined {target_branch} placeholder and assume a remote named origin exists. Since template preprocessing doesn’t substitute {target_branch}, agents may execute these literally or guess incorrectly. Recommend either (1) add explicit instructions to determine the base ref (e.g., default branch / upstream) and use that value consistently, or (2) avoid the placeholder by using a computed merge-base/upstream ref in the commands.
| # Commit count for the feature | |
| git rev-list --count origin/{target_branch}..HEAD | |
| # Files changed | |
| git diff --stat origin/{target_branch}..HEAD | |
| # Lines added/removed | |
| git diff --shortstat origin/{target_branch}..HEAD | |
| # Number of authors | |
| git log origin/{target_branch}..HEAD --format='%an' | sort -u | wc -l | |
| # Date range (first commit to last) | |
| git log origin/{target_branch}..HEAD --format='%ai' | tail -1 | |
| git log origin/{target_branch}..HEAD --format='%ai' | head -1 | |
| # Determine the base ref for this feature once per repo. | |
| # Preferred: use the upstream branch (e.g., origin/main, origin/develop): | |
| # BASE_REF="$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream})" | |
| # | |
| # Or set it explicitly if there is no upstream configured: | |
| # BASE_REF=main | |
| # BASE_REF=develop | |
| # | |
| : "${BASE_REF:?Set BASE_REF to the base branch/ref for this feature (e.g., main, develop, or an upstream ref)}" | |
| # Commit count for the feature | |
| git rev-list --count "$BASE_REF"..HEAD | |
| # Files changed | |
| git diff --stat "$BASE_REF"..HEAD | |
| # Lines added/removed | |
| git diff --shortstat "$BASE_REF"..HEAD | |
| # Number of authors | |
| git log "$BASE_REF"..HEAD --format='%an' | sort -u | wc -l | |
| # Date range (first commit to last) | |
| git log "$BASE_REF"..HEAD --format='%ai' | tail -1 | |
| git log "$BASE_REF"..HEAD --format='%ai' | head -1 |
templates/commands/retro.md
Outdated
| - Output a trend summary table | ||
|
|
||
| 12. **Generate Retrospective Report**: | ||
| Create the retro report at `FEATURE_DIR/retros/retro-{timestamp}.md` using the retrospective report template. |
There was a problem hiding this comment.
Step 12 says to generate the report “using the retrospective report template”, but the workflow never instructs the agent to read the template file (e.g., .specify/templates/retro-template.md) nor to create FEATURE_DIR/retros/ if it doesn’t exist. Add an explicit step to load the template and ensure the destination directory exists before writing retro-{timestamp}.md.
| Create the retro report at `FEATURE_DIR/retros/retro-{timestamp}.md` using the retrospective report template. | |
| - Load the retrospective report template from `.specify/templates/retro-template.md`. If the template file does not exist or cannot be read, continue using a reasonable fallback structure based on the sections above. | |
| - Ensure the `FEATURE_DIR/retros/` directory exists. If it does not exist, create it before writing any files. | |
| - Generate the retro report at `FEATURE_DIR/retros/retro-{timestamp}.md`, using the loaded retrospective report template and filling it with the metrics, findings, and improvement suggestions from the previous steps. |
templates/retro-template.md
Outdated
| 📝 Specification | ||
| Requirements: [total] total, [fulfilled] fulfilled, [partial] partial | ||
| Spec Accuracy: [accuracy]% | ||
|
|
||
| 📋 Planning | ||
| Tasks: [total] total, [completed] completed | ||
| Added during impl: [unplanned_count] | ||
| Plan Score: [EXCELLENT / GOOD / ADEQUATE / NEEDS IMPROVEMENT] | ||
|
|
||
| 💻 Implementation | ||
| Commits: [count] | ||
| Files changed: [count] | ||
| Lines: +[additions] / -[deletions] | ||
| Test/Code ratio: [ratio] | ||
|
|
||
| 🔍 Quality | ||
| Review findings: 🔴[blockers] 🟡[warnings] 🟢[suggestions] | ||
| QA pass rate: [qa_pass_rate]% | ||
| Quality Score: [score] |
There was a problem hiding this comment.
Several placeholders in the dashboard are ambiguous/reused for different metrics (e.g., Requirements: [total]... and Tasks: [total]..., plus multiple [count] fields). This makes it easy to fill the template incorrectly or to auto-populate with the wrong values. Consider using distinct placeholder names (e.g., [req_total], [tasks_total], [commit_count], [files_changed]) and keep the same placeholder name for spec accuracy throughout (dashboard [accuracy]% vs later [X]%).
- Mark plan.md as REQUIRED (matches prerequisite script behavior)
- Replace undefined {target_branch} placeholder with BASE_REF computation
- Reference templates/retro-template.md explicitly and ensure dir exists
- Use distinct placeholder names in retro-template.md dashboard
|
Thanks for the thorough review! All 4 comments addressed in the latest push:
|
|
Please review https://github.com/github/spec-kit/blob/main/extensions/EXTENSION-PUBLISHING-GUIDE.md for publishing a community hosted extension |
|
Thanks @mnriem! I've reviewed the Extension Publishing Guide. Will restructure this as a community extension following the extension.yml manifest pattern and resubmit as an extension contribution to catalog.community.json. |
|
Closing in favor of PR #2049 — restructured as a community extension per maintainer feedback. Extension repo and v1.0.0 release are available. |
Description
Problem
Spec-Kit has no feedback loop. Once a feature is shipped, there is no structured way to reflect on: Was the spec accurate? Was the plan effective? Were there quality issues that slipped through? What should the team do differently next time? Without retrospectives, teams repeat the same mistakes across development cycles and miss opportunities to improve their spec-driven workflow.
The community
retrospectiveextension exists but is not part of core, and it lacks metrics tracking and trend analysis across multiple cycles.Industry context: GStack's
/retrocommand demonstrates that embedding retrospective analysis directly in the workflow — with data-driven metrics rather than subjective impressions — creates a continuous improvement engine. Teams using structured retros consistently improve their spec accuracy and reduce rework over time.Solution
Adds
/speckit.retro— a new core command that closes the development feedback loop with structured, data-driven retrospective analysis:Output: Structured retrospective report with metrics dashboard, improvement suggestions, and trend analysis.
Business Value
Workflow Position
Files Added
templates/commands/retro.mdbefore_retro,after_retro)templates/retro-template.mdTesting
uv run specify --helpuv sync && uv run pytest— 878/972 pass (44 failures are pre-existing, unrelated to this change)specify initAI Disclosure
implement.mdandanalyze.md. All content was reviewed and validated against the project's template conventions.