# jsKjs — complete reference for AI coding agents (v1.0.0) This project uses **jsKjs** (https://jskjs.org) — one script (~8.1 KB gzipped, zero dependencies) that provides a jQuery-compatible `$`, htmx-style declarative requests (`kj-*` attributes), Alpine-style reactivity (`kj-data`) and GSAP-style animation (`$.to`). There is no build step. ## Golden rules 1. Load exactly one script: `` (or the project's local copy). **Never** add jQuery, htmx, Alpine.js or GSAP next to it. 2. Prefer HTML attributes over JavaScript: - Talking to the server → `kj-get` / `kj-post` / `kj-put` / `kj-patch` / `kj-delete` + `kj-target` + `kj-swap`. The server returns HTML fragments. - Local UI state → `kj-data` + `kj-text` / `kj-show` / `kj-model` / `@click` / `:attr`. - Write `$()` JavaScript only for what attributes cannot express. 3. Units: `$.to`, `$.from`, `$.fromTo`, `$.timeline` use **seconds**. `.fadeIn`, `.fadeOut`, `.slideUp`, `.slideDown`, `.animate` use **milliseconds**. 4. `$.ajax`, `$.get`, `$.post`, `$.getJSON` return native Promises — use `async/await` with `try/catch`; errors carry `err.status` and `err.data`. 5. Use only the APIs listed below. Do not invent jQuery plugins or methods from the "Not available" list. 6. Security: put user text in the page with `.text()` or `kj-text`. When building HTML strings, wrap every user value in `$.escape()`. Server endpoints that answer `kj-*` requests must escape their output (e.g. PHP `htmlspecialchars`). 7. Accessibility: real `

``` ```js // Entrance animation (respects reduced motion) if (!matchMedia('(prefers-reduced-motion: reduce)').matches) $.from('.card', { y: 24, opacity: 0, duration: .5, stagger: .08, ease: 'power2.out' }); // Fetch + render safely const items = await $.getJSON('/api/items.json'); $('#list').html(items.map(i => '
  • ' + $.escape(i.name) + '
  • ').join('')); // Delegation survives DOM swaps $('#list').on('click', '.remove', function () { $(this).closest('li').remove(); }); ``` Full reference: https://jskjs.org/docs/ · Machine-readable: https://jskjs.org/llms-full.txt