performance-accessibility

A set of Next.js rules for making websites load efficiently and work for people using assistive technologies. It covers image handling, static page generation, JavaScript size, code loading, semantic HTML, and alternative text.

In plain words
What is it for?
Use it when building or reviewing Next.js pages, optimizing images, choosing static rendering, splitting large components, adding loading behavior, or checking accessible HTML.
Why use it?
It helps avoid slow pages and common accessibility problems such as missing descriptions for screen readers. It also encourages the framework's built-in image and rendering features.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/muzaffar640/commitpress/performance-accessibility
Clone the repo
git clone --depth 1 https://github.com/muzaffar640/commitpress

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,153 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01153
Opus 5 $0.00000 $0.00576
Sonnet 5 $0.00000 $0.00231
Haiku 4.5 $0.00000 $0.00115

Measured yesterday against content hash 8d1c9a0b2e22, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

performance-accessibility scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/performance-accessibility.mdc · 199 lines

How it starts

The opening of the file, as written. The whole thing — 199 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Performance and Accessibility Guidelines

Performance Optimization

Image Optimization

  • Always use Next.js Image component from next/image
  • Optimize images before adding to public/ directory
  • Use appropriate image formats (WebP, AVIF when possible)
  • Add proper alt attributes for accessibility
  • Use priority prop for above-the-fold images
import Image from 'next/image';

// Optimized image usage
<Image
  src="/blog/images/cover.jpg"
  alt="Descriptive alt text for screen readers"
  width={800}
  height={400}
  priority // For above-the-fold images
  className="rounded-lg"
/>

Static Generation

  • Prefer Server Components over Client Components
  • Use static generation for blog content
  • Minimize JavaScript bundle size
  • Implement proper caching strategies

Code Splitting

  • Dynamic imports for heavy components
  • Lazy load non-critical components
  • Use React.memo for expensive components
// Dynamic import example
const HeavyComponent = dynamic(() => import('./HeavyComponent'), {
  loading: () => <div>Loading...</div>,
  ssr: false // If component doesn't need SSR
});

Accessibility (a11y) Standards

Semantic HTML

  • Use proper heading hierarchy (h1 → h2 → h3)
  • Use semantic elements (article, section, nav, main)
  • Ensure proper document structure
  • Use landmarks for navigation

ARIA Attributes

  • Add aria-label for actions without text
  • Use aria-describedby for additional context
  • Implement aria-expanded for collapsible content
  • Add role attributes when semantic HTML isn't sufficient
// Accessible button example
<button
  aria-label="Close modal"
  aria-expanded={isOpen}
  onClick={closeModal}
  className="p-2 rounded-md focus:ring-2 focus:ring-blue-500"
>
  <CloseIcon aria-hidden="true" />
</button>

Focus Management

  • Ensure all interactive elements are keyboard accessible
  • Implement visible focus indicators
  • Manage focus for modals and dropdowns
  • Use proper tab order

Read the full file on GitHub · 199 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 199 lines · 0 tokens per session scan A 8d1c9a0b2e22

Subscribe to this mod's changes

performance-accessibility is a cursor rule published in the GitHub repository muzaffar640/commitpress (7 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,153 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.