skills/coding/coding-javascript/SKILL.md
JavaScript ES2024+: DOM, fetch, promises, generators, WeakRef, Proxy, modern patterns
npx skillsauth add alphaonedev/openclaw-graph coding-javascriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill equips OpenClaw to assist with JavaScript coding tasks using ES2024 features, focusing on modern browser-based development like DOM manipulation, asynchronous operations, and advanced patterns.
Use this skill when users need help with frontend JavaScript, such as building interactive web apps, handling API requests, or implementing efficient memory management with WeakRef. Apply it for tasks involving promises, generators, or Proxies in ES6+ environments, especially in browser contexts.
To invoke this skill, prefix user queries with "use coding-javascript" in OpenClaw commands, e.g., "openclaw use coding-javascript and write a fetch function". For code generation, provide specific inputs like variable names or API endpoints. Always specify ES2024 features if needed, e.g., "generate code using WeakRef". Integrate by chaining skills, like "use coding-javascript then coding-web for full-stack advice". Test outputs in a browser console before deployment.
Use OpenClaw CLI to activate: openclaw run coding-javascript --query="explain promises". For JavaScript specifics:
fetch('https://api.example.com/data', { method: 'GET' }) to make requests; handle responses with .then(response => response.json())..then() and .catch(), e.g., new Promise(resolve => resolve('data')).then(data => console.log(data)).function* gen() { yield 1; yield 2; } and iterate using for (let value of gen()) { console.log(value); }.new WeakRef(object) and dereference via .deref() for potential null if garbage collected.new Proxy(target, { get: (target, prop) => console.log(prop) }) to intercept access.
Config format: Use JSON for skill inputs, e.g., { "feature": "promises", "example": true } in OpenClaw configs. If external APIs are involved, set auth via env vars like $JAVASCRIPT_API_KEY in your script.Integrate this skill with OpenClaw by including it in multi-skill workflows, e.g., "openclaw chain coding-javascript and coding-css". For browser environments, ensure code runs in a modern engine like Chrome or Node.js v14+. Use env vars for secrets, e.g., export $FETCH_API_KEY and reference in code as process.env.FETCH_API_KEY. Avoid conflicts by specifying versions, like "use ES2024 only". For testing, wrap code in modules: import { fetch } from 'whatwg-fetch';.
Always wrap asynchronous code in try-catch blocks, e.g.:
try {
await fetch('url').then(res => res.json());
} catch (error) {
console.error('Fetch failed:', error.message);
}
For promises, use .catch(): promise.then(data => process(data)).catch(err => logError(err)). With generators, handle iteration errors via try-catch in the loop. For Proxies, trap errors in handlers, e.g., new Proxy({}, { get: (target, prop) => { if (!target[prop]) throw new Error('Property not found'); } }). Check for WeakRef validity: if (weakRef.deref() !== undefined) { useObject(); }. In OpenClaw, log errors with openclaw log --skill=coding-javascript --error=details.
openclaw use coding-javascript and generate: const userId = 1; fetch(https://api.example.com/users/${userId}).then(res => res.json()).then(data => console.log(data.name));.openclaw use coding-javascript and code: const handler = { set: (obj, prop, value) => { if (prop === 'age' && value < 18) throw Error('Underage'); obj[prop] = value; } }; const proxy = new Proxy({}, handler); proxy.age = 16; // Throws error.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui