# DevFlow

A developer productivity plugin for Claude Code with code analysis, debugging, testing, and refactoring workflows.

## Installation

Copy this plugin to your Claude Code plugins directory:

```bash
cp -r devflow ~/.claude/plugins/
```

## Commands

| Command | Description |
|---------|-------------|
| `/review` | Review code changes for quality, bugs, performance, and security |
| `/dead-code` | Scan repo for unused files/functions, generate removal patch |
| `/dead-code-apply` | Safely apply the dead code removal patch |
| `/debug` | Systematic 6-step debugging workflow |
| `/commit` | Generate conventional commit messages from staged changes |
| `/test` | Generate comprehensive tests with edge case coverage |
| `/refactor` | Guided refactoring with safety checks and incremental changes |
| `/docs` | Generate documentation from code (JSDoc, docstrings, etc.) |

## Agents

### dead-code-hunter

Thorough static analysis agent for finding dead code. Performs 6-phase analysis:

1. Project discovery
2. Dependency graph building
3. Dead code detection
4. False positive filtering
5. Confidence scoring
6. Report generation

**Output files:**
- `dead-code-report.md` - Full analysis
- `dead-code-removal.patch` - Safe deletions (90%+ confidence)
- `dead-code-review.md` - Items needing human review

## Skills

### tdd (Test-Driven Development)

Enforces the Red-Green-Refactor cycle:

```
RED → Write failing test
GREEN → Write minimal code to pass
REFACTOR → Improve without breaking tests
```

**Rules:**
- No production code without a failing test
- Write minimum test to fail
- Write minimum code to pass
- Refactor only when green

### code-patterns

Common code patterns and best practices reference for quick lookup.

## Hooks

### pre-commit

Runs before each commit to ensure code quality:
- Linting (ESLint, Pylint, etc.)
- Formatting (Prettier, Black, etc.)
- Type checking (TypeScript, mypy)

### post-stage

Triggers after `git add` to offer commit message generation.

## Example Workflows

### Finding and Removing Dead Code

```bash
# 1. Scan for dead code
/dead-code

# 2. Review the generated report
cat dead-code-report.md

# 3. Apply safe deletions
/dead-code-apply
```

### Test-Driven Feature Development

```bash
# 1. Activate TDD skill (enforces Red-Green-Refactor)
# 2. Write first failing test
# 3. Implement minimal code
# 4. Refactor
# 5. Repeat
```

### Debugging an Issue

```bash
# 1. Start systematic debugging
/debug

# 2. Follow the 6-step process:
#    - Understand the problem
#    - Gather evidence
#    - Form hypotheses
#    - Test hypotheses
#    - Isolate the bug
#    - Fix and verify
```

## Configuration

Edit `.claude-plugin/plugin.json` to customize:

```json
{
  "name": "devflow",
  "version": "1.0.0",
  "author": {
    "name": "your-name",
    "email": "your-email@example.com"
  }
}
```

## License

MIT
