$npx -y skills add Svenja-dev/claude-code-skills --skill kaizenManufacturing-fokussierter Continuous Improvement Skill fuer fabrikIQ. Implementiert Lean Manufacturing Prinzipien (5 Whys, Ishikawa, PDCA) fuer systematische Problemloesung und Qualitaetsverbesserung. Aktivieren bei Bug-Analyse, Refactoring, Code Review, Production Incidents.
| 1 | # Kaizen - Continuous Improvement Skill |
| 2 | |
| 3 | Dieser Skill bringt bewaehrte Lean Manufacturing Methoden in die Softwareentwicklung. Entwickelt fuer fabrikIQ, anwendbar auf jedes TypeScript/React Projekt. |
| 4 | |
| 5 | ## Die 4 Saeulen des Kaizen |
| 6 | |
| 7 | ### 1. Continuous Improvement (Kaizen) |
| 8 | Kleine, inkrementelle Aenderungen statt Big Bang Refactoring. |
| 9 | |
| 10 | **Prinzip**: Jeder Commit sollte den Code minimal besser hinterlassen als vorgefunden. |
| 11 | |
| 12 | ```typescript |
| 13 | // VORHER: Grosses Refactoring geplant |
| 14 | // "Ich refactore mal schnell die ganze Auth-Logik" |
| 15 | |
| 16 | // KAIZEN: Kleine Schritte |
| 17 | // Commit 1: Extrahiere validateToken() aus auth.ts |
| 18 | // Commit 2: Fuege Typen fuer TokenPayload hinzu |
| 19 | // Commit 3: Ersetze any mit unknown + Type Guard |
| 20 | // Commit 4: Schreibe Unit Test fuer validateToken() |
| 21 | ``` |
| 22 | |
| 23 | ### 2. Poka-Yoke (Error Proofing) |
| 24 | Fehler durch Design verhindern, nicht durch Disziplin. |
| 25 | |
| 26 | **TypeScript Constraints**: |
| 27 | ```typescript |
| 28 | // FALSCH: Runtime Check (Fehler moeglich) |
| 29 | function processOrder(status: string) { |
| 30 | if (status !== 'pending' && status !== 'approved') { |
| 31 | throw new Error('Invalid status'); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // POKA-YOKE: Compile-Time Constraint (Fehler unmoeglich) |
| 36 | type OrderStatus = 'pending' | 'approved' | 'shipped' | 'cancelled'; |
| 37 | |
| 38 | function processOrder(status: OrderStatus) { |
| 39 | // TypeScript verhindert ungueltige Werte |
| 40 | } |
| 41 | ``` |
| 42 | |
| 43 | **Fail-Fast Pattern**: |
| 44 | ```typescript |
| 45 | // FALSCH: Spaete Fehlererkennung |
| 46 | async function analyzeData(file: File) { |
| 47 | const data = await parseFile(file); // 10 Sekunden |
| 48 | const result = await geminiAnalyze(data); // 30 Sekunden |
| 49 | if (!data.hasRequiredColumns()) { // Fehler erst nach 40 Sekunden! |
| 50 | throw new Error('Missing columns'); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // POKA-YOKE: Fail-Fast (fruehe Validierung) |
| 55 | async function analyzeData(file: File) { |
| 56 | // Validierung ZUERST (< 1ms) |
| 57 | const preview = await parseFilePreview(file, 10); |
| 58 | if (!preview.hasRequiredColumns()) { |
| 59 | throw new Error('Missing columns'); // Sofort! |
| 60 | } |
| 61 | |
| 62 | // Teure Operationen NUR wenn valide |
| 63 | const data = await parseFile(file); |
| 64 | const result = await geminiAnalyze(data); |
| 65 | } |
| 66 | ``` |
| 67 | |
| 68 | ### 3. Standardized Work |
| 69 | Konsistente Patterns reduzieren kognitive Last und Fehler. |
| 70 | |
| 71 | **API Response Pattern (fabrikIQ Standard)**: |
| 72 | ```typescript |
| 73 | // Standard Response Format |
| 74 | interface ApiResponse<T> { |
| 75 | success: boolean; |
| 76 | data?: T; |
| 77 | error?: { |
| 78 | code: string; |
| 79 | message: string; |
| 80 | details?: unknown; |
| 81 | }; |
| 82 | meta?: { |
| 83 | timestamp: string; |
| 84 | duration_ms: number; |
| 85 | region: 'fra1'; // DSGVO |
| 86 | }; |
| 87 | } |
| 88 | |
| 89 | // Alle Endpoints nutzen dieses Format |
| 90 | export async function handler(req: Request): Promise<Response> { |
| 91 | const start = Date.now(); |
| 92 | try { |
| 93 | const result = await processRequest(req); |
| 94 | return Response.json({ |
| 95 | success: true, |
| 96 | data: result, |
| 97 | meta: { |
| 98 | timestamp: new Date().toISOString(), |
| 99 | duration_ms: Date.now() - start, |
| 100 | region: 'fra1' |
| 101 | } |
| 102 | }); |
| 103 | } catch (error) { |
| 104 | return Response.json({ |
| 105 | success: false, |
| 106 | error: { |
| 107 | code: error.code ?? 'UNKNOWN_ERROR', |
| 108 | message: error.message |
| 109 | } |
| 110 | }, { status: error.status ?? 500 }); |
| 111 | } |
| 112 | } |
| 113 | ``` |
| 114 | |
| 115 | ### 4. Just-In-Time (YAGNI) |
| 116 | Implementiere nur was JETZT gebraucht wird. |
| 117 | |
| 118 | ```typescript |
| 119 | // FALSCH: "Vielleicht brauchen wir das spaeter" |
| 120 | interface User { |
| 121 | id: string; |
| 122 | email: string; |
| 123 | name: string; |
| 124 | // "Fuer spaeter" |
| 125 | avatar?: string; |
| 126 | preferences?: UserPreferences; |
| 127 | notifications?: NotificationSettings; |
| 128 | integrations?: ExternalIntegrations; |
| 129 | analytics?: UserAnalytics; |
| 130 | } |
| 131 | |
| 132 | // YAGNI: Nur aktuelle Requirements |
| 133 | interface User { |
| 134 | id: string; |
| 135 | email: string; |
| 136 | name: string; |
| 137 | } |
| 138 | |
| 139 | // Erweitern wenn tatsaechlich benoetigt (mit eigenem Commit) |
| 140 | ``` |
| 141 | |
| 142 | --- |
| 143 | |
| 144 | ## Befehle |
| 145 | |
| 146 | ### /why - 5-Whys Root Cause Analysis |
| 147 | |
| 148 | **Trigger**: `/why`, `5 whys`, `root cause`, `warum passiert` |
| 149 | |
| 150 | **Anwendung**: Bei Bugs, Production Incidents, wiederkehrenden Problemen |
| 151 | |
| 152 | **Workflow**: |
| 153 | |
| 154 | 1. **Problem definieren** (konkret, messbar) |
| 155 | ``` |
| 156 | Problem: API Timeout bei SECOM-Dataset (504 nach 60s) |
| 157 | ``` |
| 158 | |
| 159 | 2. **5x "Warum?" fragen** |
| 160 | ``` |
| 161 | Why 1: Warum Timeout? |
| 162 | → Gemini API braucht >60s fuer Antwort |
| 163 | |
| 164 | Why 2: Warum >60s? |
| 165 | → Prompt enthaelt 590 Spalten x 1567 Zeilen |
| 166 | |
| 167 | Why 3: Warum so viele Daten? |
| 168 | → Kein Column Sampling implementiert |
| 169 | |
| 170 | Why 4: Warum kein Sampling? |
| 171 | → Urspruenglich nur kleine CSVs erwartet |
| 172 | |
| 173 | Why 5: Warum nicht angepasst? |
| 174 | → Keine automatischen Performance-Tests mit grossen Dateien |
| 175 | ``` |
| 176 | |
| 177 | 3. **Root Cause identifizieren** |
| 178 | ``` |
| 179 | Root Cause: Fehlende Performance-Testabdeckung fuer grosse Datasets |
| 180 | ``` |
| 181 | |
| 182 | 4. **Countermeasure definieren** |
| 183 | ``` |
| 184 | Massnahme 1: Column Sampling (MAX_COLUMNS = 50) implementieren |
| 185 | Massnahme 2: Performan |