web-performance-optimization by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill web-performance-optimization实施性能优化策略,包括懒加载、代码分割、缓存、压缩和监控,以提升核心网页指标和用户体验。
最小工作示例:
// utils/lazyLoad.ts
import React from 'react';
export const lazyLoad = (importStatement: Promise<any>) => {
return React.lazy(() =>
importStatement.then(module => ({
default: module.default
}))
);
};
// routes.tsx
import { lazyLoad } from './utils/lazyLoad';
export const routes = [
{
path: '/',
component: () => import('./pages/Home'),
lazy: lazyLoad(import('./pages/Home'))
},
{
path: '/dashboard',
lazy: lazyLoad(import('./pages/Dashboard'))
},
{
// ... (完整实现请参阅参考指南)
references/ 目录下的详细实现:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 指南 | 内容 |
|---|---|
| 代码分割与懒加载 (React) | 代码分割与懒加载 (React) |
| 图片优化 | 图片优化 |
| HTTP 缓存与服务工作者 | HTTP 缓存与服务工作者 |
| Gzip 压缩与资源优化 | Gzip 压缩与资源优化 |
| 性能监控 | 性能监控 |
每周安装量
118
代码仓库
GitHub 星标数
116
首次出现
2026年1月21日
安全审计
安装于
opencode97
gemini-cli94
codex91
cursor89
claude-code88
github-copilot78
Implement performance optimization strategies including lazy loading, code splitting, caching, compression, and monitoring to improve Core Web Vitals and user experience.
Minimal working example:
// utils/lazyLoad.ts
import React from 'react';
export const lazyLoad = (importStatement: Promise<any>) => {
return React.lazy(() =>
importStatement.then(module => ({
default: module.default
}))
);
};
// routes.tsx
import { lazyLoad } from './utils/lazyLoad';
export const routes = [
{
path: '/',
component: () => import('./pages/Home'),
lazy: lazyLoad(import('./pages/Home'))
},
{
path: '/dashboard',
lazy: lazyLoad(import('./pages/Dashboard'))
},
{
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Code Splitting and Lazy Loading (React) | Code Splitting and Lazy Loading (React) |
| Image Optimization | Image Optimization |
| HTTP Caching and Service Workers | HTTP Caching and Service Workers |
| Gzip Compression and Asset Optimization | Gzip Compression and Asset Optimization |
| Performance Monitoring | Performance Monitoring |
Weekly Installs
118
Repository
GitHub Stars
116
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode97
gemini-cli94
codex91
cursor89
claude-code88
github-copilot78
Genkit JS 开发指南:AI 应用构建、错误排查与最佳实践
7,700 周安装