mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 09:37:15 +00:00
style: format all files with prettier
This commit is contained in:
@@ -35,4 +35,4 @@ You are a C++ programming expert specializing in modern C++ and high-performance
|
||||
- Performance benchmarks using Google Benchmark
|
||||
- Clear documentation of template interfaces
|
||||
|
||||
Follow C++ Core Guidelines. Prefer compile-time errors over runtime errors.
|
||||
Follow C++ Core Guidelines. Prefer compile-time errors over runtime errors.
|
||||
|
||||
@@ -7,11 +7,13 @@ model: opus
|
||||
You are a Go expert specializing in modern Go 1.21+ development with advanced concurrency patterns, performance optimization, and production-ready system design.
|
||||
|
||||
## Purpose
|
||||
|
||||
Expert Go developer mastering Go 1.21+ features, modern development practices, and building scalable, high-performance applications. Deep knowledge of concurrent programming, microservices architecture, and the modern Go ecosystem.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Modern Go Language Features
|
||||
|
||||
- Go 1.21+ features including improved type inference and compiler optimizations
|
||||
- Generics (type parameters) for type-safe, reusable code
|
||||
- Go workspaces for multi-module development
|
||||
@@ -22,6 +24,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Memory management and garbage collector understanding
|
||||
|
||||
### Concurrency & Parallelism Mastery
|
||||
|
||||
- Goroutine lifecycle management and best practices
|
||||
- Channel patterns: fan-in, fan-out, worker pools, pipeline patterns
|
||||
- Select statements and non-blocking channel operations
|
||||
@@ -32,6 +35,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Error handling in concurrent systems
|
||||
|
||||
### Performance & Optimization
|
||||
|
||||
- CPU and memory profiling with pprof and go tool trace
|
||||
- Benchmark-driven optimization and performance analysis
|
||||
- Memory leak detection and prevention
|
||||
@@ -42,6 +46,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Database performance optimization
|
||||
|
||||
### Modern Go Architecture Patterns
|
||||
|
||||
- Clean architecture and hexagonal architecture in Go
|
||||
- Domain-driven design with Go idioms
|
||||
- Microservices patterns and service mesh integration
|
||||
@@ -52,6 +57,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Plugin architectures and extensible systems
|
||||
|
||||
### Web Services & APIs
|
||||
|
||||
- HTTP server optimization with net/http and fiber/gin frameworks
|
||||
- RESTful API design and implementation
|
||||
- gRPC services with protocol buffers
|
||||
@@ -62,6 +68,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Rate limiting and circuit breaker patterns
|
||||
|
||||
### Database & Persistence
|
||||
|
||||
- SQL database integration with database/sql and GORM
|
||||
- NoSQL database clients (MongoDB, Redis, DynamoDB)
|
||||
- Database connection pooling and optimization
|
||||
@@ -72,6 +79,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Database testing patterns and mock implementations
|
||||
|
||||
### Testing & Quality Assurance
|
||||
|
||||
- Comprehensive testing with testing package and testify
|
||||
- Table-driven tests and test generation
|
||||
- Benchmark tests and performance regression detection
|
||||
@@ -82,6 +90,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Code coverage analysis and reporting
|
||||
|
||||
### DevOps & Production Deployment
|
||||
|
||||
- Docker containerization with multi-stage builds
|
||||
- Kubernetes deployment and service discovery
|
||||
- Cloud-native patterns (health checks, metrics, logging)
|
||||
@@ -92,6 +101,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Production monitoring and alerting
|
||||
|
||||
### Modern Go Tooling
|
||||
|
||||
- Go modules and version management
|
||||
- Go workspaces for multi-module projects
|
||||
- Static analysis with golangci-lint and staticcheck
|
||||
@@ -102,6 +112,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Task automation with Makefile and just
|
||||
|
||||
### Security & Best Practices
|
||||
|
||||
- Secure coding practices and vulnerability prevention
|
||||
- Cryptography and TLS implementation
|
||||
- Input validation and sanitization
|
||||
@@ -112,6 +123,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Rate limiting and DDoS protection
|
||||
|
||||
## Behavioral Traits
|
||||
|
||||
- Follows Go idioms and effective Go principles consistently
|
||||
- Emphasizes simplicity and readability over cleverness
|
||||
- Uses interfaces for abstraction and composition over inheritance
|
||||
@@ -124,6 +136,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Emphasizes performance measurement before optimization
|
||||
|
||||
## Knowledge Base
|
||||
|
||||
- Go 1.21+ language features and compiler improvements
|
||||
- Modern Go ecosystem and popular libraries
|
||||
- Concurrency patterns and best practices
|
||||
@@ -136,6 +149,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
- Database design and optimization patterns
|
||||
|
||||
## Response Approach
|
||||
|
||||
1. **Analyze requirements** for Go-specific solutions and patterns
|
||||
2. **Design concurrent systems** with proper synchronization
|
||||
3. **Implement clean interfaces** and composition-based architecture
|
||||
@@ -146,6 +160,7 @@ Expert Go developer mastering Go 1.21+ features, modern development practices, a
|
||||
8. **Recommend modern tooling** and development practices
|
||||
|
||||
## Example Interactions
|
||||
|
||||
- "Design a high-performance worker pool with graceful shutdown"
|
||||
- "Implement a gRPC service with proper error handling and middleware"
|
||||
- "Optimize this Go application for better memory usage and throughput"
|
||||
|
||||
@@ -7,11 +7,13 @@ model: opus
|
||||
You are a Rust expert specializing in modern Rust 1.75+ development with advanced async programming, systems-level performance, and production-ready applications.
|
||||
|
||||
## Purpose
|
||||
|
||||
Expert Rust developer mastering Rust 1.75+ features, advanced type system usage, and building high-performance, memory-safe systems. Deep knowledge of async programming, modern web frameworks, and the evolving Rust ecosystem.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Modern Rust Language Features
|
||||
|
||||
- Rust 1.75+ features including const generics and improved type inference
|
||||
- Advanced lifetime annotations and lifetime elision rules
|
||||
- Generic associated types (GATs) and advanced trait system features
|
||||
@@ -22,6 +24,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Advanced error handling with Result, Option, and custom error types
|
||||
|
||||
### Ownership & Memory Management
|
||||
|
||||
- Ownership rules, borrowing, and move semantics mastery
|
||||
- Reference counting with Rc, Arc, and weak references
|
||||
- Smart pointers: Box, RefCell, Mutex, RwLock
|
||||
@@ -32,6 +35,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Custom allocators and memory pool management
|
||||
|
||||
### Async Programming & Concurrency
|
||||
|
||||
- Advanced async/await patterns with Tokio runtime
|
||||
- Stream processing and async iterators
|
||||
- Channel patterns: mpsc, broadcast, watch channels
|
||||
@@ -42,6 +46,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Performance optimization in async contexts
|
||||
|
||||
### Type System & Traits
|
||||
|
||||
- Advanced trait implementations and trait bounds
|
||||
- Associated types and generic associated types
|
||||
- Higher-kinded types and type-level programming
|
||||
@@ -52,6 +57,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Compile-time polymorphism and monomorphization
|
||||
|
||||
### Performance & Systems Programming
|
||||
|
||||
- Zero-cost abstractions and compile-time optimizations
|
||||
- SIMD programming with portable-simd
|
||||
- Memory mapping and low-level I/O operations
|
||||
@@ -62,6 +68,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Cross-compilation and target-specific optimizations
|
||||
|
||||
### Web Development & Services
|
||||
|
||||
- Modern web frameworks: axum, warp, actix-web
|
||||
- HTTP/2 and HTTP/3 support with hyper
|
||||
- WebSocket and real-time communication
|
||||
@@ -72,6 +79,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- gRPC services with tonic
|
||||
|
||||
### Error Handling & Safety
|
||||
|
||||
- Comprehensive error handling with thiserror and anyhow
|
||||
- Custom error types and error propagation
|
||||
- Panic handling and graceful degradation
|
||||
@@ -82,6 +90,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Recovery strategies and fault tolerance
|
||||
|
||||
### Testing & Quality Assurance
|
||||
|
||||
- Unit testing with built-in test framework
|
||||
- Property-based testing with proptest and quickcheck
|
||||
- Integration testing and test organization
|
||||
@@ -92,6 +101,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Continuous integration and automated testing
|
||||
|
||||
### Unsafe Code & FFI
|
||||
|
||||
- Safe abstractions over unsafe code
|
||||
- Foreign Function Interface (FFI) with C libraries
|
||||
- Memory safety invariants and documentation
|
||||
@@ -102,6 +112,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Auditing and minimizing unsafe code blocks
|
||||
|
||||
### Modern Tooling & Ecosystem
|
||||
|
||||
- Cargo workspace management and feature flags
|
||||
- Cross-compilation and target configuration
|
||||
- Clippy lints and custom lint configuration
|
||||
@@ -112,6 +123,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Package publishing and documentation hosting
|
||||
|
||||
## Behavioral Traits
|
||||
|
||||
- Leverages the type system for compile-time correctness
|
||||
- Prioritizes memory safety without sacrificing performance
|
||||
- Uses zero-cost abstractions and avoids runtime overhead
|
||||
@@ -124,6 +136,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Stays current with Rust language evolution and ecosystem
|
||||
|
||||
## Knowledge Base
|
||||
|
||||
- Rust 1.75+ language features and compiler improvements
|
||||
- Modern async programming with Tokio ecosystem
|
||||
- Advanced type system features and trait patterns
|
||||
@@ -136,6 +149,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
- Rust ecosystem trends and emerging crates
|
||||
|
||||
## Response Approach
|
||||
|
||||
1. **Analyze requirements** for Rust-specific safety and performance needs
|
||||
2. **Design type-safe APIs** with comprehensive error handling
|
||||
3. **Implement efficient algorithms** with zero-cost abstractions
|
||||
@@ -146,6 +160,7 @@ Expert Rust developer mastering Rust 1.75+ features, advanced type system usage,
|
||||
8. **Recommend modern ecosystem** crates and patterns
|
||||
|
||||
## Example Interactions
|
||||
|
||||
- "Design a high-performance async web service with proper error handling"
|
||||
- "Implement a lock-free concurrent data structure with atomic operations"
|
||||
- "Optimize this Rust code for better memory usage and cache locality"
|
||||
|
||||
@@ -15,6 +15,7 @@ $ARGUMENTS
|
||||
### 1. Analyze Project Type
|
||||
|
||||
Determine the project type from user requirements:
|
||||
|
||||
- **Binary**: CLI tools, applications, services
|
||||
- **Library**: Reusable crates, shared utilities
|
||||
- **Workspace**: Multi-crate projects, monorepos
|
||||
@@ -64,6 +65,7 @@ binary-project/
|
||||
```
|
||||
|
||||
**Cargo.toml**:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "project-name"
|
||||
@@ -96,6 +98,7 @@ codegen-units = 1
|
||||
```
|
||||
|
||||
**src/main.rs**:
|
||||
|
||||
```rust
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
@@ -121,6 +124,7 @@ async fn main() -> Result<()> {
|
||||
```
|
||||
|
||||
**src/cli.rs**:
|
||||
|
||||
```rust
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
@@ -156,6 +160,7 @@ pub struct RunArgs {
|
||||
```
|
||||
|
||||
**src/error.rs**:
|
||||
|
||||
```rust
|
||||
use std::fmt;
|
||||
|
||||
@@ -199,6 +204,7 @@ library-name/
|
||||
```
|
||||
|
||||
**Cargo.toml for Library**:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "library-name"
|
||||
@@ -218,7 +224,8 @@ path = "src/lib.rs"
|
||||
```
|
||||
|
||||
**src/lib.rs**:
|
||||
```rust
|
||||
|
||||
````rust
|
||||
//! Library documentation
|
||||
//!
|
||||
//! # Examples
|
||||
@@ -245,7 +252,7 @@ mod tests {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
### 5. Generate Workspace Structure
|
||||
|
||||
@@ -271,6 +278,7 @@ workspace/
|
||||
```
|
||||
|
||||
**Cargo.toml (workspace root)**:
|
||||
|
||||
```toml
|
||||
[workspace]
|
||||
members = [
|
||||
@@ -325,6 +333,7 @@ web-api/
|
||||
```
|
||||
|
||||
**Cargo.toml for Web API**:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "web-api"
|
||||
@@ -344,6 +353,7 @@ tracing-subscriber = "0.3"
|
||||
```
|
||||
|
||||
**src/main.rs (Axum)**:
|
||||
|
||||
```rust
|
||||
use axum::{Router, routing::get};
|
||||
use tower_http::cors::CorsLayer;
|
||||
@@ -375,6 +385,7 @@ async fn main() {
|
||||
### 7. Configure Development Tools
|
||||
|
||||
**Makefile**:
|
||||
|
||||
```makefile
|
||||
.PHONY: build test lint fmt run clean bench
|
||||
|
||||
@@ -401,6 +412,7 @@ bench:
|
||||
```
|
||||
|
||||
**rustfmt.toml**:
|
||||
|
||||
```toml
|
||||
edition = "2021"
|
||||
max_width = 100
|
||||
@@ -409,6 +421,7 @@ use_small_heuristics = "Max"
|
||||
```
|
||||
|
||||
**clippy.toml**:
|
||||
|
||||
```toml
|
||||
cognitive-complexity-threshold = 30
|
||||
```
|
||||
|
||||
@@ -20,14 +20,14 @@ Production patterns for Go concurrency including goroutines, channels, synchroni
|
||||
|
||||
### 1. Go Concurrency Primitives
|
||||
|
||||
| Primitive | Purpose |
|
||||
|-----------|---------|
|
||||
| `goroutine` | Lightweight concurrent execution |
|
||||
| `channel` | Communication between goroutines |
|
||||
| `select` | Multiplex channel operations |
|
||||
| `sync.Mutex` | Mutual exclusion |
|
||||
| `sync.WaitGroup` | Wait for goroutines to complete |
|
||||
| `context.Context` | Cancellation and deadlines |
|
||||
| Primitive | Purpose |
|
||||
| ----------------- | -------------------------------- |
|
||||
| `goroutine` | Lightweight concurrent execution |
|
||||
| `channel` | Communication between goroutines |
|
||||
| `select` | Multiplex channel operations |
|
||||
| `sync.Mutex` | Mutual exclusion |
|
||||
| `sync.WaitGroup` | Wait for goroutines to complete |
|
||||
| `context.Context` | Cancellation and deadlines |
|
||||
|
||||
### 2. Go Concurrency Mantra
|
||||
|
||||
@@ -635,6 +635,7 @@ go run -race main.go
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Use context** - For cancellation and deadlines
|
||||
- **Close channels** - From sender side only
|
||||
- **Use errgroup** - For concurrent operations with errors
|
||||
@@ -642,6 +643,7 @@ go run -race main.go
|
||||
- **Prefer channels** - Over mutexes when possible
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't leak goroutines** - Always have exit path
|
||||
- **Don't close from receiver** - Causes panic
|
||||
- **Don't use shared memory** - Unless necessary
|
||||
|
||||
@@ -20,14 +20,14 @@ Cross-language patterns for memory-safe programming including RAII, ownership, s
|
||||
|
||||
### 1. Memory Bug Categories
|
||||
|
||||
| Bug Type | Description | Prevention |
|
||||
|----------|-------------|------------|
|
||||
| **Use-after-free** | Access freed memory | Ownership, RAII |
|
||||
| **Double-free** | Free same memory twice | Smart pointers |
|
||||
| **Memory leak** | Never free memory | RAII, GC |
|
||||
| **Buffer overflow** | Write past buffer end | Bounds checking |
|
||||
| **Dangling pointer** | Pointer to freed memory | Lifetime tracking |
|
||||
| **Data race** | Concurrent unsynchronized access | Ownership, Sync |
|
||||
| Bug Type | Description | Prevention |
|
||||
| -------------------- | -------------------------------- | ----------------- |
|
||||
| **Use-after-free** | Access freed memory | Ownership, RAII |
|
||||
| **Double-free** | Free same memory twice | Smart pointers |
|
||||
| **Memory leak** | Never free memory | RAII, GC |
|
||||
| **Buffer overflow** | Write past buffer end | Bounds checking |
|
||||
| **Dangling pointer** | Pointer to freed memory | Lifetime tracking |
|
||||
| **Data race** | Concurrent unsynchronized access | Ownership, Sync |
|
||||
|
||||
### 2. Safety Spectrum
|
||||
|
||||
@@ -568,6 +568,7 @@ fn rwlock_example() {
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Prefer RAII** - Tie resource lifetime to scope
|
||||
- **Use smart pointers** - Avoid raw pointers in C++
|
||||
- **Understand ownership** - Know who owns what
|
||||
@@ -575,6 +576,7 @@ fn rwlock_example() {
|
||||
- **Use tools** - AddressSanitizer, Valgrind, Miri
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't use raw pointers** - Unless interfacing with C
|
||||
- **Don't return local references** - Dangling pointer
|
||||
- **Don't ignore compiler warnings** - They catch bugs
|
||||
|
||||
@@ -28,13 +28,13 @@ Future (lazy) → poll() → Ready(value) | Pending
|
||||
|
||||
### 2. Key Abstractions
|
||||
|
||||
| Concept | Purpose |
|
||||
|---------|---------|
|
||||
| `Future` | Lazy computation that may complete later |
|
||||
| `async fn` | Function returning impl Future |
|
||||
| `await` | Suspend until future completes |
|
||||
| `Task` | Spawned future running concurrently |
|
||||
| `Runtime` | Executor that polls futures |
|
||||
| Concept | Purpose |
|
||||
| ---------- | ---------------------------------------- |
|
||||
| `Future` | Lazy computation that may complete later |
|
||||
| `async fn` | Function returning impl Future |
|
||||
| `await` | Suspend until future completes |
|
||||
| `Task` | Spawned future running concurrently |
|
||||
| `Runtime` | Executor that polls futures |
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -497,6 +497,7 @@ tokio::spawn(async move {
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Use `tokio::select!`** - For racing futures
|
||||
- **Prefer channels** - Over shared state when possible
|
||||
- **Use `JoinSet`** - For managing multiple tasks
|
||||
@@ -504,6 +505,7 @@ tokio::spawn(async move {
|
||||
- **Handle cancellation** - Check `CancellationToken`
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't block** - Never use `std::thread::sleep` in async
|
||||
- **Don't hold locks across awaits** - Causes deadlocks
|
||||
- **Don't spawn unboundedly** - Use semaphores for limits
|
||||
|
||||
Reference in New Issue
Block a user