JavaScript Development
knowledge skill
Writes and refactors JavaScript code to implement logic, manipulate the DOM, or build server-side functions. Produces executable .js files or code snippets that adhere to ECMAScript standards.
Worked examples
- {"input": {"requirements": "Create a function to fetch user data from /api/users and filter by active status.", "context": "REST API returns array of objects {id, name, active}", "target_environment": "browser"}, "output": {"code": "async function getActiveUsers() {\n const res = await fetch('/api/users');\n const data = await res.json();\n return data.filter(user => user.active === true);\n}", "explanation": "Uses async/await for the fetch API and Array.prototype.filter for status checking.", "dependencies": []}}
- {"input": {"requirements": "Write a Node.js middleware to validate that a request header contains an 'X-API-Key'.", "context": "Express.js framework", "target_environment": "Node.js"}, "output": {"code": "const authMiddleware = (req, res, next) => {\n if (!req.headers['x-api-key']) {\n return res.status(401).send('Missing API Key');\n }\n next();\n};", "explanation": "Checks request headers object and returns 401 status if key is absent.", "dependencies": ["express"]}}
Input
- requirements: string: functional specifications
- context: string: existing codebase or API definitions
- target_environment: string: browser or Node.js
Output
- code: string: the generated JavaScript source
- explanation: string: technical breakdown of logic
- dependencies: array: required npm packages or libraries
Details
- Skill type: knowledge skill
- Safety level: safe_public_research
- Version: 1.0.0