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.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
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
- Use const by default: Only use let when reassignment is needed
- Prefer arrow functions: Especially for callbacks
- Use template literals: Instead of string concatenation
- Destructure objects and arrays: For cleaner code
- Use async/await: Instead of Promise chains
- Avoid mutating data: Use spread operator and array methods
- Use optional chaining: Prevent "Cannot read property of undefined"
- Use nullish coalescing: For default values
- Prefer array methods: Over traditional loops
- Use modules: For better code organization
- Write pure functions: Easier to test and reason about
- Use meaningful variable names: Self-documenting code
- Keep functions small: Single responsibility principle
- Handle errors properly: Use try/catch with async/await
- 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
Bình luận
- …
Thêm skill từ kho mã này
screen-reader-testing
41kGiúp agent của bạn kiểm thử website bằng trình đọc màn hình để đảm bảo chúng có thể truy cập được.
wcag-audit-patterns
41kGiúp agent của bạn kiểm toán website về khả năng truy cập và sửa các vấn đề theo hướng dẫn WCAG.
multi-reviewer-patterns
41kCho phép agent của bạn điều phối các đợt rà soát mã song song, loại bỏ phát hiện trùng lặp và tổng hợp báo cáo.
parallel-debugging
41kCho phép agent gỡ lỗi các vấn đề phức tạp bằng cách điều tra song song và phân tích nguyên nhân gốc.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.