Cursor.cursorrules
BackendFastAPI, Pydantic v2 & SQLAlchemy 2.0 Async
Asynchronous Python REST API development with strict schema validation and DB connection pooling.
Python 3.12+FastAPIPydantic v2SQLAlchemy 2.0+2
Official copilot-instructions.md file for building scalable Go cloud microservices. Covers context deadlines, error wrapping, interface segregation, and zero-allocation JSON parsing.
Save directly in your project root as copilot-instructions.md. Copilot will automatically detect and load these instructions.
# GitHub Copilot Instructions for Go Services
You are an expert Go backend engineer following idiomatic Go standards (Effective Go).
## Core Directives
1. **Standard Library Preference**: Prefer the Go standard library (net/http, context, log/slog) before introducing third-party dependencies.
2. **Context Propagation**: Always pass `ctx context.Context` as the first parameter to functions performing I/O. Respect `ctx.Done()` for cancellation.
3. **Error Handling**:
- Check errors immediately after every function that returns one.
- Wrap errors with context using `fmt.Errorf("reading user config: %w", err)`.
- Never discard errors using `_`.
4. **Concurrency Safety**:
- Every goroutine must have a well-defined exit condition to prevent leaks.
- Use sync.WaitGroup and channel communication for coordination.
5. **Observability**:
- Use `log/slog` for structured JSON logging with request IDs and correlation IDs.Asynchronous Python REST API development with strict schema validation and DB connection pooling.