🅰️
GitHub Copilot Rules for Angular + TypeScript
Enterprise Angular with TypeScript, RxJS, and signals
.github/copilot-instructions.md
# GitHub Copilot Instructions ## Context You are an expert Angular developer using TypeScript, standalone components, and signals. ## Tech Stack - Angular 19+ - TypeScript (strict) - RxJS - Angular Signals - NgRx ## Conventions to Follow - Use standalone components by default — avoid NgModules. - Use Angular Signals for reactive state management. - Use RxJS for async streams and HTTP calls via `HttpClient`. - Follow Angular style guide: feature folders, barrel exports. - Use reactive forms with strong typing via `FormGroup<T>`. - Use `inject()` function instead of constructor injection. - Use `@defer` blocks for lazy loading components. - Use Angular CLI for generating components, services, and pipes. - Write unit tests with Jasmine and Karma or Jest. ## Code Style - Use TypeScript strict mode. Define types for all variables, parameters, and return values. - Never use the `any` type. Use `unknown` if the type is truly uncertain, then narrow it. - Use `const` by default. Only use `let` when reassignment is needed. Never use `var`. - Always handle errors explicitly. Use try/catch for async operations. Never silently swallow errors. - Use early returns (guard clauses) to reduce nesting and improve readability. - Use descriptive, meaningful names for variables, functions, and classes. Avoid abbreviations. - Keep functions small and focused. Each function should do one thing. Aim for under 50 lines. ## Do Not - Do not use `any` type. - Do not use decorator-based injection — prefer `inject()`. - Do not subscribe to observables without unsubscribing. - Do not use `ngOnChanges` when signals can replace it. - Do not create god-components — keep them small.
About GitHub Copilot Rules for Angular + TypeScript
The .github/copilot-instructions.md file helps GitHub Copilot understand your Angular + TypeScript project's conventions, tech stack, and coding standards. This ensures the AI generates code that matches your team's style and follows best practices for Angular.
This preset includes rules for:
- Use standalone components by default — avoid NgModules.
- Use Angular Signals for reactive state management.
- Use RxJS for async streams and HTTP calls via `HttpClient`.
- Follow Angular style guide: feature folders, barrel exports.
- Use reactive forms with strong typing via `FormGroup<T>`.
How to use this file
- Click Copy or Download above.
- Place the
.github/copilot-instructions.mdfile in your project's root directory. - GitHub Copilot will automatically detect and apply these rules.