JavaScript Handler Skill
Mission
Create JavaScript handlers following the project's strict standards.
Location
front/public/site/js/<feature>/<name>.js
Standards
MANDATORY: Read and apply ALL rules from:
.claude/rules/javascript-standards.md
Quick Reference
- •IIFE -
(function() { 'use strict'; ... })(); - •No
var-constdefault,letif reassignment - •Declare locally - Variables closest to usage
- •Assertions - Validate at function entry, throw explicit errors
- •Max 60 lines - Per function
- •Check returns -
response.ok, null, undefined - •No empty catch - Log with context or re-throw
- •No mutation - Return new objects
- •Object mapping - Over
switchwhen possible - •Bounded loops - Prefer
map/filter/reduce
Translations
javascript
// Twig: {{ ['key1', 'key2'] | tradJS }}
// JS: window.trad.key1
Checklist
See .claude/rules/javascript-standards.md for complete checklist.