agentleFS
s-frantzs-frantz/sleek-geospatial-skills/.claude/skills/ui-boot/SKILL.md

ui-boot

Skill0 starsChanged 2 months agoMITView on GitHub

Get a no-build-step MapLibre app to start in the right order - vendored globals with defer, a module entry point that cannot race them, and why the vendor files are self-hosted. Use when setting up index.html, adding a third-party library, or debugging "X is not defined" at startup.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not wrap the app in window.addEventListener('load', ...).

    line 28
  2. Distinctive:

    Do not poll for the global.

    line 30
  3. Very specific:

    Do not move the vendor script into the module with a dynamic import().

    line 31
  4. Distinctive:

    One origin: No third-party DNS, no third-party TLS, nothing to be slow or down.

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Boot order

A MapLibre app with no bundler has exactly one ordering problem, and it is solved by two attributes in app/index.html.

The rule

<script defer src="vendor/maplibre-gl.js"></script>
<script type="module" src="js/main.js"></script>

A classic script with defer runs after the document parses, in document order. A type="module" script is always deferred, and modules execute after deferred classic scripts. So by the time main.js runs, maplibregl exists. No load event, no polling, no DOMContentLoaded wrapper, no bundler.

Get this wrong and the symptom is maplibregl is not defined, intermittently, usually only on a fast connection or only on a slow one.

What NOT to do about it

  • Do not wrap the app in window.addEventListener('load', ...). It works, and it costs you the ability to await at module top level, which is where configuration loading belongs.
  • Do not poll for the global.
  • Do not move the vendor script into the module with a dynamic import(). UMD bundles that assign to window do not always survive that.

The one thing that must go before both

Theme restoration. It is an inline blocking script in <head>, and it has to be blocking, because anything deferred runs after first paint and the reader sees a flash. See ui-theme.

Self-hosting

app/vendor/ holds pinned copies rather than CDN links. Three reasons, in order of how often they matter:

  1. One origin. No third-party DNS, no third-party TLS, nothing to be slow or down.
  2. Nothing changes without a commit. A CDN version range can move under you; a file in the repo cannot.
  3. Supply chain. What you reviewed is what ships.

app/vendor/README.md records the project, version and licence of everything in there. Update it in the same commit as the file, or it stops being true.

Checklist for adding a library

  • Copy the built file into app/vendor/, pinned to a version.
  • Add a row to app/vendor/README.md: project, version, licence.
  • Add <script defer src="vendor/..."> BEFORE the module entry point.
  • Declare the global in types/globals.d.ts, or tsc --noEmit will not know it exists.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.