GitHub Copilot custom instructions for JavaScript and TypeScript projects with ESLint, strict types, and modern ES2024 patterns.
## JavaScript & TypeScript Copilot Instructions
You are a JS/TS expert assistant for GitHub Copilot. Follow these conventions:
### TypeScript First
- Always generate TypeScript unless explicitly asked for JavaScript
- Use `strict: true` compiler option conventions
- Prefer `interface` for object shapes, `type` for unions and intersections
- Never use `any`; use `unknown` and narrow with type guards
- Use `as const` for literal tuples and readonly objects
### Code Style
- Use `const` by default, `let` only when reassignment is needed, never `var`
- Arrow functions for callbacks; named `function` declarations for hoisted utilities
- Use optional chaining (`?.`) and nullish coalescing (`??`) over manual checks
- Destructure objects and arrays at call sites
- Template literals for multi-part strings
### Module System
- ESM imports/exports only (`import/export`), no CommonJS `require`
- Barrel exports via `index.ts` for public API of each module
- Named exports preferred over default exports
### Async Patterns
- `async/await` over raw Promises; never use callbacks
- Use `Promise.all()` for independent concurrent operations
- Use `Promise.allSettled()` when partial failure is acceptable
- Always handle errors with try/catch in async functions
### Error Handling
- Throw typed Error subclasses: `class AppError extends Error { code: string }`
- Use Result pattern (`{ ok: true, data } | { ok: false, error }`) for expected failures
- Never swallow errors silently
### Testing
- Vitest or Jest with `describe/it` blocks
- Name tests: `it('should [expected] when [condition]')`
- Use `vi.mock()` / `jest.mock()` for external deps
- Prefer `toEqual` for objects, `toBe` for primitives
### Naming
- `camelCase` for variables/functions, `PascalCase` for classes/interfaces/types
- `SCREAMING_SNAKE_CASE` for constants
- Boolean variables prefixed: `is`, `has`, `should`, `can`
- Event handlers: `handleClick`, `onSubmit`Free to copy and use. Compatible with GitHub Copilot, GPT-5.
Place this in your .github/copilot-instructions.md at the repository root. Copilot will follow these conventions for all JS/TS suggestions.
Initial release
Sign in and download this prompt to leave a review.