Agent skill
lang-javascript
This skill should be used when the user asks to "write JavaScript", "debug a Node.js/Bun app", "create a Hono server", "configure Biome", "run tests with bun test", or mentions .js/.mjs files. Covers ES2024+, Bun, and Hono patterns.
Install this agent skill to your Project
npx add-skill https://github.com/joncrangle/.dotfiles/tree/main/dot_config/opencode/skills/lang-javascript
SKILL.md
<skill_doc> <trigger_keywords>
Trigger Keywords
Activate this skill when the user mentions any of:
File Extensions: .js, .mjs, .cjs, package.json, bun.lockb
JavaScript Core: JavaScript, ES2024, ES2025, ESM, CommonJS, import/export, async/await, Promise, Set methods, Object.groupBy, Map.groupBy, toSorted, toReversed, toSpliced
Runtime: Bun, Bun.serve, Bun.file, Bun.write, bun:sqlite, bun:test, Node.js alternative
Web Frameworks: Hono, hono/cors, hono/jwt, edge-first, Cloudflare Workers, c.json, c.text, middleware
Validation: Valibot, @hono/valibot-validator, v.object, v.string, v.pipe, schema validation
Testing: bun test, describe, it, expect, mock, beforeEach, afterEach, --coverage
Linting: Biome, biomejs, biome.json, linter, formatter, biome check
Database: bun:sqlite, Drizzle ORM, SQLite, prepared statements </trigger_keywords>
⛔ Forbidden Patterns
- NO
var: Always useconstorlet. Block scope is mandatory. - NO
requirein ESM: Useimport/exportsyntax unless explicitly in a CJS context or interacting with legacy CJS-only packages in a compatible way. - NO Promise Constructors for Async/Await: Avoid
new Promise()wrappers around functions that already return promises. Useasync/awaitdirectly. - NO Loose Equality: Always use
===and!==instead of==and!=. - NO Ignoring Floating Point Precision: Be aware of
0.1 + 0.2 !== 0.3. Use libraries likedecimal.jsfor financial calculations if needed.
🤖 Agent Tool Strategy
- Discovery: Check for
justfilefirst. If it exists, usejust -lto list recipes and preferjustcommands over language-specific CLIs (npm, cargo, poetry, etc.). Then, readpackage.jsonto understand the project type (type: "module"vs "commonjs"), dependencies, and scripts. - File Operations:
- Use
bun initornpm init(via Bash) only if creating a new project. - Use
Readto inspect existing code before modifying.
- Use
- Testing: Prefer running tests via
bun testornpm testafter changes to verify correctness. - Linting: Check for
biome.jsonoreslint.config.jsand respect the project's linting rules.
Quick Reference (30 seconds)
JavaScript ES2024+ Development Specialist - Modern JavaScript with Bun runtime and Hono framework.
Auto-Triggers: .js, .mjs, .cjs files, package.json, JavaScript projects
Core Stack:
- ES2024+: Set methods, Promise.withResolvers, immutable arrays, import attributes
- Bun: Fast all-in-one runtime, bundler, test runner, package manager
- Hono: Ultrafast, edge-first web framework
- Testing: Bun's built-in test runner
- Linting: Biome (linter + formatter)
- Validation: Valibot (tree-shakable)
Quick Commands:
# Create new project
bun init
# Install dependencies
bun install
bun add hono valibot
bun add -d @biomejs/biome
# Run development server
bun run --watch src/index.js
# Run tests
bun test
# Bundle for production
bun build ./src/index.js --outdir=./dist --target=bun
Implementation Guide (5 minutes)
See patterns.md for detailed implementation patterns covering:
- ES2024 Key Features (Set Operations, Promise.withResolvers)
- ES2025 Features (Import Attributes, RegExp.escape)
- Bun Runtime (File I/O, HTTP Server, SQLite)
- Hono Web Framework (Basic Setup, Validation, JWT, Error Handling)
- Testing with Bun
- Biome (Linter + Formatter)
Quick Troubleshooting
Bun Issues:
# Check version
bun --version
# Upgrade Bun
bun upgrade
# Clear cache
bun pm cache rm
Module System:
# Check package.json type
# (Use the Read tool to inspect package.json)
# ESM: "type": "module" - use import/export
# CommonJS: "type": "commonjs" or omitted - use require/module.exports
Common Fixes:
# Delete cache and reinstall
rm -rf node_modules bun.lockb && bun install
# Check for outdated packages
bun outdated
Advanced Patterns
For comprehensive documentation including advanced async patterns, module system details, performance optimization, and production deployment configurations, see:
- patterns.md - Implementation patterns (Bun, Hono, Biome)
- reference.md - Complete API reference, Context7 library mappings, Bun APIs
- examples.md - Production-ready code examples, full-stack patterns, testing templates
Context7 Integration
// Bun - mcp__context7__get_library_docs("/oven-sh/bun", "runtime bundler test", 1)
// Hono - mcp__context7__get_library_docs("/honojs/hono", "middleware validators routing", 1)
// Valibot - mcp__context7__get_library_docs("/fabian-hiller/valibot", "schema validation", 1)
// Drizzle - mcp__context7__get_library_docs("/drizzle-team/drizzle-orm", "queries migrations", 1)
Quick Troubleshooting
Bun Issues:
# Check version
bun --version
# Upgrade Bun
bun upgrade
# Clear cache
bun pm cache rm
Module System:
# Check package.json type
# (Use the Read tool to inspect package.json)
# ESM: "type": "module" - use import/export
# CommonJS: "type": "commonjs" or omitted - use require/module.exports
Common Fixes:
# Delete cache and reinstall
rm -rf node_modules bun.lockb && bun install
# Check for outdated packages
bun outdated
</skill_doc>
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
opentui
Comprehensive OpenTUI skill for building terminal user interfaces. Covers the core imperative API, React reconciler, and Solid reconciler. Use for any TUI development task including components, layout, keyboard handling, animations, and testing.
vitest
Specialist in Vitest, a blazing fast unit test framework powered by Vite. Focuses on Jest compatibility, in-source testing, and native ESM support.
PreventionPatterns
Known bug patterns and their fixes to prevent regression.
lang-typescript
This skill should be used when the user asks to "write TypeScript", "debug TypeScript", "create a SolidJS component", "configure TanStack Start", "validate data with Valibot", or mentions .ts/.tsx files. Covers TypeScript 5.9+, SolidJS, and TanStack patterns.
just-cli
This skill should be used when the user asks to "create a justfile", "write just recipes", "configure just settings", "add just modules", "use just attributes", "set up task automation", mentions justfile, just command runner, or task automation with just.
lang-go
Go 1.23+ development specialist covering Chi, GORM, and concurrent programming patterns. Use when building high-performance microservices, CLI tools, or cloud-native applications.
Didn't find tool you were looking for?