Skip to content

Commit 7252b94

Browse files
committed
Update claude.md
1 parent 2c12eb9 commit 7252b94

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

CLAUDE.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ You are a **Principal Software Engineer** responsible for:
4949
- **Update snapshots**: `pnpm test:unit -u` or `pnpm testu`
5050
- **Coverage report**: `pnpm test:unit:coverage`
5151

52+
### Cross-Platform Compatibility - CRITICAL: Windows and POSIX
53+
- **🚨 MANDATORY**: Tests and functionality MUST work on both POSIX (macOS/Linux) and Windows systems
54+
- **Path handling**: ALWAYS use `path.join()`, `path.resolve()`, `path.sep` for file paths
55+
- ❌ WRONG: `'/usr/local/bin/npm'` (hard-coded POSIX path)
56+
- ✅ CORRECT: `path.join(path.sep, 'usr', 'local', 'bin', 'npm')` (cross-platform)
57+
- ❌ WRONG: `'/project/package-lock.json'` (hard-coded forward slashes)
58+
- ✅ CORRECT: `path.join('project', 'package-lock.json')` (uses correct separator)
59+
- **Temp directories**: Use `os.tmpdir()` for temporary file paths in tests
60+
- ❌ WRONG: `'/tmp/test-project'` (POSIX-specific)
61+
- ✅ CORRECT: `path.join(os.tmpdir(), 'test-project')` (cross-platform)
62+
- **Path separators**: Never hard-code `/` or `\` in paths
63+
- Use `path.sep` when you need the separator character
64+
- Use `path.join()` to construct paths correctly
65+
- **File URLs**: Use `pathToFileURL()` and `fileURLToPath()` from `node:url` when working with file:// URLs
66+
- **Line endings**: Be aware of CRLF (Windows) vs LF (Unix) differences when processing text files
67+
- **Shell commands**: Consider platform differences in shell commands and utilities
68+
5269
### Git Commit Guidelines
5370
- **🚨 FORBIDDEN**: NEVER add Claude co-authorship or Claude signatures to commits
5471
- **🚨 FORBIDDEN**: Do NOT include "Generated with Claude Code" or similar AI attribution in commit messages
@@ -140,9 +157,19 @@ This is a JavaScript implementation of the Package URL (purl) specification for
140157
### 🏗️ Code Structure (CRITICAL PATTERNS)
141158
- **Error handling**: 🚨 REQUIRED - Use try-catch blocks and handle errors gracefully
142159
- **Array destructuring**: Use object notation `{ 0: key, 1: data }` instead of array destructuring `[key, data]`
143-
- **Comment periods**: 🚨 MANDATORY - ALL comments MUST end with periods. This includes single-line comments, multi-line comments, and inline comments. No exceptions.
144-
- **Comment placement**: Place comments on their own line, not to the right of code
145-
- **Comment formatting**: Use fewer hyphens/dashes and prefer commas, colons, or semicolons for better readability
160+
- **Comment formatting**: 🚨 MANDATORY - ALL comments MUST follow these rules:
161+
- **Periods required**: Every comment MUST end with a period, except ESLint disable comments and URLs which are directives/references. This includes single-line, multi-line, inline, and c8 ignore comments.
162+
- **Sentence structure**: Comments should be complete sentences with proper capitalization and grammar.
163+
- **Placement**: Place comments on their own line above the code they describe, not trailing to the right of code.
164+
- **Style**: Use fewer hyphens/dashes and prefer commas, colons, or semicolons for better readability.
165+
- **Examples**:
166+
- ✅ CORRECT: `// This function validates user input.`
167+
- ✅ CORRECT: `/* This is a multi-line comment that explains the complex logic below. */`
168+
- ✅ CORRECT: `// eslint-disable-next-line no-await-in-loop` (directive, no period)
169+
- ✅ CORRECT: `// See https://example.com/docs` (URL reference, no period)
170+
- ✅ CORRECT: `// c8 ignore start - Reason for ignoring.` (explanation has period)
171+
- ❌ WRONG: `// this validates input` (no period, not capitalized)
172+
- ❌ WRONG: `const x = 5 // some value` (trailing comment)
146173
- **Sorting**: 🚨 MANDATORY - Always sort lists, exports, and items alphabetically for consistency
147174
- **Await in loops**: When using `await` inside for-loops, add `// eslint-disable-next-line no-await-in-loop` when sequential processing is intentional
148175
- **If statement returns**: Never use single-line return if statements; always use proper block syntax with braces

0 commit comments

Comments
 (0)