Retrospective Analyze Skill
User Input
$ARGUMENTS
Consider user input before proceeding (if not empty).
Goal
Analyze completed implementation against spec.md, plan.md, and tasks.md to measure spec adherence and drift. Generate actionable insights for future SDD cycles.
Constraints
- Output: Generates and saves
retrospective.md report to FEATURE_DIR
- Post-Implementation: Run after implementation complete; warn if <80% tasks done, confirm before proceeding if <50%
- Human Gate for spec changes: before any action that modifies
spec.md (including /speckit.specify handoff), explicitly ask for user confirmation and stop if not approved
- Confirmation policy: default is NO. Only explicit approvals (
y, yes, si, s, sí) count as consent
Execution Steps
1. Initialize Context
Run .specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks from repo root. Parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive paths: SPEC, PLAN, TASKS = FEATURE_DIR/{spec,plan,tasks}.md. Abort if missing.
For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'''m Groot' (or double-quote if possible: "I'm Groot").
2. Validate Completeness
total_tasks=$(grep -c '^- \[[ Xx]\]' "$TASKS" || echo 0)
completed_tasks=$(grep -c '^- \[[Xx]\]' "$TASKS" || echo 0)
if [ "$total_tasks" -eq 0 ]; then
echo "No tasks found in $TASKS" && exit 1
fi
completion_rate=$((completed_tasks * 100 / total_tasks))
Completion thresholds:
=80%: Proceed with full retrospective
- 50-79%: Warn about incomplete implementation, continue with partial analysis
- <50%: STOP and confirm before continuing
3. Load Artifacts
spec.md: FR-XXX, NFR-XXX, SC-XXX, user stories, assumptions, edge cases
plan.md: Architecture, data model, phases, constraints, dependencies
tasks.md: All tasks with status, file paths, blockers
- constitution:
.specify/memory/constitution.md (if exists)
4. Discover Implementation
- Extract file paths from completed tasks plus recent git history
- Inventory: Models, APIs, Services, Tests, Config changes
- Audit: Libraries, frameworks, integrations actually used
5. Spec Drift Analysis
Perform:
- Requirement coverage (implemented, partial, not implemented, modified, unspecified)
- Success criteria validation
- Architecture drift against plan
- Task fidelity (completed/modified/added/dropped)
- Timeline and blockers (if available)
Calculate:
Spec Adherence % = ((IMPLEMENTED + MODIFIED + (PARTIAL * 0.5)) / (Total Requirements - UNSPECIFIED)) * 100
Where Total Requirements is the count of all FR-XXX, NFR-XXX, SC-XXX from spec.md.
6. Severity Classification
Classify findings as:
- CRITICAL (core functionality or constitution violations)
- SIGNIFICANT (deviations that affect UX/performance/operations)
- MINOR (small or cosmetic variations)
- POSITIVE (improvements over spec)
7. Innovation Opportunities
For positive deviations, document:
- What improved
- Why it is better
- Reusability potential
- Whether it is a constitution candidate
8. Root Cause Analysis
For key deviations capture:
- Discovery point (planning/implementation/testing/review)
- Cause (spec gap, tech constraint, scope evolution, misunderstanding, improvement, process skip)
- Prevention recommendation
9. Constitution Compliance
Check each constitution article against implementation. Treat violations as CRITICAL.
10. Generate Report
Create retrospective.md with:
- YAML frontmatter (feature, branch, date, completion_rate, spec_adherence, counts)
- Executive summary
- Proposed Spec Changes (explicit list of intended
spec.md edits, grouped by FR/NFR/SC and rationale)
- Requirement coverage matrix
- Success criteria assessment
- Architecture drift table
- Significant deviations
- Innovations and best practices
- Constitution compliance
- Unspecified implementations
- Task execution analysis
- Lessons learned and recommendations
- File traceability appendix
11. Self-Assessment Checklist (Required)
Before finalizing output, run this checklist and mark each item as PASS/FAIL:
- Evidence completeness:
- Every major deviation includes concrete evidence (file/task/behavior).
- Coverage integrity:
- FR/NFR/SC coverage is complete with no missing requirement IDs.
- Metrics sanity:
completion_rate and spec_adherence formulas are applied correctly.
- Severity consistency:
- CRITICAL/SIGNIFICANT/MINOR/POSITIVE labels match stated impact.
- Constitution review:
- Constitution violations are explicitly listed (or
None is stated).
- Human Gate readiness:
- If spec changes are proposed,
Proposed Spec Changes is populated and ready for user confirmation.
- Actionability:
- Recommendations are specific, prioritized, and directly tied to findings.
Blocking rule:
- If any of these fail:
Coverage integrity, Metrics sanity, Human Gate readiness (when applicable), or Constitution review, do not finalize the report. Fix the gaps first.
12. Save Report
- Write to
FEATURE_DIR/retrospective.md
- Optionally commit with:
feat(retrospective): add spec adherence report (adherence X%, completion X%)
- Confirm:
Retrospective saved | Adherence: X% | Critical findings: X
13. Human Gate Before Spec Changes
If retrospective findings recommend updating or regenerating the spec:
- Present a short summary of the proposed
spec.md changes, referencing the Proposed Spec Changes section.
- Ask explicitly:
Do you want me to modify spec.md now? (y/N)
- Treat any response other than
y, yes, si, s, or sí as NO.
- Require a separate confirmation for each spec-modifying action (for example, each
/speckit.specify run or direct spec.md edit).
- If declined or no response, do not modify spec and continue with report-only recommendations.
Treat launching /speckit.specify as a spec-modifying action that requires this gate.
14. Follow-up Actions
Prioritize:
- CRITICAL: constitution violations, breaking changes, security issues
- HIGH: significant drift and process improvements
- MEDIUM: best practices and constitution candidates
- LOW: minor optimizations
Follow-up commands:
/speckit.constitution for violations
/speckit.specify for spec updates
/speckit.checklist for new checklists
Guidelines
Count as Drift
Features differing from spec, dropped requirements, scope creep, or changes in technical approach.
Not Drift
Implementation details, bounded optimizations, bug fixes, refactoring, and test improvements.
Principles
- Facts over judgments
- Process over blame
- Positive deviations are learning opportunities
- Keep report concise and actionable
Source: ahmedemad3/super-ai-agency-framework — distributed by TomeVault.
1---2name: speckit-retrospective-analyze3description: Perform a post-implementation retrospective analysis measuring spec adherence, Use when this capability is needed.4---56# Retrospective Analyze Skill78## User Input910```text11$ARGUMENTS12```1314Consider user input before proceeding (if not empty).1516## Goal1718Analyze completed implementation against `spec.md`, `plan.md`, and `tasks.md` to measure spec adherence and drift. Generate actionable insights for future SDD cycles.1920## Constraints2122- Output: Generates and saves `retrospective.md` report to FEATURE_DIR23- Post-Implementation: Run after implementation complete; warn if <80% tasks done, confirm before proceeding if <50%24- Human Gate for spec changes: before any action that modifies `spec.md` (including `/speckit.specify` handoff), explicitly ask for user confirmation and stop if not approved25- Confirmation policy: default is NO. Only explicit approvals (`y`, `yes`, `si`, `s`, `sí`) count as consent2627## Execution Steps2829### 1. Initialize Context3031Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` from repo root. Parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive paths: SPEC, PLAN, TASKS = FEATURE_DIR/{spec,plan,tasks}.md. Abort if missing.3233For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'''m Groot' (or double-quote if possible: "I'm Groot").3435### 2. Validate Completeness3637```bash38total_tasks=$(grep -c '^- \[[ Xx]\]' "$TASKS" || echo 0)39completed_tasks=$(grep -c '^- \[[Xx]\]' "$TASKS" || echo 0)40if [ "$total_tasks" -eq 0 ]; then41 echo "No tasks found in $TASKS" && exit 142fi43completion_rate=$((completed_tasks * 100 / total_tasks))44```4546Completion thresholds:47- >=80%: Proceed with full retrospective48- 50-79%: Warn about incomplete implementation, continue with partial analysis49- <50%: STOP and confirm before continuing5051### 3. Load Artifacts5253- `spec.md`: FR-XXX, NFR-XXX, SC-XXX, user stories, assumptions, edge cases54- `plan.md`: Architecture, data model, phases, constraints, dependencies55- `tasks.md`: All tasks with status, file paths, blockers56- constitution: `.specify/memory/constitution.md` (if exists)5758### 4. Discover Implementation5960- Extract file paths from completed tasks plus recent git history61- Inventory: Models, APIs, Services, Tests, Config changes62- Audit: Libraries, frameworks, integrations actually used6364### 5. Spec Drift Analysis6566Perform:671. Requirement coverage (implemented, partial, not implemented, modified, unspecified)682. Success criteria validation693. Architecture drift against plan704. Task fidelity (completed/modified/added/dropped)715. Timeline and blockers (if available)7273Calculate:7475```text76Spec Adherence % = ((IMPLEMENTED + MODIFIED + (PARTIAL * 0.5)) / (Total Requirements - UNSPECIFIED)) * 10077```7879Where Total Requirements is the count of all FR-XXX, NFR-XXX, SC-XXX from `spec.md`.8081### 6. Severity Classification8283Classify findings as:84- CRITICAL (core functionality or constitution violations)85- SIGNIFICANT (deviations that affect UX/performance/operations)86- MINOR (small or cosmetic variations)87- POSITIVE (improvements over spec)8889### 7. Innovation Opportunities9091For positive deviations, document:92- What improved93- Why it is better94- Reusability potential95- Whether it is a constitution candidate9697### 8. Root Cause Analysis9899For key deviations capture:100- Discovery point (planning/implementation/testing/review)101- Cause (spec gap, tech constraint, scope evolution, misunderstanding, improvement, process skip)102- Prevention recommendation103104### 9. Constitution Compliance105106Check each constitution article against implementation. Treat violations as CRITICAL.107108### 10. Generate Report109110Create `retrospective.md` with:111- YAML frontmatter (feature, branch, date, completion_rate, spec_adherence, counts)112- Executive summary113- Proposed Spec Changes (explicit list of intended `spec.md` edits, grouped by FR/NFR/SC and rationale)114- Requirement coverage matrix115- Success criteria assessment116- Architecture drift table117- Significant deviations118- Innovations and best practices119- Constitution compliance120- Unspecified implementations121- Task execution analysis122- Lessons learned and recommendations123- File traceability appendix124125### 11. Self-Assessment Checklist (Required)126127Before finalizing output, run this checklist and mark each item as PASS/FAIL:128129- Evidence completeness:130 - Every major deviation includes concrete evidence (file/task/behavior).131- Coverage integrity:132 - FR/NFR/SC coverage is complete with no missing requirement IDs.133- Metrics sanity:134 - `completion_rate` and `spec_adherence` formulas are applied correctly.135- Severity consistency:136 - CRITICAL/SIGNIFICANT/MINOR/POSITIVE labels match stated impact.137- Constitution review:138 - Constitution violations are explicitly listed (or `None` is stated).139- Human Gate readiness:140 - If spec changes are proposed, `Proposed Spec Changes` is populated and ready for user confirmation.141- Actionability:142 - Recommendations are specific, prioritized, and directly tied to findings.143144Blocking rule:145- If any of these fail: `Coverage integrity`, `Metrics sanity`, `Human Gate readiness` (when applicable), or `Constitution review`, do not finalize the report. Fix the gaps first.146147### 12. Save Report1481491. Write to `FEATURE_DIR/retrospective.md`1502. Optionally commit with:151 - `feat(retrospective): add spec adherence report (adherence X%, completion X%)`1523. Confirm:153 - `Retrospective saved | Adherence: X% | Critical findings: X`154155### 13. Human Gate Before Spec Changes156157If retrospective findings recommend updating or regenerating the spec:1581591. Present a short summary of the proposed `spec.md` changes, referencing the `Proposed Spec Changes` section.1602. Ask explicitly: `Do you want me to modify spec.md now? (y/N)`1613. Treat any response other than `y`, `yes`, `si`, `s`, or `sí` as NO.1624. Require a separate confirmation for each spec-modifying action (for example, each `/speckit.specify` run or direct `spec.md` edit).1635. If declined or no response, do not modify spec and continue with report-only recommendations.164165Treat launching `/speckit.specify` as a spec-modifying action that requires this gate.166167### 14. Follow-up Actions168169Prioritize:1701. CRITICAL: constitution violations, breaking changes, security issues1712. HIGH: significant drift and process improvements1723. MEDIUM: best practices and constitution candidates1734. LOW: minor optimizations174175Follow-up commands:176- `/speckit.constitution` for violations177- `/speckit.specify` for spec updates178- `/speckit.checklist` for new checklists179180## Guidelines181182### Count as Drift183184Features differing from spec, dropped requirements, scope creep, or changes in technical approach.185186### Not Drift187188Implementation details, bounded optimizations, bug fixes, refactoring, and test improvements.189190### Principles191192- Facts over judgments193- Process over blame194- Positive deviations are learning opportunities195- Keep report concise and actionable196197---198> Source: [ahmedemad3/super-ai-agency-framework](https://github.com/ahmedemad3/super-ai-agency-framework) — distributed by [TomeVault](https://tomevault.io).199<!-- tomevault:4.0:skill_md:2026-06-23 -->