本文へスキップ
Skillpedia
一般的なプログラミング41k · #6713

modern-javascript-patterns

できること

このガイドでは、最新バージョンのJavaScript(ES6以降と呼ばれます)を使って、よりすっきりとして高速で、理解しやすいコードを書く方法を解説します。「async/await」や「分割代入(destructuring)」などの機能を扱います。

使う場面

  • ✓古いJavaScriptのコードを更新したいとき。
  • ✓より整理されて読みやすいコードを書きたいとき。
  • ✓インターネットからのデータ取得など、時間のかかる処理を扱う必要があるとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/wshobson/agents/blob/main/plugins/javascript-typescript/skills/modern-javascript-patterns/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“この古いJavaScriptコードを、最新の機能を使うように書き換えるにはどうすればよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIは、このガイドのベストプラクティスと例を使って、コードの書き換え方を示します。新しいJavaScriptの機能を活用して、より効率的で読みやすいコードにすることに重点を置きます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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.

よくある質問

「ES6+」とは何ですか?

JavaScript言語の最新バージョン群のことです。プログラマーの作業を楽にする多くの改善や新機能が加えられています。

「async/await」とは何ですか?

インターネットからの情報取得など、時間のかかる処理を扱うためのシンプルな書き方です。処理の完了を待つ間も、プログラムの他の部分は動き続けられます。

「コードのリファクタリング」とは何ですか?

動作を変えずに、既存のコードを書き直して改善することです。家具を動かさずに部屋を片付けて掃除するようなものです。

詳細

作者による元の説明

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

人気

GitHubのスター
41k
ランキング
#6713
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル