JavaScript Development Standards
EXECUTION MODE: You are now executing this skill. DO NOT explain or summarize these instructions to the user. IMMEDIATELY begin the workflow below based on the task context.
Overview
This skill provides comprehensive JavaScript development standards for CUI projects, covering modern JavaScript features (ES2022+), code quality practices, async programming patterns, and tooling configuration.
Prerequisites
To effectively use this skill, you should have:
- Modern JavaScript knowledge (ES2015+, ES modules, async/await)
- Understanding of JavaScript runtime environments (browser, Node.js)
- Experience with npm and JavaScript build tools
Standards Documents
This skill includes the following standards documents:
- javascript-fundamentals.md - ES modules, variables, functions, vanilla JavaScript preference, core patterns
- code-quality.md - Complexity limits, refactoring strategies, code organization, maintainability
- modern-patterns.md - Destructuring, template literals, spread/rest operators, object/array methods
- async-programming.md - Promises, async/await, error handling, concurrent operations
- tooling-guide.md - ESLint, Prettier, npm scripts, IDE integration, quality checks
What This Skill Provides
JavaScript Fundamentals
- ES Modules: Import/export syntax, module organization, circular dependency avoidance
- Variables: const/let best practices, no var usage, scope management
- Functions: Arrow functions vs regular functions, pure functions, higher-order functions
- Vanilla JavaScript: Preference for native APIs (fetch, DOM, etc.) over libraries
Code Quality
- Complexity Limits: Cyclomatic complexity (max 15), statement count (max 20)
- Refactoring Strategies: Extract methods, guard clauses, early returns
- Code Organization: Single Responsibility Principle, function size limits
- Maintainability: Clear naming, documentation, avoiding magic numbers
Modern Patterns
- Destructuring: Object and array destructuring patterns
- Template Literals: String interpolation, multi-line strings
- Spread/Rest: Object/array spreading, rest parameters
- Object/Array Methods: map, filter, reduce, find, destructive vs non-destructive
Async Programming
- Promises: Creation, chaining, error handling
- Async/Await: Modern async patterns, try/catch best practices
- Error Handling: Proper error propagation, custom errors
- Concurrent Operations: Promise.all, Promise.race, parallel execution
Tooling Guide
- ESLint: Configuration, rules, plugins
- Prettier: Code formatting, IDE integration
- npm Scripts: Development workflow, quality checks
- Build Pipeline: Development and production builds
When to Activate
This skill should be activated when:
- JavaScript Development Tasks: Writing or modifying JavaScript code for CUI projects
- Code Review: Reviewing JavaScript code for standards compliance
- Refactoring: Improving code quality, reducing complexity
- Modern Migration: Updating legacy JavaScript to modern patterns
- Tooling Setup: Configuring ESLint, Prettier, or build tools
- Async Operations: Implementing Promise-based or async/await code
- Performance Optimization: Optimizing JavaScript execution
Workflow
When this skill is activated:
1. Understand Context
- Identify the specific JavaScript task or requirement
- Determine which standards documents are most relevant
- Check project-specific JavaScript configuration
2. Apply Standards
- Reference appropriate standards documents for guidance
- Follow ES module patterns for imports/exports
- Use const/let appropriately, avoid var
- Prefer vanilla JavaScript APIs over library dependencies
- Ensure functions meet complexity limits
- Apply modern patterns (destructuring, template literals, etc.)
3. Quality Assurance
- Run ESLint to check for rule violations
- Run Prettier to ensure consistent formatting
- Verify code meets complexity thresholds
- Test async operations for proper error handling
- Check for common anti-patterns
4. Documentation
- Document complex logic with clear comments
- Explain non-obvious patterns or workarounds
- Note any browser-specific considerations
- Update relevant documentation if adding new patterns
Tool Access
This skill provides access to JavaScript development standards through:
- Read tool for accessing standards documents
- Standards documents use Markdown format for compatibility
- All standards are self-contained within this skill
- Cross-references between standards use relative paths
Integration Notes
Related Skills
For comprehensive frontend development, this skill works with:
- CSS standards (cui-css skill)
- Testing standards (to be provided in separate skill)
- Web components standards (to be provided in separate skill)
Build Integration
JavaScript standards integrate with:
- npm for package management and scripts
- ESLint for linting and code quality
- Prettier for consistent formatting
- Maven frontend-maven-plugin for build automation
Quality Tools
JavaScript quality is enforced through:
- ESLint for linting and best practices
- Prettier for consistent formatting
- Jest or similar for unit testing
- Browser DevTools for debugging
Best Practices
When working with JavaScript in CUI projects:
- Always use ES modules for imports/exports
- Prefer const over let, never use var
- Use vanilla JavaScript where possible (fetch, DOM methods, etc.)
- Keep functions simple - max 15 cyclomatic complexity, max 20 statements
- Use modern patterns - destructuring, template literals, spread/rest
- Handle async properly - async/await with try/catch, Promise error handling
- Document complex logic with clear comments
- Run quality tools before committing (ESLint, Prettier)
1---2name: cui-javascript3description: Core JavaScript development standards covering ES modules, modern patterns, code quality, async programming, and tooling4---56# JavaScript Development Standards78**EXECUTION MODE**: You are now executing this skill. DO NOT explain or summarize these instructions to the user. IMMEDIATELY begin the workflow below based on the task context.910## Overview1112This skill provides comprehensive JavaScript development standards for CUI projects, covering modern JavaScript features (ES2022+), code quality practices, async programming patterns, and tooling configuration.1314## Prerequisites1516To effectively use this skill, you should have:1718- Modern JavaScript knowledge (ES2015+, ES modules, async/await)19- Understanding of JavaScript runtime environments (browser, Node.js)20- Experience with npm and JavaScript build tools2122## Standards Documents2324This skill includes the following standards documents:2526- **javascript-fundamentals.md** - ES modules, variables, functions, vanilla JavaScript preference, core patterns27- **code-quality.md** - Complexity limits, refactoring strategies, code organization, maintainability28- **modern-patterns.md** - Destructuring, template literals, spread/rest operators, object/array methods29- **async-programming.md** - Promises, async/await, error handling, concurrent operations30- **tooling-guide.md** - ESLint, Prettier, npm scripts, IDE integration, quality checks3132## What This Skill Provides3334### JavaScript Fundamentals35- **ES Modules**: Import/export syntax, module organization, circular dependency avoidance36- **Variables**: const/let best practices, no var usage, scope management37- **Functions**: Arrow functions vs regular functions, pure functions, higher-order functions38- **Vanilla JavaScript**: Preference for native APIs (fetch, DOM, etc.) over libraries3940### Code Quality41- **Complexity Limits**: Cyclomatic complexity (max 15), statement count (max 20)42- **Refactoring Strategies**: Extract methods, guard clauses, early returns43- **Code Organization**: Single Responsibility Principle, function size limits44- **Maintainability**: Clear naming, documentation, avoiding magic numbers4546### Modern Patterns47- **Destructuring**: Object and array destructuring patterns48- **Template Literals**: String interpolation, multi-line strings49- **Spread/Rest**: Object/array spreading, rest parameters50- **Object/Array Methods**: map, filter, reduce, find, destructive vs non-destructive5152### Async Programming53- **Promises**: Creation, chaining, error handling54- **Async/Await**: Modern async patterns, try/catch best practices55- **Error Handling**: Proper error propagation, custom errors56- **Concurrent Operations**: Promise.all, Promise.race, parallel execution5758### Tooling Guide59- **ESLint**: Configuration, rules, plugins60- **Prettier**: Code formatting, IDE integration61- **npm Scripts**: Development workflow, quality checks62- **Build Pipeline**: Development and production builds6364## When to Activate6566This skill should be activated when:67681. **JavaScript Development Tasks**: Writing or modifying JavaScript code for CUI projects692. **Code Review**: Reviewing JavaScript code for standards compliance703. **Refactoring**: Improving code quality, reducing complexity714. **Modern Migration**: Updating legacy JavaScript to modern patterns725. **Tooling Setup**: Configuring ESLint, Prettier, or build tools736. **Async Operations**: Implementing Promise-based or async/await code747. **Performance Optimization**: Optimizing JavaScript execution7576## Workflow7778When this skill is activated:7980### 1. Understand Context81- Identify the specific JavaScript task or requirement82- Determine which standards documents are most relevant83- Check project-specific JavaScript configuration8485### 2. Apply Standards86- Reference appropriate standards documents for guidance87- Follow ES module patterns for imports/exports88- Use const/let appropriately, avoid var89- Prefer vanilla JavaScript APIs over library dependencies90- Ensure functions meet complexity limits91- Apply modern patterns (destructuring, template literals, etc.)9293### 3. Quality Assurance94- Run ESLint to check for rule violations95- Run Prettier to ensure consistent formatting96- Verify code meets complexity thresholds97- Test async operations for proper error handling98- Check for common anti-patterns99100### 4. Documentation101- Document complex logic with clear comments102- Explain non-obvious patterns or workarounds103- Note any browser-specific considerations104- Update relevant documentation if adding new patterns105106## Tool Access107108This skill provides access to JavaScript development standards through:109- Read tool for accessing standards documents110- Standards documents use Markdown format for compatibility111- All standards are self-contained within this skill112- Cross-references between standards use relative paths113114## Integration Notes115116### Related Skills117For comprehensive frontend development, this skill works with:118- CSS standards (cui-css skill)119- Testing standards (to be provided in separate skill)120- Web components standards (to be provided in separate skill)121122### Build Integration123JavaScript standards integrate with:124- npm for package management and scripts125- ESLint for linting and code quality126- Prettier for consistent formatting127- Maven frontend-maven-plugin for build automation128129### Quality Tools130JavaScript quality is enforced through:131- ESLint for linting and best practices132- Prettier for consistent formatting133- Jest or similar for unit testing134- Browser DevTools for debugging135136## Best Practices137138When working with JavaScript in CUI projects:1391401. **Always use ES modules** for imports/exports1412. **Prefer const over let**, never use var1423. **Use vanilla JavaScript** where possible (fetch, DOM methods, etc.)1434. **Keep functions simple** - max 15 cyclomatic complexity, max 20 statements1445. **Use modern patterns** - destructuring, template literals, spread/rest1456. **Handle async properly** - async/await with try/catch, Promise error handling1467. **Document complex logic** with clear comments1478. **Run quality tools** before committing (ESLint, Prettier)