JavaScript Programming
knowledge skill
Writes executable JavaScript code to implement a specified function or module. Produces a string containing valid JS that can be saved to a .js file or executed in a Node.js runtime.
Worked examples
- {"input": {"task": "Create a function that takes an array of numbers and returns a new array with each element squared", "runtime": "node", "dependencies": []}, "output": {"code": "function squareArray(arr) {\n return arr.map(n => n * n);\n}\nmodule.exports = { squareArray };", "dependencies": [], "entry_point": "squareArray"}}
- {"input": {"task": "Implement a React component that displays a counter with increment and decrement buttons", "runtime": "browser", "dependencies": ["react", "react-dom"]}, "output": {"code": "import React, { useState } from 'react';\nexport function Counter() {\n const [count, setCount] = useState(0);\n return (\n <div>\n <button onClick={() => setCount(c => c - 1)}>-</button>\n <span>{count}</span>\n <button onClick={() => setCount(c => c + 1)}>+</button>\n </div>\n );\n}", "dependencies": ["react@18.2.0", "react-dom@18.2.0"], "entry_point": "Counter"}}
Input
- task: string: description of the function or module to implement, including inputs and expected behavior
- runtime: string: target execution environment (node, browser, deno)
- dependencies: array: list of npm package names required for the task
Output
- code: string: valid JavaScript source code implementing the requested functionality
- dependencies: array: resolved npm package names with versions
- entry_point: string: name of the exported function or module entry point
Details
- Skill type: knowledge skill
- Safety level: safe_public_research
- Version: 1.0.0