Skip to content

docs(claude): always existsSync; forbid async fileExists#1228

Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom
claude/docs-existssync-rule
Apr 17, 2026
Merged

docs(claude): always existsSync; forbid async fileExists#1228
John-David Dalton (jdalton) merged 1 commit intomainfrom
claude/docs-existssync-rule

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 17, 2026

Summary

  • Tighten the fs import example in CLAUDE.md to the canonical form import { existsSync, promises as fs } from 'node:fs' (was someSyncThing placeholder).
  • Explicitly forbid async fileExists wrappers and fs.stat-for-existence checks in addition to fs.access.

Docs-only; no code changes. Keeps socket-cli's CLAUDE.md in sync with the shared rule being rolled out across the socket-* repos.

Test plan

  • pnpm run fix + pnpm run check passed via pre-commit hooks
  • Reviewer sanity-check the wording

Note

Low Risk
Low risk because this PR only updates guidance in CLAUDE.md with no runtime code changes. Risk is limited to potential developer confusion if teams were relying on the previously looser wording.

Overview
Clarifies the CLAUDE.md Node.js fs guidance by standardizing the import example to import { existsSync, promises as fs } from 'node:fs'.

Tightens the file-existence rule to explicitly forbid fs.access, fs.stat-for-existence checks, and any async fileExists wrapper in favor of using existsSync.

Reviewed by Cursor Bugbot for commit e41555d. Configure here.

Strengthen the File Organization rules:

- Tighten the fs import example to the canonical form
  `import { existsSync, promises as fs } from 'node:fs'` (was
  `someSyncThing` placeholder).
- Explicitly forbid async `fileExists` wrappers and
  `fs.stat`-for-existence checks in addition to `fs.access`.

No code changes.
@jdalton John-David Dalton (jdalton) merged commit 35e70d4 into main Apr 17, 2026
6 checks passed
@jdalton John-David Dalton (jdalton) deleted the claude/docs-existssync-rule branch April 17, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants