Use when the user wants to check if their JavaScript code is efficient, asks about Big-O complexity, suspects a memory leak, or notices slow performance. Analyses time/space complexity, identifies hidden bottlenecks, and provides an optimized version.
Use when the user asks "what is X?", "how does X work?", or is confused about a JavaScript concept, syntax, built-in method, or API. Defines the concept in plain English, provides a minimal code example, and lists common beginner gotchas.
Use when the user wants to practice, train, or test their understanding of a JavaScript topic. Generates a focused coding challenge with requirements, boilerplate, and scoring — never gives away the solution.
Use when the user pastes messy, repetitive, tightly-coupled, or hard-to-maintain JavaScript code. Identifies the core structural problem, selects an appropriate design pattern (Module, Observer, Factory, Strategy, etc.), and refactors with inline explanations.