본문으로 건너뛰기
cccskills
무료GitHub에 공개

preact-buildless-frontend

Build-less ESM frontends that run directly in the browser without bundlers. Use this skill when creating static frontends, SPAs without build tools, prototypes, or when the user explicitly wants no Vite/Webpack/bundler. Covers import maps, CDN imports, cache-busting, hash routing, and performance patterns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(6)

  • SKILL.md5.7 KB
  • assets/starter/app.js951 B
  • assets/starter/config.js75 B
  • assets/starter/index.css587 B
  • assets/starter/index.html1.4 KB
  • README.md650 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Build-less ESM Frontend

Create frontends that run directly in the browser using ES modules—no bundler, no build step.

Starter Template

Copy from assets/starter/ for a working baseline:

  • index.html — import map + module entry
  • app.js — Preact + signals + hash routing
  • index.css — CSS variables, dark mode

Run locally:

npx serve assets/starter   # or python3 -m http.server 3000

Core Patterns

1. Import Maps

Use <script type="importmap"> to:

  • Map bare specifiers (preact) to CDN URLs
  • Map directory aliases (@utils/) to local folders
  • Attach ?v=<version> for cache-busting
<script type="importmap">
{
  "imports": {
    "preact": "https://cdn.jsdelivr.net/npm/preact@10.24.3/dist/preact.module.js",
    "@utils/": "./utils/",
    "./app.js": "./app.js?v=1.0.0"
  }
}
</script>

Generate this map dynamically (server middleware) or commit a static version.

2. CDN Imports

Import third-party ESM directly from CDN. Pin versions:

import { signal } from 'https://cdn.jsdelivr.net/npm/@preact/signals@1.3.0/dist/signals.module.js';

Prefer mapping through import map to keep source clean:

import { signal } from '@preact/signals';  // resolved via import map

3. Cache-Busting

Two approaches:

A) Versioned URLs (recommended):

  • Append ?v=<git-sha|version|timestamp> to local .js and .css
  • Set Cache-Control: immutable headers

B) ETag/Last-Modified:

  • Keep stable URLs, let browser revalidate

For dynamic injection, rewrite index.html at serve time. For static hosting, commit versioned URLs manually.

4. Subpath Mounting

If served under a subpath (e.g., /app), use <base>:

<base href="/app/">

Ensures relative imports resolve correctly.

Structure

Minimal:

frontend/
  index.html
  index.css
  app.js

Growing app:

frontend/
  index.html
  index.css
  app.js          # entry + router
  state.js        # signals/atoms
  api.js          # fetch helpers
  components/
    nav.js
  pages/
    home.js
    settings.js

Configuration

Inject environment variables via global window.ENV (no build replacement).

index.html:

<script src="/config.js"></script>
<script type="module" src="./app.js"></script>

config.js:

window.ENV = {
  API_URL: "https://api.example.com"
};

Exclude config.js from caching or generate at runtime.

Routing

Hash-based routing (no server config needed):

const route = signal(location.hash.slice(1) || '/');
window.addEventListener('hashchange', () => {
  route.value = location.hash.slice(1) || '/';
});

// Links: <a href="#/about">About</a>
// Read: route.value === '/about'

For history API routing, the server must serve index.html for all routes.

Lazy Loading

Load features on demand:

button.onclick = async () => {
  const { heavyFeature } = await import('./heavy.js');
  heavyFeature();
};

Rule: if not needed for first paint, load lazily.

Error Handling

Wrap dynamic imports:

async function loadPage(name) {
  try {
    return await import(`./pages/${name}.js`);
  } catch (e) {
    console.error(`Failed to load ${name}:`, e);
    return { default: () => html`<p>Failed to load page.</p>` };
  }
}

Type Safety

Use JSDoc + jsconfig.json for full type checking without TypeScript build step.

jsconfig.json:

{ "compilerOptions": { "checkJs": true, "module": "ESNext" } }

Code usage:

/** @type {import('./types.js').User} */
const user = await api.getUser();

Performance

Startup:

  • One <script type="module"> entry
  • Use <link rel="modulepreload" href="..."> for critical deps (fixes waterfall)
  • Import only what's needed for first paint

Rendering (with framework):

  • Fine-grained reactivity (signals) over full re-renders
  • Memoize expensive computations

Rendering (vanilla DOM):

  • Event delegation on root
  • Batch DOM writes (build fragment, insert once)
  • Avoid layout thrash (don't interleave reads/writes)

CSS:

  • CSS variables for theming
  • Shallow selectors
  • Avoid large frameworks

Security

Content Security Policy (CSP): Strict CSP blocks inline scripts. For inline import maps, use:

  1. Nonce: <script type="importmap" nonce="..."> (recommended)
  2. Hash: 'sha256-...' of the script content

Allow CDNs in script-src: Content-Security-Policy: script-src 'self' 'nonce-...' https://cdn.jsdelivr.net;

Deliverables

When asked to create a build-less frontend:

  1. Frontend folder with index.html, index.css, entry JS
  2. Import map with CDN deps + local modules
  3. (Optional) Server config for cache headers / HTML rewriting

Constraints

  • No bundler, no transpilation
  • type="module" everywhere
  • Relative imports with .js extension (./utils.js)
  • Bare imports only if mapped in import map

Pitfalls

  • Bare imports without map → browser error
  • Import cycles → keep modules focused
  • Missing <base> → broken imports on subpath
  • Eager imports → slow startup; use lazy import()
  • Browser support → import maps need Chrome 89+, Firefox 108+, Safari 16.4+

Verification

After generating:

  1. Start server (npx serve or python3 -m http.server)
  2. Open in browser, check console for errors
  3. Network panel: confirm .js loads as type="module"
  4. If cache-busting: confirm ?v=... in URLs

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when the user requests integration testing, feature validation, or test plan execution

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

av/skills202026년 10월 12일 업데이트

anneal

무료

Use when the user wants to systematically fix AI code slop — duplicated logic, over-engineering, silent error swallowing, convention drift, cargo-cult patterns, and other LLM-introduced architectural decay — over a specified duration

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

av/skills202026년 10월 12일 업데이트

Produce a researched long-form article from a topic prompt via an orchestrated pipeline - research agent (first-person sources, working-definition gate), narrative-architecture outline, writer/cold-reviewer loop with an explicit ACCEPT/REVISE verdict contract, then a catalog-deslop pass with a regression gate. The orchestrator dispatches subagents only; the writer never judges its own draft. Use when the user says "article factory", "write an article about X", "run the article pipeline", or asks for a researched long-form piece produced end-to-end. For essays and micro posts in the user's own voice without a research stage, use the prose skill instead.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

av/skills202026년 10월 12일 업데이트

Runs autonomous keep/discard experiments on a codebase to optimize a single metric for a fixed duration, in the style of karpathy/autoresearch. Use when the user says "autoresearch" (optionally with a focus, e.g. "autoresearch the optimizer"), asks to run experiments on a repo overnight, to hill-climb or optimize a metric autonomously, or points at a repo with a karpathy-style program.md.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

av/skills202026년 10월 12일 업데이트

Create custom modules for [Harbor Boost](https://github.com/av/harbor/tree/main/boost), an optimizing LLM proxy. Use when building Python modules that intercept/transform LLM chat completions—reasoning chains, prompt injection, structured outputs, artifacts, or custom workflows. Triggers on requests to create Boost modules, extend LLM behavior via proxy, or implement chat completion middleware.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

av/skills202026년 10월 12일 업데이트

bugbash

무료

Systematically explore and test any software project (CLI, API, Backend, Library, etc.) to find bugs, usability issues, and edge cases. Produces a structured report with full reproduction evidence (exact commands, inputs, logs, and tracebacks) for every issue.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

av/skills202026년 10월 12일 업데이트

av의 스킬 모두 보기

이 스킬의 문제 신고