mianshi_skill

Explain Go concurrency, distributed transactions, and database optimization patterns.

Updated Aug 21, 2025
One-click install
npx skills add https://github.com/kuihuar/ai --skill mianshi-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mianshi_skill
Source: https://github.com/kuihuar/ai/tree/main/x/md/mianshi_skill
Command: npx skills add https://github.com/kuihuar/ai --skill mianshi-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps you understand and implement advanced concurrency patterns, distributed transaction strategies, and efficient data handling in Go, crucial for building robust and scalable applications.

Core Features & Use Cases

  • Concurrency Patterns: Learn about Goroutines, Channels, Mutexes, RWMutexes, Atomic operations, and Worker Pools.
  • Distributed Transactions: Explore 2PC, 3PC, TCC, Saga, and message-driven approaches.
  • Database & Cache Optimization: Understand strategies for handling hot keys, large keys, and optimizing MySQL transactions.
  • Context & Tracing: Implement context propagation, timeouts, cancellations, and distributed tracing.

Quick Start

Explore the concurrent safe counter implementation by running the UseCounter function.

Frequently Asked Questions about mianshi_skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement distributed transactions in Go using Saga or TCC patterns?

Worker pools in Go manage task distribution across a fixed number of Goroutines using channels to limit resource consumption. They process tasks concurrently by sending jobs into a channel consumed by the worker pool.

What is the best way to handle Redis hot keys and big keys in distributed systems?

Handling Redis hot keys and big keys requires splitting large values into smaller chunks and distributing read traffic across replicas. This prevents memory skew and avoids single-node bottlenecks in distributed cache layers.

How do I prevent MySQL deadlocks when managing concurrent transactions?

Preventing MySQL deadlocks involves keeping transactions small, accessing tables and rows in a consistent order, and using appropriate isolation levels. This minimizes lock contention and avoids resource wait cycles.

When should I use mutexes versus atomic operations for Go concurrency?

Use mutexes for protecting complex critical sections and atomic operations for single-variable state counters. Atomic operations provide low-level memory safety without locking overhead, while RWMutexes allow concurrent reads.

Can I implement context propagation and distributed tracing within Goroutines?

Context propagation passes timeouts and cancellation signals down through Goroutine call trees. Distributed tracing tracks context across service boundaries, ensuring concurrent operations halt cleanly when parent processes cancel.