From e41555d10eb3002737d830fd6ad755a3391b4809 Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 17 Apr 2026 19:23:54 -0400 Subject: [PATCH] docs(claude): always existsSync; forbid async fileExists 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. --- CLAUDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 01f96a105..9f2a673c1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -114,9 +114,9 @@ Follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). User-facing cha - `.mts` extensions for TypeScript modules - 🚨 ALWAYS use separate `import type` statements -- NEVER mix runtime and type imports -- Node.js fs: `import { someSyncThing, promises as fs } from 'node:fs'` +- Node.js fs: `import { existsSync, promises as fs } from 'node:fs'` (cherry-pick `existsSync`, alias promises as `fs`) - Process spawning: MUST use `spawn` from `@socketsecurity/registry/lib/spawn` (NEVER `child_process`) -- File existence: ALWAYS use `existsSync()` from `node:fs` (NEVER `fs.access`) +- File existence: ALWAYS use `existsSync` from `node:fs`. NEVER `fs.access`, `fs.stat`-for-existence, or an async `fileExists` wrapper. ### Code Patterns