This commit is contained in:
新新 committed 2026-04-27 17:03:56 +08:00
commit fe636432d0
154 files changed
+30381

No files matched your search

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2026 Vadim Comanescu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,110 @@
---
name: frontend-design
description: "Create distinctive, production-grade frontend UI with a bold, intentional aesthetic direction, purposeful layouts, meaningful motion, and strong accessibility. Prefer React + Next.js (TypeScript), but support vanilla HTML/CSS/JS when appropriate."
---
# Frontend Design
Build memorable, functional interfaces with a clear point-of-view (no generic templates). Commit to one aesthetic direction, define tokens, ship accessible + responsive UI, and keep changes scoped.
## Preferred Targets (choose the best fit)
1) **Next.js (TypeScript)**: preferred for production app/marketing routes and design system work.
2) **React (TypeScript)**: preferred for SPA/component libraries outside Next.js.
3) **Vanilla HTML/CSS/JS**: great for static demos, prototypes, and standalone embeds.
## Quick Start (do this first)
1) Ask up to 4 questions:
- What user and job-to-be-done (what should feel “easy” after the change)?
- Where does it live (component/route) and what stack? Prefer Next.js/React; vanilla is fine for standalone pages or prototypes.
- In Next.js: assume App Router (`app/`). Any server/client constraints?
- Any hard constraints (brand tokens, light/dark, motion limits, must-keep UI parts, perf budgets)?
2) Pick an aesthetic direction + **one signature move**. If vague, propose 2–3 options from `references/aesthetic-playbook.md`.
3) Define tokens (type, palette, spacing, radius, shadows, motion). Keep accents to 1–2.
4) Build structure first (semantic markup + layout), then motion, then polish + QA.
## Guardrails (avoid footguns)
- Keep scope tight: redesign only what the user asked for.
- Reuse existing tokens/components if working in an existing repo; do not introduce a new global styling system unless requested.
- Match complexity to the vision: refined minimalism needs restraint; maximalism needs deliberate structure (not random decoration).
- Respect `prefers-reduced-motion` for all animations.
- Avoid “AI slop” defaults. If the repo already uses a generic font, keep it unless the user explicitly wants new typography.
- Enforce token semantics: error/success/warning colors are for meaning, not decoration; keep contrast accessible in light/dark.
- Default to shipping code that is easy to maintain: small components, clear hierarchy, minimal dependencies.
- Don’t add new packages (animation libs, UI kits, icon sets) unless the user explicitly asks or the repo already uses them.
- Default to one primary CTA per view; demote the rest (secondary/tertiary) to avoid competing actions.
## Workflow
### 1) Commit to a direction
- Declare: aesthetic direction, palette mood, type pairing, and the signature move.
- Write a 1–2 sentence design thesis that explains the hierarchy and vibe.
- Use `references/anti-patterns.md` to avoid predictable layouts and cliched palettes.
### 1b) Design system rules (strict vs flexible)
- **Strict**: semantic color meaning, readable type ramp, reduced motion, visible focus, and “human-in-control” for AI actions (undo/apply/confirm).
- **Flexible**: brand accent hue, surface “temperature” in dark mode, and density preset (compact vs comfy).
- **When to read more**: load `references/tokens-and-semantics.md` when defining tokens and `references/ai-native-ui-patterns.md` when adding AI surfaces.
### 1a) React/Next.js coding guidance (read when implementing)
- **React fundamentals**: keep components pure; prefer event handlers over Effects for user-driven work; follow the Rules of Hooks.
- **Next.js App Router**: keep Client Components small; use Server Components by default; mark `"use client"` only where you need state, effects, or browser APIs.
- **Data fetching**: prefer server-side `fetch` and explicit cache/revalidate controls; avoid unnecessary client-side effects for data.
- **When to read more**: load `references/react-next-best-practices.md` before writing complex React logic or introducing new data fetching patterns.
### 2) Plan tokens and layout (before details)
- Define CSS variables (or a theme object) for:
- Color: background/surface/ink/muted/accent(+optional accent2)
- Type: display/body/mono, size scale, line-height
- Shape: radius scale and border rules
- Depth: shadow and outline rules
- Motion: durations + easing + reveal stagger step
- Lay out the page/component skeleton and content hierarchy.
- Reference `references/implementation-patterns.md` for patterns and QA.
### 3) Implement (ship code, not moodboards)
- Start with semantic structure and accessible interactions (keyboard + focus states).
- Build macro layout with Grid; micro layout with Flexbox.
- For Next.js/React, keep components small and composable; prefer CSS Modules or the repo’s existing styling approach.
- Use “link for navigation, button for actions” to keep semantics and keyboard behavior correct.
- Apply the signature move sparingly but decisively (one memorable thing, not ten).
- Add motion as orchestration (one strong page-load + a few micro-interactions), not random flourishes.
### 3a) Next.js implementation notes (when applicable)
- **App Router only**: assume `app/` routing (not `pages/`).
- **Server vs Client**: default to Server Components; add `"use client"` only for interactive islands.
- **Data + state**: keep data fetching on the server when possible; keep client state local and purposeful.
- **Performance**: avoid layout shift (stable heights, predictable grids); keep blur/shadows paint-friendly on mobile.
- **Platform primitives**: prefer `next/link` for navigation and `next/image` for real images when available.
- **Fonts**: if changing typography in Next.js, prefer `next/font` to avoid FOIT/FOUT surprises.
- **Styling**: keep it consistent—CSS Modules, Tailwind, or the existing system; don’t introduce a new one without asking.
### 3b) Content + states (don’t ship empty shells)
- Define loading, empty, and error states for any data-driven UI.
- Keep copy tight and purposeful; avoid placeholder lorem unless asked.
- Preserve existing product terminology unless the user requests copy changes.
### 4) Polish and QA
- Responsive pass: collapse grids, maintain padding, preserve CTA prominence on mobile.
- Accessibility pass: landmarks, one `h1`, labels, contrast, focus order, skip link when relevant.
- Performance pass: avoid expensive shadows on mobile, keep animation paint-friendly, avoid large images.
## Definition of Done
- Layout looks intentional at mobile + desktop breakpoints (no cramped type, no orphan CTAs).
- Focus states are visible, tab order is logical, and motion respects `prefers-reduced-motion`.
- Tokens are centralized (CSS variables/theme), and the signature move is present but not overused.
## Deliverables (how to present results)
- List files changed and what they do.
- Explain the aesthetic direction + signature move (1–2 sentences).
- Provide commands to validate (use the repo’s conventions; common ones include `npm run dev`, `npm run lint`, `npm test`).
## Bundled Resources
- `references/aesthetic-playbook.md`: strong directions, type+color cues, signature moves.
- `references/implementation-patterns.md`: layout/motion/a11y patterns for vanilla + React.
- `references/anti-patterns.md`: quick “don’t do this” checklist to avoid generic output.
- `references/react-next-best-practices.md`: React + Next.js coding guidelines (hooks, effects, server/client, data fetching).
- `references/tokens-and-semantics.md`: token semantics, type ramp, dark mode, and density rules (strict vs flexible).
- `references/ai-native-ui-patterns.md`: copilot panels, citations, disclosures, and human-in-the-loop UI patterns.
- `assets/vanilla-starter/`: runnable vanilla starter you can copy + retheme via CSS variables.
- `assets/react-component-starter/`: small React component + CSS module skeleton to retheme.
- `assets/nextjs-app-router-starter/`: minimal Next.js App Router page + tokens you can copy and retheme.
@@ -0,0 +1,8 @@
# Next.js App Router Starter
Copy these files into an existing Next.js App Router project to bootstrap a strongly-themed, token-driven page.
- Files assume `app/` routing (not `pages/`).
- Uses CSS variables + CSS Modules (no external styling dependencies).
- Designed to be rethemed by editing `app/globals.css` tokens.
- Includes an “Assistant Rail” component demonstrating AI-native UX patterns (AI disclosure, citations, and human-in-control apply/undo).
@@ -0,0 +1,69 @@
:root {
--bg: #0b0d12;
--surface: rgba(255, 255, 255, 0.06);
--surface-2: rgba(255, 255, 255, 0.1);
--ink: rgba(255, 255, 255, 0.92);
--muted: rgba(255, 255, 255, 0.68);
--accent: #6ee7ff;
--danger: #ff5a7a;
--warning: #ffcc66;
--success: #55f2b1;
--info: #6ea8ff;
--radius-sm: 10px;
--radius-md: 16px;
--radius-lg: 22px;
--shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.28);
--shadow-md: 0 22px 70px rgba(0, 0, 0, 0.4);
--container: 1120px;
--gutter: clamp(16px, 3vw, 28px);
--grid-gap: clamp(14px, 2vw, 22px);
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
--dur-1: 140ms;
--dur-2: 240ms;
--dur-3: 420ms;
}
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
}
body {
margin: 0;
background: radial-gradient(1200px 900px at 18% -10%, rgba(110, 231, 255, 0.18), transparent 55%),
radial-gradient(900px 700px at 78% 10%, rgba(255, 115, 224, 0.14), transparent 60%),
var(--bg);
color: var(--ink);
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
"Apple Color Emoji", "Segoe UI Emoji";
line-height: 1.45;
}
a {
color: inherit;
text-decoration: none;
}
:focus-visible {
outline: 2px solid color-mix(in oklab, var(--accent), white 10%);
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
@@ -0,0 +1,18 @@
import type { Metadata } from "next";
import "./globals.css";
import type { ReactNode } from "react";
export const metadata: Metadata = {
title: "Frontend Design Starter",
description: "Token-driven Next.js starter page for rapid retheming.",
};
export default function RootLayout({
children,
}: Readonly<{ children: ReactNode }>) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
@@ -0,0 +1,244 @@
.page {
min-height: 100dvh;
}
.skip {
position: absolute;
left: -999px;
top: 12px;
padding: 10px 12px;
border-radius: 999px;
background: var(--surface-2);
}
.skip:focus {
left: 12px;
}
.topbar {
position: sticky;
top: 0;
z-index: 10;
backdrop-filter: blur(18px);
background: color-mix(in oklab, var(--bg), transparent 35%);
border-bottom: 1px solid color-mix(in oklab, white, transparent 90%);
}
.topbarInner {
max-width: var(--container);
margin: 0 auto;
padding: 14px var(--gutter);
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
}
.brand {
display: inline-flex;
align-items: center;
gap: 10px;
font-weight: 650;
letter-spacing: 0.02em;
}
.mark {
width: 28px;
height: 28px;
border-radius: 10px;
background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.45), transparent 60%),
linear-gradient(135deg, rgba(110, 231, 255, 0.85), rgba(255, 115, 224, 0.62));
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.nav {
display: flex;
gap: 14px;
color: var(--muted);
font-size: 14px;
}
.nav a {
padding: 8px 10px;
border-radius: 999px;
}
.nav a:hover {
background: rgba(255, 255, 255, 0.06);
color: var(--ink);
}
.hero {
max-width: var(--container);
margin: 0 auto;
padding: 54px var(--gutter) 28px;
display: grid;
grid-template-columns: 1.15fr 0.85fr;
gap: clamp(18px, 3vw, 36px);
align-items: start;
}
.headline {
margin: 0;
font-size: clamp(34px, 4vw, 56px);
line-height: 1.03;
letter-spacing: -0.02em;
}
.lede {
margin: 14px 0 0;
color: var(--muted);
font-size: clamp(16px, 1.4vw, 18px);
max-width: 58ch;
}
.ctaRow {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.btn {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 11px 14px;
border-radius: 999px;
border: 1px solid color-mix(in oklab, white, transparent 85%);
background: rgba(255, 255, 255, 0.04);
box-shadow: var(--shadow-sm);
transition: transform var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out),
border-color var(--dur-2) var(--ease-out);
}
.btn:hover {
transform: translateY(-1px);
background: rgba(255, 255, 255, 0.07);
border-color: color-mix(in oklab, var(--accent), white 35%);
}
.btnPrimary {
border-color: color-mix(in oklab, var(--accent), white 40%);
background: linear-gradient(
180deg,
rgba(110, 231, 255, 0.22),
rgba(255, 255, 255, 0.06)
);
}
.panel {
border-radius: var(--radius-lg);
background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
border: 1px solid color-mix(in oklab, white, transparent 88%);
box-shadow: var(--shadow-md);
padding: 18px;
}
.rail {
margin-top: 16px;
}
.panelHeader {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
}
.panelTitle {
margin: 0;
font-size: 15px;
letter-spacing: 0.02em;
color: color-mix(in oklab, var(--muted), white 18%);
}
.badge {
font-size: 12px;
color: color-mix(in oklab, var(--accent), white 20%);
background: rgba(110, 231, 255, 0.12);
border: 1px solid rgba(110, 231, 255, 0.28);
padding: 6px 10px;
border-radius: 999px;
}
.list {
margin: 14px 0 0;
padding: 0;
list-style: none;
display: grid;
gap: 10px;
}
.item {
border-radius: var(--radius-md);
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.06);
padding: 12px 12px;
}
.itemTitle {
font-weight: 620;
margin: 0;
font-size: 14px;
}
.itemBody {
margin: 6px 0 0;
color: var(--muted);
font-size: 13px;
}
.content {
max-width: var(--container);
margin: 0 auto;
padding: 28px var(--gutter) 64px;
}
.grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: var(--grid-gap);
}
.card {
grid-column: span 4;
border-radius: var(--radius-lg);
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.07);
padding: 18px;
transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.card:hover {
transform: translateY(-2px);
border-color: color-mix(in oklab, var(--accent), white 35%);
}
.card h2 {
margin: 0 0 8px;
font-size: 16px;
letter-spacing: 0.01em;
}
.card p {
margin: 0;
color: var(--muted);
font-size: 14px;
}
@media (max-width: 900px) {
.hero {
grid-template-columns: 1fr;
}
.card {
grid-column: span 6;
}
}
@media (max-width: 560px) {
.card {
grid-column: span 12;
}
}
@@ -0,0 +1,99 @@
import styles from "./page.module.css";
import { AssistantRail } from "../components/AssistantRail";
const quickWins = [
{
title: "Token-first styling",
body: "Retheme fast by editing CSS variables in globals.css (palette, radii, shadows, motion).",
},
{
title: "One signature move",
body: "Commit to a single memorable gesture (light sweep, stripe, grain, or brutal border logic).",
},
{
title: "Accessible by default",
body: "Semantic structure, visible focus, and reduced-motion support are built in.",
},
];
export default function Page() {
return (
<div className={styles.page}>
<a className={styles.skip} href="#content">
Skip to content
</a>
<header className={styles.topbar}>
<div className={styles.topbarInner}>
<a className={styles.brand} href="#">
<span aria-hidden className={styles.mark} />
Frontend Design
</a>
<nav className={styles.nav} aria-label="Primary">
<a href="#principles">Principles</a>
<a href="#cards">Patterns</a>
<a href="#cta">CTA</a>
</nav>
</div>
</header>
<main id="content">
<section className={styles.hero} aria-labelledby="headline">
<div>
<h1 id="headline" className={styles.headline}>
A token-driven page that looks intentional on day one.
</h1>
<p className={styles.lede}>
Build structure first, then motion, then polish. Keep the UI memorable with one
signature move—not ten random decorations.
</p>
<div className={styles.ctaRow} id="cta">
<a className={`${styles.btn} ${styles.btnPrimary}`} href="#">
Start a redesign <span aria-hidden>→</span>
</a>
<a className={styles.btn} href="#cards">
See patterns
</a>
</div>
</div>
<aside className={styles.panel} aria-label="Quick Wins" id="principles">
<div className={styles.panelHeader}>
<h2 className={styles.panelTitle}>Quick Wins</h2>
<span className={styles.badge}>Next.js App Router</span>
</div>
<ul className={styles.list}>
{quickWins.map((item) => (
<li key={item.title} className={styles.item}>
<p className={styles.itemTitle}>{item.title}</p>
<p className={styles.itemBody}>{item.body}</p>
</li>
))}
</ul>
</aside>
<div className={styles.rail}>
<AssistantRail />
</div>
</section>
<section className={styles.content} aria-labelledby="cards" id="cards">
<div className={styles.grid}>
<article className={styles.card}>
<h2>Hierarchy</h2>
<p>Make the primary action obvious, then design the supporting rails.</p>
</article>
<article className={styles.card}>
<h2>Texture</h2>
<p>Use subtle grain/mesh/stripe logic to avoid flat UI without clutter.</p>
</article>
<article className={styles.card}>
<h2>Motion</h2>
<p>Orchestrate a few meaningful reveals and micro-interactions—guarded by settings.</p>
</article>
</div>
</section>
</main>
</div>
);
}
@@ -0,0 +1,217 @@
.wrap {
display: grid;
gap: 12px;
}
.panel {
border-radius: var(--radius-lg);
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.07),
rgba(255, 255, 255, 0.03)
);
border: 1px solid color-mix(in oklab, white, transparent 88%);
box-shadow: var(--shadow-md);
padding: 16px;
}
.header {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.title {
margin: 0;
font-size: 15px;
letter-spacing: 0.02em;
color: color-mix(in oklab, var(--muted), white 18%);
}
.disclosure {
display: inline-flex;
align-items: center;
gap: 8px;
}
.badge {
font-size: 12px;
color: color-mix(in oklab, var(--accent), white 18%);
background: rgba(110, 231, 255, 0.12);
border: 1px solid rgba(110, 231, 255, 0.28);
padding: 6px 10px;
border-radius: 999px;
}
.hint {
font-size: 12px;
color: var(--muted);
}
.promptRow {
display: flex;
gap: 10px;
margin-top: 10px;
}
.input {
flex: 1;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.12);
color: var(--ink);
padding: 10px 12px;
font: inherit;
}
.input::placeholder {
color: color-mix(in oklab, var(--muted), transparent 10%);
}
.btn {
border-radius: 999px;
border: 1px solid color-mix(in oklab, white, transparent 85%);
background: rgba(255, 255, 255, 0.04);
color: var(--ink);
padding: 10px 12px;
font: inherit;
cursor: pointer;
transition: transform var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out),
border-color var(--dur-2) var(--ease-out);
}
.btn:hover {
transform: translateY(-1px);
background: rgba(255, 255, 255, 0.07);
border-color: color-mix(in oklab, var(--accent), white 35%);
}
.btnPrimary {
border-color: color-mix(in oklab, var(--accent), white 40%);
background: linear-gradient(
180deg,
rgba(110, 231, 255, 0.2),
rgba(255, 255, 255, 0.06)
);
}
.output {
margin-top: 12px;
border-radius: var(--radius-md);
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(255, 255, 255, 0.03);
padding: 12px;
}
.typing {
display: inline-flex;
gap: 6px;
align-items: center;
color: var(--muted);
font-size: 13px;
}
.dot {
width: 6px;
height: 6px;
border-radius: 999px;
background: color-mix(in oklab, var(--accent), white 15%);
opacity: 0.6;
animation: pulse 900ms var(--ease-out) infinite;
}
.dot:nth-child(2) {
animation-delay: 120ms;
}
.dot:nth-child(3) {
animation-delay: 240ms;
}
@keyframes pulse {
0%,
100% {
transform: translateY(0);
opacity: 0.45;
}
50% {
transform: translateY(-1px);
opacity: 0.9;
}
}
.text {
margin: 0;
color: color-mix(in oklab, var(--ink), white 2%);
font-size: 13px;
line-height: 1.45;
}
.citations {
margin-top: 10px;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.chip {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(255, 255, 255, 0.04);
color: var(--muted);
font-size: 12px;
}
.chipNumber {
width: 18px;
height: 18px;
border-radius: 999px;
display: inline-flex;
align-items: center;
justify-content: center;
background: rgba(110, 231, 255, 0.14);
border: 1px solid rgba(110, 231, 255, 0.26);
color: color-mix(in oklab, var(--accent), white 20%);
font-weight: 650;
font-size: 11px;
}
.controls {
margin-top: 12px;
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
justify-content: space-between;
}
.controlRow {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.whyRow {
margin-top: 12px;
}
.status {
font-size: 12px;
color: var(--muted);
}
.statusStrong {
color: color-mix(in oklab, var(--success), white 18%);
}
@media (prefers-reduced-motion: reduce) {
.dot {
animation: none;
}
}
@@ -0,0 +1,167 @@
"use client";
import { useMemo, useState } from "react";
import styles from "./AssistantRail.module.css";
type Suggestion = {
id: string;
text: string;
citations: Array<{ title: string; href: string }>;
};
const seededSuggestions: Suggestion[] = [
{
id: "cta",
text: "Reduce competing CTAs: keep one primary action, demote the rest to secondary to sharpen hierarchy.",
citations: [
{ title: "Design System: CTA hierarchy", href: "#" },
{ title: "UX principle: one primary per view", href: "#" },
],
},
{
id: "motion",
text: "Use motion only as feedback (hover, state changes, subtle reveal). Respect reduced-motion automatically.",
citations: [
{ title: "Motion guidelines", href: "#" },
{ title: "Reduced motion support", href: "#" },
],
},
];
export function AssistantRail() {
const [prompt, setPrompt] = useState("Summarize how to improve this page’s hierarchy.");
const [isGenerating, setIsGenerating] = useState(false);
const [active, setActive] = useState<Suggestion | null>(seededSuggestions[0]);
const [appliedIds, setAppliedIds] = useState<string[]>([]);
const [lastAppliedId, setLastAppliedId] = useState<string | null>(null);
const [showWhy, setShowWhy] = useState(false);
const appliedSet = useMemo(() => new Set(appliedIds), [appliedIds]);
function run() {
setIsGenerating(true);
window.setTimeout(() => {
const promptLower = prompt.toLowerCase();
const keywordMatch =
promptLower.includes("motion") || promptLower.includes("animation")
? "motion"
: promptLower.includes("cta") || promptLower.includes("button")
? "cta"
: null;
const next =
(keywordMatch ? seededSuggestions.find((s) => s.id === keywordMatch) : null) ??
(() => {
const currentIndex = seededSuggestions.findIndex((s) => s.id === (active?.id ?? seededSuggestions[0].id));
const nextIndex = (currentIndex + 1) % seededSuggestions.length;
return seededSuggestions[nextIndex];
})();
setActive(next);
setShowWhy(false);
setIsGenerating(false);
}, 700);
}
function apply() {
if (!active || appliedSet.has(active.id)) return;
setAppliedIds((prev) => [...prev, active.id]);
setLastAppliedId(active.id);
}
function undo() {
if (!lastAppliedId) return;
setAppliedIds((prev) => prev.filter((id) => id !== lastAppliedId));
setLastAppliedId(null);
}
function resetApplied() {
if (!appliedIds.length) return;
const ok = window.confirm("Clear applied items? This is just a demo of confirmation UI.");
if (!ok) return;
setAppliedIds([]);
setLastAppliedId(null);
}
return (
<section className={styles.panel} aria-label="AI Assistant">
<div className={styles.header}>
<h2 className={styles.title}>Assistant Rail</h2>
<div className={styles.disclosure}>
<span className={styles.badge} title="This content is generated by AI. Review before applying.">
AI-generated
</span>
</div>
</div>
<p className={styles.hint}>
Human-in-control: you can apply or undo changes. This is a starter UI pattern, not a full chatbot.
</p>
<div className={styles.promptRow}>
<input
className={styles.input}
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
placeholder="Ask for a UI change…"
aria-label="Prompt"
/>
<button className={`${styles.btn} ${styles.btnPrimary}`} type="button" onClick={run}>
Ask
</button>
</div>
<div className={styles.output} aria-live="polite">
{isGenerating ? (
<div className={styles.typing} aria-label="Generating">
<span>Thinking</span>
<span className={styles.dot} />
<span className={styles.dot} />
<span className={styles.dot} />
</div>
) : (
<>
<p className={styles.text}>{active?.text}</p>
<div className={styles.citations} aria-label="Citations">
{(active?.citations ?? []).map((c, idx) => (
<span key={c.title} className={styles.chip} title={c.title}>
<span className={styles.chipNumber}>{idx + 1}</span>
<a href={c.href}>{c.title}</a>
</span>
))}
</div>
<div className={styles.whyRow}>
<button className={styles.btn} type="button" onClick={() => setShowWhy((v) => !v)}>
Why this?
</button>
</div>
{showWhy ? (
<p className={styles.hint}>
This suggestion targets high-leverage UX: clearer hierarchy reduces cognitive load and makes the
primary action obvious. It also reduces regret by keeping changes easy to apply/undo.
</p>
) : null}
</>
)}
</div>
<div className={styles.controls}>
<div className={styles.controlRow}>
<button className={styles.btn} type="button" onClick={apply} disabled={!active || appliedSet.has(active.id)}>
Apply
</button>
<button className={styles.btn} type="button" onClick={undo} disabled={!lastAppliedId}>
Undo
</button>
<button className={styles.btn} type="button" onClick={resetApplied} disabled={!appliedIds.length}>
Reset
</button>
</div>
<div className={styles.status} aria-live="polite">
Applied:{" "}
<span className={appliedIds.length ? styles.statusStrong : undefined}>{appliedIds.length}</span>
</div>
</div>
</section>
);
}
@@ -0,0 +1,198 @@
:root {
--fd-bg: #0b0d10;
--fd-surface: rgba(255, 255, 255, 0.06);
--fd-ink: rgba(245, 244, 240, 0.96);
--fd-muted: rgba(245, 244, 240, 0.66);
--fd-accent: #d7ff3f;
--fd-accent2: #68e0ff;
--fd-radius: 20px;
--fd-stroke: rgba(245, 244, 240, 0.14);
--fd-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
--fd-ease: cubic-bezier(0.2, 0.9, 0.2, 1);
}
.shell {
position: relative;
color: var(--fd-ink);
border: 1px solid var(--fd-stroke);
border-radius: var(--fd-radius);
background:
radial-gradient(1000px 300px at 20% 0%, rgba(104, 224, 255, 0.14), transparent 60%),
radial-gradient(800px 340px at 85% 20%, rgba(215, 255, 63, 0.14), transparent 55%),
linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
box-shadow: var(--fd-shadow);
overflow: clip;
padding: 22px 20px;
}
.shell::before {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background:
repeating-linear-gradient(
135deg,
rgba(245, 244, 240, 0.05),
rgba(245, 244, 240, 0.05) 1px,
transparent 1px,
transparent 9px
);
opacity: 0.35;
mix-blend-mode: soft-light;
}
.head {
position: relative;
padding-bottom: 14px;
border-bottom: 1px solid var(--fd-stroke);
margin-bottom: 16px;
}
.kicker {
display: inline-flex;
gap: 10px;
align-items: center;
font-size: 12px;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--fd-muted);
}
.kicker::before {
content: "";
width: 10px;
height: 10px;
border-radius: 999px;
background: radial-gradient(circle at 35% 35%, var(--fd-accent), rgba(215, 255, 63, 0.2));
box-shadow: 0 0 0 2px rgba(215, 255, 63, 0.12);
}
.title {
margin: 10px 0 6px;
font-size: 28px;
line-height: 1.05;
letter-spacing: -0.02em;
}
.subtitle {
margin: 0;
max-width: 62ch;
color: var(--fd-muted);
line-height: 1.35;
font-size: 14px;
}
.grid {
position: relative;
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
}
.card {
border: 1px solid rgba(245, 244, 240, 0.12);
border-radius: 16px;
background: rgba(0, 0, 0, 0.2);
padding: 14px 14px 12px;
transform: translateY(0);
transition: transform 280ms var(--fd-ease), border-color 280ms var(--fd-ease);
}
.card:hover {
transform: translateY(-2px);
border-color: rgba(215, 255, 63, 0.35);
}
.cardTop {
display: flex;
justify-content: space-between;
gap: 10px;
align-items: baseline;
}
.cardLabel {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(245, 244, 240, 0.72);
}
.cardHint {
font-size: 12px;
color: rgba(104, 224, 255, 0.8);
}
.cardValue {
margin-top: 12px;
font-size: 24px;
line-height: 1;
letter-spacing: -0.02em;
}
.foot {
position: relative;
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
.cta {
appearance: none;
border: 1px solid rgba(245, 244, 240, 0.18);
color: var(--fd-ink);
background: rgba(0, 0, 0, 0.18);
border-radius: 999px;
padding: 12px 14px;
display: inline-flex;
gap: 10px;
align-items: center;
cursor: pointer;
transition: transform 220ms var(--fd-ease), border-color 220ms var(--fd-ease);
}
.cta:hover {
transform: translateY(-1px);
border-color: rgba(245, 244, 240, 0.34);
}
.cta:focus-visible {
outline: 3px solid rgba(104, 224, 255, 0.45);
outline-offset: 3px;
}
.ctaText {
font-size: 13px;
letter-spacing: 0.02em;
}
.ctaIcon {
color: var(--fd-accent);
transform: translateX(0);
transition: transform 220ms var(--fd-ease);
}
.cta:hover .ctaIcon {
transform: translateX(2px);
}
@media (max-width: 720px) {
.grid {
grid-template-columns: 1fr;
}
.title {
font-size: 26px;
}
}
@media (prefers-reduced-motion: reduce) {
.card,
.cta,
.ctaIcon {
transition: none;
}
.card:hover,
.cta:hover {
transform: none;
}
}
@@ -0,0 +1,52 @@
import styles from "./DesignPanel.module.css";
type Stat = { label: string; value: string; hint?: string };
const defaultStats: Stat[] = [
{ label: "Uptime", value: "99.98%", hint: "30d" },
{ label: "Latency", value: "84ms", hint: "p95" },
{ label: "Migrations", value: "12", hint: "this week" },
];
export function DesignPanel({
title = "System Brief",
subtitle = "A compact panel designed for strong hierarchy and quick scanning.",
stats = defaultStats,
ctaLabel = "View details",
}: {
title?: string;
subtitle?: string;
stats?: Stat[];
ctaLabel?: string;
}) {
return (
<section className={styles.shell} aria-label={title}>
<div className={styles.head}>
<div className={styles.kicker}>Field Report</div>
<h2 className={styles.title}>{title}</h2>
<p className={styles.subtitle}>{subtitle}</p>
</div>
<div className={styles.grid} role="list">
{stats.map((s) => (
<article key={s.label} className={styles.card} role="listitem">
<div className={styles.cardTop}>
<div className={styles.cardLabel}>{s.label}</div>
{s.hint ? <div className={styles.cardHint}>{s.hint}</div> : null}
</div>
<div className={styles.cardValue}>{s.value}</div>
</article>
))}
</div>
<div className={styles.foot}>
<button className={styles.cta} type="button">
<span className={styles.ctaText}>{ctaLabel}</span>
<span className={styles.ctaIcon} aria-hidden="true">
→
</span>
</button>
</div>
</section>
);
}
@@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Avant Studio</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;700&family=Newsreader:opsz,wght@6..72,400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<a class="skip-link" href="#main">Skip to content</a>
<div class="grain"></div>
<header class="top-bar">
<div class="logo">Avant Studio</div>
<nav>
<a href="#main">Work</a>
<a href="#process">Process</a>
<a href="#contact">Contact</a>
</nav>
<button class="cta">Start a project</button>
</header>
<main id="main">
<section class="hero">
<div class="hero-copy">
<p class="eyebrow">Design lab</p>
<h1>Striking, production-ready frontends without the generic glaze.</h1>
<p class="lede">We craft visceral digital spaces that move fast, feel tactile, and stay memorable. Built with intent, tuned for launch.</p>
<div class="actions">
<button class="cta primary">See capabilities</button>
<button class="ghost">View a live concept</button>
</div>
<div class="stats">
<div><span>42</span> shipped sites</div>
<div><span>95%</span> lighthouse perf</div>
<div><span>0</span> generic templates</div>
</div>
</div>
<div class="hero-card reveal">
<div class="tag">Now launching</div>
<div class="card-body">
<h2>Neon Observatory</h2>
<p>A retro-futurist control room with live telemetry, aurora gradients, and glitch hover states.</p>
<div class="pill">CSS Grid</div>
<div class="pill">Framer Motion</div>
<div class="pill">ARIA-first</div>
<div class="line"></div>
<div class="meta">
<span>ETA: 2 weeks</span>
<span>Visual QA locked</span>
</div>
</div>
</div>
</section>
<section class="grid" id="process">
<article class="panel reveal">
<p class="eyebrow">01 / Intent</p>
<h3>Pick a bold narrative, define the signature move, lock the palette.</h3>
<p>We interrogate purpose, audience, and constraints. Each build commits to one unmistakable gesture—stripe, glow, or grain—and sticks to it.</p>
</article>
<article class="panel reveal">
<p class="eyebrow">02 / Build</p>
<h3>Real code: semantic HTML, layered CSS, purposeful motion.</h3>
<p>CSS variables for theming, responsive grids, progressive enhancement. Animations gated by prefers-reduced-motion.</p>
</article>
<article class="panel reveal">
<p class="eyebrow">03 / Polish</p>
<h3>Accessibility, performance, and tactile interactions.</h3>
<p>Contrast checks, keyboard navigation, tuned shadows, intentional hover states. We avoid boilerplate aesthetics at all costs.</p>
</article>
</section>
<section class="timeline" id="contact">
<div class="timeline-head">
<p class="eyebrow">Field notes</p>
<h3>Recent drops</h3>
</div>
<div class="timeline-rail">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
<div class="timeline-items">
<div class="timeline-card reveal">
<p class="label">2024</p>
<h4>Aerial atlas</h4>
<p>Editorial map portal with split-screen narrative and scroll-synced chapters.</p>
</div>
<div class="timeline-card reveal">
<p class="label">2023</p>
<h4>Glassfoundry</h4>
<p>Industrial dashboard with translucent panels, border glows, and live system vitals.</p>
</div>
<div class="timeline-card reveal">
<p class="label">2022</p>
<h4>Islands</h4>
<p>Pastel travel companion with hand-drawn dividers, slow float animations, and tactile cards.</p>
</div>
</div>
</section>
</main>
<footer class="footer">
<div class="marquee" aria-hidden="true">
<span>Distinctive frontends · Real code · No generic glaze · </span>
<span>Distinctive frontends · Real code · No generic glaze · </span>
<span>Distinctive frontends · Real code · No generic glaze · </span>
</div>
<div class="footer-grid">
<div>
<p class="eyebrow">Contact</p>
<a href="mailto:hello@avant.studio">hello@avant.studio</a>
</div>
<div>
<p class="eyebrow">Social</p>
<a href="#">Are.na</a>
<a href="#">Behance</a>
</div>
<div>
<p class="eyebrow">Collab</p>
<p>We ship components, pages, systems, and microsites.</p>
</div>
</div>
</footer>
<script src="./script.js"></script>
</body>
</html>
@@ -0,0 +1,13 @@
const observer = new IntersectionObserver(
entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
observer.unobserve(entry.target);
}
});
},
{ threshold: 0.2 }
);
document.querySelectorAll('.reveal').forEach(el => observer.observe(el));
@@ -0,0 +1,425 @@
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;700&family=Newsreader:opsz,wght@6..72,400;600&display=swap');
:root {
--bg: #0b0c10;
--fg: #f6f1e6;
--muted: #a7acba;
--accent: #ff6b4a;
--accent-2: #6b9bff;
--card: rgba(255, 255, 255, 0.03);
--stroke: rgba(255, 255, 255, 0.12);
--radius: 18px;
--shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
--ease: cubic-bezier(0.22, 1, 0.36, 1);
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Newsreader', 'Times New Roman', serif;
color: var(--fg);
background: var(--bg);
min-height: 100vh;
line-height: 1.7;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
background-image:
radial-gradient(1200px at 15% 20%, rgba(107, 155, 255, 0.25), transparent 50%),
radial-gradient(1400px at 80% 0%, rgba(255, 107, 74, 0.2), transparent 50%),
linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent);
}
.grain {
position: fixed;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.04), transparent 35%),
repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02) 1px, transparent 1px, transparent 3px);
mix-blend-mode: soft-light;
opacity: 0.7;
z-index: 1;
}
a {
color: inherit;
text-decoration: none;
}
.skip-link {
position: absolute;
left: -999px;
top: 0;
padding: 12px 16px;
background: var(--accent);
color: #0b0c10;
border-radius: 8px;
font-weight: 700;
z-index: 999;
}
.skip-link:focus {
left: 16px;
top: 16px;
}
.top-bar {
position: sticky;
top: 0;
z-index: 10;
display: flex;
align-items: center;
justify-content: space-between;
padding: 18px 36px;
backdrop-filter: blur(10px);
background: rgba(11, 12, 16, 0.75);
border-bottom: 1px solid var(--stroke);
}
.logo {
font-family: 'Bricolage Grotesque', 'Arial Black', sans-serif;
font-weight: 700;
letter-spacing: -0.02em;
}
nav {
display: flex;
gap: 18px;
font-size: 0.95rem;
}
nav a {
padding: 8px 12px;
border-radius: 999px;
border: 1px solid transparent;
transition: border-color 220ms var(--ease), color 220ms var(--ease);
}
nav a:hover,
nav a:focus-visible {
border-color: var(--stroke);
color: var(--accent);
}
button {
font-family: 'Bricolage Grotesque', sans-serif;
font-weight: 700;
border: none;
cursor: pointer;
}
.cta {
padding: 12px 18px;
border-radius: 999px;
background: linear-gradient(120deg, var(--accent), var(--accent-2));
color: #0b0c10;
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.cta:hover {
transform: translateY(-3px);
box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
}
.hero {
display: grid;
grid-template-columns: 1.2fr 0.8fr;
gap: 32px;
padding: 96px 36px 48px;
position: relative;
}
.hero-copy h1 {
font-family: 'Bricolage Grotesque', sans-serif;
font-size: clamp(2.4rem, 5vw, 3.6rem);
line-height: 1.1;
letter-spacing: -0.03em;
margin: 12px 0;
}
.hero .lede {
max-width: 56ch;
color: var(--muted);
font-size: 1.05rem;
}
.eyebrow {
text-transform: uppercase;
letter-spacing: 0.18em;
font-size: 0.78rem;
color: var(--accent);
margin: 0 0 8px;
}
.actions {
display: flex;
gap: 12px;
margin: 24px 0 18px;
}
.ghost {
padding: 12px 16px;
border-radius: 999px;
background: transparent;
border: 1.5px solid var(--stroke);
color: var(--fg);
transition: border-color 220ms var(--ease), color 220ms var(--ease), transform 220ms var(--ease);
}
.ghost:hover {
border-color: var(--accent);
color: var(--accent);
transform: translateY(-2px);
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 12px;
margin-top: 20px;
color: var(--muted);
font-size: 0.95rem;
}
.stats span {
display: block;
font-family: 'Bricolage Grotesque', sans-serif;
font-size: 1.5rem;
color: var(--fg);
}
.hero-card {
background: var(--card);
border: 1px solid var(--stroke);
border-radius: 22px;
padding: 24px;
box-shadow: var(--shadow);
position: relative;
overflow: hidden;
}
.hero-card::after {
content: '';
position: absolute;
inset: -30%;
background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.04), transparent 45%);
transform: rotate(8deg);
opacity: 0.8;
}
.hero-card .tag {
display: inline-block;
padding: 8px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.07);
color: var(--accent);
font-size: 0.85rem;
position: relative;
z-index: 2;
}
.hero-card .card-body {
position: relative;
z-index: 2;
}
.hero-card h2 {
font-family: 'Bricolage Grotesque', sans-serif;
margin: 12px 0 8px;
}
.hero-card p {
color: var(--muted);
margin-bottom: 12px;
}
.pill {
display: inline-block;
padding: 8px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--stroke);
margin: 4px 6px 4px 0;
font-size: 0.85rem;
}
.line {
margin: 16px 0;
height: 1px;
background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.meta {
display: flex;
justify-content: space-between;
color: var(--muted);
font-size: 0.9rem;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 18px;
padding: 48px 36px;
}
.panel {
border: 1px solid var(--stroke);
border-radius: var(--radius);
padding: 22px;
background: rgba(255, 255, 255, 0.02);
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}
.panel h3 {
margin: 6px 0 10px;
font-family: 'Bricolage Grotesque', sans-serif;
}
.panel p {
color: var(--muted);
}
.timeline {
padding: 24px 36px 80px;
border-top: 1px solid var(--stroke);
}
.timeline-head h3 {
font-family: 'Bricolage Grotesque', sans-serif;
margin: 8px 0 16px;
}
.timeline-rail {
position: relative;
height: 3px;
background: var(--stroke);
border-radius: 999px;
margin: 24px 0 32px;
}
.timeline-rail .dot {
position: absolute;
top: -6px;
width: 15px;
height: 15px;
background: var(--accent);
border-radius: 50%;
box-shadow: 0 0 0 6px rgba(255, 107, 74, 0.15);
}
.timeline-rail .dot:nth-child(1) { left: 8%; }
.timeline-rail .dot:nth-child(2) { left: 50%; }
.timeline-rail .dot:nth-child(3) { left: 88%; }
.timeline-items {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 16px;
}
.timeline-card {
border: 1px solid var(--stroke);
border-radius: var(--radius);
padding: 18px;
background: rgba(255, 255, 255, 0.02);
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}
.timeline-card .label {
font-size: 0.9rem;
letter-spacing: 0.12em;
color: var(--accent);
text-transform: uppercase;
margin-bottom: 6px;
}
.timeline-card h4 {
margin: 4px 0 8px;
font-family: 'Bricolage Grotesque', sans-serif;
}
.timeline-card p {
color: var(--muted);
}
.footer {
border-top: 1px solid var(--stroke);
padding: 28px 36px 48px;
position: relative;
overflow: hidden;
}
.marquee {
display: grid;
grid-auto-flow: column;
gap: 16px;
font-family: 'Bricolage Grotesque', sans-serif;
text-transform: uppercase;
letter-spacing: 0.14em;
color: var(--muted);
animation: scroll 18s linear infinite;
}
@keyframes scroll {
from { transform: translateX(0); }
to { transform: translateX(-50%); }
}
.footer-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
margin-top: 24px;
}
.footer-grid a {
display: block;
color: var(--fg);
text-decoration: underline;
margin-bottom: 4px;
}
.reveal {
opacity: 0;
transform: translateY(22px);
transition: transform 320ms var(--ease), opacity 320ms var(--ease);
}
.reveal.visible {
opacity: 1;
transform: translateY(0);
}
@media (max-width: 960px) {
.hero {
grid-template-columns: 1fr;
padding-top: 72px;
}
.top-bar {
position: sticky;
}
nav {
display: none;
}
.actions {
flex-direction: column;
align-items: flex-start;
}
}
@media (prefers-reduced-motion: reduce) {
* {
animation: none !important;
transition: none !important;
}
}
@@ -0,0 +1,49 @@
# Aesthetic Playbook
Pick ONE direction and commit. Swap colors/fonts if needed, but keep the intent. Choose a single **signature move** that someone will remember.
## Font Rule (avoid default vibes)
- If the repo already has a font system, stay consistent unless asked to change it.
- Otherwise: pick a characterful display font + a legible body font. Avoid overused “default tech” pairings.
## Brutalist Raw (high-contrast, rule-heavy)
- Fonts: Display `Bricolage Grotesque` / `Fraunces`; Body `Atkinson Hyperlegible` / `IBM Plex Sans`; Mono `IBM Plex Mono`.
- Colors: Ink/ivory with one acidic accent (e.g. tomato, chartreuse).
- Signature moves: oversized numeric index badges; thick 2px rules; hard invert hover.
- Backgrounds: checkerboard corner, dotted matrix, a single diagonal stripe.
## Editorial / Magazine (luxury, typographic hierarchy)
- Fonts: Display `Instrument Serif` / `Cormorant Garamond`; Body `Source Serif 4` / `Newsreader`; Mono `DM Mono`.
- Colors: warm off-white, deep ink, one burnt accent (rust/saffron).
- Signature moves: pull-quote rail; hairline rules; “issue number” metadata strip.
- Backgrounds: subtle paper grain, soft vignette.
## Techno-Gothic (dark, minimal, sharp accents)
- Fonts: Display `Unbounded` / `Syne`; Body `Work Sans` / `Barlow`; Mono `JetBrains Mono`.
- Colors: near-black base with cold accent (cyan/acid green) + muted steel.
- Signature moves: corner ticks, scanline sheen on hover, “system status” chips.
- Backgrounds: diagonal hatch, faint grid, tiny starfield.
## Neo-Poster (bold blocks, loud hierarchy)
- Fonts: Display `Bebas Neue` / `Archivo Black`; Body `Noto Sans`; Mono `Space Mono` (only if it fits the concept).
- Colors: high-sat primaries on warm neutral, with black rules.
- Signature moves: torn-paper edge (CSS mask vibe); huge headline with tight tracking; sticker CTA.
- Backgrounds: halftone dot field, off-register shadows.
## Soft Craft (warm, tactile, friendly)
- Fonts: Display `Sora` / `Epilogue`; Body `Alegreya Sans` / `Manrope`; Mono optional.
- Colors: warm cream, terracotta accent, sage secondary.
- Signature moves: stitched borders; stacked cards; gentle floating blobs (reduced-motion safe).
- Backgrounds: irregular gradient blobs + low-opacity noise.
## Industrial / Utilitarian (labeled panels, measured density)
- Fonts: Display `Archivo` / `Anton`; Body `Barlow` / `IBM Plex Sans`; Mono `JetBrains Mono`.
- Colors: cold neutrals with hazard accent (amber) and a secondary teal.
- Signature moves: panel labels; coordinate tags; “spec table” sectioning.
- Backgrounds: repeating hatch, soft inner glows for depth.
## How to Choose (fast)
1) Choose the emotional goal (luxe, raw, calm, severe, playful).
2) Pick type first (display sets the tone).
3) Pick one signature move and apply it in 2–3 places max.
4) Keep everything else quiet and supportive.
@@ -0,0 +1,42 @@
# AI-native UI Patterns (trust + control)
AI UI should feel like a product feature, not a bolt-on chatbot. Prioritize clarity, trust, and user control.
## Core patterns
### Copilot side panel (assistive AI)
- Persistent panel (often right rail) with:
- header + **AI disclosure**
- prompt input (or command chips/templates)
- output stream area
- actions (apply, copy, discard)
### AI-generated labeling (strict)
- AI output must not be visually confused with user-authored content.
- Use a badge/label (“AI-generated”) with tooltip text and/or subtle tinting.
### Citations / sources (recommended for factual outputs)
- Render as chips or footnotes under the relevant block.
- Make them clickable and scannable (title + optional section anchor).
### “Why this?” affordance
- Provide a short “why this suggestion?” expansion with neutral language.
- Prefer concrete reasons (policy, data, heuristic) over anthropomorphic phrasing.
## Human-in-the-loop (strict)
- Provide at least one of:
- **Apply / Undo**
- **Accept / Reject**
- confirmation for destructive actions
- Never silently perform irreversible changes.
## AI loading and motion
- Use subtle, purposeful indicators:
- typing dots, shimmer skeleton, progressive reveal
- Respect `prefers-reduced-motion` (no endless animated flourish).
## Signature move ideas (pick one)
- Citation rail (chips aligned to the right edge of the answer)
- Apply stack (queued changes with an “apply all” + per-item undo)
- Confidence capsule (uncertainty/assumptions shown as compact pills)
@@ -0,0 +1,23 @@
# Anti-Patterns (avoid “AI slop”)
Use this as a quick filter before shipping.
## Visual clichés
- Generic purple-on-white gradients with soft glass cards everywhere.
- Samey startup landing layout: centered hero, 3 cards, logo wall, FAQ, identical CTA band.
- Indiscriminate glow + blur layers that reduce legibility.
## Typography defaults
- Unintentional type: no scale, no rhythm, headings too close in size to body.
- Mixing too many fonts “because it looks cool” (unless the direction is explicitly chaotic).
- Defaulting to the same trendy “safe” font pairings (e.g., the usual modern grotesks) when the project calls for a stronger voice.
## Motion mistakes
- Random micro-animations everywhere instead of one orchestrated sequence.
- No `prefers-reduced-motion` handling.
- Hover-only affordances (mobile users get nothing).
## UX/a11y misses
- Weak focus states, low contrast, tiny hit targets.
- Buttons styled as links (or vice versa) without correct semantics.
- Missing labels on inputs, icon-only actions without accessible names.
@@ -0,0 +1,56 @@
# Implementation Patterns
Use these patterns to move quickly while keeping the aesthetic sharp. Prefer real code and real semantics over “design vibes”.
## Decision: Vanilla vs React
- Use **vanilla** for quick concepts, single pages, marketing-style layouts.
- Use **React** when the UI lives inside an app, needs state, routes, or reusable components.
## Vanilla HTML/CSS/JS Workflow
- Start with semantic structure: `header`, `main`, `section`, `article`, `footer`.
- Add skip links when there’s a nav/header: `a.skip-nav` → `#main`.
- Define theme tokens up top:
```css
:root {
--bg: #0b0c10;
--surface: #10131a;
--fg: #f7f2e9;
--muted: #9aa1b5;
--accent: #ff6b4a;
--radius: 18px;
--shadow: 0 18px 40px rgba(0,0,0,0.35);
--ease: cubic-bezier(.2,.9,.2,1);
}
```
- Layout: Grid for macro, Flexbox for clusters. Break the grid deliberately but preserve reading order.
- Motion: prefer CSS keyframes + `transition`. Orchestrate a few moments (load + hover), not everything.
- Reveal animations: use IntersectionObserver to toggle classes (small JS only).
## React Patterns (TypeScript)
- Keep components small: `Hero`, `FeatureList`, `SpecsRail`, `CTA`.
- Use data arrays for repeated UI (cards/steps/metrics) and map to components.
- Styling: prefer the repo’s existing approach. If unknown, CSS Modules is a safe default.
- Motion: keep durations < 500ms; stagger by 80–140ms; gate everything with reduced-motion.
## Motion & Reduced Motion
- Always include a reduced-motion fallback:
```css
@media (prefers-reduced-motion: reduce) {
* { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
```
- Keep animations paint-friendly (transform/opacity). Avoid animating large blur shadows.
## Layout & Spacing
- Use a spacing scale (4/8 base). Keep prose line-length ~68–76ch.
- If maximalist: constrain chaos inside frames. If minimal: increase margins and tighten hierarchy.
## Texture & Backgrounds (CSS-only)
- Use layered gradients and subtle noise-like patterns (no heavy assets by default).
- Prefer subtle grain overlays over full-page blur.
## QA Checklist
- One `h1`, logical heading order, landmarks present.
- Focus visible, keyboard usable, contrast AA+.
- Tap targets 44px minimum for primary interactions.
- Mobile layout feels intentional (not just “stack everything”).
@@ -0,0 +1,25 @@
# React + Next.js Best Practices (concise)
## React component design
- Keep components and Hooks pure: compute UI from props/state without side effects in render.
- Run side effects outside render (event handlers or Effects).
- Prefer event handlers for user-driven work; avoid “Effect for everything.”
- Follow the Rules of Hooks (top-level only; consistent call order; only in React functions).
- Don’t call component functions directly; use JSX so React controls rendering.
- Split large components into small, focused pieces; keep props stable and typed.
## Next.js App Router
- Server Components by default; add `"use client"` only when you need state, effects, or browser APIs.
- Keep Client Components small and isolated (UI islands).
- Use `next/link` for navigation and `next/image` for real images.
- Prefer `next/font` when changing typography to avoid layout shift/FOIT.
## Data fetching and caching
- Prefer server-side `fetch` and explicit caching with `cache`/`revalidate`.
- Avoid client-side fetch inside `useEffect` unless you truly need client-only data.
- Keep loading/error states explicit and user-friendly.
## State and performance
- Minimize global state; lift only when necessary.
- Memoize expensive calculations; keep derived state computed, not stored.
- Avoid unnecessary re-renders by splitting components and using stable props.
@@ -0,0 +1,138 @@
---
name: skill-vetter
version: 1.0.0
description: Security-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns.
---
# Skill Vetter 🔒
Security-first vetting protocol for AI agent skills. **Never install a skill without vetting it first.**
## When to Use
- Before installing any skill from ClawdHub
- Before running skills from GitHub repos
- When evaluating skills shared by other agents
- Anytime you're asked to install unknown code
## Vetting Protocol
### Step 1: Source Check
```
Questions to answer:
- [ ] Where did this skill come from?
- [ ] Is the author known/reputable?
- [ ] How many downloads/stars does it have?
- [ ] When was it last updated?
- [ ] Are there reviews from other agents?
```
### Step 2: Code Review (MANDATORY)
Read ALL files in the skill. Check for these **RED FLAGS**:
```
🚨 REJECT IMMEDIATELY IF YOU SEE:
─────────────────────────────────────────
• curl/wget to unknown URLs
• Sends data to external servers
• Requests credentials/tokens/API keys
• Reads ~/.ssh, ~/.aws, ~/.config without clear reason
• Accesses MEMORY.md, USER.md, SOUL.md, IDENTITY.md
• Uses base64 decode on anything
• Uses eval() or exec() with external input
• Modifies system files outside workspace
• Installs packages without listing them
• Network calls to IPs instead of domains
• Obfuscated code (compressed, encoded, minified)
• Requests elevated/sudo permissions
• Accesses browser cookies/sessions
• Touches credential files
─────────────────────────────────────────
```
### Step 3: Permission Scope
```
Evaluate:
- [ ] What files does it need to read?
- [ ] What files does it need to write?
- [ ] What commands does it run?
- [ ] Does it need network access? To where?
- [ ] Is the scope minimal for its stated purpose?
```
### Step 4: Risk Classification
| Risk Level | Examples | Action |
|------------|----------|--------|
| 🟢 LOW | Notes, weather, formatting | Basic review, install OK |
| 🟡 MEDIUM | File ops, browser, APIs | Full code review required |
| 🔴 HIGH | Credentials, trading, system | Human approval required |
| ⛔ EXTREME | Security configs, root access | Do NOT install |
## Output Format
After vetting, produce this report:
```
SKILL VETTING REPORT
═══════════════════════════════════════
Skill: [name]
Source: [ClawdHub / GitHub / other]
Author: [username]
Version: [version]
───────────────────────────────────────
METRICS:
• Downloads/Stars: [count]
• Last Updated: [date]
• Files Reviewed: [count]
───────────────────────────────────────
RED FLAGS: [None / List them]
PERMISSIONS NEEDED:
• Files: [list or "None"]
• Network: [list or "None"]
• Commands: [list or "None"]
───────────────────────────────────────
RISK LEVEL: [🟢 LOW / 🟡 MEDIUM / 🔴 HIGH / ⛔ EXTREME]
VERDICT: [✅ SAFE TO INSTALL / ⚠️ INSTALL WITH CAUTION / ❌ DO NOT INSTALL]
NOTES: [Any observations]
═══════════════════════════════════════
```
## Quick Vet Commands
For GitHub-hosted skills:
```bash
# Check repo stats
curl -s "https://api.github.com/repos/OWNER/REPO" | jq '{stars: .stargazers_count, forks: .forks_count, updated: .updated_at}'
# List skill files
curl -s "https://api.github.com/repos/OWNER/REPO/contents/skills/SKILL_NAME" | jq '.[].name'
# Fetch and review SKILL.md
curl -s "https://raw.githubusercontent.com/OWNER/REPO/main/skills/SKILL_NAME/SKILL.md"
```
## Trust Hierarchy
1. **Official OpenClaw skills** → Lower scrutiny (still review)
2. **High-star repos (1000+)** → Moderate scrutiny
3. **Known authors** → Moderate scrutiny
4. **New/unknown sources** → Maximum scrutiny
5. **Skills requesting credentials** → Human approval always
## Remember
- No skill is worth compromising security
- When in doubt, don't install
- Ask your human for high-risk decisions
- Document what you vet for future reference
---
*Paranoia is a feature.* 🔒🦀
@@ -0,0 +1,11 @@
{
"owner": "spclaudehome",
"slug": "skill-vetter",
"displayName": "Skill Vetter",
"latest": {
"version": "1.0.0",
"publishedAt": 1769863429632,
"commit": "https://github.com/clawdbot/skills/commit/c563399ea973b60cb63db5ed84e871750e65939a"
},
"history": []
}
@@ -0,0 +1,978 @@
---
name: superpowers
description: >
Agentic software development methodology — 13 integrated skills for
disciplined AI-assisted development covering brainstorming, planning,
TDD, debugging, code review, git worktrees, and branch management.
metadata:
openclaw:
emoji: "⚡"
---
# Superpowers
Disciplined, systematic approach to AI-assisted software development. 13 integrated skills covering the full development lifecycle.
## The 7-Step Workflow
1. **Brainstorm** — Design before implementation (Section 2)
2. **Plan** — Write detailed implementation plan (Section 3)
3. **Execute** — Implement with subagents or batches (Sections 4-6)
4. **Test** — TDD throughout: RED-GREEN-REFACTOR (Section 7)
5. **Debug** — Systematic root cause analysis when needed (Section 8)
6. **Review** — Code review after each task (Section 10)
7. **Finish** — Branch completion and integration (Section 12)
## How to Use
Apply the relevant section based on your current task:
| Task | Section |
|------|---------|
| Starting new work | Section 2 (Brainstorming) → Section 3 (Writing Plans) |
| Implementing a plan (this session) | Section 5 (Subagent-Driven Development) |
| Implementing a plan (separate session) | Section 4 (Executing Plans) |
| Multiple independent problems | Section 6 (Dispatching Parallel Agents) |
| Writing or fixing code | Section 7 (Test-Driven Development) |
| Bug, test failure, unexpected behavior | Section 8 (Systematic Debugging) |
| About to claim work is done | Section 9 (Verification Before Completion) |
| After completing work | Section 10 (Code Review) |
| Need isolated workspace | Section 11 (Using Git Worktrees) |
| Ready to merge/integrate | Section 12 (Finishing a Development Branch) |
| Creating new skills | Section 13 (Writing Skills) |
**Skill priority:** Process skills first (brainstorming, debugging), then implementation skills.
**Skill types:**
- **Rigid** (TDD, debugging, verification): Follow exactly. Don't adapt away discipline.
- **Flexible** (patterns, worktrees): Adapt principles to context.
---
## 1. Using Superpowers
<EXTREMELY-IMPORTANT>
If you think there is even a 1% chance a skill might apply to what you are doing, you ABSOLUTELY MUST invoke the skill.
IF A SKILL APPLIES TO YOUR TASK, YOU DO NOT HAVE A CHOICE. YOU MUST USE IT.
This is not negotiable. This is not optional. You cannot rationalize your way out of this.
</EXTREMELY-IMPORTANT>
**Rule:** Invoke relevant skills BEFORE any response or action. Even a 1% chance a section might apply means you should check.
**Process:**
1. User message received
2. Check: might any section apply?
- Yes → Follow that section
- No → Respond directly
3. If about to plan: check Section 2 (Brainstorming) first
4. If section has checklist: create todo per checklist item
5. Announce: "Using [skill] to [purpose]"
**Priority order:**
1. Process sections first (brainstorming, debugging)
2. Implementation sections second
**User instructions say WHAT, not HOW.** "Add X" or "Fix Y" doesn't mean skip workflows.
### Red Flags — You're Rationalizing
| Thought | Reality |
|---------|---------|
| "This is just a simple question" | Questions are tasks. Check for skills. |
| "I need more context first" | Skill check comes BEFORE clarifying questions. |
| "Let me explore the codebase first" | Skills tell you HOW to explore. Check first. |
| "I can check git/files quickly" | Files lack conversation context. Check for skills. |
| "Let me gather information first" | Skills tell you HOW to gather information. |
| "This doesn't need a formal skill" | If a skill exists, use it. |
| "I remember this skill" | Skills evolve. Read current version. |
| "This doesn't count as a task" | Action = task. Check for skills. |
| "The skill is overkill" | Simple things become complex. Use it. |
| "I'll just do this one thing first" | Check BEFORE doing anything. |
| "This feels productive" | Undisciplined action wastes time. Skills prevent this. |
| "I know what that means" | Knowing the concept ≠ using the skill. Invoke it. |
---
## 2. Brainstorming
**Use before:** Any creative work — creating features, building components, adding functionality, or modifying behavior.
<HARD-GATE>
Do NOT write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
</HARD-GATE>
### Anti-Pattern: "This Is Too Simple To Need A Design"
Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
### Checklist
1. **Explore project context** — check files, docs, recent commits
2. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
3. **Propose 2-3 approaches** — with trade-offs and your recommendation
4. **Present design** — in sections scaled to complexity, get user approval after each section
5. **Write design doc** — save to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit
6. **Transition to implementation** — follow Section 3 (Writing Plans)
### Process
- Ask one question at a time. Prefer multiple choice.
- Propose 2-3 approaches with trade-offs. Lead with your recommendation.
- Present design sections incrementally. Get approval after each.
- Cover: architecture, components, data flow, error handling, testing.
- Apply YAGNI ruthlessly.
- Be flexible — go back and clarify when something doesn't make sense.
### After Design Approval
Write validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`, commit, then follow Section 3 (Writing Plans).
**The terminal state is invoking writing-plans.** Do NOT invoke any other implementation skill. The ONLY next step after brainstorming is writing-plans.
### Key Principles
- **One question at a time** — Don't overwhelm with multiple questions
- **Multiple choice preferred** — Easier to answer than open-ended when possible
- **YAGNI ruthlessly** — Remove unnecessary features from all designs
- **Explore alternatives** — Always propose 2-3 approaches before settling
- **Incremental validation** — Present design, get approval before moving on
---
## 3. Writing Plans
**Use when:** You have a spec or requirements for a multi-step task, before touching code.
Write comprehensive implementation plans with bite-sized tasks. Assume the implementer has zero context. Document exact file paths, complete code, exact commands with expected output.
**Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
**Save plans to:** `docs/plans/YYYY-MM-DD-<feature-name>.md`
### Plan Header Template
Every plan MUST start with:
# [Feature Name] Implementation Plan
> **For agent:** REQUIRED SUB-SKILL: Use Section 4 or Section 5 to implement this plan.
**Goal:** [One sentence]
**Architecture:** [2-3 sentences]
**Tech Stack:** [Key technologies]
### Task Granularity
Each step is one action (2-5 minutes):
- "Write the failing test" — step
- "Run it to verify it fails" — step
- "Implement minimal code to pass" — step
- "Run tests to verify pass" — step
- "Commit" — step
### Task Structure
### Task N: [Component Name]
**Files:**
- Create: `exact/path/to/file.py`
- Modify: `exact/path/to/existing.py:123-145`
- Test: `tests/exact/path/to/test.py`
**Step 1:** Write failing test (with complete code)
**Step 2:** Run test, verify fails (exact command + expected output)
**Step 3:** Write minimal implementation (complete code)
**Step 4:** Run test, verify passes (exact command + expected output)
**Step 5:** Commit (exact git commands)
### Remember
- Exact file paths always
- Complete code in plan (not "add validation")
- Exact commands with expected output
- DRY, YAGNI, TDD, frequent commits
### Execution Handoff
After saving plan, offer:
**"Plan complete and saved. Two execution options:**
**1. Subagent-Driven (this session)** — fresh subagent per task, review between tasks, fast iteration → follow Section 5
**2. Parallel Session (separate)** — open new session, batch execution with checkpoints → follow Section 4
**Which approach?"**
---
## 4. Executing Plans
**Use when:** You have a written implementation plan to execute in a separate session with review checkpoints.
**Announce at start:** "I'm using the executing-plans skill to implement this plan."
### Process
1. **Load and review plan** — Read critically, raise concerns before starting. If no concerns: create task list and proceed.
2. **Execute batch** — Default first 3 tasks. For each: mark in_progress → follow steps exactly → run verifications → mark completed
3. **Report** — Show what was implemented, verification output. Say: "Ready for feedback."
4. **Continue** — Apply feedback, execute next batch, repeat
5. **Complete** — After all tasks verified, follow Section 12 (Finishing a Development Branch)
### When to Stop and Ask for Help
**STOP executing immediately when:**
- Hit a blocker mid-batch (missing dependency, test fails, instruction unclear)
- Plan has critical gaps preventing starting
- You don't understand an instruction
- Verification fails repeatedly
**Ask for clarification rather than guessing.**
### When to Revisit Earlier Steps
**Return to Review (Step 1) when:**
- Partner updates the plan based on your feedback
- Fundamental approach needs rethinking
**Don't force through blockers** — stop and ask.
### Rules
- Follow plan steps exactly
- Don't skip verifications
- Between batches: report and wait
- Stop when blocked, don't guess
- Never start implementation on main/master without explicit consent
### Integration
- REQUIRED: Set up workspace with Section 11 (Git Worktrees) before starting
- After all tasks: follow Section 12 (Finishing a Development Branch)
---
## 5. Subagent-Driven Development
**Use when:** Executing implementation plans with independent tasks in the current session. Fresh subagent per task + two-stage review.
**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration
### Process
1. **Read plan, extract all tasks** with full text and context. Create task list.
2. **Per task:**
a. Dispatch implementer subagent (provide full task text + context, don't make them read plan file)
b. If subagent asks questions → answer clearly before proceeding
c. Subagent implements, tests, commits, self-reviews
d. Dispatch spec reviewer subagent → verify code matches spec
e. If issues → implementer fixes → re-review until ✅
f. Dispatch code quality reviewer subagent
g. If issues → implementer fixes → re-review until ✅
h. Mark task complete
3. **After all tasks:** Dispatch final code reviewer for entire implementation
4. **Complete:** Follow Section 12 (Finishing a Development Branch)
### Implementer Subagent Prompt
Provide: full task text, context (where it fits), working directory. Tell them:
- Implement exactly what task specifies
- Write tests (TDD if task says to)
- If you have questions about requirements, approach, or anything unclear — **ask them now before starting**
- Commit work
- Self-review: completeness (all requirements?), quality (clean, maintainable?), discipline (YAGNI?), testing (real behavior, not mocks?)
- If you find issues during self-review, fix them now before reporting
- Report: what implemented, test results, files changed, self-review findings, concerns
### Spec Reviewer Prompt
Provide: full task requirements, implementer's report. Tell them:
- **CRITICAL: Do NOT trust the implementer's report** — read actual code
- The implementer may be incomplete, inaccurate, or optimistic
- Check by reading code: missing requirements, extra/unneeded work, misunderstandings
- Report: ✅ spec compliant or ❌ issues with file:line references
### Code Quality Reviewer Prompt
Use code review template (see Section 10). Provide: BASE_SHA, HEAD_SHA, description.
- Only dispatch after spec compliance passes
- Returns: Strengths, Issues (Critical/Important/Minor), Assessment
### Rules
- Never start on main/master without consent
- Never skip reviews (spec OR quality)
- Spec review BEFORE code quality review
- Don't dispatch parallel implementation subagents (conflicts)
- Don't move to next task with open review issues
- If subagent fails → dispatch fix subagent, don't fix manually (context pollution)
- Don't make subagent read plan file (provide full text instead)
- Accept "close enough" on spec compliance → NOT acceptable (spec issues = not done)
- **Start code quality review before spec compliance is ✅** → WRONG ORDER
---
## 6. Dispatching Parallel Agents
**Use when:** 2+ independent tasks that can be worked on without shared state or sequential dependencies.
### When to Use
- 3+ test files failing with different root causes
- Multiple subsystems broken independently
- Each problem can be understood without context from others
- No shared state between investigations
**Don't use when:**
- Failures are related (fix one might fix others)
- Need full system context to understand
- Agents would interfere (editing same files, shared resources)
- Exploratory debugging (you don't know what's broken yet)
### Pattern
1. **Identify independent domains** — group failures by what's broken
2. **Create focused agent tasks** — each gets: specific scope, clear goal, constraints, expected output format
3. **Dispatch in parallel** — one agent per domain
4. **Review and integrate** — read summaries, verify no conflicts, run full test suite
### Agent Prompt Structure
Good prompts are: focused (one problem domain), self-contained (all context needed), specific about output (what to return).
- ❌ Too broad: "Fix all the tests" — agent gets lost
- ✅ Specific: "Fix agent-tool-abort.test.ts — 3 failures listed below"
- ❌ No constraints: agent might refactor everything
- ✅ Constrained: "Do NOT change production code" or "Fix tests only"
- ❌ Vague output: "Fix it" — you don't know what changed
- ✅ Specific: "Return summary of root cause and changes"
### Real Example
**Scenario:** 6 test failures across 3 files after major refactoring
**Dispatch:**
- Agent 1 → Fix agent-tool-abort.test.ts (3 timing issues)
- Agent 2 → Fix batch-completion-behavior.test.ts (2 event structure bugs)
- Agent 3 → Fix tool-approval-race-conditions.test.ts (1 async issue)
**Results:** All fixes independent, no conflicts, full suite green. 3 problems solved in time of 1.
---
## 7. Test-Driven Development
**Use when:** Implementing any feature or bugfix, before writing implementation code.
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
**Violating the letter of the rules is violating the spirit of the rules.**
### The Iron Law
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Delete it. Start over. No exceptions:
- Don't keep it as "reference"
- Don't "adapt" it while writing tests
- Don't look at it
- Delete means delete
Implement fresh from tests. Period.
### RED — Write Failing Test
Write one minimal test showing what should happen.
**Good:**
```typescript
test('retries failed operations 3 times', async () => {
let attempts = 0;
const operation = () => {
attempts++;
if (attempts < 3) throw new Error('fail');
return 'success';
};
const result = await retryOperation(operation);
expect(result).toBe('success');
expect(attempts).toBe(3);
});
```
Clear name, tests real behavior, one thing.
**Bad:**
```typescript
test('retry works', async () => {
const mock = jest.fn()
.mockRejectedValueOnce(new Error())
.mockResolvedValueOnce('success');
await retryOperation(mock);
expect(mock).toHaveBeenCalledTimes(2);
});
```
Vague name, tests mock not code.
**Requirements:** One behavior. Clear name. Real code (no mocks unless unavoidable).
### Verify RED
**MANDATORY. Never skip.**
Run test. Confirm: fails (not errors), expected failure message, fails because feature missing.
- Test passes? You're testing existing behavior. Fix test.
- Test errors? Fix error, re-run until it fails correctly.
### GREEN — Minimal Code
Write simplest code to pass the test. Don't add features, refactor, or "improve" beyond the test.
**Good:** Just enough to pass.
**Bad:** Over-engineered with options/backoff/callbacks the test doesn't require (YAGNI).
### Verify GREEN
**MANDATORY.**
Run test. Confirm: passes, other tests still pass, output pristine (no errors, warnings).
- Test fails? Fix code, not test.
- Other tests fail? Fix now.
### REFACTOR
After green only: remove duplication, improve names, extract helpers. Keep tests green. Don't add behavior.
### Why Order Matters
**"I'll write tests after"** — Tests written after code pass immediately. Passing immediately proves nothing: might test wrong thing, might test implementation not behavior, might miss edge cases. Test-first forces you to see the test fail, proving it actually tests something.
**"Already manually tested"** — Manual testing is ad-hoc. No record, can't re-run, easy to forget cases. Automated tests are systematic.
**"Deleting X hours is wasteful"** — Sunk cost fallacy. The time is already gone. Keeping unverified code is technical debt.
**"TDD is dogmatic"** — TDD IS pragmatic: finds bugs before commit, prevents regressions, documents behavior, enables refactoring. "Pragmatic" shortcuts = debugging in production = slower.
### Bug Fix Example
**Bug:** Empty email accepted
**RED:**
```typescript
test('rejects empty email', async () => {
const result = await submitForm({ email: '' });
expect(result.error).toBe('Email required');
});
```
**Verify RED:** FAIL — expected 'Email required', got undefined ✓
**GREEN:**
```typescript
function submitForm(data: FormData) {
if (!data.email?.trim()) return { error: 'Email required' };
// ...
}
```
**Verify GREEN:** PASS ✓ → **REFACTOR** → extract validation if needed.
### Verification Checklist
Before marking work complete:
- [ ] Every new function/method has a test
- [ ] Watched each test fail before implementing
- [ ] Each test failed for expected reason
- [ ] Wrote minimal code to pass each test
- [ ] All tests pass
- [ ] Output pristine (no errors, warnings)
- [ ] Tests use real code (mocks only if unavoidable)
- [ ] Edge cases and errors covered
Can't check all boxes? You skipped TDD. Start over.
### When Stuck
| Problem | Solution |
|---------|----------|
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
| Test too complicated | Design too complicated. Simplify interface. |
| Must mock everything | Code too coupled. Use dependency injection. |
| Test setup huge | Extract helpers. Still complex? Simplify design. |
### Testing Anti-Patterns
When adding mocks or test utilities, avoid these pitfalls:
- **Testing mock behavior instead of real behavior** — Assert on real component output, not mock existence
- **Adding test-only methods to production classes** — Move to test utilities instead
- **Mocking without understanding dependencies** — Understand side effects before mocking; mock at lowest level needed
- **Incomplete mocks** — Mock the COMPLETE data structure as it exists in reality
- **Tests as afterthought** — Testing is part of implementation, not optional follow-up
### Common Rationalizations
| Excuse | Reality |
|--------|---------|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is debt. |
| "Keep as reference" | You'll adapt it. That's testing after. Delete means delete. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
| "TDD will slow me down" | TDD faster than debugging. |
| "Existing code has no tests" | You're improving it. Add tests for existing code. |
| "It's about spirit not ritual" | Violating the letter IS violating the spirit. |
### Red Flags — STOP and Start Over
Code before test. Test after implementation. Test passes immediately. Can't explain why test failed. Rationalizing "just this once." "I already manually tested it." "Keep as reference." "This is different because..."
**All mean: Delete code. Start over with TDD.**
---
## 8. Systematic Debugging
**Use when:** Any bug, test failure, or unexpected behavior — before proposing fixes.
**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
**Violating the letter of this process is violating the spirit of debugging.**
### The Iron Law
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
**Use this ESPECIALLY when:**
- Under time pressure (emergencies make guessing tempting)
- "Just one quick fix" seems obvious
- You've already tried multiple fixes
- You don't fully understand the issue
### Phase 1: Root Cause Investigation
**BEFORE attempting ANY fix:**
1. **Read error messages carefully** — don't skip. Read stack traces completely. Note line numbers, file paths, error codes.
2. **Reproduce consistently** — exact steps, every time. Not reproducible → gather more data, don't guess.
3. **Check recent changes** — git diff, recent commits, new dependencies, config changes, environmental differences.
4. **Gather evidence in multi-component systems** — Log data at each component boundary. Run once to see WHERE it breaks. Then investigate that component.
Example: For CI → build → signing pipeline:
```bash
# Log at each layer boundary:
# Layer 1 (workflow): echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
# Layer 2 (build): env | grep IDENTITY
# Layer 3 (signing): security find-identity -v
# Reveals: which layer the propagation fails
```
5. **Trace data flow** — Where does bad value originate? Trace up the call stack to the source. Fix at source, not symptom.
**Root cause tracing technique:** Observe symptom → find immediate cause → ask "what called this?" → keep tracing up → find original trigger → fix at source.
Example: `git init` in wrong directory → `cwd: ''` → `createWorktree('')` → `Session.create()` → test accessed `tempDir` before `beforeEach` → **root cause**: top-level variable initialization.
### Phase 2: Pattern Analysis
1. Find working examples of similar code in the codebase
2. Compare: what's different between working and broken?
3. List every difference, however small
4. Understand dependencies and assumptions
### Phase 3: Hypothesis and Testing
1. Form single hypothesis: "X is root cause because Y"
2. Make SMALLEST possible change to test it
3. One variable at a time
4. Didn't work → new hypothesis. DON'T add more fixes on top.
### Phase 4: Implementation
1. Create failing test reproducing the bug (Section 7: TDD)
2. Implement single fix addressing root cause
3. Verify: test passes, no other tests broken
4. **If 3+ fixes failed:** STOP. Question the architecture. Discuss with your human partner.
**Pattern indicating architectural problem:**
- Each fix reveals new shared state/coupling/problem in different place
- Fixes require "massive refactoring" to implement
- Each fix creates new symptoms elsewhere
This is NOT a failed hypothesis — this is a wrong architecture.
### Supporting Techniques
- **Defense-in-depth:** After finding root cause, validate at EVERY layer data passes through. Entry point → business logic → environment guards → debug instrumentation. Single validation can be bypassed; multiple layers make the bug structurally impossible.
- **Condition-based waiting:** Replace arbitrary timeouts/sleeps with condition polling. Wait for the actual condition, not a guess about timing. `waitFor(() => condition())` instead of `setTimeout(check, 500)`.
### Common Rationalizations
| Excuse | Reality |
|--------|---------|
| "Issue is simple" | Simple issues have root causes too. |
| "Emergency, no time" | Systematic is FASTER than thrashing. |
| "Just try this first" | First fix sets the pattern. Do it right. |
| "I see the problem" | Seeing symptoms ≠ understanding root cause. |
| "Multiple fixes saves time" | Can't isolate what worked. Causes new bugs. |
| "One more fix attempt" (after 2+) | 3+ failures = architectural problem. Question pattern. |
| "Reference too long, I'll adapt" | Partial understanding guarantees bugs. Read completely. |
### Red Flags — STOP and Follow Process
- "Quick fix for now, investigate later"
- "Just try changing X and see"
- Proposing solutions before tracing data flow
- "I don't fully understand but this might work"
- Each fix reveals new problem in different place
- 3+ fix attempts failed → **question the architecture**
**ALL of these mean: STOP. Return to Phase 1.**
---
## 9. Verification Before Completion
**Use when:** About to claim work is complete, fixed, or passing — before committing or creating PRs.
**Core principle:** Evidence before claims, always.
**Violating the letter of this rule is violating the spirit of this rule.**
### The Iron Law
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
If you haven't run the verification command in this message, you cannot claim it passes.
### The Gate
Before claiming ANY status:
1. IDENTIFY: What command proves this claim?
2. RUN: Execute the FULL command (fresh, complete)
3. READ: Full output, check exit code, count failures
4. VERIFY: Does output confirm the claim?
- If NO: State actual status with evidence
- If YES: State claim WITH evidence
5. ONLY THEN: Make the claim
Skip any step = lying, not verifying
### What Counts as Verification
| Claim | Requires | NOT Sufficient |
|-------|----------|----------------|
| Tests pass | Test output: 0 failures | Previous run, "should pass" |
| Linter clean | Linter output: 0 errors | Partial check, extrapolation |
| Build succeeds | Build: exit 0 | Linter passing |
| Bug fixed | Test original symptom | Code changed, assumed fixed |
| Regression test works | Red-green cycle verified | Test passes once |
| Agent completed | VCS diff shows changes | Agent reports "success" |
| Requirements met | Line-by-line checklist | Tests passing |
### Key Patterns
**Tests:**
```
✅ [Run test command] [See: 34/34 pass] "All tests pass"
❌ "Should pass now" / "Looks correct"
```
**Regression tests (TDD Red-Green):**
```
✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
❌ "I've written a regression test" (without red-green verification)
```
**Agent delegation:**
```
✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
❌ Trust agent report
```
### Red Flags
- Using "should", "probably", "seems to"
- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!")
- Trusting agent success reports
- Relying on partial verification
- ANY wording implying success without having run verification
**Run the command. Read the output. THEN claim the result.**
### Rationalization Prevention
| Excuse | Reality |
|--------|---------|
| "Should work now" | RUN the verification |
| "I'm confident" | Confidence ≠ evidence |
| "Just this once" | No exceptions |
| "Agent said success" | Verify independently |
| "Partial check is enough" | Partial proves nothing |
| "Different words so rule doesn't apply" | Spirit over letter |
---
## 10. Code Review
**Use when:** Completing tasks, implementing major features, before merging, or when receiving review feedback.
### Part 1: Requesting Review
**Mandatory after:** each task in subagent-driven development, major features, before merge.
**How to request:**
1. Get git SHAs: `BASE_SHA=$(git rev-parse HEAD~1)`, `HEAD_SHA=$(git rev-parse HEAD)`
2. Dispatch code-reviewer subagent with the template below
3. Act on feedback: fix Critical immediately, fix Important before proceeding, note Minor for later
**Code Reviewer Template:**
You are reviewing code changes for production readiness.
Review {WHAT_WAS_IMPLEMENTED} against {PLAN_OR_REQUIREMENTS}.
Git range: {BASE_SHA}..{HEAD_SHA}
Check: code quality, architecture, testing, requirements, production readiness.
Review Checklist:
- Code: separation of concerns, error handling, type safety, DRY, edge cases
- Architecture: design decisions, scalability, performance, security
- Testing: tests test logic not mocks, edge cases, integration tests, all passing
- Requirements: all met, matches spec, no scope creep, breaking changes documented
Output format:
### Strengths — what's well done (be specific, file:line)
### Issues
#### Critical (Must Fix) — bugs, security, data loss
#### Important (Should Fix) — architecture, missing features, test gaps
#### Minor (Nice to Have) — style, optimization
For each: file:line, what's wrong, why it matters, how to fix
### Assessment — Ready to merge? [Yes/No/With fixes]
### Part 2: Receiving Feedback
**Response pattern:** READ → UNDERSTAND → VERIFY → EVALUATE → RESPOND → IMPLEMENT
**Forbidden responses — NEVER say:**
- "You're absolutely right!" (performative)
- "Great point!" / "Excellent feedback!" (performative)
- "Let me implement that now" (before verification)
**Instead:** Restate the technical requirement, ask clarifying questions, push back if wrong, or just fix it.
**Handling unclear feedback:**
```
IF any item is unclear:
STOP — do not implement anything yet
ASK for clarification on ALL unclear items
WHY: Items may be related. Partial understanding = wrong implementation.
```
**Implementation order for multi-item feedback:**
1. Clarify anything unclear FIRST
2. Blocking issues (breaks, security)
3. Simple fixes (typos, imports)
4. Complex fixes (refactoring, logic)
5. Test each fix individually
**YAGNI check:** If reviewer suggests "implementing properly," grep codebase for actual usage. If unused → "This endpoint isn't called. Remove it (YAGNI)?"
**When to push back:**
- Suggestion breaks existing functionality
- Reviewer lacks full context
- Violates YAGNI (unused feature)
- Technically incorrect for this stack
- Conflicts with architectural decisions
**When feedback IS correct:**
```
✅ "Fixed. [Brief description]"
✅ [Just fix it in code]
❌ "You're absolutely right!" / "Thanks for catching that!"
```
Actions speak. Just fix it.
---
## 11. Using Git Worktrees
**Use when:** Starting feature work that needs isolation or before executing implementation plans.
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
### Directory Selection (priority order)
1. **Check existing:** `ls -d .worktrees 2>/dev/null` (preferred) or `ls -d worktrees 2>/dev/null`
- If found: use that directory. If both exist, `.worktrees` wins.
2. **Check AGENTS.md:** `grep -i "worktree.*director" AGENTS.md 2>/dev/null`
- If preference specified: use without asking.
3. **Ask user:** `.worktrees/` (project-local, hidden) or `~/.config/superpowers/worktrees/<project>/` (global)
### Safety Verification
For project-local directories: verify directory is in `.gitignore` before creating worktree.
git check-ignore -q .worktrees 2>/dev/null
If NOT ignored:
1. Add appropriate line to `.gitignore`
2. Commit the change
3. Proceed with worktree creation
**Why critical:** Prevents accidentally committing worktree contents to repository.
### Creation Steps
1. **Detect project:** `project=$(basename "$(git rev-parse --show-toplevel)")`
2. **Create worktree:** `git worktree add "$path" -b "$BRANCH_NAME"`
3. **Run project setup** (auto-detect):
```bash
if [ -f package.json ]; then npm install; fi
if [ -f Cargo.toml ]; then cargo build; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
if [ -f go.mod ]; then go mod download; fi
```
4. **Verify clean baseline** — run tests. If tests fail: report failures, ask whether to proceed.
5. **Report:** location, test results, ready status
### Rules
- Never create worktree without verifying it's ignored (project-local)
- Never skip baseline test verification
- Never proceed with failing tests without asking
- Follow directory priority: existing → AGENTS.md → ask
- Auto-detect setup commands from project files
---
## 12. Finishing a Development Branch
**Use when:** Implementation is complete, all tests pass, ready to integrate.
**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
### Process
1. **Verify tests pass** — if failing, stop. Cannot proceed.
2. **Determine base branch** — `git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null`
3. **Present exactly 4 options:**
```
Implementation complete. What would you like to do?
1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is
4. Discard this work
```
4. **Execute choice**
5. **Cleanup worktree** (for options 1, 2, 4 only)
### Option Details
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|--------|-------|------|---------------|----------------|
| 1. Merge locally | Yes | - | - | Yes |
| 2. Create PR | - | Yes | Yes | - |
| 3. Keep as-is | - | - | Yes | - |
| 4. Discard | - | - | - | Yes (force) |
**Option 1 (Merge):** Checkout base → pull latest → merge feature → verify tests on merged result → delete feature branch → cleanup worktree
**Option 2 (Push/PR):** Push branch → `gh pr create` with summary and test plan → cleanup worktree
**Option 4 (Discard):** Require typed "discard" confirmation. Show what will be deleted (branch, commits, worktree). Then: checkout base → `git branch -D` → cleanup worktree
### Rules
- Never proceed with failing tests
- Always verify tests on merged result (option 1)
- Require typed "discard" confirmation (option 4)
- Don't force-push without explicit request
- Present exactly 4 options — don't use open-ended questions
---
## 13. Writing Skills
**Use when:** Creating new skills, editing existing skills, or verifying skills work.
### What is a Skill?
A reusable reference guide for proven techniques, patterns, or tools. NOT narratives about how you solved a problem once.
**Skills are:** Reusable techniques, patterns, tools, reference guides
**Skills are NOT:** One-off solutions, project-specific conventions, mechanical constraints (automate those instead)
### The Iron Law (Same as TDD)
NO SKILL WITHOUT A FAILING TEST FIRST
Test with subagent pressure scenarios. Watch agents fail without skill (RED). Write minimal skill (GREEN). Close loopholes (REFACTOR).
### SKILL.md Structure
---
name: skill-name-with-hyphens
description: "Use when [specific triggering conditions]"
---
Sections: Overview → When to Use → Core Pattern → Quick Reference → Common Mistakes
### Description Field (Critical for Discovery)
**CRITICAL: Description = When to Use, NOT What the Skill Does**
Agents read description to decide which skills to load. The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow.
**Why:** Testing revealed that when a description summarizes workflow, agents follow the description shortcut instead of reading the full skill. A description saying "code review between tasks" caused an agent to do ONE review, even though the skill specified TWO reviews (spec + quality).
```yaml
# ❌ BAD: Summarizes workflow — agent may follow this instead of reading skill
description: Use when executing plans - dispatches subagent per task with code review
# ✅ GOOD: Just triggering conditions
description: Use when executing implementation plans with independent tasks
```
### Naming
- Verb-first, active voice: `condition-based-waiting` not `async-test-helpers`
- Gerunds work well: `creating-skills`, `testing-skills`
- Name by what you DO: `root-cause-tracing` not `debugging-techniques`
### Key Rules
- One excellent example beats many mediocre ones
- Flowcharts only for non-obvious decisions
- Keep inline unless reference >100 lines
- Test BEFORE deploying. No exceptions.
### Bulletproofing Against Rationalization
Skills that enforce discipline need to resist rationalization:
1. **Close every loophole explicitly** — Don't just state the rule; forbid specific workarounds ("Don't keep it as reference, don't adapt it, delete means delete")
2. **Address "spirit vs letter"** — Add "Violating the letter IS violating the spirit" early
3. **Build rationalization table** — Capture every excuse agents make, add counters
4. **Create red flags list** — Make it easy to self-check when rationalizing
### Skill Creation Checklist
**RED:** Create pressure scenarios → run WITHOUT skill → document baseline failures (exact rationalizations agents use)
**GREEN:** Write skill addressing specific failures → run WITH skill → verify compliance
**REFACTOR:** Find new rationalizations → add counters → re-test until bulletproof
### Common Rationalizations for Skipping Testing
| Excuse | Reality |
|--------|---------|
| "Skill is obviously clear" | Clear to you ≠ clear to agents. Test it. |
| "It's just a reference" | References can have gaps. Test retrieval. |
| "Testing is overkill" | Untested skills always have issues. 15 min saves hours. |
| "I'll test if problems emerge" | Problems = agents can't use skill. Test BEFORE deploying. |
| "No time to test" | Deploying untested skill wastes more time fixing later. |
@@ -0,0 +1,17 @@
{
"owner": "cutd",
"slug": "claw-superpowers",
"displayName": "claw-superpowers",
"latest": {
"version": "1.0.1",
"publishedAt": 1773111136740,
"commit": "https://github.com/openclaw/skills/commit/720aedbd618f70e5d23de7b68f9c0b45a3d7aa55"
},
"history": [
{
"version": "1.0.0",
"publishedAt": 1772673651563,
"commit": "https://github.com/openclaw/skills/commit/fa7462f557f358244a2ed1675ec8148ee853ff2c"
}
]
}