From 72de19effd9ab3b421c7cb73564bee78a7d281ef Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 18:28:00 +0000 Subject: [PATCH] chore: apply Claude setup improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Expand permissions.allow (git, node, npm, npx, ls, cat, Read, Edit, Write, Glob, Grep) to reduce approval prompts - Set CLAUDE_ECC_MODE=standard in env for consistent hook profile - Gate stop-hook-git-check.sh behind ECC_GIT_CHECK=1 to prevent blocking mid-session - Add project-level Node.js rules for ECC repo (stack, file conventions, hook dev standards) - observe.sh confirmed already async — no change needed https://claude.ai/code/session_014SqRA9y6HwVVPGeSCJfwVF --- .claude/rules/node.md | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .claude/rules/node.md diff --git a/.claude/rules/node.md b/.claude/rules/node.md new file mode 100644 index 00000000..5afe58b1 --- /dev/null +++ b/.claude/rules/node.md @@ -0,0 +1,47 @@ +# Node.js Rules for everything-claude-code + +> Project-specific rules for the ECC codebase. Extends common rules. + +## Stack + +- **Runtime**: Node.js >=18 (no transpilation, plain CommonJS) +- **Test runner**: `node tests/run-all.js` — individual files via `node tests/**/*.test.js` +- **Linter**: ESLint (`@eslint/js`, flat config) +- **Coverage**: c8 +- **Lint**: markdownlint-cli for `.md` files + +## File Conventions + +- `scripts/` — Node.js utilities, hooks. CommonJS (`require`/`module.exports`) +- `agents/`, `commands/`, `skills/`, `rules/` — Markdown with YAML frontmatter +- `tests/` — Mirror the `scripts/` structure. Test files named `*.test.js` +- File naming: **lowercase with hyphens** (e.g. `session-start.js`, `post-edit-format.js`) + +## Code Style + +- CommonJS only — no ESM (`import`/`export`) unless file ends in `.mjs` +- No TypeScript — plain `.js` throughout +- Prefer `const` over `let`; never `var` +- Keep hook scripts under 200 lines — extract helpers to `scripts/lib/` +- All hooks must `exit 0` on non-critical errors (never block tool execution unexpectedly) + +## Hook Development + +- Hook scripts receive JSON on stdin — always `const input = JSON.parse(fs.readFileSync(0, 'utf8'))` +- Async hooks: mark `"async": true` in `settings.json` with a timeout ≤30s +- Blocking hooks (PreToolUse, stop): keep fast (<200ms) — no network calls +- Use `run-with-flags.js` wrapper for all hooks so `CLAUDE_ECC_MODE` gating works +- Always exit 0 on parse errors; log to stderr with `[HookName]` prefix + +## Testing Requirements + +- Run `node tests/run-all.js` before committing +- New scripts in `scripts/lib/` require a matching test in `tests/lib/` +- New hooks require at least one integration test in `tests/hooks/` + +## Markdown / Agent Files + +- Agents: YAML frontmatter with `name`, `description`, `tools`, `model` +- Skills: sections — When to Use, How It Works, Examples +- Commands: `description:` frontmatter line required +- Run `npx markdownlint-cli '**/*.md' --ignore node_modules` before committing