Skip to main content
rule CX Codex

_sections — Claude Code rule: performance optimization framework

A rule for Claude Code that defines eight performance optimization sections, ranks them by impact, and guides the agent in prioritizing code improvements. Install once, reference by ID when analyzing bottlenecks.

MIT ★ 7,191 updated 2026-10-24

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/_sections.md
Open on GitHub

What _sections does

The rule structures optimization into a hierarchy: async waterfalls and bundle size are CRITICAL; server and client data fetching are HIGH or MEDIUM-HIGH; re-renders and rendering come next; JavaScript micro-optimizations and advanced patterns are LOW or LOW-MEDIUM. Each section includes a concise description of why it matters. Eliminating sequential awaits yields the largest gains. Reducing initial bundle size improves Time to Interactive and Largest Contentful Paint.

Drop the file into .claude/rules/_sections.md for Claude Code, .cursor/rules/_sections.mdc for Cursor, or .clinerules/_sections.md for Cline. The agent then references sections by ID (async, bundle, server, client, rerender, rendering, js, advanced) when identifying and prioritizing performance fixes.

What it helps with

  • Establish a shared framework for performance optimization priorities
  • Enable the agent to triage bottlenecks by impact level
  • Align waterfalls, bundle, and rendering recommendations in one reference
  • Distinguish between critical and marginal improvements

Example prompts for the agent

  • Create a performance audit for this codebase using the _sections hierarchy, starting with async and bundle
  • Which sections from _sections apply to this React component, and which matter most?
  • Analyze this endpoint and tell me which _sections section is the biggest bottleneck

How to install _sections

Manually: put the files in place

.claude/rules/_sections.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about _sections

How do I install _sections in Claude Code?

Place the file at .claude/rules/_sections.md in your project root. Claude Code will load it automatically on the next session.

What does _sections do?

It ranks eight performance optimization areas by impact: eliminating async waterfalls and reducing bundle size are critical; server and client data fetching are high-impact; re-render and rendering optimizations are medium; JavaScript tweaks and advanced patterns are low-impact. The agent uses it to prioritize fixes.

Does _sections work with IDEs other than Claude Code?

Yes. Use .cursor/rules/_sections.mdc for Cursor, .clinerules/_sections.md for Cline, .github/instructions/_sections.instructions.md for GitHub Copilot, and .devin/rules/_sections.md for Windsurf.

Source text

_sections.md · MIT
# Sections

This file defines all sections, their ordering, impact levels, and descriptions.
The section ID (in parentheses) is the filename prefix used to group rules.

---

## 1. Eliminating Waterfalls (async)

**Impact:** CRITICAL  
**Description:** Waterfalls are the #1 performance killer. Each sequential await adds full network latency. Eliminating them yields the largest gains.

## 2. Bundle Size Optimization (bundle)

**Impact:** CRITICAL  
**Description:** Reducing initial bundle size improves Time to Interactive and Largest Contentful Paint.

## 3. Server-Side Performance (server)

**Impact:** HIGH  
**Description:** Optimizing server-side rendering and data fetching eliminates server-side waterfalls and reduces response times.

## 4. Client-Side Data Fetching (client)

**Impact:** MEDIUM-HIGH  
**Description:** Automatic deduplication and efficient data fetching patterns reduce redundant network requests.

## 5. Re-render Optimization (rerender)

**Impact:** MEDIUM  
**Description:** Reducing unnecessary re-renders minimizes wasted computation and improves UI responsiveness.

## 6. Rendering Performance (rendering)

**Impact:** MEDIUM  
**Description:** Optimizing the rendering process reduces the work the browser needs to do.

## 7. JavaScript Performance (js)

**Impact:** LOW-MEDIUM  
**Description:** Micro-optimizations for hot paths can add up to meaningful improvements.

## 8. Advanced Patterns (advanced)

**Impact:** LOW  
**Description:** Advanced patterns for specific cases that require careful implementation.

© tech-leads-club · MIT · tech-leads-club/agent-skills

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set130

The whole set →
async-dependencies async-dependencies instructs Claude Code to execute partially dependent async tasks concurrently using better-all or native promise chains rather than blocking Promise.all calls. CX Codex +1 ★ 7,191repo stars server-cache-lru The server-cache-lru rule explains when React.cache() is too narrow and an LRU cache should share data between requests. Use it for sequential actions that reuse the same records. CX Codex +1 ★ 7,191repo stars advanced-event-handler-refs advanced-event-handler-refs guides Claude Code to keep event callbacks in refs or useEffectEvent, stopping React effects from re-subscribing on every render. CX Codex +1 ★ 7,191repo stars server-parallel-fetching The server-parallel-fetching rule shows how to compose React Server Components so independent data requests can run in parallel. Use it when one component waits on another component’s fetch. CX Codex +1 ★ 7,191repo stars client-passive-event-listeners client-passive-event-listeners instructs the agent to add { passive: true } to touch and wheel listeners, preventing scroll stutter in browser viewports. CX Codex +1 ★ 7,191repo stars js-cache-storage js-cache-storage keeps localStorage, sessionStorage and cookie values in memory so reads stop hitting synchronous browser storage. CX Codex +1 ★ 7,191repo stars rerender-use-ref-transient-values The rerender-use-ref-transient-values rule teaches the agent to store frequently changing values in useRef instead of useState to avoid re-rendering the component on every update. CX Codex +1 ★ 7,191repo stars js-length-check-first js-length-check-first — a rule for Claude Code that prompts the AI to check array lengths before running expensive operations like sorting or deep equality checks. If lengths differ, arrays cannot be equal—no expensive work needed. CX Codex +1 ★ 7,191repo stars

Project sponsors

Companies that keep this analytics open