Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问clear审计提醒

preact-buildless-frontendpreact 无构建前端

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

288

周安装

12

GitHub Stars

4

下载量

96
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:preact-buildless-frontend(preact 无构建前端)
来源仓库:https://github.com/av/skills
仓库路径:skills/preact-buildless-frontend
安装命令:
npx skills add https://github.com/av/skills --skill preact-buildless-frontend
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/av/skills --skill preact-buildless-frontend

简介

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。

  • 适合生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构或定位布局问题。
  • 使用时需结合项目现有设计系统、路由和构建方式,避免生成孤立片段。
  • 涉及页面改动时应配合本地预览和构建检查确认视觉效果。
  • preact-buildless-frontend 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

replit

25.15%
按下载量换算24

windsurf

22.39%
按下载量换算21

OpenCode

18.08%
按下载量换算17

weavefox

12.93%
按下载量换算12

Codex

7.11%
按下载量换算7

Claude Code

3.57%
按下载量换算3

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills