Github Copilot Instructions
# GitHub Copilot Instructions - Spring Boot 3.5 & Java 21
## Project Context
This project uses **Spring Boot 3.5** and **Java 21** for production-level enterprise applications.
Focus: **Maintainability**, **Memory Efficiency**, and **Performance**.
## Best Practices References
Follow these topic-specific guidelines for code generation:
### Core Java & OOP
- [OOP Principles](./copilot-rules/oop-principles.md) - SOLID, encapsulation, sealed classes
- [Collections](./copilot-rules/collections.md) - List, Set, Map usage and optimization
- [Streams & Lambdas](./copilot-rules/streams-lambdas.md) - Functional programming patterns
- [Error Handling](./copilot-rules/error-handling.md) - Exception strategies
- [Concurrency](./copilot-rules/concurrency.md) - Thread safety, virtual threads, async patterns
- [Memory Management](./copilot-rules/memory-management.md) - Resource cleanup and optimization
- [Date & Time](./copilot-rules/date-time.md) - java.time API, timezones, formatting
### Spring Boot Specifics
- [Dependency Injection](./copilot-rules/dependency-injection.md) - Bean management and scopes
- [REST API Design](./copilot-rules/rest-api-design.md) - Controllers and endpoints
- [Data Access](./copilot-rules/data-access.md) - JPA, repositories, transactions
- [Transactions](./copilot-rules/transactions.md) - @Transactional, propagation, isolation, rollback
- [Configuration](./copilot-rules/configuration.md) - Properties, profiles, and externalized config
- [Security](./copilot-rules/security.md) - Authentication and authorization
- [Testing](./copilot-rules/testing.md) - Unit and integration tests
- [Observability](./copilot-rules/observability.md) - Logging, metrics, tracing
- [Resilience](./copilot-rules/resilience.md) - Circuit breakers, retries, timeouts, bulkheads
## General Guidelines
### Code Style
- Use Java 21 features: records, pattern matching, virtual threads, sequenced collections
- Prefer immutability: use `final` for variables and fields when possible
- Use meaningful names: avoid abbreviations, be descriptive
- Keep methods small: single responsibility, <20 lines preferred
- Use sealed classes/interfaces for controlled hierarchies
- Prefer `var` for local variables when type is obvious
### Java 21 Features to Usewhen to use it
Community prompt sourced from the open-source GitHub repo adnanhakim/copilot-instructions (MIT). A "Github Copilot Instructions" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
roleplaycommunitygeneral
source
adnanhakim/copilot-instructions · MIT