text stringlengths 3 8.33k | repo stringclasses 52
values | path stringlengths 6 141 | language stringclasses 35
values | sha stringlengths 64 64 | chunk_index int32 0 273 | n_tokens int32 1 896 |
|---|---|---|---|---|---|---|
on `session.user`; editing any other field of `user` invalidates it.
- **An array/collection read drags the whole collection.** Reading one element establishes a dependency on the entire stored collection.
```swift
// PREFER: cache derived values as stored properties, kept in sync in didSet
@MainActor @Observable
fina... | openai-build-week | .agents/skills/swiftui-expert-skill/references/state-management.md | Markdown | 4f8e1d299838de666dc1a940e32b641829d965309e89d7e636dbb98e2f0faa07 | 2 | 896 |
view and passing it down. If you must create one in a custom initializer, pass the expression directly to `StateObject(wrappedValue:)` so the `@autoclosure` prevents redundant allocations:
```swift
// Inside a View's init(movie:):
// WRONG — assigning to a local first defeats @autoclosure
let vm = MovieDetailsViewMode... | openai-build-week | .agents/skills/swiftui-expert-skill/references/state-management.md | Markdown | 5f496914eb153c2f189a86143c23e2749f97268e6639f44a491ef83ffe7edb2d | 3 | 896 |
doesn't help — the struct still contains an uncomparable closure. The fix is to eliminate the closure: store the data it would have captured as properties and expose the behavior via `callAsFunction` or a method.
```swift
// AVOID: closure in a custom environment key
extension EnvironmentValues {
@Entry var submit... | openai-build-week | .agents/skills/swiftui-expert-skill/references/state-management.md | Markdown | 687935330a1701a191b51c8b5aa8e190cf0567d1d0819995a5cb558e317a22d4 | 4 | 896 |
passed
struct MyView: View {
// Created by view - private
@State private var isExpanded = false
@State private var viewModel = ViewModel()
@AppStorage("theme") private var theme = "light"
@Environment(\.colorScheme) private var colorScheme
// Passed from parent - not private
let title: ... | openai-build-week | .agents/skills/swiftui-expert-skill/references/state-management.md | Markdown | 7c20d7308b5bb2ee8cb400894a15ae73aea6f993661636523aa631e568e6a03d | 5 | 464 |
# SwiftUI Text Patterns Reference
> For broader localization guidance — String Catalogs, `#bundle` for packages, `LocalizedStringResource`, locale-aware formatting, RTL layout, and translator comments — see `references/localization.md`. This file covers only the verbatim-vs-localized decision for a single `Text`.
## ... | openai-build-week | .agents/skills/swiftui-expert-skill/references/text-patterns.md | Markdown | 0621f15e8112e6ad3ecc2af6c5a9cce4ff5b41b91d1108cb76c22bca104ffebe | 0 | 312 |
# Instruments Trace Analysis
Use this reference whenever the user references an Xcode Instruments `.trace`
file. A target SwiftUI source file is **optional** — if provided, you can
cite specific lines; without one, the trace still surfaces view names,
hot symbols, and high-severity events that tell the user where to l... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-analysis.md | Markdown | a41744094dff8de0884a7508cdfb53f9041bede0cf2363b5dfb74d2436c6ca87 | 0 | 896 |
intervals": [...], "events": [...] }`. Intervals are
paired `begin`/`end` signposts with `start_ms`, `end_ms`, `duration_ms`,
`name`, `subsystem`, `category`, `process`, `signpost_id`. Single-point
events (and any unpaired begins) go into `events`. All filters are
AND-combined; `--signpost-name-contains` is case-insens... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-analysis.md | Markdown | 5473a208e43578c39d6fb4ee7c12fd3510c283f7c7837785af2ef27f1f90a37d | 1 | 896 |
: "hitches", "available": true, "schema_used": "hitches",
"metrics": { "count", "total_hitch_ms", "worst_hitch_ms",
"narrative_breakdown": {...}, "system_hitches", "app_hitches" },
"top_offenders": [ { "start_ms", "hitch_duration_ms", "narrative", "is_system" } ] },
{ "lane": "swiftui... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-analysis.md | Markdown | 8f4dd79b94289916696c27e01b1c3305d92ccfaa43d30e7908cd9f09020fd880 | 2 | 896 |
Expensive `.onChange` body | `references/performance-patterns.md`, `references/state-management.md` |
| `Gesture` | Heavy gesture handler | `references/performance-patterns.md` |
| `Action Callback`| Button/tap handler work | `references/performance-patterns.md` |
| `Update` | View body recomputati... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-analysis.md | Markdown | 9e1356100ffe673f5c57bc4bd574b5ec8dee1b1ce97b80a0290c7b466587a00e | 3 | 896 |
a specific view in `swiftui.high_severity_events` keeps showing up,
run `--fanin-for "<view name>"` to see the ranked list of sources
invalidating it.
### Picking targets from a full-trace analysis
Prioritise from most actionable to least:
1. **Any `hangs` with `main_running_coverage_pct < 25%`** — these are
bloc... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-analysis.md | Markdown | 09c5639a3dab7c23b850469131a52b147895c4b83fe7e605591178cd39b242e3 | 4 | 454 |
# Recording an Instruments Trace
Use this reference when the user asks to record a new trace — either to
attach to a running app, launch one fresh, or capture a specific session
of actions they'll perform interactively.
The bundled `scripts/record_trace.py` wraps `xctrace record` with:
- The **SwiftUI** template by ... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-recording.md | Markdown | eabb4cae8cdf3271c1549344b5da0e1ff15d7af7e0af9e4e6363731f4a6347ca | 0 | 896 |
------------------|
| Physical iOS/iPadOS device (connected) | `SwiftUI` (default) |
| Host Mac (macOS app, `--all-processes`, etc.)| `SwiftUI` (default) |
| iOS / iPadOS / watchOS / tvOS Simulator | `Time Profiler` |
Always confirm the target kind with `--list-devices` before starting a
recording: e... | openai-build-week | .agents/skills/swiftui-expert-skill/references/trace-recording.md | Markdown | c475298f04d61049631acbc961c800848bbef99255c7f828a3914444fe4a84d1 | 1 | 494 |
# SwiftUI View Structure Reference
## Table of Contents
- [View Structure Principles](#view-structure-principles)
- [View File Structure (optional readability suggestion)](#view-file-structure-optional-readability-suggestion)
- [Struct or Method / Computed Property?](#struct-or-method--computed-property)
- [Prefer Mo... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | fba80b8adeace6064703978cd01303d7a5f746158c507be9d280f6e5ae0a161e | 0 | 896 |
can diff inputs and skip body evaluation.
- For reusable, stateful, or logically independent UI sections: prefer a dedicated `struct`.
```swift
struct ContentView: View {
var titleView: some View {
Text("Hello from Property")
.font(.largeTitle)
.foregroundColor(.blue)
}
fun... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | bcb21027371aff42d233e34ccb2fe660f762df14cfc282abc842651872488698 | 1 | 896 |
: \(count)") { count += 1 }
complexSection() // Re-executes every tap!
}
}
@ViewBuilder
func complexSection() -> some View {
// Complex views that re-execute unnecessarily
ForEach(0..<100) { i in
HStack {
Image(systemName: "star")
... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | 6c0e3ffb08cf6472d1a6a9ac0c405c14dbe287f2cb91de0d18213513465112ac | 2 | 896 |
` when:
- there is conditional branching between multiple view types
- extracting a separate `struct` would not provide meaningful separation
## Keep View Body Simple and Avoid High-Cost Operations
Refrain from performing complex operations within the `body` of your view. Instead of passing a ready-to-use sequence w... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | 705307787ca5f4bdba9fe274d8f55ed7c6645b6aae672617a74e0d4abd00972e | 3 | 896 |
branches — and is fine.
## When to Extract Subviews
Extract complex views into separate subviews when:
- The view has multiple logical sections or responsibilities
- The view contains reusable components
- The view body becomes difficult to read or understand
- You need to isolate state changes for performance
- The ... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | 05b225a8f4318b1f1623134b4e042209bd8b094a34f3b95e65e3a8f8f9ad6eda | 4 | 896 |
composited. Where antialiased edges overlap — typically at rounded corners — you get visible color fringes (semi-transparent pixels of different colors blending together).
```swift
let shape = RoundedRectangle(cornerRadius: 16)
// BAD - each layer antialiased separately, producing color fringes at corners
Color.red
... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | cf3d69b1b8bfcdeadceaf8f09a4bb8a8f7b17eb385d7a8622acd1d09d32ba3d2 | 5 | 896 |
ButtonStyle where Self == PrimaryButtonStyle {
static var primary: PrimaryButtonStyle { .init() }
}
// Usage: .buttonStyle(.primary)
```
This pattern works for any SwiftUI style protocol (`ButtonStyle`, `ListStyle`, `ToggleStyle`, etc.).
## Skeleton Loading with Redacted Views
Use `.redacted(reason: .placeholde... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | 88c134e0c7983793ba17dc7cd2cdb279190c206d8bfde5bfc11a723d01779f6f | 6 | 896 |
\(counter)")
Button {
counter += 1
} label: {
Text("Counter +1")
}
.buttonStyle(.borderedProminent)
}
.padding()
}
}
```
Use these tools only for debugging and remove them from production code.
### Handling "The Compil... | openai-build-week | .agents/skills/swiftui-expert-skill/references/view-structure.md | Markdown | 57111192980031b08127d6d9f9389e327e1c595e4e36a43acb3e4156f6ad2c71 | 7 | 465 |
#!/usr/bin/env python3
"""Analyze an Xcode Instruments .trace file and emit JSON + markdown.
Primary modes:
(default) Full four-lane analysis + cross-lane correlations.
--list-logs Dump os_log entries (optionally filtered) as JSON so an
agent can locate a focus window by log... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/analyze_trace.py | Python | 230f599b8f862f352f7f0e26edafe124cb359c2526fd7c12fcd268308574ed70 | 0 | 896 |
"store_true")
args = parser.parse_args(argv)
# The discovery modes aren't in a mutually_exclusive_group because they
# live alongside their sub-filters in the same argparse group; enforce the
# constraint by hand so an agent gets a clear error instead of silent
# precedence.
active_modes = sum... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/analyze_trace.py | Python | 5cdf13251a530f2434218d8a066fb52986d063c756772d36aaafe3366046b286 | 1 | 896 |
lanes": public_lanes,
"correlations": correlations,
}
if window_ns is not None:
result["window_ms"] = {
"start": window_ns[0] / 1_000_000,
"end": window_ns[1] / 1_000_000,
}
md = summary.render(result)
if args.output:
json_path = args.output.with... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/analyze_trace.py | Python | af1ded63571ee1dfb128a3eb76fef1825258fec9560233368ace8011646fb8b4 | 2 | 663 |
#!/usr/bin/env python3
"""Record an Xcode Instruments .trace file via `xctrace record`.
Three modes:
(default) Start a recording. Stops on Ctrl+C, stop-file, or time limit.
--list-devices Enumerate connected devices + simulators as JSON.
--list-templates Enumerate available Instruments templates a... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/record_trace.py | Python | 9185d842629118e66ec49cb8fe01249357b769e8dfb4e29f088a5f970c9e119e | 0 | 896 |
t my env var apply?".
print("error: --env only applies to --launch; remove it or switch target mode.",
file=sys.stderr)
return 2
output = args.output or Path.cwd() / _default_trace_name(args.template)
if output.exists():
print(f"error: output already exists: {output}", fil... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/record_trace.py | Python | bcd96ce279c32d26002a2a96bf96318b683105ba69dbed63cdddf7df1e6a34f2 | 1 | 896 |
now().strftime("%Y%m%d-%H%M%S")
return f"{safe}-{ts}.trace"
def _wait_with_stop(proc: subprocess.Popen, stop_file: Path | None) -> None:
"""Poll until xctrace exits or stop_file appears; then send SIGINT."""
while True:
rc = proc.poll()
if rc is not None:
return
if stop... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/record_trace.py | Python | 1e9a8b92bab8192175991d545068db47f2c08e9cfb0bd53e4914f9c264797607 | 2 | 782 |
"""Parsers for Xcode Instruments .trace files via xctrace export."""
| openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/__init__.py | Python | fdf7c99bed236e0fb71524b155be864a00a71af4997d6848c6c33f49fce62861 | 0 | 17 |
"""SwiftUI cause-graph lane (`swiftui-causes` schema).
Instruments emits one row per edge in SwiftUI's dependency graph: every time
a source node (a state change, user defaults observer, system event, etc.)
propagates to a destination node (a body evaluation, layout, creation), a
row is written with both endpoints as ... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/causes.py | Python | 851f68c8e27639db36dc2d9569c1ef48c0b33730a5767e5847c6da0b21de514b | 0 | 896 |
: len(destination_edges),
"top_labels": dict(label_counts.most_common(top_n)),
},
"top_sources": top_sources,
"top_destinations": top_destinations,
"notes": [],
}
def fanin_for(
trace_path: Path,
toc_schemas: frozenset[str],
destination_contains: str,
to... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/causes.py | Python | 7999eabe222c25c25dbc2782c1985a4150689ee9f46304133226b726e8e8fac2 | 1 | 502 |
"""Cross-lane correlation: for each hang and top-N worst hitches, aggregate
Time Profiler samples and SwiftUI updates whose timestamps fall inside the
event window [start, start+duration]. Uses bisect so lookups stay O(log N)
per event.
"""
from __future__ import annotations
from bisect import bisect_left, bisect_righ... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/correlate.py | Python | 835dd36d5729f27a0326982e8ee70fa87f63e4a793d388b0d3772d32c4574139 | 0 | 896 |
main_running_coverage_pct": round(coverage_pct, 1),
"hot_symbols": tp["hot_symbols"],
}
if sui_events is not None:
sui_overlap = _swiftui_overlaps(sui_events, start_ns, end_ns)
entry["swiftui_overlapping_updates"] = sui_overlap
return entry
def _time_profile_hot_symbols(
... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/correlate.py | Python | 0ab03e293e544af689bb45388be75c6782c50a8805dd877b7b64037542c1b20e | 1 | 592 |
"""Discovery helpers for os_log messages and os_signpost intervals.
These let an agent locate a focus window (e.g. "after the log saying X",
"during signpost Y") before running the main lane analysis.
"""
from __future__ import annotations
from pathlib import Path
from typing import Any
from . import xctrace, xml_ut... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/events.py | Python | fff26af19a68ed23df8d761fbcaa7b0722d5d507cb858a77ed8af71f80b377ca | 0 | 896 |
. `name_contains` is a case-insensitive substring
match. `window_ns` keeps intervals that overlap the window (not strict
containment) and point events whose timestamp falls inside it.
"""
# The two signpost schemas overlap: every paired begin/end in `os-signpost`
# also shows up as a row in `os-sign... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/events.py | Python | ce536e487e5208b1e0f4c7b2f96bc743203ae915672952f808f57a8c0618099d | 1 | 896 |
, Any]]]:
"""Read the os-signpost schema and pair begin/end rows into intervals."""
xml_bytes = xctrace.export_schema(trace_path, OS_SIGNPOST_SCHEMA, run=run)
stream = xml_utils.RowStream(xml_bytes)
pending: dict[tuple, dict] = {}
intervals: list[dict[str, Any]] = []
events: list[dict[str, Any]... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/events.py | Python | 61f0a204b8bb2386dcd040aeebd051d7c23981adab78e59b73dfd87d73bc7603 | 2 | 715 |
"""Hangs lane parser (schema `potential-hangs`).
The schema lacks inline backtraces — stacks come from Time Profiler samples
that overlap each hang's window. Correlation is done later in correlate.py.
"""
from __future__ import annotations
from pathlib import Path
from typing import Any
from . import xctrace, xml_ut... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/hangs.py | Python | af779727b7342186606021acad8f38dfb88778ee068a95d0a9b119f415bc5162 | 0 | 792 |
"""Animation hitches lane parser.
Xcode 26 schema `hitches` columns: start, duration (hitch time), process,
is-system, swap-id, label, display, narrative-description. The
narrative-description field carries Apple's own attribution (e.g.
"Potentially expensive app update(s)") which is the highest-signal column.
"""
fro... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/hitches.py | Python | aa42cc7893505b8af645860c81e72cc0d83322f564162accc1ba2ca7ecc1f1f7 | 0 | 896 |
narrative_counts.most_common()),
},
"top_offenders": top_offenders,
"notes": [],
"_events": events,
}
def _pick_schema(available: frozenset[str]) -> str | None:
for s in CANDIDATE_SCHEMAS:
if s in available:
return s
return None
def _first_int(row, str... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/hitches.py | Python | b0ad1a71833270f2995bd534af96cfeed863a11f15d5a256dc4e43be7f414524 | 1 | 165 |
"""Markdown summary renderer for the combined trace analysis."""
from __future__ import annotations
def render(result: dict) -> str:
lines: list[str] = []
trace = result.get("trace", "?")
header = result.get("xctrace_version") or ""
template = result.get("template") or ""
duration_s = result.get("... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/summary.py | Python | 652f711f228925912d0cf468e18e99bd39aa0318f059b7d69b85ab38f31d1936 | 0 | 896 |
"
f"250ms–1s={buckets['250ms_1s']}, >1s={buckets['gt_1s']}"
)
lines.append("")
for i, h in enumerate(lane["top_offenders"], 1):
lines.append(
f"{i}. {h['duration_ms']:.0f}ms {h['hang_type']} at "
f"{h['start_ms']:.2f}ms on {_short_thread(h['thread'])}"
)
l... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/summary.py | Python | 1f80951b47bfb929565d61e4b93b36741060b5c9a3c977035d6bc90932234fe0 | 1 | 896 |
, 1):
lines.append(
f"{i}. `{_truncate(v['view'], 80)}` — {v['total_ms']:.0f}ms total, "
f"{v['count']} updates (avg {v['avg_ms']:.2f}ms)"
)
if lane.get("high_severity_events"):
lines.append("")
lines.append("High-severity updates:")
fo... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/summary.py | Python | 993c50af7f1cdb6a04080b61782c5eab198b5c7ad7e157ab6ef1368f9c247b62 | 2 | 896 |
blocked' if cov < 25 else 'mostly running'})"
)
for s in tp["hot_symbols"][:3]:
lines.append(
f" · `{_truncate(s['symbol'], 80)}` "
f"{s['percent_of_main']:.0f}% ({s['samples']} samples)"
)
if not tp["hot_symb... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/summary.py | Python | 01b93eb45201f17b4f0a6abec145f4372a222730f64af0aa522272f4e96c5347 | 3 | 350 |
"""SwiftUI lane parser (Xcode 26+).
Primary schema is `swiftui-updates` with columns: start, duration, id,
update-type, allocations, description, category, view-hierarchy, module,
view-name, process, thread, root-causes, severity, cause-graph-node,
full-cause-graph-node.
We aggregate by view-name across all SwiftUI s... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/swiftui.py | Python | 9e099551882e620d1dfb2ac4df4045937aa8f3db2a92a6c0d9827ee230255069 | 0 | 896 |
": view,
"module": module,
"category": category,
"update_type": update_type,
"severity": severity,
"description": description,
})
events.sort(key=lambda e: e["duration_ns"], reverse=True)
top_by_total = sorted(
... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/swiftui.py | Python | 52522e0f784b621c2f02df37ff28e729c8730bede7c9726e8e8247145c590609 | 1 | 576 |
"""Time Profiler lane parser (schema `time-profile`).
Aggregates CPU samples by leaf symbol, keeps per-sample rows so that other
lanes can correlate by timestamp window.
"""
from __future__ import annotations
from collections import defaultdict
from pathlib import Path
from typing import Any
from . import xctrace, x... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/time_profiler.py | Python | 550a209d812a5ea2f85b11ea2d073c4f59b0927e2b1c6c9b6ce61f5e05eeaf98 | 0 | 896 |
,
},
"top_offenders": top_offenders,
"notes": notes,
# Internal: retained for correlation. Stripped before JSON emission
# if --slim is requested by the orchestrator.
"_samples": samples,
}
def _pick_schema(available: frozenset[str]) -> str | None:
for s in PREF... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/time_profiler.py | Python | ce5bd59a5261949a125b178406da0844264aadd8e6a144fbff82f577b304d5e5 | 1 | 76 |
"""Thin wrapper around the `xctrace` CLI."""
from __future__ import annotations
import subprocess
import xml.etree.ElementTree as ET
from dataclasses import dataclass
from pathlib import Path
@dataclass(frozen=True)
class RunInfo:
"""Per-run metadata and schemas. Instruments traces can hold multiple runs."""
... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/xctrace.py | Python | b680bddb80d7f63ff97b7ba69b1c9ddda57d4080d601e9a1a47f09e81c2870ce | 0 | 852 |
"""Streaming XML helpers for xctrace export output.
Instruments XML deduplicates repeated values with `id`/`ref` attributes that
can span the whole document, so we stream rows with iterparse while keeping
a global id cache for later ref lookups.
"""
from __future__ import annotations
import xml.etree.ElementTree as E... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/xml_utils.py | Python | d44a9646fb3b3dbe4d958d9462edb262ed4e063e9c447828dd07ebc0d4b3fa1f | 0 | 896 |
(data)
# --- Extraction helpers ---------------------------------------------------
def int_text(elem: ET.Element | None) -> int | None:
if elem is None or elem.text is None:
return None
try:
return int(elem.text)
except ValueError:
return None
def str_text(elem: ET.Element | No... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/xml_utils.py | Python | 5ce614d0f78c8886865699c0b4e0d045805f857174a561cf35a18c210a4b6fd7 | 1 | 896 |
return None
def in_window(time_ns: int | None, window: tuple[int, int] | None) -> bool:
"""Return True if time_ns is inside [start, end] (inclusive), or window is None."""
if window is None:
return True
if time_ns is None:
return False
start, end = window
return start <= time_ns <=... | openai-build-week | .agents/skills/swiftui-expert-skill/scripts/instruments_parser/xml_utils.py | Python | 75c38babd7d2342dfb786b4cb2a08e320ae522bb5f3c046308fd5ade4e22b179 | 2 | 153 |
# React Best Practices
**Version 1.0.0**
Vercel Engineering
January 2026
> **Note:**
> This document is mainly for agents and LLMs to follow when maintaining,
> generating, or refactoring React and Next.js codebases. Humans
> may also find it useful, but guidance here is optimized for automation
> and con... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 69956043a643ebda201126befbbb21c4c7f5467d5bbc4f0f54e94831238bb610 | 0 | 896 |
Automatic Deduplication](#43-use-swr-for-automatic-deduplication)
- 4.4 [Version and Minimize localStorage Data](#44-version-and-minimize-localstorage-data)
5. [Re-render Optimization](#5-re-render-optimization) — **MEDIUM**
- 5.1 [Calculate Derived State During Rendering](#51-calculate-derived-state-during-rende... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | e9fd2c0b2c61fc84fd8ec9c69188a10db708ac841a2be8ffea28d65cd10f7577 | 1 | 896 |
)
- 7.5 [Cache Storage API Calls](#75-cache-storage-api-calls)
- 7.6 [Combine Multiple Array Iterations](#76-combine-multiple-array-iterations)
- 7.7 [Defer Non-Critical Work with requestIdleCallback](#77-defer-non-critical-work-with-requestidlecallback)
- 7.8 [Early Length Check for Array Comparisons](#78-... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 7bf96ce461afb006e21879a626a074d4cd802363acd09fff4201258a56393af8 | 2 | 896 |
{
if (skipProcessing) {
// Returns immediately without waiting
return { skipped: true }
}
// Fetch only when needed
const userData = await fetchUserData(userId)
return processUserData(userData)
}
```
**Another example: early return optimization**
```typescript
// Incorrect: always fetches permiss... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 35711b014711fbe5e983be04e6883a039e887c6db2af21d1341ee8117e0e9f25 | 3 | 896 |
improvement)**
When async operations have no interdependencies, execute them concurrently using `Promise.all()`.
**Incorrect: sequential execution, 3 round trips**
```typescript
const user = await fetchUser()
const posts = await fetchPosts()
const comments = await fetchComments()
```
**Correct: parallel execution, ... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 7b4772da9dabf6099410410a9df160ed88aa76e8980e0360870fb327fd3c8697 | 4 | 896 |
-800ms just to import them**, affecting both development speed and production cold starts.
**Why tree-shaking doesn't help:** When a library is marked as external (not bundled), the bundler can't optimize it. If you bundle it to enable tree-shaking, builds become substantially slower analyzing the entire module graph.... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | d06b9d272491d450a55caa4db7cb73434e415eb9b6049bfb1abd3aad3aef1905 | 5 | 896 |
} from '@vercel/analytics/react'
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
)
}
```
**Correct: loads after hydration**
```tsx
import dynamic from 'next/dynamic'
const Analytics = dynamic(
() => import('... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 2481b5d29f237eecf6c4f07b902af1dea30cbea49694299afd65564419c57e15 | 6 | 896 |
output), [https://nextjs.org/learn/seo/dynamic-imports](https://nextjs.org/learn/seo/dynamic-imports), [https://vite.dev/guide/features.html](https://vite.dev/guide/features.html), [https://esbuild.github.io/api/](https://esbuild.github.io/api/), [https://www.npmjs.com/package/@rollup/plugin-dynamic-import-vars](https:... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | fec30379ec70c61eca6b2b4d1a3cd54956066015fb80491e50c3592755225a46 | 7 | 896 |
```typescript
'use server'
import { verifySession } from '@/lib/auth'
import { z } from 'zod'
const updateProfileSchema = z.object({
userId: z.string().uuid(),
name: z.string().min(1).max(100),
email: z.string().email()
})
export async function updateProfile(data: unknown) {
// Validate input first
const v... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | a5b80a2469e4d78633173ae5ea3df5da0de69842b42a32898f89b1cc558a9302 | 8 | 896 |
and client components rendered during SSR, avoid using mutable module-level variables to share request-scoped data. Server renders can run concurrently in the same process. If one render writes to shared module state and another render reads it, you can get race conditions, cross-request contamination, and security bug... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 168ecf8dd60f713c3749f7aa871a535926704b0f9d97c26b937284a074e47ca9 | 9 | 896 |
url)
).then(res => res.arrayBuffer())
const logoData = await fetch(
new URL('./images/logo.png', import.meta.url)
).then(res => res.arrayBuffer())
return new ImageResponse(
<div style={{ fontFamily: 'Inter' }}>
<img src={logoData} />
Hello World
</div>,
{ fonts: [{ name: 'Inter', d... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 4b85fffa7fd4741e90a5c543a801a9012a2837fd28725e33bf6974c5789c121c | 10 | 896 |
://vercel.com/docs/fluid-compute), module-level caching is especially effective because multiple concurrent requests share the same function instance. The static assets stay loaded in memory across requests without cold start penalties.
In traditional serverless, each cold start re-executes module-level code, but subs... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 8411d0f44c3c3c8bbe252e1abd4264933fc9965af0410a4877aad4d59f10fae5 | 11 | 896 |
(
chatIds.map(id => getChat(id).then(chat => getUser(chat.author)))
)
```
Each item independently chains `getChat` → `getUser`, so a slow chat doesn't block author fetches for the others.
### 3.9 Per-Request Deduplication with React.cache()
**Impact: MEDIUM (deduplicates within request)**
Use `React.cache()` for ... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | d2b57b2b2f5583c030b5ae9857de0a97292a3cbb17e88cee14f64298798e8b5b | 12 | 896 |
sessionCookie = (await cookies()).get('session-id')?.value || 'anonymous'
logUserAction({ sessionCookie, userAgent })
})
return new Response(JSON.stringify({ status: 'success' }), {
status: 200,
headers: { 'Content-Type': 'application/json' }
})
}
```
The response is sent immediately while lo... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 8bd1ef4ec1978344d8db2290b29f6829b610662fd6066e6b5955ed285b440c06 | 13 | 896 |
(e.deltaY)
document.addEventListener('touchstart', handleTouch)
document.addEventListener('wheel', handleWheel)
return () => {
document.removeEventListener('touchstart', handleTouch)
document.removeEventListener('wheel', handleWheel)
}
}, [])
```
**Correct:**
```typescript
useEffect(() => {
co... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 3f8cdb1c36b1938538b6401370f70b08f92fd8accb963ccbe6b875be88fa9179 | 14 | 896 |
``
**Store minimal fields from server responses:**
```typescript
// User object has 20+ fields, only store what UI needs
function cachePrefs(user: FullUser) {
try {
localStorage.setItem('prefs:v1', JSON.stringify({
theme: user.preferences.theme,
notifications: user.preferences.notifications
}))
... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 89b7af6b760363150078c23df96c24622199acd6a733660b5e64492f6e403e10 | 15 | 896 |
/ return some markup
}
```
**Correct:**
```tsx
function Header({ user, notifications }: Props) {
const isLoading = user.isLoading || notifications.isLoading
if (isLoading) return <Skeleton />
// return some markup
}
```
### 5.4 Don't Define Components Inside Components
**Impact: HIGH (prevents remount on eve... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 8121b42661c62c395cdf06d6a0bb9f966e70e113ffe67fb281548ac8b0fe120f | 16 | 896 |
before computation.
**Incorrect: computes avatar even when loading**
```tsx
function Profile({ user, loading }: Props) {
const avatar = useMemo(() => {
const id = computeAvatarId(user)
return <Avatar id={id} />
}, [user])
if (loading) return <Skeleton />
return <div>{avatar}</div>
}
```
**Correct: s... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | d8196eb867549ed1e46cefd9d0530293321c59c03761afb7398afaf66639be9d | 17 | 896 |
even if some tasks don't use the changed value.
**Incorrect: changing `sortOrder` recomputes filtering**
```tsx
const sortedProducts = useMemo(() => {
const filtered = products.filter((p) => p.category === category)
const sorted = filtered.toSorted((a, b) =>
sortOrder === "asc" ? a.price - b.price : b.price -... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | e909c0fc70df8fda3186ae2d6a1afb6fe294acef509b8b130270ee28cd420c7b | 18 | 896 |
closures**
```tsx
function TodoList() {
const [items, setItems] = useState(initialItems)
// Stable callback, never recreated
const addItems = useCallback((newItems: Item[]) => {
setItems(curr => [...curr, ...newItems])
}, []) // ✅ No dependencies needed
// Always uses latest state, no stale closur... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | b8e6382215969581667fb628ec47c09b40ebea79fd5b9f4af809c5b25abf1166 | 19 | 896 |
: MEDIUM (maintains UI responsiveness)**
Mark frequent, non-urgent state updates as transitions to maintain UI responsiveness.
**Incorrect: blocks UI on every scroll**
```tsx
function ScrollTracker() {
const [scrollY, setScrollY] = useState(0)
useEffect(() => {
const handler = () => setScrollY(window.scrollY... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 564d7ebbf7e3636cb0679e205b49cbbedb4698ab7328c0708201c03b8a553830 | 20 | 896 |
: 'fixed',
top: 0,
left: lastX,
width: 8,
height: 8,
background: 'black',
}}
/>
)
}
```
**Correct: no re-render for tracking**
```tsx
function Tracker() {
const lastXRef = useRef(0)
const dotRef = useRef<HTMLDivElement>(null)
useEffect(() => {
const onMov... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | e19914bfa1700e6c42ce486c850330625c6006e97685098b056fa427b70589ca | 21 | 896 |
element**
```tsx
const loadingSkeleton = (
<div className="animate-pulse h-20 bg-gray-200" />
)
function Container() {
return (
<div>
{loading && loadingSkeleton}
</div>
)
}
```
This is especially helpful for large and static SVG nodes, which can be expensive to recreate on every render.
**Note:... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | f2eb661ca79a930222f1aae92c93ac42e3d1c7a5565d7dee7af0305571b422c4 | 22 | 896 |
mismatch warnings**
```tsx
function Timestamp() {
return <span>{new Date().toLocaleString()}</span>
}
```
**Correct: suppress expected mismatch only**
```tsx
function Timestamp() {
return (
<span suppressHydrationWarning>
{new Date().toLocaleString()}
</span>
)
}
```
### 6.7 Use Activity Compone... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | c0ae6b56e5a966898f612d3ce2ad14944ec06a8a844988ad62318c0e610ab82f | 23 | 896 |
<div><span class="badge">5</span></div>
```
### 6.10 Use React DOM Resource Hints
**Impact: HIGH (reduces load time for critical resources)**
React DOM provides APIs to hint the browser about resources it will need. These are especially useful in server components to start loading resources before the client even re... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 9c9171f7b54da50843c5d8d6dd84724f97ffea87837e7883d68a5fbf32ebed84 | 24 | 896 |
=> handleSearch(e.target.value)} />
{isLoading && <Spinner />}
<ResultsList results={results} />
</>
)
}
```
**Correct: useTransition with built-in pending state**
```tsx
import { useTransition, useState } from 'react'
function SearchResults() {
const [query, setQuery] = useState('')
const [res... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | ca31f47b6327c5535b518e8d00aa308a2df999fceed762d4c48ca88611f0cb1c | 25 | 896 |
ref}>Content</div>
}
// Correct: toggle class
function Box({ isHighlighted }: { isHighlighted: boolean }) {
return (
<div className={isHighlighted ? 'highlighted-box' : ''}>
Content
</div>
)
}
```
Prefer CSS classes over inline styles when possible. CSS files are cached by the browser, and classes p... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | d11bbf5deb0fc6f6853cba27c808dc1f993075e3f17d5f615d365361fd00850d | 26 | 896 |
= null) {
return isLoggedInCache
}
isLoggedInCache = document.cookie.includes('auth=')
return isLoggedInCache
}
// Clear cache when auth changes
function onAuthChange() {
isLoggedInCache = null
}
```
Use a Map (not a hook) so it works everywhere: utilities, event handlers, not just React components.
R... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | be55f4cb3b689a10f5fb820a24832798a0ab3534b85afae93cf9a82f31c953ca | 27 | 896 |
, { query })
saveToRecentSearches(query)
prefetchTopResults(results.slice(0, 3))
}
```
**Correct: defers non-critical work to idle time**
```typescript
function handleSearch(query: string) {
const results = searchItems(query)
setResults(results)
// Defer non-critical work to idle periods
requestIdleCallb... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | b8d8ee893740e4e9d84cd19a7781b38404f92e479f5d77dc7c1df603a72dfc41 | 28 | 896 |
*Incorrect: processes all items even after finding answer**
```typescript
function validateUsers(users: User[]) {
let hasError = false
let errorMessage = ''
for (const user of users) {
if (!user.email) {
hasError = true
errorMessage = 'Email required'
}
if (!user.name) {
hasError... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 9ed2a42fbd2e2c5d0b144ed1b87a096108c4c109da74a85fa17314f77d79941c | 29 | 896 |
filtering some out
- Conditional mapping where some inputs produce no output
- Parsing/validating where invalid inputs should be skipped
### 7.12 Use Loop for Min/Max Instead of Sort
**Impact: LOW (O(n) instead of O(n log n))**
Finding the smallest or largest element only requires a single pass through the array. ... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | f414e48b5d603ecc1089de4f494dcaaaa6c4e6d1c7280228ed015329ef9dcf95 | 30 | 896 |
.toSorted()` to create a new sorted array without mutation.
**Incorrect: mutates original array**
```typescript
function UserList({ users }: { users: User[] }) {
// Mutates the users prop array!
const sorted = useMemo(
() => users.sort((a, b) => a.name.localeCompare(b.name)),
[users]
)
return <div>{so... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | e9f58b762e5ffa38e48b2defe9ee3e7df9681411dd4ae1b9710560076a12f3af | 31 | 896 |
initialization that must run once per app load inside `useEffect([])` of a component. Components can remount and effects will re-run. Use a module-level guard or top-level init in the entry module instead.
**Incorrect: runs twice in dev, re-runs on remount**
```tsx
function Comp() {
useEffect(() => {
loadFromSt... | openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | d5ac35483fac8121ec5547aec6c8d69f41f881c2a814e14c6309d3bf25363374 | 32 | 896 |
/isaacs/node-lru-cache)
6. [https://vercel.com/blog/how-we-optimized-package-imports-in-next-js](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js)
7. [https://vercel.com/blog/how-we-made-the-vercel-dashboard-twice-as-fast](https://vercel.com/blog/how-we-made-the-vercel-dashboard-twice-as-fast)
| openai-build-week | .agents/skills/vercel-react-best-practices/AGENTS.md | Markdown | 65b3eb7aefca99ccfca39d30730a77477dc1ff68e3d88e380bfdde1859509b6b | 33 | 125 |
{
"version": "1.0.0",
"organization": "Vercel Engineering",
"date": "January 2026",
"abstract": "Comprehensive performance optimization guide for React and Next.js applications, designed for AI agents and LLMs. Contains 40+ rules across 8 categories, prioritized by impact from critical (eliminating waterfalls, ... | openai-build-week | .agents/skills/vercel-react-best-practices/metadata.json | JSON | c4e18bac3290fbe1b471a605867d4df68b03144ea26b8befdbe8f9d8fd124354 | 0 | 242 |
# React Best Practices
A structured repository for creating and maintaining React Best Practices optimized for agents and LLMs.
## Structure
- `rules/` - Individual rule files (one per rule)
- `_sections.md` - Section metadata (titles, impacts, descriptions)
- `_template.md` - Template for creating new rules
-... | openai-build-week | .agents/skills/vercel-react-best-practices/README.md | Markdown | 9eafb2123d3b8b2aef41fba0db2648a3f4f49996f8c7c8bb2c86263befd8b48a | 0 | 806 |
---
name: vercel-react-best-practices
description: React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data... | openai-build-week | .agents/skills/vercel-react-best-practices/SKILL.md | Markdown | 7e3099b5227398da1e704071f864216053fe7c54b3a8f4025ffc8478a9186bdf | 0 | 896 |
- `client-localstorage-schema` - Version and minimize localStorage data
### 5. Re-render Optimization (MEDIUM)
- `rerender-defer-reads` - Don't subscribe to state only used in callbacks
- `rerender-memo` - Extract expensive work into memoized components
- `rerender-memo-with-default-value` - Hoist default non-primiti... | openai-build-week | .agents/skills/vercel-react-best-practices/SKILL.md | Markdown | f22bef4d2c209f5dfa70dbb40bb7f41dbb9d9841ec8c3a66b3267af08e5e929a | 1 | 875 |
# 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 add... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/_sections.md | Markdown | 01c59969e4e867f0708c8f8ef9c6d87fab9a07d0586244f429ff84013db8a115 | 0 | 339 |
---
title: Rule Title Here
impact: MEDIUM
impactDescription: Optional description of impact (e.g., "20-50% improvement")
tags: tag1, tag2
---
## Rule Title Here
**Impact: MEDIUM (optional impact description)**
Brief explanation of the rule and why it matters. This should be clear and concise, explaining the performa... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/_template.md | Markdown | 99df2a3ea088c6c22de2484ddc7e964d0e9923846f44c63380343ecc64455442 | 0 | 162 |
---
title: Do Not Put Effect Events in Dependency Arrays
impact: LOW
impactDescription: avoids unnecessary effect re-runs and lint errors
tags: advanced, hooks, useEffectEvent, dependencies, effects
---
## Do Not Put Effect Events in Dependency Arrays
Effect Event functions do not have a stable identity. Their identi... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/advanced-effect-event-deps.md | Markdown | 55ed8f9f27a1bff803d6fa55828176207714b02123cbb97ddb8a90d88024a723 | 0 | 386 |
---
title: Store Event Handlers in Refs
impact: LOW
impactDescription: stable subscriptions
tags: advanced, hooks, refs, event-handlers, optimization
---
## Store Event Handlers in Refs
Store callbacks in refs when used in effects that shouldn't re-subscribe on callback changes.
**Incorrect (re-subscribes on every r... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md | Markdown | a3097edeecfb2ff6851cd66ed8cdf0617c3c88180504bee824aa6e75a215bbbc | 0 | 362 |
---
title: Initialize App Once, Not Per Mount
impact: LOW-MEDIUM
impactDescription: avoids duplicate init in development
tags: initialization, useEffect, app-startup, side-effects
---
## Initialize App Once, Not Per Mount
Do not put app-wide initialization that must run once per app load inside `useEffect([])` of a c... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/advanced-init-once.md | Markdown | 3e4dc22173eb0e2b6dcf583e3babd862b8696328f8f59aee7c4d746c5bc05f6c | 0 | 252 |
---
title: useEffectEvent for Stable Callback Refs
impact: LOW
impactDescription: prevents effect re-runs
tags: advanced, hooks, useEffectEvent, refs, optimization
---
## useEffectEvent for Stable Callback Refs
Access latest values in callbacks without adding them to dependency arrays. Prevents effect re-runs while a... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md | Markdown | 8a3f64dfe5a77d1564248faf17fe662ae75b55d497a243cb30b38eb07ccbbf9a | 0 | 268 |
---
title: Prevent Waterfall Chains in API Routes
impact: CRITICAL
impactDescription: 2-10× improvement
tags: api-routes, server-actions, waterfalls, parallelization
---
## Prevent Waterfall Chains in API Routes
In API routes and Server Actions, start independent operations immediately, even if you don't await them y... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/async-api-routes.md | Markdown | 523338540d73427dc14c0cbb19f2741ebccdf8b105a7b2c1b33d2905cf237a42 | 0 | 249 |
---
title: Check Cheap Conditions Before Async Flags
impact: HIGH
impactDescription: avoids unnecessary async work when a synchronous guard already fails
tags: async, await, feature-flags, short-circuit, conditional
---
## Check Cheap Conditions Before Async Flags
When a branch uses `await` for a flag or remote value... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/async-cheap-condition-before-await.md | Markdown | 03107c1f70a293cd58a8abc5474c5548e20ea4efdf01b6d45aae7ad0ac1cb32c | 0 | 288 |
---
title: Defer Await Until Needed
impact: HIGH
impactDescription: avoids blocking unused code paths
tags: async, await, conditional, optimization
---
## Defer Await Until Needed
Move `await` operations into the branches where they're actually used to avoid blocking code paths that don't need them.
**Incorrect (blo... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/async-defer-await.md | Markdown | f3c142d090615abdcc99d31c123be37b31f0f1ed8d9ec9f7789a3bc6883ae0fb | 0 | 450 |
---
title: Dependency-Based Parallelization
impact: CRITICAL
impactDescription: 2-10× improvement
tags: async, parallelization, dependencies, better-all
---
## Dependency-Based Parallelization
For operations with partial dependencies, use `better-all` to maximize parallelism. It automatically starts each task at the ... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/async-dependencies.md | Markdown | 16ef469f877e30c6b8e1e1b4bc3e527312fa3c6318cb785a4eca186ea236131a | 0 | 323 |
---
title: Promise.all() for Independent Operations
impact: CRITICAL
impactDescription: 2-10× improvement
tags: async, parallelization, promises, waterfalls
---
## Promise.all() for Independent Operations
When async operations have no interdependencies, execute them concurrently using `Promise.all()`.
**Incorrect (s... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/async-parallel.md | Markdown | 6d2f841896279e976dfcdc1ac89e70771ac188baadfd43c096b5706cb838b961 | 0 | 155 |
---
title: Strategic Suspense Boundaries
impact: HIGH
impactDescription: faster initial paint
tags: async, suspense, streaming, layout-shift
---
## Strategic Suspense Boundaries
Instead of awaiting data in async components before returning JSX, use Suspense boundaries to show the wrapper UI faster while data loads.
... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md | Markdown | de05fedac2eb7ae563b887b5a424464ec3dfaf84e5b7797467ebe2a796ac8afc | 0 | 597 |
---
title: Prefer Statically Analyzable Paths
impact: HIGH
impactDescription: avoids accidental broad bundles and file traces
tags: bundle, nextjs, vite, webpack, rollup, esbuild, path
---
## Prefer Statically Analyzable Paths
Build tools work best when import and file-system paths are obvious at build time. If you h... | openai-build-week | .agents/skills/vercel-react-best-practices/rules/bundle-analyzable-paths.md | Markdown | 62090b5c815fd71bf1133dce754f51abc16a9456d0ccd025fd627de27726e92a | 0 | 644 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.