ccjk 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.ja.md +249 -297
  2. package/README.ko.md +241 -290
  3. package/README.md +216 -360
  4. package/README.zh-CN.md +234 -311
  5. package/dist/chunks/claude-code-config-manager.mjs +7 -7
  6. package/dist/chunks/claude-code-incremental-manager.mjs +1 -1
  7. package/dist/chunks/codex-config-switch.mjs +3 -3
  8. package/dist/chunks/codex-uninstaller.mjs +2 -2
  9. package/dist/chunks/features.mjs +10 -10
  10. package/dist/chunks/simple-config.mjs +388 -45
  11. package/dist/chunks/smart-guide.mjs +234 -0
  12. package/dist/cli.mjs +2325 -1317
  13. package/dist/i18n/locales/en/marketplace.json +84 -0
  14. package/dist/i18n/locales/en/menu.json +38 -1
  15. package/dist/i18n/locales/en/skills.json +140 -0
  16. package/dist/i18n/locales/en/smartGuide.json +49 -0
  17. package/dist/i18n/locales/en/subagent.json +69 -0
  18. package/dist/i18n/locales/en/superpowers.json +58 -0
  19. package/dist/i18n/locales/en/workflow.json +28 -9
  20. package/dist/i18n/locales/zh-CN/marketplace.json +84 -0
  21. package/dist/i18n/locales/zh-CN/menu.json +38 -1
  22. package/dist/i18n/locales/zh-CN/skills.json +140 -0
  23. package/dist/i18n/locales/zh-CN/smartGuide.json +49 -0
  24. package/dist/i18n/locales/zh-CN/subagent.json +69 -0
  25. package/dist/i18n/locales/zh-CN/superpowers.json +58 -0
  26. package/dist/i18n/locales/zh-CN/workflow.json +28 -9
  27. package/dist/index.d.mts +1 -0
  28. package/dist/index.d.ts +1 -0
  29. package/package.json +26 -27
  30. package/templates/claude-code/en/workflow/essential/commands/feat.md +196 -51
  31. package/templates/claude-code/zh-CN/workflow/essential/commands/feat.md +194 -51
  32. package/templates/common/skills/en/brainstorming.md +64 -0
  33. package/templates/common/skills/en/code-review.md +81 -0
  34. package/templates/common/skills/en/documentation-gen.md +808 -0
  35. package/templates/common/skills/en/executing-plans.md +75 -0
  36. package/templates/common/skills/en/git-commit.md +216 -0
  37. package/templates/common/skills/en/interview.md +223 -0
  38. package/templates/common/skills/en/migration-assistant.md +312 -0
  39. package/templates/common/skills/en/performance-profiling.md +576 -0
  40. package/templates/common/skills/en/pr-review.md +341 -0
  41. package/templates/common/skills/en/refactoring.md +384 -0
  42. package/templates/common/skills/en/security-audit.md +462 -0
  43. package/templates/common/skills/en/systematic-debugging.md +82 -0
  44. package/templates/common/skills/en/tdd-workflow.md +93 -0
  45. package/templates/common/skills/en/verification.md +81 -0
  46. package/templates/common/skills/en/workflow.md +370 -0
  47. package/templates/common/skills/en/writing-plans.md +78 -0
  48. package/templates/common/skills/zh-CN/documentation-gen.md +807 -0
  49. package/templates/common/skills/zh-CN/migration-assistant.md +318 -0
  50. package/templates/common/skills/zh-CN/performance-profiling.md +746 -0
  51. package/templates/common/skills/zh-CN/pr-review.md +341 -0
  52. package/templates/common/skills/zh-CN/refactoring.md +384 -0
  53. package/templates/common/skills/zh-CN/security-audit.md +462 -0
  54. package/templates/common/smart-guide/en/smart-guide.md +72 -0
  55. package/templates/common/smart-guide/zh-CN/smart-guide.md +72 -0
  56. package/templates/common/workflow/sixStep/en/workflow.md +137 -31
  57. package/templates/common/workflow/sixStep/zh-CN/workflow.md +152 -10
@@ -0,0 +1,576 @@
1
+ ---
2
+ name: performance-profiling
3
+ description: Performance analysis and optimization recommendations
4
+ version: 1.0.0
5
+ author: CCJK
6
+ category: dev
7
+ triggers:
8
+ - /perf
9
+ - /performance
10
+ - /profile
11
+ use_when:
12
+ - "User wants performance analysis"
13
+ - "Code is slow"
14
+ - "Need to optimize performance"
15
+ - "User mentions profiling"
16
+ auto_activate: false
17
+ priority: 6
18
+ difficulty: advanced
19
+ tags:
20
+ - performance
21
+ - optimization
22
+ - profiling
23
+ allowed-tools:
24
+ - Read
25
+ - Grep
26
+ - Glob
27
+ - Bash(node --prof *)
28
+ - Bash(npm run *)
29
+ - Bash(pnpm run *)
30
+ context: fork
31
+ user-invocable: true
32
+ ---
33
+
34
+ # Performance Profiling Skill
35
+
36
+ ## Overview
37
+
38
+ This skill provides comprehensive performance analysis and optimization recommendations for your codebase. It helps identify bottlenecks, memory issues, and provides actionable optimization strategies.
39
+
40
+ ## Performance Analysis Checklist
41
+
42
+ ### 1. Algorithm Complexity Analysis
43
+
44
+ **Big O Notation Review:**
45
+ - Identify loops and nested loops (O(n), O(n²), O(n³))
46
+ - Check recursive functions for exponential complexity
47
+ - Review sorting and searching algorithms
48
+ - Analyze data structure operations (arrays, objects, maps, sets)
49
+
50
+ **Red Flags:**
51
+ - Nested loops over large datasets
52
+ - Recursive functions without memoization
53
+ - Linear searches in hot paths
54
+ - Repeated array operations (filter, map, reduce chains)
55
+
56
+ ### 2. Memory Usage Patterns
57
+
58
+ **Memory Profiling:**
59
+ - Check for memory leaks (event listeners, timers, closures)
60
+ - Analyze object retention and garbage collection
61
+ - Review large data structure allocations
62
+ - Monitor heap size growth over time
63
+
64
+ **Common Issues:**
65
+ - Unclosed database connections
66
+ - Unremoved event listeners
67
+ - Circular references
68
+ - Large in-memory caches without limits
69
+
70
+ ### 3. I/O Operations
71
+
72
+ **File System:**
73
+ - Identify synchronous file operations (fs.readFileSync)
74
+ - Check for unnecessary file reads/writes
75
+ - Review file streaming vs. loading entire files
76
+ - Analyze temporary file cleanup
77
+
78
+ **Database:**
79
+ - Detect N+1 query problems
80
+ - Review missing indexes
81
+ - Check for full table scans
82
+ - Analyze connection pool usage
83
+
84
+ ### 4. Network Requests
85
+
86
+ **HTTP/API Calls:**
87
+ - Identify sequential requests that could be parallel
88
+ - Check for missing request caching
89
+ - Review timeout configurations
90
+ - Analyze payload sizes
91
+
92
+ **Optimization Opportunities:**
93
+ - Implement request batching
94
+ - Add response caching (Redis, in-memory)
95
+ - Use HTTP/2 multiplexing
96
+ - Compress request/response payloads
97
+
98
+ ### 5. Bundle Size Analysis
99
+
100
+ **Frontend Performance:**
101
+ - Analyze bundle size and composition
102
+ - Check for duplicate dependencies
103
+ - Review code splitting strategy
104
+ - Identify unused code (tree-shaking opportunities)
105
+
106
+ **Tools:**
107
+ - webpack-bundle-analyzer
108
+ - source-map-explorer
109
+ - Lighthouse CI
110
+
111
+ ## Common Performance Issues
112
+
113
+ ### 1. N+1 Query Problem
114
+
115
+ **Symptom:**
116
+ ```javascript
117
+ // BAD: N+1 queries
118
+ const users = await User.findAll();
119
+ for (const user of users) {
120
+ user.posts = await Post.findAll({ where: { userId: user.id } });
121
+ }
122
+ ```
123
+
124
+ **Solution:**
125
+ ```javascript
126
+ // GOOD: Single query with join
127
+ const users = await User.findAll({
128
+ include: [{ model: Post }]
129
+ });
130
+ ```
131
+
132
+ ### 2. Memory Leaks
133
+
134
+ **Common Causes:**
135
+ ```javascript
136
+ // BAD: Event listener not removed
137
+ element.addEventListener('click', handler);
138
+ // Component unmounts but listener remains
139
+
140
+ // BAD: Timer not cleared
141
+ setInterval(() => { /* ... */ }, 1000);
142
+ // Component unmounts but timer continues
143
+
144
+ // BAD: Closure retaining large objects
145
+ function createHandler() {
146
+ const largeData = new Array(1000000);
147
+ return () => console.log(largeData.length);
148
+ }
149
+ ```
150
+
151
+ **Solutions:**
152
+ ```javascript
153
+ // GOOD: Cleanup event listeners
154
+ useEffect(() => {
155
+ element.addEventListener('click', handler);
156
+ return () => element.removeEventListener('click', handler);
157
+ }, []);
158
+
159
+ // GOOD: Clear timers
160
+ useEffect(() => {
161
+ const timer = setInterval(() => { /* ... */ }, 1000);
162
+ return () => clearInterval(timer);
163
+ }, []);
164
+
165
+ // GOOD: Avoid unnecessary closures
166
+ function createHandler() {
167
+ return () => console.log('No large data retained');
168
+ }
169
+ ```
170
+
171
+ ### 3. Unnecessary Re-renders (React)
172
+
173
+ **Problem:**
174
+ ```javascript
175
+ // BAD: Creates new object on every render
176
+ function Component() {
177
+ const config = { theme: 'dark' }; // New object each time
178
+ return <Child config={config} />;
179
+ }
180
+ ```
181
+
182
+ **Solution:**
183
+ ```javascript
184
+ // GOOD: Memoize objects
185
+ function Component() {
186
+ const config = useMemo(() => ({ theme: 'dark' }), []);
187
+ return <Child config={config} />;
188
+ }
189
+
190
+ // GOOD: Use React.memo for expensive components
191
+ const Child = React.memo(({ config }) => {
192
+ // Expensive rendering logic
193
+ });
194
+ ```
195
+
196
+ ### 4. Large Bundle Sizes
197
+
198
+ **Issues:**
199
+ - Importing entire libraries for single functions
200
+ - No code splitting for routes
201
+ - Unoptimized images and assets
202
+ - Missing compression
203
+
204
+ **Solutions:**
205
+ ```javascript
206
+ // BAD: Import entire library
207
+ import _ from 'lodash';
208
+
209
+ // GOOD: Import specific functions
210
+ import debounce from 'lodash/debounce';
211
+
212
+ // GOOD: Dynamic imports for code splitting
213
+ const HeavyComponent = lazy(() => import('./HeavyComponent'));
214
+ ```
215
+
216
+ ## Profiling Tools Integration
217
+
218
+ ### 1. Node.js Profiler
219
+
220
+ **CPU Profiling:**
221
+ ```bash
222
+ # Generate CPU profile
223
+ node --prof app.js
224
+
225
+ # Process the profile
226
+ node --prof-process isolate-0x*.log > processed.txt
227
+
228
+ # Analyze the output for hot functions
229
+ ```
230
+
231
+ **Heap Snapshot:**
232
+ ```bash
233
+ # Take heap snapshot
234
+ node --inspect app.js
235
+ # Open chrome://inspect in Chrome
236
+ # Take heap snapshot in DevTools
237
+ ```
238
+
239
+ ### 2. Chrome DevTools
240
+
241
+ **Performance Tab:**
242
+ 1. Open DevTools (F12)
243
+ 2. Go to Performance tab
244
+ 3. Click Record
245
+ 4. Perform actions to profile
246
+ 5. Stop recording
247
+ 6. Analyze flame chart for bottlenecks
248
+
249
+ **Memory Tab:**
250
+ 1. Take heap snapshots before/after actions
251
+ 2. Compare snapshots to find leaks
252
+ 3. Use Allocation Timeline for real-time monitoring
253
+
254
+ ### 3. Lighthouse
255
+
256
+ **Run Lighthouse:**
257
+ ```bash
258
+ # CLI
259
+ npm install -g lighthouse
260
+ lighthouse https://example.com --view
261
+
262
+ # Programmatic
263
+ npm install lighthouse
264
+ ```
265
+
266
+ **Key Metrics:**
267
+ - First Contentful Paint (FCP)
268
+ - Largest Contentful Paint (LCP)
269
+ - Time to Interactive (TTI)
270
+ - Total Blocking Time (TBT)
271
+ - Cumulative Layout Shift (CLS)
272
+
273
+ ### 4. Additional Tools
274
+
275
+ **Backend:**
276
+ - `clinic.js` - Node.js performance profiling
277
+ - `autocannon` - HTTP load testing
278
+ - `0x` - Flamegraph profiler
279
+
280
+ **Frontend:**
281
+ - `react-devtools-profiler` - React component profiling
282
+ - `why-did-you-render` - Detect unnecessary re-renders
283
+ - `bundle-analyzer` - Webpack bundle analysis
284
+
285
+ ## Optimization Strategies
286
+
287
+ ### 1. Algorithm Optimization
288
+
289
+ **Strategy:**
290
+ - Replace O(n²) with O(n log n) or O(n)
291
+ - Use appropriate data structures (Map vs Object, Set vs Array)
292
+ - Implement caching/memoization for expensive calculations
293
+ - Consider lazy evaluation
294
+
295
+ **Example:**
296
+ ```javascript
297
+ // BAD: O(n²) - nested loops
298
+ function findDuplicates(arr) {
299
+ const duplicates = [];
300
+ for (let i = 0; i < arr.length; i++) {
301
+ for (let j = i + 1; j < arr.length; j++) {
302
+ if (arr[i] === arr[j]) duplicates.push(arr[i]);
303
+ }
304
+ }
305
+ return duplicates;
306
+ }
307
+
308
+ // GOOD: O(n) - using Set
309
+ function findDuplicates(arr) {
310
+ const seen = new Set();
311
+ const duplicates = new Set();
312
+ for (const item of arr) {
313
+ if (seen.has(item)) duplicates.add(item);
314
+ seen.add(item);
315
+ }
316
+ return Array.from(duplicates);
317
+ }
318
+ ```
319
+
320
+ ### 2. Caching Strategy
321
+
322
+ **Levels:**
323
+ 1. **In-Memory Cache** - Fast, limited by RAM
324
+ 2. **Redis Cache** - Shared across instances
325
+ 3. **CDN Cache** - Edge caching for static assets
326
+ 4. **Browser Cache** - HTTP caching headers
327
+
328
+ **Implementation:**
329
+ ```javascript
330
+ // Simple in-memory cache with TTL
331
+ class Cache {
332
+ constructor(ttl = 60000) {
333
+ this.cache = new Map();
334
+ this.ttl = ttl;
335
+ }
336
+
337
+ set(key, value) {
338
+ this.cache.set(key, {
339
+ value,
340
+ expires: Date.now() + this.ttl
341
+ });
342
+ }
343
+
344
+ get(key) {
345
+ const item = this.cache.get(key);
346
+ if (!item) return null;
347
+ if (Date.now() > item.expires) {
348
+ this.cache.delete(key);
349
+ return null;
350
+ }
351
+ return item.value;
352
+ }
353
+ }
354
+ ```
355
+
356
+ ### 3. Database Optimization
357
+
358
+ **Strategies:**
359
+ - Add indexes on frequently queried columns
360
+ - Use connection pooling
361
+ - Implement query result caching
362
+ - Optimize JOIN operations
363
+ - Use EXPLAIN to analyze query plans
364
+
365
+ **Example:**
366
+ ```sql
367
+ -- Add index
368
+ CREATE INDEX idx_user_email ON users(email);
369
+
370
+ -- Analyze query
371
+ EXPLAIN SELECT * FROM users WHERE email = 'test@example.com';
372
+ ```
373
+
374
+ ### 4. Lazy Loading
375
+
376
+ **Code Splitting:**
377
+ ```javascript
378
+ // React lazy loading
379
+ const Dashboard = lazy(() => import('./Dashboard'));
380
+
381
+ // Route-based splitting
382
+ const routes = [
383
+ {
384
+ path: '/dashboard',
385
+ component: lazy(() => import('./Dashboard'))
386
+ }
387
+ ];
388
+ ```
389
+
390
+ **Image Lazy Loading:**
391
+ ```html
392
+ <!-- Native lazy loading -->
393
+ <img src="image.jpg" loading="lazy" alt="Description">
394
+ ```
395
+
396
+ ### 5. Debouncing and Throttling
397
+
398
+ **Use Cases:**
399
+ - Search input (debounce)
400
+ - Scroll events (throttle)
401
+ - Window resize (throttle)
402
+ - API calls (debounce)
403
+
404
+ **Implementation:**
405
+ ```javascript
406
+ // Debounce: Wait for pause in events
407
+ function debounce(fn, delay) {
408
+ let timeoutId;
409
+ return (...args) => {
410
+ clearTimeout(timeoutId);
411
+ timeoutId = setTimeout(() => fn(...args), delay);
412
+ };
413
+ }
414
+
415
+ // Throttle: Limit execution rate
416
+ function throttle(fn, limit) {
417
+ let inThrottle;
418
+ return (...args) => {
419
+ if (!inThrottle) {
420
+ fn(...args);
421
+ inThrottle = true;
422
+ setTimeout(() => inThrottle = false, limit);
423
+ }
424
+ };
425
+ }
426
+ ```
427
+
428
+ ## Performance Report Format
429
+
430
+ ### Executive Summary
431
+
432
+ ```markdown
433
+ ## Performance Analysis Report
434
+
435
+ **Date:** [YYYY-MM-DD]
436
+ **Analyzed Files:** [Count]
437
+ **Critical Issues:** [Count]
438
+ **Optimization Opportunities:** [Count]
439
+
440
+ ### Overall Performance Score: [X/10]
441
+
442
+ **Key Findings:**
443
+ 1. [Most critical issue]
444
+ 2. [Second most critical issue]
445
+ 3. [Third most critical issue]
446
+ ```
447
+
448
+ ### Detailed Analysis
449
+
450
+ ```markdown
451
+ ## 1. Algorithm Complexity Issues
452
+
453
+ ### Issue: [Description]
454
+ - **Location:** `path/to/file.js:123`
455
+ - **Current Complexity:** O(n²)
456
+ - **Impact:** High - Executed in hot path
457
+ - **Recommendation:** Use Map for O(n) lookup
458
+
459
+ **Before:**
460
+ \`\`\`javascript
461
+ [problematic code]
462
+ \`\`\`
463
+
464
+ **After:**
465
+ \`\`\`javascript
466
+ [optimized code]
467
+ \`\`\`
468
+
469
+ **Expected Improvement:** 10x faster for n=1000
470
+
471
+ ---
472
+
473
+ ## 2. Memory Issues
474
+
475
+ ### Issue: [Description]
476
+ - **Location:** `path/to/file.js:456`
477
+ - **Type:** Memory leak - Event listener not removed
478
+ - **Impact:** Medium - Grows over time
479
+ - **Recommendation:** Add cleanup in useEffect
480
+
481
+ [Similar format for each issue]
482
+
483
+ ---
484
+
485
+ ## 3. Bundle Size Analysis
486
+
487
+ **Current Size:** 2.5 MB (uncompressed)
488
+ **Gzipped:** 850 KB
489
+
490
+ **Largest Dependencies:**
491
+ 1. lodash - 500 KB (use lodash-es or specific imports)
492
+ 2. moment - 300 KB (replace with date-fns or dayjs)
493
+ 3. [other large deps]
494
+
495
+ **Recommendations:**
496
+ - Implement code splitting: -40% initial bundle
497
+ - Replace moment with dayjs: -280 KB
498
+ - Use lodash-es with tree-shaking: -400 KB
499
+
500
+ **Estimated Final Size:** 1.2 MB (-52%)
501
+
502
+ ---
503
+
504
+ ## 4. Network Performance
505
+
506
+ **Issues Found:**
507
+ - 15 sequential API calls (should be parallel)
508
+ - No request caching
509
+ - Large payload sizes (avg 200 KB)
510
+
511
+ **Recommendations:**
512
+ 1. Use Promise.all() for parallel requests
513
+ 2. Implement Redis caching for frequent queries
514
+ 3. Add response compression (gzip)
515
+
516
+ **Expected Improvement:**
517
+ - API response time: -60%
518
+ - Server load: -40%
519
+
520
+ ---
521
+
522
+ ## Priority Action Items
523
+
524
+ ### High Priority (Do First)
525
+ 1. [ ] Fix N+1 query in user dashboard (10x speedup)
526
+ 2. [ ] Add index on users.email column (5x speedup)
527
+ 3. [ ] Remove memory leak in WebSocket handler
528
+
529
+ ### Medium Priority (Do Next)
530
+ 1. [ ] Implement code splitting for routes
531
+ 2. [ ] Replace moment with dayjs
532
+ 3. [ ] Add Redis caching for API responses
533
+
534
+ ### Low Priority (Nice to Have)
535
+ 1. [ ] Optimize image loading with lazy loading
536
+ 2. [ ] Implement service worker for offline support
537
+ 3. [ ] Add bundle size monitoring to CI
538
+
539
+ ---
540
+
541
+ ## Monitoring Recommendations
542
+
543
+ **Metrics to Track:**
544
+ - Response time (p50, p95, p99)
545
+ - Memory usage (heap size, GC frequency)
546
+ - Bundle size (track over time)
547
+ - Lighthouse scores (weekly)
548
+
549
+ **Tools to Implement:**
550
+ - Application Performance Monitoring (APM)
551
+ - Real User Monitoring (RUM)
552
+ - Synthetic monitoring for critical paths
553
+
554
+ ---
555
+
556
+ ## Conclusion
557
+
558
+ **Estimated Overall Improvement:**
559
+ - Response time: -50%
560
+ - Memory usage: -30%
561
+ - Bundle size: -52%
562
+ - User experience: Significantly improved
563
+
564
+ **Next Steps:**
565
+ 1. Review and prioritize action items
566
+ 2. Implement high-priority fixes
567
+ 3. Set up performance monitoring
568
+ 4. Schedule follow-up analysis in 2 weeks
569
+ ```
570
+
571
+ ## Usage Examples
572
+
573
+ ### Example 1: Analyze Specific File
574
+
575
+ ```
576
+ User: /perf analyze src/api/users.ts