Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guide for continuous improvement, error proofing, and standardization. Use this skill when the user wants to improve code quality, refactor, or discuss process improvements.
.claude/skills/davila7-kaizen/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 205% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 240% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 127% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 326% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 197% | 0% |
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.
Always applied for:
Philosophy: Quality through incremental progress and prevention, not perfection through massive effort.
Small, frequent improvements compound into major gains.
Incremental over revolutionary:
Always leave code better:
Iterative refinement:
<Good>
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 };
Overwhelming, error-prone, hard to verify </Bad>
When implementing features:
When refactoring:
When reviewing code:
Design systems that prevent errors at compile/design time, not runtime.
Make errors impossible:
Design for safety:
Defense in layers:
<Good>
typescript// Error: string status can be any value type OrderBad = { status: string; // Can be "pending", "PENDING", "pnding", anything! total: number; }; // Good: Only valid states possible type OrderStatus = 'pending' | 'processing' | 'shipped' | 'delivered'; type Order = { status: OrderStatus; total: number; }; // Better: States with associated data type Order = | { status: 'pending'; createdAt: Date } | { status: 'processing'; startedAt: Date; estimatedCompletion: Date } | { status: 'shipped'; trackingNumber: string; shippedAt: Date } | { status: 'delivered'; deliveredAt: Date; signature: string }; // Now impossible to have shipped without trackingNumber
Type system prevents entire classes of errors </Good>
<Good>
typescript// Make invalid states unrepresentable type NonEmptyArray<T> = [T, ...T[]]; const firstItem = <T>(items: NonEmptyArray<T>): T => { return items[0]; // Always safe, never undefined! }; // Caller must prove array is non-empty const items: number[] = [1, 2, 3]; if (items.length > 0) { firstItem(items as NonEmptyArray<number>); // Safe }
Function signature guarantees safety </Good>
<Good>
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'); // ... }; // Good: Validate immediately const processPayment = (amount: number) => { if (amount <= 0) { throw new Error('Payment amount must be positive'); } if (amount > 10000) { throw new Error('Payment exceeds maximum allowed'); } const fee = amount \* 0.03; // ... now safe to use }; // Better: Validation at boundary with branded type type PositiveNumber = number & { readonly \_\_brand: 'PositiveNumber' }; const validatePositive = (n: number): PositiveNumber => { if (n <= 0) throw new Error('Must be positive'); return n as PositiveNumber; }; const processPayment = (amount: PositiveNumber) => { // amount is guaranteed positive, no need to check const fee = amount \* 0.03; }; // Validate at system boundary const handlePaymentRequest = (req: Request) => { const amount = validatePositive(req.body.amount); // Validate once processPayment(amount); // Use everywhere safely };
Validate once at boundary, safe everywhere else </Good>
<Good>
typescript// Early returns prevent deeply nested code const processUser = (user: User | null) => { if (!user) { logger.error('User not found'); return; } if (!user.email) { logger.error('User email missing'); return; } if (!user.isActive) { logger.info('User inactive, skipping'); return; } // Main logic here, guaranteed user is valid and active sendEmail(user.email, 'Welcome!'); };
Guards make assumptions explicit and enforced </Good>
<Good>
typescript// Error: Optional config with unsafe defaults type ConfigBad = { apiKey?: string; timeout?: number; }; const client = new APIClient({ timeout: 5000 }); // apiKey missing! // Good: Required config, fails early type Config = { apiKey: string; timeout: number; }; const loadConfig = (): Config => { const apiKey = process.env.API_KEY; if (!apiKey) { throw new Error('API_KEY environment variable required'); } return { apiKey, timeout: 5000, }; }; // App fails at startup if config invalid, not during request const config = loadConfig(); const client = new APIClient(config);
Fail at startup, not in production </Good>
When designing APIs:
When handling errors:
When configuring:
Follow established patterns. Document what works. Make good practices easy to follow.
Consistency over cleverness:
Documentation lives with code:
Automate standards:
<Good>
typescript// Existing codebase pattern for API clients class UserAPIClient { async getUser(id: string): Promise<User> { return this.fetch(`/users/${id}`); } } // New code follows the same pattern class OrderAPIClient { async getOrder(id: string): Promise<Order> { return this.fetch(`/orders/${id}`); } }
Consistency makes codebase predictable </Good>
<Bad>
typescript// Existing pattern uses classes class UserAPIClient { /* ... */ } // New code introduces different pattern without discussion const getOrder = async (id: string): Promise<Order> => { // Breaking consistency "because I prefer functions" };
Inconsistency creates confusion </Bad>
<Good>
typescript// Project standard: Result type for recoverable errors type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }; // All services follow this pattern const fetchUser = async (id: string): Promise<Result<User, Error>> => { try { const user = await db.users.findById(id); if (!user) { return { ok: false, error: new Error('User not found') }; } return { ok: true, value: user }; } catch (err) { return { ok: false, error: err as Error }; } }; // Callers use consistent pattern const result = await fetchUser('123'); if (!result.ok) { logger.error('Failed to fetch user', result.error); return; } const user = result.value; // Type-safe!
Standard pattern across codebase </Good>
<Good>
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 <T>( operation: () => Promise<T>, options: RetryOptions ): Promise<T> => { // Implementation... };
Documents why, when, and how </Good>
Before adding new patterns:
When writing code:
When reviewing:
Build what's needed now. No more, no less. Avoid premature optimization and over-engineering.
YAGNI (You Aren't Gonna Need It):
Simplest thing that works:
Optimize when measured:
<Good>
typescript// Current requirement: Log errors to console const logError = (error: Error) => { console.error(error.message); };
Simple, meets current need </Good>
<Bad>
typescript// Over-engineered for "future needs" interface LogTransport { write(level: LogLevel, message: string, meta?: LogMetadata): Promise<void>; } class ConsoleTransport implements LogTransport { /_... _/ } class FileTransport implements LogTransport { /_ ... _/ } class RemoteTransport implements LogTransport { /_ ..._/ } class Logger { private transports: LogTransport[] = []; private queue: LogEntry[] = []; private rateLimiter: RateLimiter; private formatter: LogFormatter; // 200 lines of code for "maybe we'll need it" } const logError = (error: Error) => { Logger.getInstance().log('error', error.message); };
Building for imaginary future requirements </Bad>
When to add complexity:
<Good>
typescript// Start simple const formatCurrency = (amount: number): string => { return `$${amount.toFixed(2)}`; }; // Requirement evolves: support multiple currencies const formatCurrency = (amount: number, currency: string): string => { const symbols = { USD: '$', EUR: '€', GBP: '£' }; return `${symbols[currency]}${amount.toFixed(2)}`; }; // Requirement evolves: support localization const formatCurrency = (amount: number, locale: string): string => { return new Intl.NumberFormat(locale, {\n style: 'currency', currency: locale === 'en-US' ? 'USD' : 'EUR', }).format(amount); };
Complexity added only when needed </Good>
<Bad>
typescript// One use case, but building generic framework abstract class BaseCRUDService<T> { abstract getAll(): Promise<T[]>; abstract getById(id: string): Promise<T>; abstract create(data: Partial<T>): Promise<T>; abstract update(id: string, data: Partial<T>): Promise<T>; abstract delete(id: string): Promise<void>; } class GenericRepository<T> { /_300 lines _/ } class QueryBuilder<T> { /_ 200 lines_/ } // ... building entire ORM for single table
Massive abstraction for uncertain future </Bad>
<Good>
typescript// Simple functions for current needs const getUsers = async (): Promise<User[]> => { return db.query('SELECT * FROM users'); }; const getUserById = async (id: string): Promise<User | null> => { return db.query('SELECT * FROM users WHERE id = $1', [id]); }; // When pattern emerges across multiple entities, then abstract
Abstract only when pattern proven across 3+ cases </Good>
<Good>
typescript// Current: Simple approach const filterActiveUsers = (users: User[]): User[] => { return users.filter(user => user.isActive); }; // Benchmark shows: 50ms for 1000 users (acceptable) // ✓ Ship it, no optimization needed // Later: After profiling shows this is bottleneck // Then optimize with indexed lookup or caching
Optimize based on measurement, not assumptions </Good>
<Bad>
typescript// Premature optimization const filterActiveUsers = (users: User[]): User[] => { // "This might be slow, so let's cache and index" const cache = new WeakMap(); const indexed = buildBTreeIndex(users, 'isActive'); // 100 lines of optimization code // Adds complexity, harder to maintain // No evidence it was needed };\
Complex solution for unmeasured problem </Bad>
When implementing:
When optimizing:
When abstracting:
The Kaizen skill guides how you work. The commands provide structured analysis:
/why: Root cause analysis (5 Whys)/cause-and-effect: Multi-factor analysis (Fishbone)/plan-do-check-act: Iterative improvement cycles/analyse-problem: Comprehensive documentation (A3)/analyse: Smart method selection (Gemba/VSM/Muda)Use commands for structured problem-solving. Apply skill for day-to-day development.
Violating Continuous Improvement:
Violating Poka-Yoke:
Violating Standardized Work:
Violating Just-In-Time:
Kaizen is about:
Not about:
Mindset: Good enough today, better tomorrow. Repeat.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-06 | pass→pass | 13,474 | 7,214 | -46% | 1 | 1 | 0% | 2,003 | 5,629 | +181% | 0 | 0 | — |
case-01 | pass→pass | 16,560 | 9,560 | -42% | 1 | 1 | 0% | 2,838 | 6,211 | +119% | 0 | 0 | — |
case-02 | pass→pass | 13,068 | 8,270 | -37% | 1 | 1 | 0% | 2,594 | 6,094 | +135% | 0 | 0 | — |
case-03 | pass→pass | 10,489 | 10,698 | +2% | 1 | 1 | 0% | 2,005 | 6,395 | +219% | 0 | 0 | — |
case-04 | pass→pass | 17,089 | 16,733 | -2% | 1 | 1 | 0% | 3,238 | 7,535 | +133% | 0 | 0 | — |
case-05 | pass→pass | 9,146 | 4,851 | -47% | 1 | 1 | 0% | 1,697 | 5,309 | +213% | 0 | 0 | — |
case-07 | pass→pass | 13,437 | 9,672 | -28% | 1 | 1 | 0% | 2,124 | 6,166 | +190% | 0 | 0 | — |
case-08 | pass→pass | 12,179 | 8,701 | -29% | 1 | 1 | 0% | 2,020 | 6,105 | +202% | 0 | 0 | — |
case-09 | pass→pass | 9,863 | 4,549 | -54% | 1 | 1 | 0% | 1,743 | 5,310 | +205% | 0 | 0 | — |
case-10 | fail→pass | 10,228 | 6,739 | -34% | 1 | 1 | 0% | 1,819 | 5,549 | +205% | 0 | 0 | — |
case-11 | fail→pass | 9,380 | 7,074 | -25% | 1 | 1 | 0% | 1,650 | 5,615 | +240% | 0 | 0 | — |
case-12 | pass→pass | 11,310 | 6,109 | -46% | 1 | 1 | 0% | 1,954 | 5,500 | +181% | 0 | 0 | — |
case-13 | fail→pass | 11,693 | 7,220 | -38% | 1 | 1 | 0% | 2,592 | 5,884 | +127% | 0 | 0 | — |
case-14 | fail→pass | 6,285 | 1,391 | -78% | 1 | 1 | 0% | 1,118 | 4,761 | +326% | 0 | 0 | — |
case-15 | fail→pass | 9,000 | 2,118 | -76% | 1 | 1 | 0% | 1,620 | 4,815 | +197% | 0 | 0 | — |
case-16 | fail→pass | 8,400 | 1,841 | -78% | 1 | 1 | 0% | 1,429 | 4,787 | +235% | 0 | 0 | — |
case-17 | fail→pass | 7,029 | 2,226 | -68% | 1 | 1 | 0% | 1,101 | 4,885 | +344% | 0 | 0 | — |
case-18 | fail→pass | 9,391 | 2,265 | -76% | 1 | 1 | 0% | 1,656 | 4,886 | +195% | 0 | 0 | — |
case-19 | fail→pass | 9,078 | 6,337 | -30% | 1 | 1 | 0% | 1,503 | 5,631 | +275% | 0 | 0 | — |
case-20 | pass→pass | 11,092 | 8,290 | -25% | 1 | 1 | 0% | 2,137 | 6,038 | +183% | 0 | 0 | — |
case-21 | pass→pass | 6,969 | 6,735 | -3% | 1 | 1 | 0% | 1,315 | 5,746 | +337% | 0 | 0 | — |
case-22 | pass→pass | 11,957 | 11,289 | -6% | 1 | 1 | 0% | 2,134 | 6,610 | +210% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +41 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.