rasengan-dev/agent-skills

rasengan-optimizing

Optimization patterns for Rasengan.js.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/rasengan-dev/agent-skills --skill rasengan-optimizing

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

Rasengan.js Optimization Patterns

When to Activate

  • Serving static files (images, fonts, icons) from the public/ directory
  • Referencing assets in components or templates
  • Optimizing images and static resources for production
  • Configuring metadata for SEO (title, description, Open Graph, Twitter)
  • Enabling React Compiler via Sage Mode for automatic memoization

Static Assets — public/ Directory

Any file placed inside the public/ directory is automatically served at the base URL (/). No imports or special loaders needed.

File Placement

public/
├── favicon.ico
├── robots.txt
├── og-image.png
└── avatars/
    └── 1.png

Referencing in Code

tsx
// Public assets use root-relative paths
<img src="/avatars/1.png" alt="Avatar" />

// With @rasenganjs/image
import { Image } from '@rasenganjs/image';
<Image src="/avatars/1.png" alt="Avatar" width={64} height={64} />
tsx
// In the HTML template (src/template.tsx)
import { type TemplateProps } from 'rasengan';

export default function Template({ Head, Body, Script }: TemplateProps) {
  return (
    <html lang="en">
      <Head>
        <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
      </Head>
      <Body><Script /></Body>
    </html>
  );
}

src/assets/ Directory

For assets that need bundling, transformation, or import-based references, use src/assets/ instead:

tsx
import logo from '@/assets/logo.svg';

function Header() {
  return <img src={logo} alt="Logo" />;
}

Metadata & SEO

SEO metadata is defined as a static property on page or layout components:

tsx
Home.metadata = {
  title: 'Home',
  description: 'Home page description',
  openGraph: {
    title: 'Home',
    description: 'Home page',
    url: 'https://example.com',
    image: 'https://example.com/og.png',
  },
  twitter: {
    card: 'summary_large_image',
    image: 'https://example.com/twitter.png',
    title: 'Home',
  },
};

Rules:

  • Page metadata takes priority over layout metadata (merged, page wins)
  • Loader-returned meta overrides static metadata at runtime
  • openGraph.url and openGraph.image are required when using Open Graph
  • twitter.card, twitter.image, twitter.title are required when using Twitter cards

React Compiler (Sage Mode)

Enable automatic memoization in rasengan.config.js:

js
export default defineConfig({
  sageMode: {
    reactCompiler: true,                              // auto-memoize all components
    // reactCompiler: { compilationMode: 'annotation' }, // only components with "use memo"
  },
});
  • true — applies React Compiler to all components automatically
  • { compilationMode: 'annotation' } — only compiles components with a "use memo" directive

Bundle Optimization

Build output structure:

dist/
  client/        # Client bundle + manifest.json
    assets/      # JS, CSS, config.json
    .vite/       # Vite manifest
  server/        # SSR server bundle
static/          # Pre-rendered HTML (SSG)

Rules

  • Use public/ for assets that need a fixed URL path (favicon, robots.txt, og-images)
  • Use src/assets/ for assets that benefit from bundling, hashing, and import references
  • Always provide width and height on images to prevent Cumulative Layout Shift (CLS)
  • Place SEO-critical images (Open Graph, Twitter cards) in public/ for stable URLs
  • Enable sageMode.reactCompiler to reduce unnecessary re-renders in production
  • The public/ directory contents are copied as-is during build (no transformation)

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills