| name | kaizen |
| description | Guide for continuous improvement, error proofing, and standardization. Use this skill when the user wants to improve code quality, refactor, or discuss process improvements. |
| type | skill |
| created | 2026-02-27T00:00:00.000Z |
| domain | communication-content |
| category | documentation |
| risk | unknown |
| source | community |
| tags | ["skill","communication-content","documentation","kaizen"] |
Kaizen: Continuous Improvement
Overview
Small improvements, continuously. Error-proof by design. Follow what works. Build only what's needed.
Core principle: Many small improvements beat one big change. Prevent errors at design time, not with fixes.
When to Use
Always applied for:
- Code implementation and refactoring
- Architecture and design decisions
- Process and workflow improvements
- Error handling and validation
Philosophy: Quality through incremental progress and prevention, not perfection through massive effort.
The Four Pillars
1. Continuous Improvement (Kaizen)
Small, frequent improvements compound into major gains.
Principles
Incremental over revolutionary:
- Make smallest viable change that improves quality
- One improvement at a time
- Verify each change before next
- Build momentum through small wins
Always leave code better:
- Fix small issues as you encounter them
- Refactor while you work (within scope)
- Update outdated comments
- Remove dead code when you see it
Iterative refinement:
- First version: make it work
- Second pass: make it clear
- Third pass: make it efficient
- Don't try all three at once
```typescript
// Iteration 1: Make it work
const calculateTotal = (items: Item[]) => {
let total = 0;
for (let i = 0; i < items.length; i++) {
total += items[i].price * items[i].quantity;
}
return total;
};
// Iteration 2: Make it clear (refactor)
const calculateTotal = (items: Item[]): number => {
return items.reduce((total, item) => {
return total + (item.price * item.quantity);
}, 0);
};
// Iteration 3: Make it robust (add validation)
const calculateTotal = (items: Item[]): number => {
if (!items?.length) return 0;
return items.reduce((total, item) => {
if (item.price < 0 || item.quantity < 0) {
throw new Error('Price and quantity must be non-negative');
}
return total + (item.price * item.quantity);
}, 0);
};
Each step is complete, tested, and working
</Good>
<Bad>
```typescript
// Trying to do everything at once
const calculateTotal = (items: Item[]): number => {
// Validate, optimize, add features, handle edge cases all together
if (!items?.length) return 0;
const validItems = items.filter(item => {
if (item.price < 0) throw new Error('Negative price');
if (item.quantity < 0) throw new Error('Negative quantity');
return item.quantity > 0; // Also filtering zero quantities
});
// Plus caching, plus logging, plus currency conversion...
return validItems.reduce(...); // Too many concerns at once
};
```typescript
// Error: string status can be any value
type OrderBad = {
status: string; // Can be "pending", "PENDING", "pnding", anything!
total: number;
};
```typescript
// Error: Validation after use
const processPayment = (amount: number) => {
const fee = amount * 0.03; // Used before validation!
if (amount <= 0) throw new Error('Invalid amount');
// ...
};
```typescript
// Error: Optional config with unsafe defaults
type ConfigBad = {
apiKey?: string;
timeout?: number;
};
```typescript
// Existing pattern uses classes
class UserAPIClient { /* ... */ }
```typescript
/**
* Retries an async operation with exponential backoff.
*
* Why: Network requests fail temporarily; retrying improves reliability
* When to use: External API calls, database operations
* When not to use: User input validation, internal function calls
*
* @example
* const result = await retry(
* () => fetch('https://api.example.com/data'),
* { maxAttempts: 3, baseDelay: 1000 }
* );
*/
const retry = async (
operation: () => Promise,
options: RetryOptions
): Promise => {
// Implementation...
};
```
Documents why, when, and how
```typescript
// Current requirement: Log errors to console
const logError = (error: Error) => {
console.error(error.message);
};
```
Simple, meets current need
```typescript
// Over-engineered for "future needs"
interface LogTransport {
write(level: LogLevel, message: string, meta?: LogMetadata): Promise;
}
```typescript
// One use case, but building generic framework
abstract class BaseCRUDService {
abstract getAll(): Promise;
abstract getById(id: string): Promise;
abstract create(data: Partial): Promise;
abstract update(id: string, data: Partial): Promise;
abstract delete(id: string): Promise;
}
```typescript
// Current: Simple approach
const filterActiveUsers = (users: User[]): User[] => {
return users.filter(user => user.isActive);
};