-
Notifications
You must be signed in to change notification settings - Fork 124
[TW-4564] Add AI Coding Assistant Configuration #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit adds configuration for Claude Code and OpenAI Codex CLI to
improve developer experience when using AI coding assistants with this
repository.
## Claude Code Configuration (.claude/)
### Core Files
- CLAUDE.md: Project guidance with quick start, architecture overview,
git restrictions, and slash command reference
- .claudeignore: Excludes build artifacts, dependencies, secrets, and
other AI agent files from Claude's context
### Automation & Safety
- settings.json: Pre-allowed permissions for common operations,
denied git write operations (commit/push/add)
- hooks/pre-tool-use.sh: Blocks dangerous commands, enforces 500-line
limit for new files, protects auto-generated files
- hooks/post-tool-use.sh: Auto-formats code with Prettier + ESLint
### Productivity Features
- 6 parallel search agents for fast codebase exploration
- 7 slash commands (/project:test, /project:build, /project:fix, etc.)
- 3 detailed guides (architecture, adding-resources, testing)
- 4 code templates for scaffolding new resources
## OpenAI Codex CLI Configuration (.codex/)
### Core Files
- AGENTS.md: Repository context, code patterns, project structure,
and conventions for Codex to understand the codebase
### Skills (.codex/skills/)
8 reusable task-specific skills:
- add-resource: Create new API resource with model, class, and tests
- add-endpoint: Add method to existing resource
- fix-typescript: Resolve TypeScript compilation errors
- fix-tests: Fix failing Jest tests
- fix-lint: Fix ESLint and Prettier issues
- add-query-params: Add query parameter support
- handle-binary: Implement binary/stream responses
- add-pagination: Add pagination support
## Build Configuration Updates
- .eslintignore: Exclude .claude/ from linting
- .prettierignore: Exclude .claude/ from formatting
- jest.config.js: Exclude .claude/ from test discovery
- .gitignore: Ignore /docs (not .claude/docs/), auto-generated
CLAUDE.md files in subdirectories
## Developer Experience
- Auto-formatting on every edit (Prettier + ESLint)
- Pre-allowed tools reduce permission prompts
- Git safety: Claude/Codex write code, developers handle commits
- New file size limit (500 lines) encourages modular code
- Templates and guides accelerate onboarding
## File Summary
New files: 35
- .claude/: 24 files (agents, commands, docs, hooks, shared, settings)
- .codex/: 8 files (skills)
- Root: 3 files (CLAUDE.md, AGENTS.md, Makefile, .claudeignore)
Modified files: 4
- .eslintignore, .gitignore, .prettierignore, jest.config.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| "command": "bash .claude/hooks/pre-tool-use.sh" | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-tool hook matcher prevents Edit/Write protections from running
High Severity
The PreToolUse hook is configured with "matcher": "Bash", meaning the pre-tool-use.sh script only executes for Bash commands. However, the script contains protection logic for Edit and Write tools (lines 30-52) that guards src/version.ts, src/models/index.ts, package-lock.json, .env files, and enforces the 500-line limit for new files. Since the hook never triggers for Edit/Write tools, these safety checks are dead code and the documented file protections don't actually work. The matcher needs to include Edit and Write tools.
Additional Locations (1)
|
|
||
| # Block npm publish without dry-run | ||
| echo "$CMD" | grep -qE 'npm\s+publish' && ! echo "$CMD" | grep -qE '--dry-run' && \ | ||
| block "BLOCKED: Use 'npm publish --dry-run' first." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-portable regex patterns fail on BSD grep
Medium Severity
The grep patterns on lines 18, 22, and 26 use \s to match whitespace, which is a Perl-compatible regex extension not supported by POSIX extended regex. On macOS with BSD grep, \s doesn't match whitespace characters, so the safety checks for blocking git write operations, dangerous rm commands, and npm publish will silently fail. Using [[:space:]] instead would be portable across both GNU and BSD grep.
| queryParams: { | ||
| limit: 10, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test template assertion missing required overrides property
Low Severity
The "with query params" test assertion is missing overrides: undefined in the expected call object. The resource template always passes overrides to _list() (even when undefined), and AGENTS.md explicitly shows assertions should include overrides: undefined when the caller doesn't provide it. Since Jest's toHaveBeenCalledWith performs exact matching, this test would fail when developers use the template because the actual call includes overrides: undefined but the assertion doesn't expect it.
Summary
This PR adds comprehensive configuration for Claude Code and OpenAI
Codex CLI to improve developer experience when using AI coding assistants
with the Nylas Node.js SDK repository.
What's Included
Claude Code Configuration (.claude/)
OpenAI Codex CLI Configuration (.codex/)
Features
Safety & Guardrails
• Git restrictions: AI cannot commit/push/add/merge/rebase/reset
• Protected files: src/version.ts, src/models/index.ts blocked
• Secret protection: .env* files blocked
• Dangerous commands: rm -rf, npm publish blocked
• File size limit: 500 lines max for new files
Automation
• Auto-formatting: Prettier + ESLint runs after every code edit
• Pre-allowed permissions: Common operations run without prompts
• Parallel search: 6 agents for fast codebase exploration
Productivity
Codex Skills
File Changes
New Files (35)
Modified Files (4)
Usage
For Claude Code Users
For Codex CLI Users
Testing
[x] make ci passes (358 tests)
[x] ESLint clean
[x] Prettier formatted
[x] All hooks functional
[x] Templates valid TypeScript (excluded from CI via ignore files)
Documentation
• Root CLAUDE.md provides quick reference
• Detailed guides in .claude/docs/ for deep dives
• AGENTS.md provides Codex with full repository context
• Skills provide step-by-step task guidance
Breaking Changes
None. This PR only adds new configuration files.
Checklist
[x] AI assistants cannot commit/push (user controls git)
[x] Secrets protected (.env* blocked)
[x] Auto-generated files protected
[x] Templates excluded from linting/testing
[x] No duplicate content between Claude and Codex configs
[x] CI passes
Note
Introduces AI assistant scaffolding and developer tooling without changing SDK runtime behavior.
.claude/(agents, commands, docs, templates, safety hooks, settings) andCLAUDE.mdfor Claude Code.codex/skills/andAGENTS.mdfor Codex task guidesMakefilewith build/test/lint/CI shortcuts.eslintignore,.prettierignore,.gitignore(include.claude/,/docs, local patterns)jest.config.js: ignore.claude/, add module mappers, ESM handling, setup filesNo changes to
src/logic; primarily configuration, docs, and developer experience improvements.Written by Cursor Bugbot for commit 70bbb81. This will update automatically on new commits. Configure here.