rfc-generator
БесплатноБез исполняемых скриптовНе проверенGenerates Request for Comments documents for technical proposals including problem statement, solution design, alternatives, risks, and rollout plans. Use for…
от patricio0312rev★ 64 звезды на GitHubОб этом скилле
RFC Generator
Create comprehensive technical proposals with RFCs.
RFC Template
# RFC-042: Implement Read Replicas for Analytics
**Status:** Draft | In Review | Accepted | Rejected | Implemented
**Author:** Alice ([email protected])
**Reviewers:** Bob, Charlie, David
**Created:** 2024-01-15
**Updated:** 2024-01-20
**Target Date:** Q1 2024
## Summary
Add PostgreSQL read replicas to separate analytical queries from transactional workload, improving database performance and enabling new analytics features.
## Problem Statement
### Current Situation
Our PostgreSQL database serves both transactional (OLTP) and analytical (OLAP) workloads:
- 1000 writes/min (checkout, orders, inventory)
- 5000 reads/min (user browsing, search)
- 500 analytics queries/min (dashboards, reports)
### Issues
1. **Performance degradation**: Analytics queries slow down transactions
2. **Resource contention**: Complex reports consume CPU/memory
3. **Blocking features**: Can't add more dashboards without impacting users
4. **Peak hour problems**: Analytics scheduled during business hours
### Impact
- Checkout p95 latency: 800ms (target: <300ms)
- Database CPU: 75% average, 95% peak
- Customer complaints about slow pages
- Product team blocked on analytics features
### Success Criteria
- Checkout latency <300ms p95
- Database CPU <50%
- Support 2x more analytics queries
- Zero impact on transactional performance
## Proposed Solution
### High-Level Design
┌─────────────┐ │ Primary │────────────────┐ │ (Write) │ │ └─────────────┘ │ ▼ ┌─────────────┐ │ Replica 1 │ │ (Read) │ └─────────────┘ ▼ ┌─────────────┐ │ Replica 2 │ │ (Analytics)│ └─────────────┘
### Architecture
1. **Primary database**: Handles all writes and critical reads
2. **Read Replica 1**: Serves user-facing read queries
3. **Read Replica 2**: Dedicated to analytics/reporting
### Routing Strategy
```typescript
const db = {
primary: primaryConnection,
read: replicaConnection,
analytics: analyticsConnection,
};
// Write
await db.primary.users.create(data);
// Critical read (always fresh)
await db.primary.users.findById(id);
// Non-critical read (can be slightly stale)
await db.read.products.search(query);
// Analytics
await db.analytics.orders.aggregate(pipeline);
Replication
- Type: Streaming replication
- Lag: <1 second for read replica, <5 seconds acceptable for analytics
- Monitoring: Alert if lag >5 seconds
Detailed Design
Database Configuration
# Primary
max_connections: 200
shared_buffers: 4GB
work_mem: 16MB
# Read Replica
max_connections: 100
shared_buffers: 8GB
work_mem: 32MB
# Analytics Replica
max_connections: 50
shared_buffers: 16GB
work_mem: 64MB
Connection Pooling
const pools = {
primary: new Pool({ max: 20, min: 5 }),
read: new Pool({ max: 50, min: 10 }),
analytics: new Pool({ max: 10, min: 2 }),
};
Query Classification
enum QueryType {
WRITE = "primary",
CRITICAL_READ = "primary",
READ = "read",
ANALYTICS = "analytics",
}
function route(queryType: QueryType) {
return pools[queryType];
}
Alternatives Considered
Alternative 1: Vertical Scaling
Approach: Upgrade to larger database instance
- Pros: Simple, no code changes
- Cons: Expensive ($500 → $2000/month), doesn't separate workloads, still hits limits
- Verdict: Rejected - doesn't solve isolation problem
Alternative 2: Separate Analytics Database
Approach: Copy data to dedicated analytics DB (e.g., ClickHouse)
- Pros: Optimal for analytics, no impact on primary
- Cons: Complex ETL pipeline, eventual consistency, high maintenance
- Verdict: Defer - consider for future if replicas insufficient
Alternative 3: Materialized Views
Approach: Pre-compute analytics results
- Pros: Fast queries, no replicas needed
- Cons: Limited to known queries, maintenance overhead
- Verdict: Complement to replicas, not replacement
Tradeoffs
What We're Optimizing For
- Performance isolation
- Cost efficiency
- Quick implementation
- Operational simplicity
What We're Sacrificing
- Slight data staleness (acceptable for analytics)
- Additional infrastructure complexity
- Higher operational costs
Risks & Mitigations
Risk 1: Replication Lag
Impact: Analytics sees stale data Probability: Medium Mitigation:
- Monitor lag continuously
- Alert if >5 seconds
- Document expected lag for users
Risk 2: Configuration Complexity
Impact: Routing errors, performance issues Probability: Low Mitigation:
- Comprehensive testing
- Gradual rollout
- Easy rollback mechanism
Risk 3: Cost Overrun
Impact: Budget exceeded Probability: Low Mitigation:
- Use smaller instance for analytics ($300/month)
- Monitor usage
- Right-size after 1 month
Rollout Plan
Phase 1: Setup (Week 1-2)
- Provision read replica 1
- Provision analytics repli
Установить rfc-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл rfc-generator?
Generates Request for Comments documents for technical proposals including problem statement, solution design, alternatives, risks, and rollout plans. Use for "RFC", "technical proposals", "design docs", or "architecture proposals".
Как установить скилл rfc-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rfc-generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic