Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ Use **`/speckit.implement`** to execute all tasks and build your feature accordi
/speckit.implement
```

### 7. Review and clean up (Extension)

Install and use the **cleanup extension** to review all implementation changes, identify tech debt, and ensure code quality.

```bash
# Install the cleanup extension
specify extension add cleanup

# Run cleanup
/speckit.cleanup
```

For detailed step-by-step instructions, see our [comprehensive guide](./spec-driven.md).

## 📽️ Video Overview
Expand Down Expand Up @@ -259,6 +271,14 @@ Essential commands for the Spec-Driven Development workflow:
| `/speckit.tasks` | Generate actionable task lists for implementation |
| `/speckit.implement` | Execute all tasks to build the feature according to the plan |

#### Extension Commands

Commands provided by optional extensions:

| Command | Extension | Description |
| ----------------------- | --------- | ------------------------------------------------------------------------ |
| `/speckit.cleanup` | cleanup | Review implementation, fix small issues, identify tech debt |

#### Optional Commands

Additional commands for enhanced quality and validation:
Expand Down Expand Up @@ -614,6 +634,34 @@ The `/speckit.implement` command will:

Once the implementation is complete, test the application and resolve any runtime errors that may not be visible in CLI logs (e.g., browser console errors). You can copy and paste such errors back to your AI agent for resolution.

### **STEP 8:** Clean up and review (Extension)

After implementation is complete, install and use the cleanup extension to perform a final quality review:

```text
# Install the cleanup extension first
specify extension add cleanup

# Run cleanup
/speckit.cleanup
```

The `/speckit.cleanup` command will:

- Review all files modified during implementation
- **Fix small issues immediately** (Scout Rule): Remove debugging artifacts (console.log, print statements), unused imports, dead code, and other mechanical issues
- **Create follow-up tasks** for medium issues: Missing error handling, code duplication, incomplete documentation
- **Generate detailed analysis** for large issues: Architectural concerns, security vulnerabilities, performance bottlenecks - each with multiple options and recommendations

The cleanup phase produces:

- **Direct fixes** committed with clear messages for small issues
- **Tech Debt Tasks section** appended to `tasks.md` for medium issues (can be addressed by re-running `/speckit.implement`)
- **`tech-debt-report.md`** for large issues requiring team discussion, with problem descriptions, impact assessments, and recommended approaches

> [!NOTE]
> The cleanup command will halt on critical security issues (hardcoded credentials, exposed secrets) and require you to fix them before proceeding.

</details>

---
Expand Down
30 changes: 28 additions & 2 deletions extensions/catalog.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
{
"schema_version": "1.0",
"updated_at": "2026-02-03T00:00:00Z",
"updated_at": "2026-02-20T00:00:00Z",
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/extensions/catalog.json",
"extensions": {}
"extensions": {
"cleanup": {
"name": "Cleanup",
"id": "cleanup",
"description": "Post-implementation quality gate that reviews changes, fixes small issues (scout rule), creates tasks for medium issues, and generates analysis for large issues.",
"author": "Spec Kit Contributors",
"version": "1.0.0",
"download_url": "https://github.com/github/spec-kit/archive/refs/heads/main.zip",
"repository": "https://github.com/github/spec-kit",
"homepage": "https://github.com/github/spec-kit/tree/main/extensions/cleanup",
"documentation": "https://github.com/github/spec-kit/tree/main/extensions/cleanup/README.md",
"license": "MIT",
"requires": {
"speckit_version": ">=0.1.0"
},
"provides": {
"commands": 1,
"hooks": 1
},
"tags": ["quality", "tech-debt", "review", "cleanup", "scout-rule"],
"verified": true,
"downloads": 0,
"stars": 0,
"created_at": "2026-02-20T00:00:00Z",
"updated_at": "2026-02-20T00:00:00Z"
}
}
}
12 changes: 12 additions & 0 deletions extensions/cleanup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Local configuration (user-specific overrides)
*-config.local.yml

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db
21 changes: 21 additions & 0 deletions extensions/cleanup/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to the Cleanup extension will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2026-02-20

### Added

- Initial release of the Cleanup extension
- Post-implementation quality gate command (`/speckit.cleanup.run`)
- Issue detection by severity (CRITICAL, LARGE, MEDIUM, SMALL)
- Scout Rule implementation for small issues (auto-fix with confirmation)
- Tech debt task creation for medium issues
- Tech debt report generation for large issues
- Constitution validation for all cleanup actions
- Linter and test runner integration
- `after_implement` hook for automatic cleanup prompting
- Alias support (`/speckit.cleanup` -> `/speckit.cleanup.run`)
22 changes: 22 additions & 0 deletions extensions/cleanup/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright GitHub, Inc.
Copyright (c) 2026 Dominik Srednicki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
103 changes: 103 additions & 0 deletions extensions/cleanup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Cleanup Extension for Spec Kit

Post-implementation quality gate that reviews changes, fixes small issues (scout rule), creates tasks for medium issues, and generates analysis for large issues.

## Installation

```bash
# From the spec-kit extensions directory
specify extension add cleanup

# Or install from local development
specify extension add --dev /path/to/spec-kit/extensions/cleanup
```

## Usage

After completing implementation with `/speckit.implement`, run the cleanup command:

```bash
/speckit.cleanup
```

The cleanup command will:

1. **Review all implementation changes** - Analyzes files modified during implementation
2. **Detect issues by severity**:
- **CRITICAL**: Security vulnerabilities requiring immediate attention
- **LARGE**: Architecture concerns requiring team discussion
- **MEDIUM**: Code quality issues requiring follow-up tasks
- **SMALL**: Mechanical fixes that can be applied immediately
3. **Apply fixes with user confirmation** - Small issues are fixed following the Scout Rule
4. **Create tech debt tasks** - Medium issues become follow-up tasks in tasks.md
5. **Generate analysis reports** - Large issues get detailed analysis in tech-debt-report.md

## Issue Detection

### Small Issues (Auto-fixable)
- Debugging artifacts (console.log, print statements, debugger)
- Unused imports
- Dead/unreachable code
- Hardcoded localhost URLs

### Medium Issues (Task Creation)
- Missing error handling
- Code duplication
- Missing documentation
- Disabled tests without reason

### Large Issues (Analysis Required)
- Circular dependencies
- Business logic in wrong layer
- Performance anti-patterns
- Security design issues

### Critical Issues (Halt)
- Hardcoded credentials/secrets
- Disabled authentication checks

## Outputs

| Artifact | Description |
|----------|-------------|
| Direct fixes | Small issues fixed in-place with commit |
| tasks.md | Tech Debt Tasks section appended for medium issues |
| tech-debt-report.md | Detailed analysis for large issues with options |

## Workflow Integration

The cleanup command integrates with the Spec Kit workflow:

```
/speckit.specify -> /speckit.plan -> /speckit.tasks -> /speckit.implement -> /speckit.cleanup
|
v
/speckit.implement (for tech debt tasks)
```

## Configuration

No additional configuration required. The extension uses the project's existing:
- Constitution (`/memory/constitution.md`) - for validation rules
- Linter configuration - for style deference
- Test runner - for validation

## Commands

| Command | Description |
|---------|-------------|
| `/speckit.cleanup.run` | Run post-implementation quality gate |
| `/speckit.cleanup` | Alias for `/speckit.cleanup.run` |

## Hooks

This extension provides an `after_implement` hook that optionally prompts to run cleanup after `/speckit.implement` completes.

## Requirements

- Spec Kit >= 0.1.0
- Completed implementation (tasks.md with completed tasks)

## License

MIT
Loading