Building Modern Fast Websites
Building Modern, Fast Websites
Default stack when the user names no framework: Astro or Next.js + Tailwind CSS. For a single static page: plain HTML + CSS + minimal JS. Always deliver complete, runnable code, never fragments with "...rest of code".
Minimal high-quality baseline (static page):
HTML<!DOCTYPE html> <html lang="id"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Nama Brand: Value Proposition Singkat</title> <meta name="description" content="Deskripsi 150 karakter."> <link rel="preload" href="/fonts/inter-var.woff2" as="font" type="font/woff2" crossorigin> <style> :root{--bg:#0b0d12;--fg:#e8eaf0;--muted:#9aa3b2;--accent:#6366f1;--radius:16px} *{box-sizing:border-box;margin:0} body{font:400 1rem/1.6 Inter,system-ui,sans-serif;background:var(--bg);color:var(--fg)} .container{width:min(1120px,100% - 2rem);margin-inline:auto} .hero{padding:clamp(4rem,12vw,9rem) 0;text-align:center} h1{font-size:clamp(2.2rem,6vw,4.5rem);line-height:1.05;letter-spacing:-.03em} .btn{display:inline-block;padding:.9rem 1.6rem;border-radius:999px;background:var(--accent);color:#fff;text-decoration:none;transition:transform .2s} .btn:hover{transform:translateY(-2px)} </style> </head> <body> <main class="container hero"> <h1>Headline yang jelas dan kuat</h1> <p style="color:var(--muted);margin:1rem auto 2rem;max-width:55ch">Satu kalimat manfaat utama.</p> <a class="btn" href="#cta">Mulai Sekarang</a> </main> </body> </html>
Progress:
- [ ] Step 1: Clarify goal, audience, framework (assume defaults if unspecified)
- [ ] Step 2: Define design tokens (color, type scale, spacing, radius)
- [ ] Step 3: Plan sections and component structure
- [ ] Step 4: Write complete code, mobile-first
- [ ] Step 5: Apply performance checklist
- [ ] Step 6: Apply accessibility + SEO checklist
- [ ] Step 7: Self-review, then deliver with run instructions
Step 1: Requirements
Do not interrogate the user. State assumptions in one line ("Saya asumsikan: landing page SaaS, Next.js + Tailwind, dark theme") and proceed. Ask only when a wrong guess would waste major effort.
Step 2: Design Tokens
Define once, reuse everywhere (CSS variables or Tailwind config):
- Colors: 1 accent, neutral scale (background, surface, border, muted, foreground). Check contrast ≥ 4.5:1.
- Type: one variable font (Inter, Geist, Plus Jakarta Sans). Fluid sizes with
clamp(). - Spacing: 4/8px scale. Generous whitespace is the single biggest "modern" signal.
- Radius and shadow: pick one radius (12-16px) and 2-3 soft shadows.
Step 3: Structure
Landing page default order: Nav → Hero (headline + CTA + visual) → Social proof/logos → Features (3-6) → How it works → Testimonials/Pricing → FAQ → Final CTA → Footer.
Split into reusable components (Button, Card, Section, Navbar) in framework projects.
Step 4: Framework Adaptation
| Framework | Conventions to follow |
|---|---|
| Next.js (App Router) | Server Components by default; "use client" only for interactivity; next/image, next/font, metadata export |
| React (Vite) | Function components + hooks; lazy-load routes with React.lazy |
| Vue 3 | <script setup>, Composition API, defineProps |
| Svelte/SvelteKit | Reactive $:/runes, +page.svelte routing |
| Astro | Zero JS by default; client:visible islands only where needed |
| Plain HTML | Semantic tags, CSS variables, vanilla JS modules |
| Tailwind | Utility classes, extract repeated patterns into components, not @apply sprawl |
Match the user's existing conventions (file layout, naming, styling method) when editing an existing codebase. Never introduce a new library when the current stack already solves it.
Step 5: Performance Checklist
Target: LCP < 2.5s, CLS < 0.1, INP < 200ms, Lighthouse ≥ 95.
- Images: WebP/AVIF, explicit
width/height,loading="lazy"below the fold,fetchpriority="high"on the hero image only - Fonts: self-host,
woff2,font-display: swap, subset, preload the primary one - JS: ship the minimum; code-split; defer non-critical scripts; avoid heavy libraries (use native
Intl,fetch, CSS animations instead of moment/axios/jQuery/animation libs) - CSS: inline critical CSS for static pages; purge unused styles
- Animations: animate only
transformandopacity; respectprefers-reduced-motion - Rendering: prefer static generation (SSG/ISR) over client rendering for content pages
- Caching: long-lived
Cache-Controlfor hashed assets
Step 6: Accessibility and SEO
- Semantic landmarks (
header,main,nav,footer), oneh1, logical heading order alttext, visible focus states, labels on inputs, keyboard-operable menus<title>, meta description, Open Graph tags,langattribute, canonical URL
Step 7: Delivery
Provide: file tree, full code per file, install/run commands, and 2-4 bullets on what was optimized.
- Large bold headline + muted subtext + one primary CTA
- Subtle gradient or blurred glow behind hero (CSS only, no big images)
- Card grids with 1px low-contrast borders and hover lift
- Sticky translucent navbar (
backdrop-filter: blur(12px)) - Consistent 8px rhythm, max content width ~1120px, text width ≤ 65ch
- Dark mode via
prefers-color-schemeand CSS variables
Example 1:
Input: "Buatkan landing page untuk aplikasi kasir, modern dan cepat."
Output: Assumption line, then Astro + Tailwind project: package.json, astro.config.mjs, src/layouts/Base.astro, src/pages/index.astro with sections (Hero, Fitur, Harga, FAQ, CTA), zero client JS except a mobile menu island, optimized <Image> usage, and a 4-bullet performance summary.
Example 2: Input: "Website saya lambat, tolong optimasi." (with code attached) Output: Prioritized diagnosis (e.g., 1. unoptimized 2MB hero PNG, 2. render-blocking font CSS, 3. full lodash import), then patched code for each fix, and expected impact per fix.
Example 3:
Input: "Ubah komponen ini dari React ke Vue 3."
Output: Equivalent <script setup> component preserving props, state, and styling approach, plus a note on any behavioral differences.
- Write complete files; the user should be able to copy, run, and see a result
- Mobile-first CSS, then enhance with
min-widthmedia queries - Use real, relevant copy instead of "Lorem ipsum"; match the user's language (Indonesian if they write Indonesian)
- Prefer CSS over JS for effects (grid,
:has(),scroll-snap,@container) - Keep components small, typed (TypeScript when the project uses it), and free of dead code
- Validate mentally: does it build, are imports correct, are there no undefined variables
- Handle edge states: loading, empty, error, long text, no JS
- Truncated output ("// rest of code here"); always give full code
- Adding heavy dependencies (carousel, animation, UI kits) for trivial features
- Giant unoptimized hero images or autoplay background video
- Layout shift from images/fonts without reserved space
- Low-contrast gray-on-gray text for the sake of aesthetics
- Overusing client-side JS for static content
- Ignoring the user's existing framework, versions, or code style
- Excessive animation that hurts INP or ignores reduced-motion
- Claiming performance scores without measurement; say "expected" and suggest running Lighthouse/PageSpeed Insights
- Hardcoding colors and sizes everywhere instead of tokens
This skill shapes coding behavior and quality standards. It cannot change the underlying model's capabilities; results depend on the model running it. For large projects, split into separate files (DESIGN-TOKENS.md, PERFORMANCE.md, FRAMEWORKS.md) and reference them from this skill.