Installable skillApache-2.0

Cache Property Access in Loops

reduces lookups

BY David-Li0406UPDATED Oct 28, 2026
INTENDED FOR✳Claude Code>_Codex↗Cursor◎ChatGPTInstall in a listed agent.

instructions.md

---
name: cache-property-access-in-loops-b7566c72c7ab
impact: LOW-MEDIUM
description: reduces lookups
tags: javascript, loops, optimization, caching
---

## Cache Property Access in Loops

Cache object property lookups in hot paths.

**Incorrect (3 lookups × N iterations):**

```typescript
for (let i = 0; i < arr.length; i++) {
  process(obj.config.settings.value)
}
```

**Correct (1 lookup total):**

```typescript
const value = obj.config.settings.value
const len = arr.length
for (let i = 0; i < len; i++) {
  process(value)
}
```
COMPATIBILITY & REFERENCES

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.