Chuyển đến nội dung
Skillpedia
Lập trình chung41k · #6713

modern-javascript-patterns

Skill này làm gì

Hướng dẫn này chỉ cách dùng các phiên bản mới nhất của JavaScript (gọi là ES6+) để viết code gọn gàng, nhanh hơn và dễ đọc hơn. Nội dung gồm các tính năng như “async/await” và “destructuring”.

Khi nào nên dùng

  • ✓Khi bạn có code JavaScript cũ và muốn cập nhật.
  • ✓Khi bạn muốn viết code có tổ chức và dễ đọc hơn.
  • ✓Khi bạn cần xử lý các tác vụ tốn thời gian, như lấy dữ liệu từ internet.

Liên kết skill

https://github.com/wshobson/agents/blob/main/plugins/javascript-typescript/skills/modern-javascript-patterns/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/wshobson/agents/blob/main/plugins/javascript-typescript/skills/modern-javascript-patterns/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để cập nhật đoạn code JavaScript cũ này để dùng các tính năng hiện đại?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI dùng các thực hành tốt nhất và ví dụ trong hướng dẫn để chỉ cách viết lại code của bạn. Nó tập trung vào việc dùng các tính năng mới của JavaScript để code hiệu quả và dễ đọc hơn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Modern JavaScript Patterns

Comprehensive guide for mastering modern JavaScript (ES6+) features, functional programming patterns, and best practices for writing clean, maintainable, and performant code.

When to Use This Skill

  • Refactoring legacy JavaScript to modern syntax
  • Implementing functional programming patterns
  • Optimizing JavaScript performance
  • Writing maintainable and readable code
  • Working with asynchronous operations
  • Building modern web applications
  • Migrating from callbacks to Promises/async-await
  • Implementing data transformation pipelines

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Use const by default: Only use let when reassignment is needed
  2. Prefer arrow functions: Especially for callbacks
  3. Use template literals: Instead of string concatenation
  4. Destructure objects and arrays: For cleaner code
  5. Use async/await: Instead of Promise chains
  6. Avoid mutating data: Use spread operator and array methods
  7. Use optional chaining: Prevent "Cannot read property of undefined"
  8. Use nullish coalescing: For default values
  9. Prefer array methods: Over traditional loops
  10. Use modules: For better code organization
  11. Write pure functions: Easier to test and reason about
  12. Use meaningful variable names: Self-documenting code
  13. Keep functions small: Single responsibility principle
  14. Handle errors properly: Use try/catch with async/await
  15. Use strict mode: 'use strict' for better error catching

For common pitfalls (this binding, promise anti-patterns, memory leaks), see references/advanced-patterns.md.

Câu hỏi thường gặp

“ES6+” là gì?

Đây là các phiên bản mới nhất của ngôn ngữ JavaScript, mang lại nhiều cải tiến và tính năng mới giúp công việc lập trình dễ dàng hơn.

“async/await” là gì?

Đây là cách đơn giản hơn để xử lý các tác vụ tốn thời gian, như tải dữ liệu từ internet, mà không làm dừng phần còn lại của chương trình.

“Refactoring code” nghĩa là gì?

Refactoring là viết lại code hiện có để cải thiện nó mà không thay đổi chức năng. Giống như dọn dẹp, sắp xếp nhà cửa mà không di chuyển đồ đạc.

Chi tiết

Mô tả gốc của tác giả

Master ES6+ features including async/await, destructuring, spread operators, arrow functions, promises, modules, iterators, generators, and functional programming patterns for writing clean, efficient JavaScript code. Use when refactoring legacy code, implementing modern patterns, or optimizing JavaScript applications.

repo: wshobson/agents

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6713
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự