Skip to content
Closed
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
523 changes: 523 additions & 0 deletions KENT_BECK_TDD_INTEGRATION.md

Large diffs are not rendered by default.

269 changes: 269 additions & 0 deletions NEW_COMMANDS_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
# New Slash Commands for Spec-Kit

## Overview

This document describes two new productivity commands added to the Spec-Kit toolkit, designed to optimize Claude Code's context management and conversation efficiency.

## Commands Added

### 1. `/rec_remove_agents_mcp`

Comment on lines +1 to +10
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file describes "two new productivity commands" (/rec_remove_agents_mcp and /compact_with_topic) but doesn't mention the Kent Beck TDD commands (/speckit.init-tdd and /speckit.go) which are the main focus of this PR.

This creates documentation inconsistency. Consider either:

  1. Renaming this file to clarify it covers only the productivity commands (e.g., PRODUCTIVITY_COMMANDS_SUMMARY.md)
  2. Expanding it to cover all new commands including TDD integration
  3. Removing it from this PR if the productivity commands should be in a separate PR

Copilot uses AI. Check for mistakes.
**Purpose**: Analyze current project and recommend which agents/MCP servers to keep or remove for optimal context management

**Location**: `templates/commands/rec_remove_agents_mcp.md`

**Key Features**:
- Analyzes active agents and installed MCP servers
- Reviews usage patterns from conversation history
- Provides actionable recommendations (KEEP/REMOVE/CONSIDER)
- Estimates context window savings
- Project-type specific heuristics

**When to Use**:
- Context window is becoming constrained
- Starting a new project phase
- After installing multiple MCP servers
- When experiencing performance issues

**Example Output**:
```markdown
## Recommendations

### βœ… KEEP (Essential)
- **filesystem**: File operations essential for all development
- **git**: Version control integration

### ❌ REMOVE (Unused/Redundant)
- **sqlite**: Database operations not needed for frontend-only project
- Savings: ~15% context window reduction

### πŸ€” CONSIDER (Project-Specific)
- **playwright**: Add if doing E2E testing
```

---

### 2. `/compact_with_topic`

**Purpose**: Automatically analyze recent conversation topics and run `/compact` with intelligent focus

**Location**: `templates/commands/compact_with_topic.md`

**Key Features**:
- Analyzes last 30-50 messages for key topics
- Identifies what must be preserved vs. noise
- Generates optimized compact focus
- Automatically invokes `/compact`
- Handles multiple conversation patterns (debugging, feature dev, exploration)

**When to Use**:
- Conversation exceeds 100+ messages
- Context window pressure
- After completing a major topic
- Before switching to new feature

**Example Scenarios**:

**Feature Development**:
```bash
/compact_with_topic
# Preserves: JWT implementation, active work on auth.py, CORS issues
# Drops: OAuth exploration (decision made), resolved errors
```

**Debugging Session**:
```bash
/compact_with_topic
# Preserves: Active CORS errors, file paths, error messages
# Drops: Fixed issues, off-topic discussions
```

**User-Specified Focus**:
```bash
/compact_with_topic Keep only the API design discussion
# Focuses specifically on API design while adding critical context
```

---

## Design Decisions

### Following Spec-Kit Conventions

Both commands follow the established patterns in spec-kit:

1. **YAML Frontmatter**:
```yaml
---
description: Clear one-line description
---
```

2. **User Input Section**: Always consider `$ARGUMENTS`

3. **Structured Outline**:
- Phase-based execution flow
- Clear prerequisites and outputs
- Error handling specified

4. **Detailed Guidelines**:
- Examples (βœ… CORRECT / ❌ WRONG)
- Special cases documented
- Best practices included

5. **Non-Destructive by Default**:
- `/rec_remove_agents_mcp`: Only recommends, doesn't execute
- `/compact_with_topic`: Warns about destructive nature

### Design Philosophy Alignment

These commands align with Spec-Kit's core principles:

- **Spec-Driven**: Commands follow template-driven structure
- **Constitutional**: Respect project constraints and conventions
- **Executable**: Immediately usable with clear outcomes
- **Validated**: Built-in checks and error handling

---

## Testing Locally

To test these commands locally:

1. **Create release packages**:
```bash
./.github/workflows/scripts/create-release-packages.sh v1.0.0
```

2. **Copy to test project**:
```bash
cp -r .genreleases/sdd-[agent]-package-sh/. <test-project-path>/
```

3. **Open agent and test**:
```bash
cd <test-project-path>
claude # or your AI agent

# Test commands
/rec_remove_agents_mcp
/compact_with_topic
```

---

## Documentation Updates

Updated `README.md` to include new section:

```markdown
#### Productivity & Optimization Commands

Commands for managing development environment and conversation efficiency:

| Command | Description |
|-----------------------------|-----------------------------------------------------------------------|
| `/rec_remove_agents_mcp` | Analyze current project and recommend which agents/MCP servers to keep or remove for optimal context management |
| `/compact_with_topic` | Automatically analyze recent conversation topics and run `/compact` with intelligent focus |
```

---

## Use Cases

### Scenario 1: Starting a New Project

```bash
# Initialize project
specify init my-app

# Too many MCP servers installed?
/rec_remove_agents_mcp

# Follow recommendations to optimize context
```

### Scenario 2: Long Debugging Session

```bash
# After 100+ messages debugging CORS issues...
/compact_with_topic

# Preserves: error context, file paths, attempted solutions
# Drops: resolved issues, tangents, greetings
```

### Scenario 3: Project Phase Shift

```bash
# Finished authentication, starting on payment system

# Clean up unused context
/rec_remove_agents_mcp
# Remove: auth-specific MCP servers
# Add: payment-related servers

/compact_with_topic
# Preserve: key auth decisions, API structure
# Drop: detailed auth debugging history
```

---

## Future Enhancements

Potential improvements for future iterations:

1. **Automatic Invocation**:
- Auto-suggest `/rec_remove_agents_mcp` when multiple servers detected
- Auto-suggest `/compact_with_topic` at message count thresholds

2. **Usage Analytics**:
- Track actual MCP server usage over time
- Provide trend analysis

3. **Smart Compaction Strategies**:
- Learn from user's compact preferences
- Adaptive topic detection

4. **Integration with Spec-Kit Workflow**:
- Trigger `/rec_remove_agents_mcp` after `/speckit.plan`
- Suggest `/compact_with_topic` between features

---

## Contributing

These commands were created following the guidelines in `CONTRIBUTING.md`:

- βœ… AI-assisted (disclosed)
- βœ… Tested locally
- βœ… Documentation updated
- βœ… Follows project conventions
- βœ… Includes examples and error handling

---

## Files Changed

```
templates/commands/rec_remove_agents_mcp.md (new)
templates/commands/compact_with_topic.md (new)
README.md (modified - added command table)
NEW_COMMANDS_SUMMARY.md (new - this file)
```

---

## Next Steps

1. **Local Testing**: Test commands with various project types
2. **Community Review**: Get feedback on command structure and usefulness
3. **Documentation**: Add to spec-kit documentation site if accepted
4. **Integration**: Consider adding to `specify init` workflow

---

## Contact

For questions or feedback about these commands, please open an issue in the spec-kit repository.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,24 @@ Additional commands for enhanced quality and validation:
| `/speckit.analyze` | Cross-artifact consistency & coverage analysis (run after `/speckit.tasks`, before `/speckit.implement`) |
| `/speckit.checklist` | Generate custom quality checklists that validate requirements completeness, clarity, and consistency (like "unit tests for English") |

#### Productivity & Optimization Commands

Commands for managing development environment and conversation efficiency:

| Command | Description |
|-----------------------------|-----------------------------------------------------------------------|
| `/rec_remove_agents_mcp` | Analyze current project and recommend which agents/MCP servers to keep or remove for optimal context management |
| `/compact_with_topic` | Automatically analyze recent conversation topics and run `/compact` with intelligent focus |

#### Kent Beck TDD Integration Commands

Commands for implementing [Kent Beck's Test-Driven Development](https://tidyfirst.substack.com/p/augmented-coding-beyond-the-vibes) methodology within spec-kit:

| Command | Description |
|-----------------------------|-----------------------------------------------------------------------|
| `/speckit.init-tdd` | Initialize Kent Beck TDD workflow by creating CLAUDE.md from template with project-specific configuration |
| `/speckit.go` | Execute Kent Beck TDD cycle (Red β†’ Green β†’ Refactor) for next unmarked task from tasks.md |

### Environment Variables

| Variable | Description |
Expand Down
Loading