Back to list
ProfPowell

javascript-author

by ProfPowell

A layered HTML component system. Build with native HTML elements, enhance progressively with CSS custom elements and JavaScript web components.

0🍴 0📅 Jan 25, 2026

SKILL.md


name: javascript-author description: Write vanilla JavaScript for Web Components with functional core, imperative shell. Use when creating JavaScript files, building interactive components, or writing any client-side code. allowed-tools: Read, Write, Edit, Glob, Grep

JavaScript Authoring Skill

Write modern vanilla JavaScript following functional core with imperative shell architecture.

Core Principles

PrincipleDescription
Functional CorePure functions, getters, computed values - no side effects
Imperative ShellDOM manipulation, event handlers, side effects in lifecycle hooks
Dependency InjectionImport templates, styles, i18n from separate files
Named Exports OnlyNo default exports - explicit named exports
JSDoc DocumentationDocument classes, public methods, and events

File Structure Pattern

components/
└── my-component/
    ├── my-component.js           # Main component class
    ├── my-component-template.js  # Template function
    ├── my-component-styles.js    # CSS-in-JS styles
    └── my-component-i18n.js      # Translations object

Web Component Template

import { template } from './my-component-template.js';
import { styles } from './my-component-styles.js';
import { translations } from './my-component-i18n.js';

/**
 * @class MyComponent
 * @extends HTMLElement
 * @description Brief description of component purpose
 * @fires my-component-update - Fired when state changes
 */
class MyComponent extends HTMLElement {
    static get observedAttributes() {
        return ['lang', 'value'];
    }

    constructor() {
        super();
        this.attachShadow({ mode: 'open' });
    }

    // FUNCTIONAL CORE - Pure getters
    get lang() {
        return this.getAttribute('lang') ||
               this.closest('[lang]')?.getAttribute('lang') ||
               document.documentElement.lang ||
               'en';
    }

    get translations() {
        return translations[this.lang] || translations.en;
    }

    // IMPERATIVE SHELL - Side effects
    render() {
        this.shadowRoot.innerHTML = `
            <style>${styles}</style>
            ${template(this.translations)}
        `;
    }

    connectedCallback() {
        this.render();
        // Set up observers and listeners
    }

    disconnectedCallback() {
        // Clean up observers and listeners - REQUIRED
    }

    attributeChangedCallback(name, oldValue, newValue) {
        if (oldValue !== newValue) {
            this.render();
        }
    }
}

customElements.define('my-component', MyComponent);

export { MyComponent };

Quick Reference

ESLint Rules Enforced

RuleRequirement
no-varUse const or let only
prefer-constUse const when variable is never reassigned
prefer-templateUse template literals for string concatenation
eqeqeqUse === and !== only
camelcaseUse camelCase for variables and functions
object-shorthandUse { foo } not { foo: foo }
Named exportsNo default exports

Naming Conventions

ContextConventionExample
Variables/FunctionscamelCasehandleClick, userName
ClassesPascalCaseMyComponent, UserService
Custom Elementskebab-case<my-component>, <user-card>
Eventskebab-case'user-updated', 'form-submit'
CSS Classeskebab-case.card-header, .nav-item

Skills to Consider Before Writing

When authoring JavaScript, consider invoking these related skills:

Code PatternInvoke SkillWhy
class X extends HTMLElementcustom-elementsFull Web Component lifecycle, slots, shadow DOM
fetch() or API callsapi-clientRetry logic, error handling, caching patterns
Component state, reactivitystate-managementObservable patterns, undo/redo, sync strategies
localStorage, IndexedDBdata-storagePersistence patterns, offline-first
Error handlingerror-handlingError boundaries, global handlers, reporting

When Creating Web Components

If your JavaScript file defines a custom element (extends HTMLElement), also invoke:

  • custom-elements - For registration patterns, slots, attribute handling
  • state-management - If component manages internal state
  • accessibility-checker - For keyboard navigation, ARIA

When Making API Calls

If your code uses fetch() or makes network requests:

  • api-client - Retry logic, timeout handling, typed responses
  • error-handling - Network error recovery, user feedback
  • custom-elements - Define and use custom HTML elements
  • state-management - Client-side state patterns for Web Components
  • api-client - Fetch API patterns with error handling and caching
  • data-storage - localStorage, IndexedDB, SQLite WASM patterns
  • error-handling - Consistent error handling across frontend and backend
  • unit-testing - Write unit tests with Node.js native test runner
  • typescript-author - TypeScript for Web Components and Node.js

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon