docs/agi/skills/typescript-types/SKILL.md
# Skill: typescript-types ## Scope Create and maintain TypeScript declaration files (.d.ts) for jsgui3-html components. **Does:** - Generate .d.ts files for controls and modules - Define interfaces for specs, params, and return types - Update package.json exports for TypeScript consumers - Maintain backward compatibility with JavaScript users **Does Not:** - Convert source files to TypeScript - Add runtime type checking - Handle complex generic patterns ## Inputs - File or module to type (e.
npx skillsauth add metabench/jsgui3-html docs/agi/skills/typescript-typesInstall 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.
Create and maintain TypeScript declaration files (.d.ts) for jsgui3-html components.
Does:
Does Not:
window.js, theme_params.js)What needs types?
Read the source file:
View: <file>.js
Identify: class, constructor, public methods, exports
For control classes, create a Spec interface:
// <control>.d.ts
import { Control } from '<path>/html-core/control';
import { ControlSpec } from '<path>/types/control-spec';
/**
* <Control> specific parameters.
*/
export interface <Control>Params {
/** Description of param */
size?: 'small' | 'medium' | 'large';
/** Description of param */
variant?: 'primary' | 'secondary';
// ... all params with JSDoc comments
}
/**
* <Control> specification.
*/
export interface <Control>Spec extends ControlSpec<<Control>Params> {
/** Control-specific property */
title?: string;
/** Another property */
show_buttons?: boolean;
// ... control-specific spec properties
}
/**
* <Control> - description of what the control does.
*/
export declare class <Control> extends Control {
/**
* Create a new <Control>.
* @param spec - Control specification
*/
constructor(spec?: <Control>Spec);
// Public readonly properties
/** Description */
readonly some_property: Type;
// Public mutable properties
/** Description */
some_setting: boolean;
// Public methods with full JSDoc
/**
* Description of method.
* @param param - What it does
* @returns What it returns
*/
some_method(param: Type): ReturnType;
}
export default <Control>;
For non-class modules:
// module.d.ts
/**
* Function description.
* @param param1 - Description
* @param param2 - Description
* @returns Description
*/
export declare function function_name<T = DefaultType>(
param1: Type1,
param2?: Type2
): ReturnType<T>;
/**
* Constant description.
*/
export declare const some_constant: {
key1: Type;
key2: Type;
};
types/theme.d.ts for new params:// Add new param interface
export interface <Control>Params { ... }
// Update ThemeParams
export interface ThemeParams {
window?: WindowParams;
button?: ButtonParams;
// ADD:
<control>?: <Control>Params;
}
types/index.d.ts:export {
// ... existing
<Control>Params
} from './theme';
html.d.ts main entry:// Add export
export { <Control>, <Control>Spec } from './controls/.../<control>';
When params have fixed values, use union types:
// Not this:
variant?: string;
// This:
variant?: 'default' | 'primary' | 'ghost' | 'danger';
// For control-level variant (preset name):
export interface WindowSpec extends ControlSpec<WindowParams> {
variant?: 'default' | 'macos' | 'windows-11' | 'minimal';
}
All exports should have JSDoc comments:
/**
* Resolve composition parameters for a control.
*
* Merges params from (highest to lowest priority):
* 1. spec.params - Direct params on the control
* 2. context.theme.params[control_type] - Theme-level params
* 3. Variant defaults - From the variant registry
*
* @param control_type - Control type (e.g., 'window')
* @param spec - Control specification
* @param context - Page context
* @param options - Resolution options
* @returns Resolved params and styling hooks
*
* @example
* const { params, hooks } = resolve_params('window', spec, context);
* // params.button_position === 'left'
* // hooks.attrs['data-button-style'] === 'traffic-light'
*/
export declare function resolve_params<T = Record<string, unknown>>(
control_type: string,
spec?: ControlSpec,
context?: PageContext,
options?: ResolveOptions
): ResolvedParams<T>;
Ensure TypeScript consumers can find types:
{
"name": "jsgui3-html",
"main": "html.js",
"types": "html.d.ts",
"exports": {
".": {
"require": "./html.js",
"types": "./html.d.ts"
},
"./types": {
"types": "./types/index.d.ts"
},
"./types/*": {
"types": "./types/*.d.ts"
}
}
}
// test/types/verify-<control>.ts
import { <Control>, <Control>Spec } from '../../html';
// Test spec typing
const spec: <Control>Spec = {
variant: 'primary', // Should autocomplete
params: {
size: 'large' // Should autocomplete
}
};
// Test construction
const ctrl = new <Control>(spec);
// Test methods
ctrl.some_method(); // Should have correct signature
npx tsc --noEmit test/types/verify-<control>.ts
// Base pattern for all controls
export interface ControlSpec<TParams = Record<string, unknown>> {
context?: PageContext;
params?: TParams;
variant?: string;
// ...
}
// Control extends with specific params
export interface ButtonSpec extends ControlSpec<ButtonParams> {
label?: string;
}
export type EventHandler<T = Event> = (event: T) => void;
export interface ControlEvents {
click?: EventHandler<MouseEvent>;
change?: EventHandler<CustomEvent>;
}
// For position/size
export type Position = [number, number];
export type Size = [number, number];
export type BCR = [[number, number], [number, number], [number, number]];
// Allow undefined for optional nested access
export interface PageContext {
theme?: ThemeSpec; // Can be undefined
// ...
}
tools
# Skill: ui-pick-prompting ## Scope Use the ui-pick tool to present structured choices to the user. **Does:** - Show GUI picker with options. - Wait for user selection. - Return structured result (selection, cancelled, etc.). **Does Not:** - Handle complex multi-step wizards. - Manage state between prompts. ## Inputs - Options array (strings or objects with label/value/description). - Theme (optional): `wlilo` (dark) or `bright` (light). ## Procedure ### Via HTTP (Current Session) ```power
development
# Skill: theme-system-integration ## Scope Add theme support to existing controls or integrate theming into new features. **Does:** - Define params schemas for controls - Register variants in the variant registry - Integrate `resolve_params` for merge priority - Add CSS variable hooks and data attributes - Test theme inheritance and override behavior **Does Not:** - Create controls from scratch (see jsgui3-control-creation skill) - Handle runtime theme switching animations ## Inputs - Contro
testing
# Skill: session-discipline ## Scope Maintain structured notes across agent sessions to ensure continuity and knowledge transfer. **Does:** - Initialize session folders with standard structure. - Track active work, findings, and follow-ups. - Enable future agents to resume work seamlessly. **Does Not:** - Persist state between AI context windows (that's the purpose of the docs). - Replace version control (still commit changes). ## Session Structure Each session lives in `docs/sessions/<date
testing
# Skill: lab-experimentation ## Scope Use lab experiments to answer "how should we do this?" questions about jsgui3 behavior. **Does:** - Run existing lab experiments to confirm behavior. - Create minimal new experiments when behavior is unknown. - Promote stable findings into Skills/Patterns. **Does Not:** - Replace unit tests (labs are for exploration). - Cover production deployment scenarios. ## Lab Structure ``` lab/ ├── experiments/ # Individual experiments │ └── 001-topic-