agentleFS
Use-TuskUse-Tusk/drift-node-sdk/.cursor/rules/general-gotchas.mdc

drift-node-sdk / rules

Cursor rule173 starsChanged 7 months agoApache-2.0View on GitHub

General gotchas to look for when reviewing code. Gotchas marked with "POTENTIAL BUG" have a high likelihood of causing a bug if not followed. Check for these gotchas in symbols that are being modified. If a potential gotcha exists in the code (but isn't being caused by the current changes), still mention it to improve code quality over time. IMPORTANT: When reviewing code, make sure to check for any logical bugs or flawed assumptions that could be introduced by the…

  • Reads credentials

We split this general-gotchas.mdc into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check for these gotchas in symbols that are being modified.

    line 8
  2. Very specific:

    Solution: Use OriginalGlobalUtils or create new original utilities to access uninstrumented versions:

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
general-gotchas.mdc
---
description:
globs:
alwaysApply: false
---

General gotchas to look for when reviewing code. Gotchas marked with "POTENTIAL BUG" have a high likelihood of causing a bug if not followed.
Check for these gotchas in symbols that are being modified. If a potential gotcha exists in the code (but isn't being caused by the current changes), still mention it to improve code quality over time.

**IMPORTANT: When reviewing code, make sure to check for any logical bugs or flawed assumptions that could be introduced by the changes (even if they are not listed below).**

## Instrumentation Self-Reference (POTENTIAL BUG)

**Problem**: Using instrumented global functions within the SDK's own instrumentation code can cause:

- Circular dependencies between instrumentation and utility modules
- Infinite recursion when instrumented code calls itself
- Incorrect behavior where SDK internals use mocked/replayed data instead of real data

**Examples of problematic code**:

```typescript
// BAD: Using potentially instrumented Date in logger
private formatMessage(message: string): string {
  const timestamp = new Date().toISOString(); // This Date might be instrumented!
  return `${timestamp} ${message}`;
}

// BAD: Using potentially instrumented env vars in SDK code
const config = process.env.API_KEY; // This might be mocked in replay mode!
```

**Solution**: Use `OriginalGlobalUtils` or create new original utilities to access uninstrumented versions:

```typescript
// GOOD: Using original Date for SDK internal logging
import { OriginalGlobalUtils } from '../utils/originalGlobalUtils';

private formatMessage(message: string): string {
  const timestamp = OriginalGlobalUtils.getOriginalDate().toISOString();
  return `${timestamp} ${message}`;
}

// GOOD: Using original process.env for SDK internal config
const config = OriginalGlobalUtils.getOriginalProcessEnvVar("API_KEY");
```

Download now (ZIP)

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.