Files
oh-my-pi/packages/coding-agent/src/discovery/builtin-rules/ts-set-map.md
T
can1357 c101452bb5 refactor: restructured and condensed agent prompts and system instructions
- Refactored and condensed numerous system prompts, agent instructions, and tool documentation files across packages.
- Streamlined workflow rules, formatting constraints, and execution guidelines for improved clarity and brevity.
- Updated discovery rules, recommendation criteria, and syntax standards in prompt templates.
2026-08-12 01:48:14 +02:00

725 B

description, condition, scope, interruptMode
description condition scope interruptMode
Prefer Record<K, V> for small static literals; use Set/Map for anything dynamic \bnew\s+(Set|Map)\b tool:edit(**/*.{ts,tsx}), tool:write(**/*.{ts,tsx}) never

Small, static string-keyed lookup tables: Record<K, V> / Record<K, true>.

Set / Map: dynamic/non-string keys; runtime insertion/deletion; .size, .clear(), stable insertion order, or iterator APIs.

// Static literal → Record
const LABEL_BY_KIND: Record<string, string> = {
	text: "Text",
	json: "JSON",
	binary: "Binary",
};

// Dynamic membership → Set
const seen = new Set<string>();
for (const item of items) {
	if (seen.has(item.id)) continue;
	seen.add(item.id);
}