Imported from Cookie-Cat21/apple-ultra-skills (
SKILL.md). Install upstream withnpx skills add Cookie-Cat21/apple-ultra-skills. Copyright stays with the author.
Apple Ultra Skills
Section 0: The Ultra Principle
You are operating in Apple Ultra Mode. This means:
- Read context FIRST. Before doing anything, identify which ultra-modes are active based on what is being built (file type, imports, user intent, directory structure).
- Apply ALL relevant modes simultaneously. Building a React component? Frontend Ultra + Design Ultra + Accessibility Ultra all activate together.
- Be MORE specific than generic advice. Every rule must be actionable within 30 seconds. Never say "write clean code." Say exactly what clean means in this context.
- Synthesize across domains. When writing UI, performance rules apply. When writing APIs, security rules apply. Cross-domain awareness is what makes Ultra different.
- Self-reference the
/referencesdirectory when you need depth beyond SKILL.md.
Mark β‘ for critical rules (violations cause real user harm or major bugs). Mark π― for high-impact rules (significant quality improvement). Mark π‘ for insight rules (non-obvious, expert-level patterns).
Apple Ultra 2026 operating contract
This pack is grounded in Appleβs current HIG principles: Purpose Β· Agency Β· Responsibility Β· Familiarity Β· Flexibility Β· Simplicity Β· Craft Β· Delight. Load references/apple-principles-2026.md for the repo-wide contract and references/apple-feel.md for UI/UX depth.
Before substantial work, identify the person/actor, purpose, state change, recovery path, risk, evidence, and verification. Preserve agency through reversibility and clear state; preserve responsibility through safe defaults and transparency; preserve familiarity by following existing platform/repo conventions; preserve craft by verifying the result.
Evidence rule: distinguish project facts, standards/external facts, assumptions, estimates, interpretations, and recommendations. Never invent conversion lifts, risk percentages, user findings, performance gains, or βindustry-standardβ numbers.
Section 1: Context Detection Engine
Detect active mode(s) by reading:
- File extension β
.tsx/.jsx/.vue/.svelteβ Frontend Ultra active - Imports present β
import { test }β Testing Ultra;import { NextRequest }β API Ultra - Directory path β
components/β Design + Frontend;__tests__/β Testing - User's stated intent β "make this faster" β Performance; "review this" β Architecture
- Adjacent files in the same directory
Multiple modes activate simultaneously β this is expected and correct.
Detection Matrix
| Signal | Active Modes |
|---|---|
.tsx in components/ |
Frontend, Design, Accessibility |
route.ts or api/ |
Architecture, Security, Performance |
__tests__/ or .test.ts |
Testing |
middleware.ts |
Security, Architecture, Performance |
| User says "deploy" | DevOps, Security |
User says "agent" or mcp |
Agent & Workflow |
globals.css or tokens |
Design, Frontend, Accessibility |
app/ or page.tsx (App Router) |
Frontend, next-app-router |
useTransition / useId imports |
react-18-patterns, Frontend |
tailwind.config or @theme |
tailwind-v4, Design, Frontend |
| User says "research" or "docs" | Agent-Reach, Agent & Workflow |
| User says "Apple quality", "Apple feel", or "Apple polish" | Design, Accessibility, Performance, apple-feel |
Activation Protocol
- Scan open file + imports + directory
- Parse user message for intent keywords
- List active modes at start of complex tasks:
Active: Frontend Ultra, Design Ultra, A11y Ultra - Load depth from
/references/[mode].mdwhen rules exceed SKILL.md scope
Section 2: Frontend Ultra-Mode
Synthesized from: frontend-design, react-best-practices, web-design-guidelines, ui-ux-pro-max, composition-patterns, interaction-design, fixing-motion-performance.
COMPONENT DESIGN
- π― Keep component APIs small enough to understand at the call site. When prop combinations create invalid states or repeated conditionals, prefer composition, slots, or a clearer abstraction.
- β‘ Every interactive control must define the states relevant to its behavior β at minimum default, keyboard focus, activation/pressed feedback, and disabled when disablement exists; add hover, loading, error, selected, or empty only when semantically applicable.
- π― Use composition (children, render props, slots) before adding a new prop. Ask: "Could the caller decide this instead of the component?"
- π― Co-locate state with the smallest owner that can preserve the required behavior; lift it when multiple parts of the flow genuinely coordinate around the same source of truth.
- π‘ Compound components (
Menu+Menu.Item+Menu.Trigger) are useful when composition makes valid structure clearer than a large configuration object; donβt introduce them merely to reduce a prop count. - β‘ Never use index as a React key for lists that can reorder or filter. Use a stable, unique ID from the data.
- π― Avoid
useEffectfor derived state β compute it directly in render. OnlyuseEffectfor synchronizing with external systems (timers, subscriptions, DOM APIs). - π― Extract handlers when a name clarifies intent, logic is reused/tested, or inline code obscures the rendered structure. Line count alone is not a design rule.
- π‘ Prefer
useReducerover multipleuseStatewhen state transitions are coupled (form wizards, multi-step flows). - β‘ Wrap route-level components in error boundaries β an unhandled render error must not white-screen the entire app.
- π― Use
React.Suspensewith meaningful fallbacks at route boundaries, not spinners on every micro-component. - π‘ Portals (
createPortal) for overlays, tooltips, and modals β neverposition: fixedinsideoverflow: hiddenparents without a portal.
STYLING
- π― Use semantic tokens for product meaning and repeated component roles. Raw values are acceptable for isolated artwork or truly local one-offs, but not as parallel sources of product color truth.
- π― Use fluid type (
clamp()) when continuous scaling improves the layout; use discrete responsive steps when the information hierarchy genuinely changes at a breakpoint. - π― Define a compact spacing scale (often 4/8-based) and use it consistently. Optical corrections and layout-specific values are allowed when intentional and documented.
- β‘ Images MUST have explicit width and height attributes or CSS
aspect-ratioto prevent layout shift (CLS). Undimensioned images are a Core Web Vitals failure. - π‘ Use CSS logical properties (
padding-inline,margin-block) instead of left/right/top/bottom for automatic RTL support. - π― Prefer CSS custom properties + data attributes for variant styles over conditional class logic.
data-variant="primary"scales better than 8classNameconditionals. - β‘ Respect
prefers-reduced-motionfor nonessential or potentially uncomfortable motion. Replace large travel, zoom, parallax, and repeated motion with an alternative that preserves state meaning. - π― Follow the repoβs styling architecture. Keep component-specific styles near the component when that improves ownership, and keep shared tokens/primitives centralized.
- π‘ Use
@layerin Tailwind to control specificity:baseβcomponentsβutilities. Custom overrides belong incomponents, notutilities. - π― Prefer a consistent responsive strategy. Mobile-first is a strong default for web products, but choose breakpoints and query direction from content behavior rather than dogma.
PERFORMANCE
- π― Use framework-native route/code splitting and lazy loading where it reduces initial work without harming navigation reliability. Measure the bundle and loading behavior before adding manual splits everywhere.
- π― Memoize (
useMemo,useCallback,React.memo) ONLY after measuring with React DevTools Profiler. Premature memoization adds allocation cost with no benefit. - π― Prefer tree-shakeable or narrow imports when they materially reduce shipped code; verify the package/bundler behavior instead of assuming import syntax alone determines bundle size.
- π― In Next.js App Router: prefer Server Components by default; only add
'use client'when you need browser APIs, event handlers, or hooks. - π― Use
startTransitionfor genuinely non-urgent React updates when it improves responsiveness; measure the interaction instead of adding it mechanically. - π‘ Virtualize when measured/rendered DOM cost, data size, or scroll performance warrants it. Item count alone is not the threshold.
- π― Rate-limit expensive input/scroll work according to the interaction and measured cost. Prefer event-driven CSS/observers/requestAnimationFrame where appropriate; donβt copy one debounce/throttle duration into every flow.
- π― Use framework prefetching intentionally based on likelihood, payload cost, cache behavior, and network conditions; avoid aggressive prefetch that wastes bandwidth.
ZERO GENERIC AI AESTHETIC RULE
- π― Avoid unowned template aesthetics. Familiar primitives are fine; the productβs hierarchy, content, brand, and interaction details should make the result specific without forcing novelty into every component.
- π― Before generating any UI, ask: "Would I see this exact design on a generic SaaS landing page?" If yes, redesign it.
- π‘ Prefer a small number of coherent expressive choices per surface. There is no required count; restraint matters more than novelty.
- π― Reference real products for inspiration (Linear, Raycast, Stripe) β not other AI-generated UIs.
FORM & DATA PATTERNS
- β‘ Validate authoritative constraints on the server and avoid divergent client/server rules. Share schemas when the stack supports it cleanly; Zod/react-hook-form are implementation options, not requirements.
- π― Use optimistic UI only when success is likely, rollback semantics are safe, and temporary divergence wonβt mislead people about consequential state.
- π‘ For search and scroll, choose cancellation, request dedupe, debouncing, throttling, observers, or transitions from the actual workload and latencyβnot a universal timing constant.
- π― Empty states explain the actual condition (first use, filtered, permission, offline, true zero data) and offer the next useful action when one exists. Illustration is optional.
- π― Preserve layout and status while loading. Use a skeleton only when predicting final structure helps; otherwise prefer an honest progress/status treatment.
VUE / SVELTE PATTERNS
- π― Vue: use
<script setup>+ Composition API for all new components. Options API only for legacy maintenance. - π― Svelte: leverage
$:reactive statements for derived state instead of computed stores when scope is local. - π‘ Vue slots map to React children; Svelte slots map to both β use named slots for compound component patterns.
β Deep dive: references/frontend.md
Section 3: Design Ultra-Mode
Feelings-first requirement: for a primary flow, name one primary feeling (control, calm, confidence, trust, delight, premium craft, wonder, belonging, self-expression, or respect) and at most two supporting feelings. Evaluate mechanisms against that target before scoring visual resemblance. Use references/apple-feel.md.
Synthesized from: canvas-design, brand-guidelines, interface-design, design-lab, theme-factory, fixing-accessibility, high-end-visual-design, algorithmic-art, wcag-audit-patterns.
VISUAL HIERARCHY
- π― Keep hierarchy legible enough that people can identify the primary content/action and supporting levels at a glance. Avoid unnecessary competing emphasis; there is no universal fixed number of hierarchy levels.
- β‘ Never use color as the ONLY differentiator between two states. Always pair with shape, label, or icon. (WCAG 1.4.1)
- π‘ Whitespace is an active grouping and emphasis tool. Tune it from content relationships and density needs; donβt apply a universal multiplier.
- π― Use proximity consistently to communicate grouping. The exact distance comes from the productβs spacing scale, density, and surrounding contextβnot a universal 8px law.
- π― Use size + weight + color together for hierarchy β never rely on a single axis.
- π‘ Use reading order, alignment, and content priority to guide scanning. F/Z patterns can be references, not mandatory layout templates.
TYPOGRAPHY
- π― Define a small role-based type scale. Modular ratios can help generate candidates, but optical hierarchy, content density, viewport, and brand determine the final values.
- π― Treat ~16px body text and readable line lengths/line heights as web studio starting points, then test the actual typeface, viewport, zoom, language, and content. Do not present these as WCAG constants.
- π― Use variable-font axes and optical sizing when the chosen font supports them and they improve rendering; test fallbacks and loading cost.
- π‘ Typeface pairing is optional. A single family can create excellent hierarchy; when mixing families, give each a clear role and compatible metrics/personality.
- π― Minimize type families to preserve coherence and performance. Two is a useful studio default, not an absolute ceiling.
- π― Tabular figures (
font-variant-numeric: tabular-nums) for all data tables and price displays β proportional figures cause column jitter.
COLOR
- π― Prefer perceptual color spaces such as
oklch()for token generation when browser/tooling support fits the project; provide compatible fallbacks where required. Format alone does not create a good palette. - π― Every color decision needs a contrast ratio check. Minimum 4.5:1 for body text, 3:1 for large text (18px+ or 14px+ bold), 3:1 for UI components. (WCAG 1.4.3)
- π― Build semantic color tokens in layers: primitive (
blue-500) β semantic (color-action) β component (button-background). Never skip the semantic layer. - β‘ Dark mode: define it at the token layer, not with
dark:utility classes per component. One token change should update every component. - π‘ Keep accent usage restrained enough that semantic and interactive hierarchy remains obvious. The right count depends on the product and data needs.
- π― Use stable semantic status tokens and pair color with text/icon/shape. Common conventions can improve familiarity, but test brand/cultural context and never rely on hue alone.
MOTION & INTERACTION
- β‘ Start with Intent β Mechanism β Feeling. If motion does not explain state, continuity, hierarchy, causality, or feedback, remove it.
- π― Use springs for apparent mass, gesture handoff, snapping, and spatial continuity; use timing curves for simple opacity/color changes. Never apply one motion model globally.
- β‘ Gesture-driven elements follow input directly and preserve release velocity when momentum is meaningful. A running animation must not block the next valid user action.
- β‘ Design an intentional
prefers-reduced-motionalternative: remove large travel/zoom/parallax while preserving focus, hierarchy, state, and completion cues. - π― Use shared/layout transitions only when source and destination are the same conceptual object. Do not match unrelated elements for spectacle.
- π‘ Loading states preserve final geometry and perceived continuity. Never use fake determinate progress to manufacture certainty.
β Feelings, motion presets, feedback stack, component contract, and anti-cosplay gate: references/apple-feel.md.
ELEVATION & DEPTH
- π― If the product uses elevation, define a small semantic layer model and reuse it. Not every interface needs five shadow levels.
- π‘ In dark mode: elevation is expressed by lightness increase, not shadow intensity. A dark card at elevation 2 is lighter than the background, not more shadowed.
- π― Z-index scale: define tokens (
--z-dropdown: 100,--z-modal: 200,--z-toast: 300) β never arbitraryz-index: 9999. - π― Borders over shadows for subtle separation in dense UIs β shadows compete with content in data-heavy interfaces.
BRAND & IDENTITY
- π― Brand-facing surfaces benefit from a recognizable visual or interaction signature; task-heavy product UI can earn distinctiveness through content, behavior, and craft without forcing a decorative motif.
- π‘ Brand consistency: same spacing, typography, and color tokens across marketing and product β not two design systems.
- π― Follow the actual brandβs logo clear-space specification. If none exists, define and test a consistent minimum rather than inventing a universal ratio.
- β‘ Favicon, OG image, and app icon from same source asset β consistent across touchpoints.
β Deep dive: references/design.md
Section 4: Architecture Ultra-Mode
Synthesized from: improve-codebase-architecture, composition-patterns, to-prd, to-issues, diagnose, grill-me, grill-with-docs.
BEFORE TOUCHING CODE
- π― Map the current dependency graph before any refactor. Draw (or describe) what currently imports what. The refactor target becomes clear from the graph.
- β‘ Name the architectural smell before proposing a fix. "God component" β extract domain. "Prop drilling >3 levels" β context or composition. "Data fetching in UI component" β co-locate with Server Component or move to hook.
- π‘ Ask: "If this module had to be extracted into a separate package tomorrow, what would break?" The answer reveals hidden coupling.
- π― Read the 3 most recent PRs touching the same area β understand the trajectory before adding to it.
- π‘ Check for existing ADRs (Architecture Decision Records) before proposing structural changes.
MODULE DESIGN
- β‘ Single Responsibility at the module level: one reason to change per file. If you can write two unrelated unit tests for the same module, it needs splitting.
- π― Feature slicing: organize by feature, not by type.
src/features/auth/beatssrc/components/+src/hooks/+src/utils/for anything beyond toy projects. - π― Dependency direction: features β shared; never shared β features. Circular dependencies are always a design error.
- π‘ The rule for shared utilities: if you've copy-pasted something 3 times, extract. If you've needed it in 2 features, consider
shared/. Not before. - π― Barrel exports (
index.ts) only at feature boundaries β not in every subdirectory. Deep barrel exports hide dependency graphs and slow builds. - β‘ No default exports for shared modules β named exports enable better tree-shaking and refactoring.
- π‘ Colocate tests next to source (
Button.test.tsxbesideButton.tsx) β not in a separate__tests__/tree.
PRD & ISSUE CREATION
- π― When a user describes a new feature, respond with a structured mini-PRD first: Goal | Success Metrics | Scope (in/out) | Key Decisions | Risks | Implementation Notes. Confirm before implementing.
- π― Break every PRD into atomic GitHub issues. Each issue: one deliverable, clear acceptance criteria, estimated size (S/M/L), dependency list.
- π‘ Issues should be written for a developer who has never spoken to you. Full context in the body, no external references needed.
- π― Acceptance criteria format: "Given [state], when [action], then [observable outcome]" β same as test naming.
SOCRATIC CODE REVIEW
- β‘ Before approving any architectural decision, ask: "What would have to be true for this to be wrong?" If you cannot answer, the decision is not well-reasoned.
- π― When reviewing a design pattern, cite the official docs or authoritative source, not memory. Docs are ground truth; memory drifts.
- π‘ The hardest architectural bugs are the ones you did not introduce β they were always there. When diagnosing: follow the data flow from source to symptom, form a hypothesis, then verify with the smallest possible change.
- π― Every refactor PR must state: what changed, what didn't change (behavior parity), and how to verify.
- π‘ Prefer strangler fig pattern over big-bang rewrites β migrate one route/feature at a time behind a feature flag.
DIAGNOSTIC PATTERNS
- π― When code is hard to understand, trace one request end-to-end before proposing changes.
- π‘ Git blame on confusing lines β understand why code exists before deleting it.
- π― Complexity budget: if a module needs a diagram to explain, it needs simplification.
- β‘ Circular imports are always a design error β extract shared code to break the cycle.
β Deep dive: references/architecture.md
Section 5: Testing Ultra-Mode
Synthesized from: tdd, grill-me, grill-with-docs, web-design-guidelines (testing sections).
TDD WORKFLOW
- β‘ Red β Green β Refactor. Always. Writing tests after implementation is documentation, not TDD. The value of TDD is in letting the test drive the design.
- π― Write the simplest failing test first. Not the perfect test. The simplest one that proves the behavior does not exist yet.
- β‘ Test behavior, not implementation. If refactoring internals breaks your tests without changing external behavior, the tests are testing the wrong thing.
- π― One assertion per test when possible β multiple assertions make failure diagnosis ambiguous.
- π‘ Test the contract at module boundaries, not internal helpers β internals are free to change.
TEST NAMING
- π― Format: "given [precondition], when [action], then [expected outcome]" Example: "given an unauthenticated user, when they access /dashboard, then they are redirected to /login" Never: "test1", "works correctly", "handleSubmit test"
- π― Group tests with
describeblocks matching the module/function under test β flat test files are unnavigable.
WHAT TO TEST
- β‘ Test pyramid: many unit tests (fast, isolated) β fewer integration tests (real dependencies) β few E2E tests (critical user paths only).
- π― E2E tests cover the 5 flows that, if broken, mean the business stops: sign up, log in, core action (buy/publish/submit), payment, log out.
- π‘ Do not mock what you do not own. Mock 3rd party APIs. Use real implementations for your own code. Real implementations find real bugs.
- β‘ Never use
Math.random()orDate.now()in tests. Usevi.setSystemTime()or fixed seed values. Flaky tests are worse than no tests. - π― Test error paths explicitly β happy path tests give false confidence. Every
catchblock needs a test. - π‘ Property-based testing (
fast-check) for pure functions with many input combinations β catches edge cases humans miss.
COVERAGE
- π― Coverage % is a proxy metric, not a goal. 80% coverage with tests that only check happy paths is worse than 60% that catches the real edge cases.
- π‘ Ask after writing tests: "What scenario would make the code fail without my tests catching it?" If the answer exists, write that test.
- π― Mutation testing (
stryker) quarterly β if mutants survive, your tests are checking existence, not behavior.
TEST INFRASTRUCTURE
- π― MSW for API mocking in tests β intercept at network level, test real fetch/query code.
- π‘ Factory functions (
buildUser()) over inline test data β composable, maintainable. - π― Playwright for E2E: semantic selectors (
getByRole), page object model, parallel shards in CI. - β‘
@axe-core/playwrightin E2E β accessibility regression caught in CI, not production.
β Deep dive: references/testing.md
Section 6: Security Ultra-Mode
OWASP Top 10 applied to frontend + API.
- β‘ Never trust client-side data on the server. Validate EVERYTHING at the API boundary with a schema (Zod, Yup, Valibot). Client validation is UX; server validation is security.
- β‘ XSS: Never use
dangerouslySetInnerHTMLwithout sanitizing with DOMPurify. Never useinnerHTMLwith user content. Nevereval()user input. - β‘ Never store JWTs in
localStorage. UsehttpOnlycookies.localStorageis accessible to any JS on the page, including injected scripts. - β‘ CSRF: every state-mutating API endpoint (POST/PUT/PATCH/DELETE) must verify a CSRF token or use
SameSite=Strictcookies. - β‘ Never log sensitive data (passwords, tokens, PII) in console, server logs, or error tracking. These end up in dashboards accessible to many engineers.
- π― Dependency audit: run
npm auditbefore every release. Any HIGH or CRITICAL vulnerability is a blocker, not a suggestion. - β‘ Never hardcode secrets, API keys, or credentials in source code. Use
.envfiles (gitignored) for local dev, and environment variable injection for all environments. Rungit log --all -S "sk-" --sourceperiodically to catch accidental commits. - π― Content Security Policy header on every production app. Start with
default-src 'self'and explicitly add necessary external sources. - π‘ Principle of least privilege: API tokens and service accounts should have only the permissions they actively use. Audit and rotate credentials quarterly.
- β‘ Rate-limit all public API endpoints β 100 req/min per IP for auth endpoints, 1000 req/min for read endpoints.
- π― Input sanitization at boundary + output encoding at render β defense in depth, not either/or.
- β‘ SQL injection: always parameterized queries. Never string-interpolate user input into SQL β even "safe" internal tools.
- π― Set security headers:
X-Content-Type-Options: nosniff,X-Frame-Options: DENY,Referrer-Policy: strict-origin-when-cross-origin,Strict-Transport-Security. - π‘ SSRF: validate and allowlist URLs before server-side
fetch(). Block internal IPs (10.x, 172.16.x, 192.168.x, 127.x, 169.254.x). - π― Broken access control: verify resource ownership on every request β
userIdfrom session, not from request body. - β‘ Password storage: bcrypt (cost 12+) or argon2id β never MD5, SHA, or plaintext. Enforce 12+ character minimum.
- π― MFA for admin accounts and sensitive operations β TOTP or WebAuthn, not SMS (SIM swap risk).
- π‘ Supply chain: pin dependencies with lockfiles, review new packages for download count + maintainer reputation before adding.
- π― Session fixation: regenerate session ID on login. Set
Secure,HttpOnly,SameSite=Stricton session cookies. - β‘ File upload: validate MIME type server-side (not just extension), scan for malware, store outside webroot.
API & INFRASTRUCTURE SECURITY
- π― API versioning in URL path (
/v1/) β version on breaking changes, not every deploy. - π‘ Webhook endpoints: verify HMAC signature, process idempotently, return 200 quickly.
- π― CORS preflight: handle OPTIONS requests correctly β missing preflight breaks browser clients.
- β‘ Docker: non-root user, minimal base image (distroless/alpine), no secrets in image layers.
- π― Secrets rotation: quarterly for API keys, immediately on team member departure.
β Deep dive: references/security.md
Section 7: Performance Ultra-Mode
CORE WEB VITALS TARGETS (non-negotiable)
- β‘ LCP (Largest Contentful Paint): < 2.5s. Check: is the LCP element an image? If so, it must have
fetchpriority="high"and must NOT be lazy-loaded. - β‘ INP (Interaction to Next Paint): < 200ms. Long tasks (>50ms) on the main thread cause INP failures. Profile with Chrome DevTools β Performance β Main thread.
- β‘ CLS (Cumulative Layout Shift): < 0.1. Every image, ad slot, and dynamically-injected element must have reserved space before it loads.
- π― TTFB (Time to First Byte): < 800ms. Use CDN edge caching, connection pooling, and database query optimization.
- π― FCP (First Contentful Paint): < 1.8s. Inline critical CSS, defer non-critical resources.
BUNDLE
- π― Check bundle size with
npx bundlesizeor bundle-analyzer before adding any dependency > 10KB gzipped. Is there a smaller alternative? - β‘ Split code at route boundaries. Every page bundle should only include what that page needs. Shared chunks must be explicitly configured, not left to defaults.
- π‘ Tree-shaking only works with ES modules. If a library ships only CJS, you get the whole thing. Check the package.json
"module"field before importing. - π― Dynamic import heavy libraries (charts, editors, maps) β they are never needed on first paint.
- π‘
preconnectto third-party origins you will fetch from;prefetchfor likely next navigation;preloadonly for critical current-page resources.
IMAGES
- β‘ Always use
next/image(Next.js) or equivalent image component. Never a raw<img>for user-facing images. Automatic WebP/AVIF conversion + lazy loading + sizing. - π― Use AVIF for photographs (50% smaller than WebP), WebP for illustrations, SVG for icons and logos. Never PNG when AVIF/WebP is available.
- π― Responsive images:
srcset+sizesattributes β serve 400w on mobile, 800w on tablet, 1200w on desktop. - π‘ Blur-up placeholders (LQIP) for hero images β perceived performance beats actual performance.
FONTS
- β‘
font-display: swapon all custom fonts. Invisible text while fonts load is a UX failure that costs users time. - π― Self-host fonts via
next/fontor@fontsource. Third-party font CDNs add a DNS lookup + TLS handshake on every page load. - π― Subset fonts to used character ranges β a Latin-only app does not need CJK glyphs.
- π‘ Preload only the single font weight used for above-the-fold text β preloading all weights wastes bandwidth.
RENDERING
- π― SSR for dynamic personalized content, SSG for marketing pages, ISR for semi-static content, CSR only for authenticated dashboards.
- π‘ Streaming SSR with React Suspense β send the shell immediately, stream slow data sections as they resolve.
β Deep dive: references/performance.md
Section 8: Accessibility Ultra-Mode
WCAG 2.2 AA compliance by default.
- β‘ Every
<img>needs alt text. Decorative images:alt="". Informative images: describe the content, not the appearance. "Chart showing Q3 revenue grew 40%" not "graph.png". - β‘ Every form input needs a visible
<label>associated viahtmlFor+id, ORaria-label, ORaria-labelledby. Placeholder text is NOT a label β it disappears on input. - β‘ Focus must be visible at all times. Never remove
:focus-visibleoutline without providing a custom visible alternative. Check in keyboard-only mode. - β‘ Every interactive element must be reachable and operable by keyboard alone. Tab to reach it. Enter/Space to activate it. Escape to dismiss overlays.
- β‘ Minimum touch target: 44Γ44px (WCAG 2.5.8). Add padding, not just visual size.
- π― Color contrast: 4.5:1 for normal text, 3:1 for large text and UI components. Use Colour Contrast Analyser or browser DevTools accessibility panel.
- π―
aria-liveregions for all dynamic content that updates without a page navigation. Shopping cart count, toast notifications, form errors all needaria-live="polite"oraria-atomic="true". - π‘ Test with a screen reader at least once before shipping any new component. VoiceOver (Mac/iOS) or NVDA (Windows) with Firefox. What you hear IS the product for 7.6M Americans who use screen readers.
- β‘ Modals/dialogs: must trap focus inside while open, return focus to trigger on close, and be dismissible with Escape. All three, always.
- π― Page language:
<html lang="en">on every page. Mark foreign phrases withlangattribute. - π― Skip navigation link as first focusable element:
<a href="#main" class="sr-only focus:not-sr-only">Skip to content</a>. - β‘ Heading hierarchy: one
<h1>per page, no skipped levels (h1 β h3 without h2). Headings are the screen reader table of contents. - π― Link text must describe destination β "Read our privacy policy" not "click here".
- π‘
role="status"for success messages,role="alert"for errors β semantic HTML first, ARIA roles when HTML is insufficient. - π― Form errors: associate with
aria-describedby, announce on submit failure, suggest corrections (WCAG 3.3.1, 3.3.3). - β‘ No content that flashes more than 3 times per second (WCAG 2.3.1 β seizure risk).
- π― Text must be resizable to 200% without loss of content or functionality (WCAG 1.4.4).
- π‘
inertattribute on background content when modal is open β prevents focus escape better thanaria-hiddenalone. - π― Tables: use
<th scope="col|row">,<caption>for data tables. Never use tables for layout. - β‘ Custom components must have correct ARIA roles, states, and properties β a
<div onClick>is not a button.
β Deep dive: references/accessibility.md
Section 9: Agent & Workflow Ultra-Mode
Synthesized from: agent-browser, mcp-builder, web-artifacts-builder, schedule, diagnose, vercel-deploy-claimable.
DEBUGGING PROTOCOL
- β‘ Before touching code: form a hypothesis. "The bug is in X because Y." Then find the smallest reproduction. Changing code before understanding the cause is guessing.
- π― Follow the data. Start at the source (where data enters the system), follow it to the symptom (where the wrong value appears). The bug is where the data diverges from expectation.
- π‘ When a bug seems impossible given the code, check: Is the code you are reading the code that is running? (Build cache, wrong environment, wrong file, hot-reload lag.)
- π― Binary search the problem space: disable half the system, see if bug persists, repeat.
- π‘ Read the error message completely β the answer is usually in the last line of the stack trace, not the first.
AGENT WORKFLOWS
- β‘ Plan β Execute β Verify loop for every multi-step agent task. Never skip Verify. A task is not done until you have confirmed the output matches the goal.
- π― When building MCP servers: one tool per distinct capability. Tools should be composable, not monolithic. Each tool: clear name, description the LLM will read, typed input schema (Zod), typed output.
- π‘ Use semantic browser selectors for automation:
getByRole,getByText,getByLabel. Never CSS selectors or XPath in agent browser tasks β they break on redesigns. - π― Error recovery in agent loops: catch specific errors, log them with context, retry with exponential backoff (max 3 attempts), then escalate to human. Never silent-fail.
- β‘ Agent output format: always match what the next step needs. If a downstream tool expects JSON, return JSON. Type your agent outputs.
- π― Idempotent tool design: calling the same tool twice with the same input should not create duplicate side effects.
- π‘ Context window management: summarize completed steps, keep only active task context β don't carry full conversation history into every tool call.
- π― Parallelize independent tool calls β sequential when calls depend on prior results.
- β‘ Human-in-the-loop for irreversible actions (delete, deploy to production, send email) β always confirm before executing.
- π‘ Tool descriptions are prompts: write them for the LLM reader, not the human developer. Include when to use AND when NOT to use.
β Deep dive: references/agent-patterns.md
Section 10: Documentation Ultra-Mode
Synthesized from: writing-guidelines, doc-coauthoring, grill-with-docs.
- π― Every public API (function, component, endpoint) needs: purpose (1 sentence), parameters (name + type + description + required/optional), return value, and one runnable example. Nothing more. Nothing less.
- β‘ Code examples must be copy-paste runnable with zero modification. No placeholder URLs, no
YOUR_API_KEYwithout specifying exactly where to get it. - π― Docs structure: Quick Start (works in < 5 minutes) β Core Concepts β API Reference β Guides β Troubleshooting. Never start with concepts β start with a win.
- π‘ "Why does this exist?" is the most important question your docs must answer, usually in the first paragraph. Skip it and users bounce.
- β‘ Reference official docs as the source of truth, not your memory. When explaining a framework behavior, link to the framework's own docs.
- π― README must include: install command, one usage example, link to full docs. Three things above the fold.
- π― Changelog entries: what changed, why, and migration steps for breaking changes.
- π‘ Diagrams for architecture docs, code for API docs β never prose describing what a diagram would show.
- π― Error messages in docs mirror actual error messages in code β users search for the exact string.
- π‘ Version docs alongside code β outdated docs are worse than no docs.
Section 11: Ultra Self-Improvement Protocol
This skill must improve itself. Follow these instructions:
- π‘ When you encounter a situation not covered by these rules, note it as a gap.
Format:
SKILL GAP DETECTED: [situation]. Suggested rule: [proposed rule].Add it to the relevant/references/file for the next session. - π― When a rule produces a bad outcome, flag it:
RULE CONFLICT: [rule] produced [bad outcome] because [reason]. Suggested refinement: [refined rule]. - β‘ Synthesize new patterns from the codebase you are working in. If the project has established conventions that are better than these rules, the project wins.
Note:
PROJECT OVERRIDE: [local convention] overrides [global rule] here.
Reference Index
| File | Domain | Rules |
|---|---|---|
| frontend.md | React, Next.js, Vue, Svelte, Web APIs | 150+ |
| design.md | Visual design, typography, color, motion | 200+ |
| architecture.md | SOLID, feature-slicing, API design | 100+ |
| testing.md | TDD, E2E, mocking, CI | 80+ |
| security.md | OWASP Top 10, auth, CSP | Full checklist |
| performance.md | Core Web Vitals, bundle, images | Full guide |
| accessibility.md | WCAG 2.2 AA audit checklist | Full checklist |
| agent-patterns.md | MCP, browser automation, agent loops | Full guide |
| devops.md | CI/CD, deployment, monitoring | Full guide |
| next-app-router.md | Next.js App Router production gotchas | 30+ |
| react-18-patterns.md | React 18 concurrent patterns | 30+ |
| tailwind-v4.md | Tailwind v4 CSS-first config | 30+ |
| agent-reach.md | Agent-Reach channel reference | Full guide |
Section 12: DevOps Ultra-Mode
Synthesized from: vercel-deploy-claimable, GitHub Actions patterns, infrastructure best practices.
- β‘ CI pipeline: lint β typecheck β test β build β deploy. Fail fast at each stage.
- π― PR preview deployments for every pull request β test the actual artifact, not local dev.
- β‘ Never skip staging on the path to production β local β preview β staging β production.
- π― Environment variables validated at startup with Zod β fail fast on missing config.
- π‘ Backward-compatible database migrations always β deploy code that works with old AND new schema.
- π― One-click rollback ready: keep previous deployment artifact, define rollback triggers (error rate >1%).
- β‘ Security headers on every production response: CSP, HSTS, X-Frame-Options, X-Content-Type-Options.
- π―
npm ciin CI β exact versions from lockfile, notnpm install. - π‘ Cache
node_modulesand build outputs in CI keyed on lockfile hash. - π― Monitoring: Sentry for errors, Vercel Analytics for Web Vitals, uptime checks every 5 minutes.
- β‘ Dependabot/Renovate for automated dependency updates β weekly PRs.
- π― Feature flags for risky deploys β deploy code dark, enable gradually.
- π‘ Canary deploys: 5% traffic to new version, monitor error rate, ramp to 100%.
- π― Smoke tests after every deploy: health endpoint + critical user path.
- β‘ Secrets in CI via OIDC or secret manager β never long-lived credentials in workflow files.
β Deep dive: references/devops.md
Section 13: Cross-Domain Synthesis
Ultra's power is applying multiple modes simultaneously. These cross-domain rules are what no single skill provides:
Building UI Components
- β‘ Frontend (5 states) + Design (hierarchy) + A11y (keyboard + contrast) + Performance (lazy load, no layout shift) β all apply to every component.
- π― A form component needs: Frontend (controlled inputs), Design (error state styling), A11y (labels + aria-describedby), Security (client validation + server schema), Testing (given/when/then for validation).
- π‘ A data table needs: Frontend (virtualization >50 rows), Design (tabular nums, sticky header), A11y (th scope, caption), Performance (pagination over rendering all rows).
Building API Routes
- β‘ Architecture (thin handler, fat service) + Security (Zod validation, auth check, rate limit) + Testing (integration test per endpoint) + DevOps (monitoring, error tracking).
- π― An auth endpoint needs: Security (bcrypt, httpOnly cookies, CSRF, rate limit), Testing (test lockout, test session regeneration), Architecture (auth service behind interface).
Shipping Features
- π― Architecture (mini-PRD first) β Frontend (implement) β Testing (TDD) β Security (review) β Performance (audit) β A11y (checklist) β DevOps (deploy with preview).
- π‘ The Ultra shipping sequence: Plan β Build β Test β Review β Deploy β Verify. Never skip Review or Verify.
Code Review
- β‘ When reviewing any PR, activate ALL modes that touch changed files β a CSS change still needs a11y and performance review.
- π― Review checklist: Does it work? Is it tested? Is it secure? Is it accessible? Is it performant? Is it maintainable?
- π‘ Socratic review: "What would have to be true for this approach to be wrong?" β from grill-me.
Section 14: Ultra Audit Workflow
When user requests a review, audit, or /ultra-review:
Step 1: Detect Context
- List active modes based on file type, imports, directory, user intent
- Output:
Active modes: [list]
Step 2: Scan Against Rules
- Check every β‘ critical rule in active modes β these are blockers
- Check π― high-impact rules β these are strong recommendations
- Note π‘ insights where applicable
Step 3: Report Findings
Format each finding as:
[P0/P1/P2] [Mode] Rule #N: [rule text]
Found: [what you observed in the code]
Fix: [specific actionable change]
Priority:
- P0 (β‘ critical): Must fix before ship β security, a11y, data loss, crash
- P1 (π― high-impact): Should fix β quality, performance, maintainability
- P2 (π‘ insight): Consider β optimization, polish, future-proofing
Step 4: Score
- 0-100 quality score based on rules passed vs violated
- SHIP gate: no P0 findings, <3 P1 findings to ship
Section 15: Platform Compatibility
Apple Ultra works across 20+ agent platforms. Activation method varies:
| Platform | Activation Method |
|---|---|
| Claude Code | Auto-loaded from skills directory, trigger keywords |
| Cursor | Agent Skills auto-activation, or @apple-ultra |
| GitHub Copilot | .github/copilot-instructions.md or skills extension |
| Windsurf | .windsurf/rules/ directory |
| Gemini CLI | .gemini/skills/ or --skill flag |
| Cline | .cline/skills/ or .clinerules |
| Roo Code | .roo/rules/ or custom mode |
| VS Code | Copilot instructions or AI extension config |
| Zed | Agent rules or MCP integration |
Universal principle: if the platform reads SKILL.md with triggers, Apple Ultra works.
Section 16: Agent-Reach Ultra-Mode
When you need real-world information, don't guess β reach for it. Apple Ultra Skills integrates Agent-Reach as a zero-cost research layer.
Install:
pip install agent-reach && agent-reach install
See references/agent-reach.md for channel reference.
WHEN TO USE AGENT-REACH (activate automatically)
β‘ "What does X library's latest docs say?" β agent-reach web [docs-url]
β‘ "How do others solve this problem?" β agent-reach reddit "topic query"
β‘ "What's the latest on this framework?" β agent-reach search "query"
β‘ "Summarize this YouTube tutorial" β agent-reach youtube [url]
β‘ "Check this GitHub repo" β agent-reach github owner/repo
π― "Find recent discussions about X" β agent-reach twitter "X query"
π― "Get the RSS feed for this project's releases" β agent-reach rss [feed-url]
RESEARCH PROTOCOL (always follow this order)
- GitHub first β check official repo for issues, recent commits, README
- Official docs via web β Jina Reader gives clean markdown from any URL
- Reddit/Twitter β community sentiment and real-world usage problems
- YouTube β only for tutorials when text sources are insufficient
- RSS β for tracking ongoing projects (library releases, changelogs)
RESEARCH-THEN-BUILD PATTERN
Before implementing any non-trivial pattern, run:
agent-reach github [framework]/[framework] # check recent issues/PRs
agent-reach web [official-docs-url] # get current API docs
agent-reach search "[pattern] best practices 2025" # community consensus
Then synthesize findings into your implementation. Never code from memory when the current state of a library may have changed.
NEVER
β‘ Hallucinate library APIs. If uncertain, use Agent-Reach to verify. β‘ Use deprecated patterns without checking current docs first. π― Cite documentation from memory for fast-moving libraries (React, Next.js, Tailwind, TypeScript). These change across minor versions.
Quick Commands
When the agent platform supports slash commands:
/ultra-reviewβ Run Apple Ultra audit on current file (all active modes)/ultra-prdβ Generate structured mini-PRD from feature description/ultra-testβ Generate TDD test scaffold for current module/ultra-a11yβ Run WCAG 2.2 AA checklist on current component/ultra-perfβ Audit current page for Core Web Vitals compliance