Skip to content
Development
Command

/f5-improve

Automatic code improvement and optimization

From plugin
f5-framework
2469 skills104 agents69 commands
Install
$ npx -y skills add Fujigo-Software/f5-framework-claude --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/f5-improve

Context preview

What this command does when you run it.

Automatic code improvement and optimization

Command definition

f5-improve.md
description: Automatic code improvement and optimization
argument-hint: [path] [--type quality|performance|security|all] [--preview|--safe|--auto]

/f5-improve - Code Improvement & Optimization

> **Purpose**: Analyze code and apply systematic improvements > **Version**: 1.0.0 > **Category**: Quality > **Inspiration**: SuperClaude /sc:improve

---

Command Syntax

# Basic - analyze and preview improvements
/f5-improve [path]

# With improvement type
/f5-improve [path] --type <quality|performance|security|maintainability|all>

# With apply mode
/f5-improve [path] --preview       # Preview only (default)
/f5-improve [path] --safe          # Apply low-risk changes only
/f5-improve [path] --interactive   # Confirm each change
/f5-improve [path] --auto          # Apply all automatically

# With validation
/f5-improve [path] --validate      # Run tests after applying

# Combined
/f5-improve src/services/ --type performance --preview
/f5-improve auth-module --type security --safe --validate

ARGUMENTS

The user's request is: $ARGUMENTS

---

STEP 1: PARSE ARGUMENTS

Parse from $ARGUMENTS:

parsed:
  path: "[extracted path or 'src/' default]"
  type: "[quality|performance|security|maintainability|all]"
  mode: "[preview|safe|interactive|auto]"
  validate: "[true|false]"

**Default values:**

  • path: `src/` or current directory
  • type: `all`
  • mode: `preview`
  • validate: `false`

---

STEP 2: DETECT STACK & LOAD CONFIG

Read stack from project files (`package.json`, `pom.xml`, `pyproject.toml`, etc.):

| Indicator | Stack | Language | |-----------|-------|----------| | `@nestjs/core` | NestJS | TypeScript | | `spring-boot` | Spring | Java | | `fastapi` | FastAPI | Python | | `go.mod` | Go | Go | | `flutter` | Flutter | Dart | | `next` | Next.js | TypeScript | | `vue` | Vue | TypeScript/JS | | `angular` | Angular | TypeScript | | `laravel` | Laravel | PHP |

Load improve config from `.f5/config/improve.yaml` if exists.

Output

## Configuration

| Setting | Value |
|---------|-------|
| Stack | NestJS (TypeScript) |
| Path | src/services/ |
| Type | performance |
| Mode | preview |
| Validate | false |

Excluded:
- **/*.spec.ts
- **/node_modules/**
- **/dist/**

---

STEP 3: RUN ANALYSIS

Based on `--type`, run appropriate analyzers:

Type: quality

| Analyzer | What it checks | Tool | |----------|----------------|------| | Lint | ESLint rules, warnings | eslint | | Types | TypeScript strict | tsc | | Format | Prettier compliance | prettier | | Complexity | Cyclomatic complexity | complexity-report | | Duplication | Code duplication | jscpd | | Naming | Naming conventions | custom | | Structure | Function length, SRP | custom |

**Commands by Stack:**

**NestJS/TypeScript:**

npm run lint -- --format json
npx tsc --noEmit
npx prettier --check "src/**/*.ts"
npx jscpd src/ --reporters json

**FastAPI/Python:**

ruff check . --format json
mypy app/ --json
black --check app/
radon cc app/ -j

**Go:**

golangci-lint run --out-format json
go vet ./...
gofmt -l .
gocyclo -over 10 .

Type: performance

| Analyzer | What it checks | Tool | |----------|----------------|------| | N+1 Queries | ORM query patterns | custom | | Caching | Uncached repeated calls | custom | | Async | Sequential async operations | custom | | Memory | Potential memory leaks | custom | | Indexing | Missing database indexes | custom |

**Patterns to Detect:**

n_plus_1:
  - "for.*await.*findOne"
  - "for.*await.*findBy"
  - "map.*async.*repository"

missing_cache:
  - "getCategories|getSettings|getConfig"
  - "findAll.*without.*@Cacheable"

sequential_async:
  - "await.*\n.*await.*\n.*await"
  - "for.*await"

Type: security

| Analyzer | What it checks | Tool | |----------|----------------|------| | Auth Guards | Missing @UseGuards | custom | | Role Checks | Missing @Roles | custom | | Input Validation | Missing validators | custom | | SQL Injection | Raw queries | custom | | Dependencies | Vulnerable packages | npm audit | | Secrets | Hardcoded credentials | custom |

**Commands:**

npm audit --json
npx secretlint "**/*"

Type: maintainability

| Analyzer | What it checks | Tool | |----------|----------------|------| | Documentation | Missing JSDoc/TSDoc | custom | | Types | 'any' usage, missing types | tsc | | Test Coverage | Missing tests | jest --coverage | | Comments | Outdated/TODO comments | custom |

Analysis Output

## Analysis Results

### Summary
| Category | Issues | Auto-fixable |
|----------|--------|--------------|
| Lint | 5 | 4 |
| Types | 2 | 0 |
| Format | 8 | 8 |
| Complexity | 2 | 0 |
| Performance | 3 | 2 |
| **Total** | **20** | **14** |

---

STEP 4: GENERATE IMPROVEMENTS

For each issue found, generate improvement suggestion:

improvement:
  id: "IMP-001"
  file: "order.service.ts"
  line: 120
  type: "performance"
  category: "n_plus_1"
  severity: "high"

  issue:
    title: "N+1 Query Detected"
    description: "Loading products in loop causes N+1 queries"

  current_code: |
    const orders = await this.orderRepo.find();
    for (const order of orders) {
      order.products = await this.productRepo.findByOrderId(order.id);
    }

  improved_code: |
    const orders = await this.orderRepo.find({
      relations: ['products']
    });

  risk: "low"       # low|medium|high
  impact: "high"    # low|medium|high
  auto_fixable: true
  requires_test: true

---

STEP 5: OUTPUT BY MODE

Mode: preview (default)

## /f5-improve [path] --type [type] --preview

### Analysis Summary
| Metric | Current | After | Improvement |
|--------|---------|-------|-------------|
| N+1 Queries | 3 | 0 | -100% |
| Uncached Calls | 5 | 1 | -80% |
| Sync Operations | 2 | 0 | -100% |

### Proposed Changes

#### 1. Fix N+1 Query [IMP-001]
**File:** `order.service.ts:120`
**Risk:** Low | **Impact:** High

```diff
- const orders = await this.orderRepo.fin
Read more
Ships withf5-framework

AI-Powered Development Framework for Claude Code

Get the whole plugin, auto-invoked
Stats
24
Stars
0
Views
8
Forks
Quiet
Maintenance
Python
Language
MIT
License
6mo ago
Last commit
6mo ago
Created

Repo: Fujigo-Software/f5-framework-claude