Skip to content

Conversation

@kevwan
Copy link
Contributor

@kevwan kevwan commented Dec 6, 2025

Description

This PR enhances the file to provide AI coding agents with comprehensive knowledge about the go-zero framework's architecture, patterns, and conventions.

Changes

Architecture Overview

  • Added Gateway component documentation for API gateway functionality
  • Added MCP Server component for AI agent integration via SSE
  • Expanded core utilities documentation with specific categories:
    • Resilience: circuit breakers, rate limiters, adaptive load shedding
    • Storage: SQL with cache, Redis, MongoDB
    • Concurrency: MapReduce, worker pools, sync primitives
    • Observability: metrics, tracing, structured logging

Configuration Patterns

  • Documented the requirement to embed service.ServiceConf in all service configs
  • Added service modes documentation (dev/test/rt vs pre/pro)
  • Clarified impact of modes on system protections (load shedding, stats)

Framework Guidelines

  • REST API: Added middleware chain architecture with Append()/Prepend() methods
  • RPC: Documented p2c_ewma load balancing, health checks, and client configuration
  • Database: Explained cache-aside pattern with CachedConn and connection pooling details

Build Commands

  • Added comprehensive goctl code generation commands:
    • REST API generation
    • RPC service generation
    • Database model generation from SQL

New Section: Critical Architecture Patterns

  • Resilience Design Philosophy: Defense-in-depth approach with 4 protection layers
  • Middleware Chain Architecture: Composition patterns with code examples
  • Concurrency Patterns: MapReduce, Executors, and SingleFlight use cases

Benefits

These enhancements help AI coding agents:

  • Understand the "why" behind architectural decisions
  • Follow project-specific conventions that differ from common practices
  • Execute critical workflows (goctl commands) that aren't obvious from file inspection
  • Grasp integration points and cross-component communication patterns

Testing

  • Documentation changes only, no code modifications
  • Verified markdown formatting
  • Ensured all code examples use correct syntax

cc @kevwan

- Add comprehensive architecture overview including Gateway and MCP Server
- Document service configuration patterns with ServiceConf embedding
- Detail middleware chain architecture with Append/Prepend methods
- Explain resilience design philosophy (circuit breaker, load shedding, rate limiting)
- Add specific goctl code generation commands for REST, RPC, and models
- Document database caching patterns with CachedConn
- Include RPC load balancing details (p2c_ewma) and service discovery
- Add concurrency patterns (MapReduce, Executors, SingleFlight)
- Clarify service modes and their impact on system protections
Copilot AI review requested due to automatic review settings December 6, 2025 03:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR significantly enhances the Copilot instructions documentation to provide AI coding agents with comprehensive knowledge about go-zero's architecture, patterns, and conventions.

Key Changes:

  • Expanded architecture component descriptions with specific package paths and detailed functionality
  • Added new Gateway and MCP Server components documentation
  • Enhanced configuration patterns with service mode behavior and struct embedding guidelines
  • Documented critical architecture patterns including resilience design philosophy, middleware chain architecture, and concurrency patterns

@kevwan kevwan merged commit 918a7be into master Dec 6, 2025
5 checks passed
@kevwan kevwan deleted the docs/enhance-copilot-instructions branch December 6, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants