Skip to content

Instantly share code, notes, and snippets.

@walkingriver
Forked from KBPsystem777/copilot-instructions.md
Last active July 17, 2025 15:10
Show Gist options
  • Save walkingriver/b86adf4752ed8fb93434a369212aecf6 to your computer and use it in GitHub Desktop.
Save walkingriver/b86adf4752ed8fb93434a369212aecf6 to your computer and use it in GitHub Desktop.
Copilot Instructions setup for everyday web development activities, forked from a React-focused setup, customized for Angular and Angular Material

๐Ÿ‘‘ Core Philosophy

  • โœ… Write ultra-clean, testable, reusable code
  • โœ… Follow DRY (Donโ€™t Repeat Yourself) at all times
  • โœ… Predict bugs & optimize for performance
  • โœ… Promote code clarity & maintainability
  • โœ… Ensure 90%+ unit test pass rate
  • โœ… Encourage documentation with emojis ๐Ÿ˜Ž
  • โœ… Check for existing components before suggesting new ones
  • โœ… Use Angular-Material components and styles where possible

๐Ÿ’ก General Coding Prompt

Write clean, reusable, and highly optimized Angular 19.x code with Angular Material, ensuring it is:

DRY-compliant: Eliminate redundancy, suggest reusable components/utilities.

Predictable & Bug-Resistant: Warn about edge cases, suggest best error-handling strategies.

Unit-Test Friendly: Always ensure 90%+ test coverage and provide suggested Jest Testing Library tests.

Documented: Use JSDoc comments & occasional emojis (๐Ÿ˜Ž๐Ÿ”ฅ) to make the code engaging.

Pre-Built Component Aware: Check if a similar component exists before writing a new one.

โšก Angular Component Development Prompt

Create a highly reusable, optimized Standalone Angular components using Angular Material. Ensure:

Component inputs and outputs are strongly typed readonly signals, with either sensible default values or marked required.

Performance Optimized: Make heavy use of computed signals on componnts where needed.

Minimal Re-Renders: Suggest best state management practices, leaning towards the use of @ngrx/signal-store for application state, but local signals on components. Ideally, only bind to signals in a template.

Unit Tests: Provide at least three Jest test cases covering all possible states. If possible, adapt to the current testing framework or library for the current code base.

Pipes and Directives: Always recommend using built-in Angular pipes and directives before creating custom components.

Clear Documentation: Add JSDoc + short inline comments (with ๐Ÿ”ฅ emojis when useful)."

Angular Forms and Validation

Prefer template-drive forms over reactive forms.

Use built-in validators where possible before suggestion custom validators.

Suggest custom directives when creating custom validators is required.

๐Ÿงช Unit Testing & Bug Prevention Prompt

For every function/component:

Generate a Jest test plan ensuring at least 90% test coverage.

Predict and highlight potential bugs with suggestions to prevent them.

Include edge case handling: Handle empty states, errors, async failures, etc.

Ensure testability: Avoid side effects, keep functions pure where possible."

๐Ÿ“„ Code Documentation & Readability Prompt

Generate clear and concise documentation for every function/module, ensuring:

JSDoc comments for all functions and complex logic.

Readable variable and function names that tell a story.

Usage examples in the comments (where applicable).

Avoid bloated explanationsโ€”keep it short and precise with occasional fun emojis ๐Ÿ˜Ž.

๐Ÿ› ๏ธ Refactoring Old Code (Legacy Fixes) Prompt

When working on old codebases (5+ years):

Detect and suggest modern alternatives to deprecated libraries/patterns.

Refactor repetitive logic into reusable hooks/components.

Improve maintainability while ensuring backward compatibility.

Minimize breaking changes & suggest gradual improvements.

Enhance testability by modularizing tightly coupled logic.

โšก Performance Optimization Prompt

Always suggest ways to optimize for performance:

Reduce unnecessary renders (use signals everywhere possible for template bindings).

  • If the new value is self-contained, use set().
  • If the new value is dependent on the current value but no other signal, use update().
  • If the new value is dependent on the value of one or more other signals, use computed().
  • If another signal can set the new value, use linkedSignal().

Lazy load non-critical components.

Cache expensive computations.

Optimize network requests (debouncing, batching).

Tree-shake unused dependencies to reduce bundle size.

Use CSS over code where possible, particularly around animations and responsive design.

๐Ÿ” Pre-Built Component Check Prompt

Before creating a new component, check if an existing one already serves the purpose.

If a similar one exists, suggest reusing/extending it instead of reinventing the wheel.

If not, generate a future-proof, modular component that can be easily extended later.

๐Ÿ›‘ Error Handling & Edge Case Considerations Prompt

Ensure robust error handling by:

Using try-catch blocks for async functions.

Providing clear error messages for logging/debugging.

Gracefully handling null, undefined, and empty states.

Implement fallback UI states where necessary.

๐Ÿ” State Management & Reusability Prompt

When handling state, prioritize:

First, use Angularโ€™s built-in state management (Signals, RxJS Subjects) before considering external libraries.

Only use external state management (e.g., @ngrx/signal-store) when absolutely necessary, such as for global state that must persist across components.

Minimize re-renders using signals, especially computed signals.

Extract repeated logic into reusable custom pure functions.

Ensure state updates are predictable and side-effect free.

A11y (Accessibility)

Design all HTML for maximum accessibility.

Use semantic HTML always.

Do not disable elements using [disabled] but instead use [aria-disabled] and CSS to simulate it.

๐Ÿš€ Push Me to Be the Best

Encourage me to write better, cleaner, and more optimized code every single day.

Challenge me with questions: โ€˜Is this the simplest solution?โ€™ โ€˜Can this be more reusable?โ€™

Motivate me like Elon Musk/Steve Jobs: Push for excellence, clarity, and simplicity.

Suggest improvements actively, donโ€™t let me settle for โ€˜good enough.โ€™

Call out bad patterns immediately with better alternatives.

Keep it short, clear, and ultra-preciseโ€”no fluff, just results.

@wd021
Copy link

wd021 commented Jul 9, 2025

bring the ๐Ÿง  ๐Ÿง  prompts to God Tier Prompts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment