CopilotHub
SearchPromptsInstructionsAgentsToolsMCPs
  1. Home
  2. Instructions
  3. Angular Development Instructions
Back to Instructions

Angular Development Instructions

Coding standards for angular.instructions

typescript
react
1 downloads
48 views
0

Tags

testing
security
performance
accessibility
best-practices
documentation
error-handling
async
api

Related Instructions

View all →

Python Docstring Standards

*.py

Write clear and consistent Python docstrings

python
python
documentation
+1
1
117

API Route Security

app/api/**/*.ts

Security best practices for Next.js API routes

typescript
nextjs
security
api
+2
0
113

TypeScript Error Handling

*.ts

Comprehensive error handling patterns for TypeScript applications

typescript
typescript
error-handling
+1
0
101

React Component Best Practices

*.tsx

Guidelines for creating maintainable and performant React components

typescript
react
react
typescript
+2
0
116

WordPress Development — Copilot Instructions

Coding standards for wordpress.instructions

typescript
testing
security
+5
1
185

VueJS 3 Development Instructions

Coding standards for vuejs3.instructions

typescript
react
testing
security
+6
0
157
Browse More Instructions

CopilotHub

A curated collection of prompts, instructions, agents, and tools for AI-powered development.

Quick Links

  • Prompts
  • Instructions
  • Agents
  • Tools
  • MCPs
  • Search

Browse by Category

  • Code Generation
  • Debugging
  • Documentation
  • Refactoring
  • Testing
  • Security

Legal

  • Guidelines
  • About
  • Privacy Policy
  • Terms of Service

Community

GitHub

© 2026 CopilotHub.

Angular Development Instructions

Instructions for generating high-quality Angular applications with TypeScript, using Angular Signals for state management, adhering to Angular best practices as outlined at Visit angular.dev.

Project Context

  • Latest Angular version (use standalone components by default)
  • TypeScript for type safety
  • Angular CLI for project setup and scaffolding
  • Follow Angular Style Guide (Visit angular.dev)
  • Use Angular Material or other modern UI libraries for consistent styling (if specified)

Development Standards

Architecture

  • Use standalone components unless modules are explicitly required
  • Organize code by standalone feature modules or domains for scalability
  • Implement lazy loading for feature modules to optimize performance
  • Use Angular's built-in dependency injection system effectively
  • Structure components with a clear separation of concerns (smart vs. presentational components)

TypeScript

  • Enable strict mode in tsconfig.json for type safety
  • Define clear interfaces and types for components, services, and models
  • Use type guards and union types for robust type checking
  • Implement proper error handling with RxJS operators (e.g., catchError)
  • Use typed forms (e.g., FormGroup, FormControl) for reactive forms

Component Design

  • Follow Angular's component lifecycle hooks best practices
  • When using Angular >= 19, Use input() output(), viewChild(), viewChildren(), contentChild() and contentChildren() functions instead of decorators; otherwise use decorators
  • Leverage Angular's change detection strategy (default or OnPush for performance)
  • Keep templates clean and logic in component classes or services
  • Use Angular directives and pipes for reusable functionality

Styling

  • Use Angular's component-level CSS encapsulation (default: ViewEncapsulation.Emulated)
  • Prefer SCSS for styling with consistent theming
  • Implement responsive design using CSS Grid, Flexbox, or Angular CDK Layout utilities
  • Follow Angular Material's theming guidelines if used
  • Maintain accessibility (a11y) with ARIA attributes and semantic HTML

State Management

  • Use Angular Signals for reactive state management in components and services
  • Leverage signal(), computed(), and effect() for reactive state updates
  • Use writable signals for mutable state and computed signals for derived state
  • Handle loading and error states with signals and proper UI feedback
  • Use Angular's AsyncPipe to handle observables in templates when combining signals with RxJS

Data Fetching

  • Use Angular's HttpClient for API calls with proper typing
  • Implement RxJS operators for data transformation and error handling
  • Use Angular's inject() function for dependency injection in standalone components
  • Implement caching strategies (e.g., shareReplay for observables)
  • Store API response data in signals for reactive updates
  • Handle API errors with global interceptors for consistent error handling

Security

  • Sanitize user inputs using Angular's built-in sanitization
  • Implement route guards for authentication and authorization
  • Use Angular's HttpInterceptor for CSRF protection and API authentication headers
  • Validate form inputs with Angular's reactive forms and custom validators
  • Follow Angular's security best practices (e.g., avoid direct DOM manipulation)

Performance

  • Enable production builds with ng build --prod for optimization
  • Use lazy loading for routes to reduce initial bundle size
  • Optimize change detection with OnPush strategy and signals for fine-grained reactivity
  • Use trackBy in ngFor loops to improve rendering performance
  • Implement server-side rendering (SSR) or static site generation (SSG) with Angular Universal (if specified)

Testing

  • Write unit tests for components, services, and pipes using Jasmine and Karma
  • Use Angular's TestBed for component testing with mocked dependencies
  • Test signal-based state updates using Angular's testing utilities
  • Write end-to-end tests with Cypress or Playwright (if specified)
  • Mock HTTP requests using provideHttpClientTesting
  • Ensure high test coverage for critical functionality

Implementation Process

  1. Plan project structure and feature modules
  2. Define TypeScript interfaces and models
  3. Scaffold components, services, and pipes using Angular CLI
  4. Implement data services and API integrations with signal-based state
  5. Build reusable components with clear inputs and outputs
  6. Add reactive forms and validation
  7. Apply styling with SCSS and responsive design
  8. Implement lazy-loaded routes and guards
  9. Add error handling and loading states using signals
  10. Write unit and end-to-end tests
  11. Optimize performance and bundle size

Additional Guidelines

  • Follow the Angular Style Guide for file naming conventions (see Visit angular.dev), e.g., use feature.ts for components and feature-service.ts for services. For legacy codebases, maintain consistency with existing pattern.
  • Use Angular CLI commands for generating boilerplate code
  • Document components and services with clear JSDoc comments
  • Ensure accessibility compliance (WCAG 2.1) where applicable
  • Use Angular's built-in i18n for internationalization (if specified)
  • Keep code DRY by creating reusable utilities and shared modules
  • Use signals consistently for state management to ensure reactive updates