agentleFS
ihiteshguptaihiteshgupta/ClaudeSkills/skills/architecture/system-design/SKILL.md

system-design

Skill0 starsChanged 13 months agoMITView on GitHub

Expert in system architecture and design patterns. Use for designing scalable systems, microservices, distributed systems, and solution architecture.

35 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability, api-design and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 6 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 4 projects that use this

  • VercelSkill

    web-design-guidelines

    Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

    Also in 3 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 3 projects that use this

  • AWSSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 5 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Decorator: - Add behavior dynamically

    line 58
  2. Distinctive:

    Start Simple: - Don't over-engineer

    line 412
  3. Distinctive:

    Documentation: - Keep architecture docs updated

    line 417
  4. Distinctive:

    Cost Optimization: - Consider operational costs

    line 418

“Common” is measured: kept by at least 6 in 10 of the 27 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

System Design & Solution Architecture Expert

Purpose

Provide expert guidance on system architecture, design patterns, scalability, distributed systems, and comprehensive solution design for complex software systems.

When to Use This Skill

  • Designing new systems from scratch
  • Architecting microservices
  • Planning for scale and performance
  • Distributed systems design
  • Technology stack selection
  • System migration planning
  • Capacity planning
  • Architecture documentation

Core Design Principles

1. SOLID Principles

  • Single Responsibility Principle
  • Open/Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

2. Scalability Patterns

  • Horizontal Scaling (Scale Out)
  • Vertical Scaling (Scale Up)
  • Load Balancing
  • Caching Strategies
  • Database Sharding
  • Read Replicas
  • CDN for Static Assets

3. Reliability Patterns

  • Circuit Breaker
  • Retry with Exponential Backoff
  • Bulkhead Pattern
  • Health Checks
  • Graceful Degradation
  • Failover Mechanisms

4. Design Patterns

Creational Patterns

  • Singleton - Single instance
  • Factory - Object creation interface
  • Builder - Complex object construction
  • Prototype - Clone existing objects

Structural Patterns

  • Adapter - Interface compatibility
  • Decorator - Add behavior dynamically
  • Facade - Simplified interface
  • Proxy - Placeholder for another object

Behavioral Patterns

  • Observer - Event notification
  • Strategy - Interchangeable algorithms
  • Command - Encapsulate requests
  • State - Behavior based on state

System Design Process

1. Requirements Gathering

Functional Requirements:
- What features does the system need?
- What are the core user flows?
- What operations are most critical?

Non-Functional Requirements:
- Expected traffic (QPS, DAU, MAU)
- Data volume and growth
- Latency requirements (p50, p95, p99)
- Availability requirements (99.9%, 99.99%)
- Consistency requirements
- Security requirements

2. Capacity Planning

Calculate:
- Storage: Users × Data per user × Growth rate
- Bandwidth: Requests/sec × Average request size
- Memory: Cache size + Active sessions
- Compute: CPU/Memory per request × QPS

3. High-Level Design

Components:
1. Client Layer (Web, Mobile, Desktop)
2. Edge Layer (CDN, Load Balancer)
3. Application Layer (API Servers, Services)
4. Data Layer (Databases, Caches, Queues)
5. External Services (Payment, Email, SMS)

4. API Design

RESTful API Example:
GET    /api/v1/users
POST   /api/v1/users
GET    /api/v1/users/{id}
PUT    /api/v1/users/{id}
DELETE /api/v1/users/{id}

Consider:
- Versioning strategy
- Authentication/Authorization
- Rate limiting
- Pagination
- Error handling
- HATEOAS (optional)

5. Data Model Design

Considerations:
- Normalized vs Denormalized
- SQL vs NoSQL
- Partitioning strategy
- Indexing strategy
- Data retention policy
- Backup and recovery

Common System Designs

1. URL Shortener

Requirements:
- Shorten long URLs
- Redirect to original URL
- Track analytics
- Handle 100M URLs
- 100:1 read/write ratio

Design:
┌─────────┐      ┌──────────────┐      ┌──────────┐
│ Client  │─────▶│ Load Balancer│─────▶│ API Server│
└─────────┘      └──────────────┘      └─────┬────┘
                                             │
                        ┌────────────────────┼────────────┐
                        │                    │            │
                   ┌────▼────┐         ┌─────▼─────┐ ┌───▼────┐
                   │  Cache  │         │ Database  │ │Analytics│
                   │ (Redis) │         │(PostgreSQL│ │(ClickHouse)│
                   └─────────┘         └───────────┘ └────────┘

Key Design Decisions:
- Base62 encoding for short codes
- Redis for caching hot URLs
- PostgreSQL for persistence
- Separate analytics database
- Rate limiting per user

2. Social Media Feed

Requirements:
- Post creation and display
- Follow/unfollow users
- Timeline generation
- 500M users
- Sub-second feed load time

Design:
┌─────────┐     ┌──────────┐     ┌───────────┐
│ Mobile  │────▶│   CDN    │────▶│  API GW   │
└─────────┘     └──────────┘     └─────┬─────┘
                                       │
              ┌────────────────────────┼──────────────┐
              │                        │              │
        ┌─────▼─────┐          ┌──────▼──────┐  ┌────▼────┐
        │ User Svc  │          │  Post Svc   │  │Feed Svc │
        └─────┬─────┘          └──────┬──────┘  └────┬────┘
              │                       │              │
        ┌─────▼─────┐          ┌──────▼──────┐  ┌────▼────┐
        │ User DB   │          │  Post DB    │  │ Cache   │
        │(PostgreSQL│          │ (Cassandra) │  │(Redis)  │
        └───────────┘          └─────────────┘  └─────────┘

Key Design Decisions:
- Fan-out on write for small followings
- Fan-out on read for celebrities
- Cassandra for time-series data
- Redis for pre-computed feeds
- Separate microservices

3. E-Commerce Platform

Microservices Architecture:

┌────────────────────────────────────────────────────┐
│                   API Gateway                      │
└─────┬──────┬──────┬──────┬──────┬──────┬─────────┘
      │      │      │      │      │      │
   ┌──▼──┐┌──▼──┐┌──▼──┐┌──▼──┐┌──▼──┐┌──▼──┐
   │User ││Prod ││Cart ││Order││Pay  ││Inv  │
   │ Svc ││ Svc ││ Svc ││ Svc ││ Svc ││ Svc │
   └──┬──┘└──┬──┘└──┬──┘└──┬──┘└──┬──┘└──┬──┘
      │      │      │      │      │      │
   ┌──▼──────▼──────▼──────▼──────▼──────▼──┐
   │         Message Queue (RabbitMQ)       │
   └────────────────────────────────────────┘
      │      │      │      │      │      │
   ┌──▼──┐┌──▼──┐┌──▼──┐┌──▼──┐┌──▼──┐┌──▼──┐
   │User ││Prod ││Cart ││Order││Pay  ││Inv  │
   │ DB  ││ DB  ││Cache││ DB  ││Logs ││ DB  │
   └─────┘└─────┘└─────┘└─────┘└─────┘└─────┘

Event Flow:
1. User places order → OrderCreated event
2. Payment Service → PaymentProcessed event
3. Inventory Service → ItemsReserved event
4. Notification Service → OrderConfirmed email

Architecture Patterns

1. Microservices

Pros:

  • Independent deployment
  • Technology diversity
  • Scalability
  • Fault isolation

Cons:

  • Complexity
  • Distributed system challenges
  • Network latency
  • Data consistency

2. Event-Driven Architecture

Components:

  • Event Producers
  • Event Bus (Kafka, RabbitMQ)
  • Event Consumers
  • Event Store

Benefits:

  • Loose coupling
  • Asynchronous processing
  • Scalability
  • Audit trail

3. CQRS (Command Query Responsibility Segregation)

Write Side:              Read Side:
┌─────────┐             ┌─────────┐
│ Command │             │  Query  │
│ Handler │             │ Handler │
└────┬────┘             └────┬────┘
     │                       │
┌────▼────┐             ┌────▼────┐
│ Write   │   Events    │  Read   │
│  DB     │────────────▶│  DB     │
└─────────┘             └─────────┘

4. Hexagonal Architecture (Ports & Adapters)

        ┌──────────────────────┐
        │   Application Core   │
        │   (Business Logic)   │
        └──────────┬───────────┘
                   │
        ┌──────────┴───────────┐
        │                      │
   ┌────▼────┐           ┌────▼────┐
   │  Ports  │           │  Ports  │
   │  (API)  │           │  (SPI)  │
   └────┬────┘           └────┬────┘
        │                     │
   ┌────▼────┐           ┌────▼────┐
   │Adapters │           │Adapters │
   │(HTTP,   │           │(DB,     │
   │ gRPC)   │           │ Queue)  │
   └─────────┘           └─────────┘

Database Selection Guide

SQL (PostgreSQL, MySQL)

Use When:

  • ACID compliance required
  • Complex joins and relationships
  • Data integrity is critical
  • Well-defined schema

NoSQL Document (MongoDB)

Use When:

  • Flexible schema
  • Hierarchical data
  • Rapid development
  • Horizontal scaling

NoSQL Key-Value (Redis, DynamoDB)

Use When:

  • Simple key-based lookups
  • Caching
  • Session storage
  • High-speed access

NoSQL Wide-Column (Cassandra, HBase)

Use When:

  • Time-series data
  • Write-heavy workloads
  • Massive scale
  • High availability

NoSQL Graph (Neo4j)

Use When:

  • Relationship-heavy data
  • Social networks
  • Recommendation engines
  • Fraud detection

Performance Optimization

Caching Strategies

1. Cache-Aside (Lazy Loading)
   - App checks cache first
   - On miss, load from DB and cache
   - Use for: Read-heavy workloads

2. Write-Through
   - Write to cache and DB together
   - Use for: Data consistency

3. Write-Behind
   - Write to cache first, DB later
   - Use for: Write-heavy workloads

4. Refresh-Ahead
   - Proactively refresh cache
   - Use for: Predictable access patterns

CDN Strategy

  • Static assets (images, CSS, JS)
  • Geographic distribution
  • Edge caching
  • Reduced origin server load

Database Optimization

  • Proper indexing
  • Query optimization
  • Connection pooling
  • Read replicas
  • Partitioning/Sharding

Security Considerations

  1. Authentication & Authorization
    • JWT tokens
    • OAuth 2.0
    • Role-based access control (RBAC)
    • Principle of least privilege
  2. Data Protection
    • Encryption at rest
    • Encryption in transit (TLS)
    • Sensitive data masking
    • PII compliance
  3. API Security
    • Rate limiting
    • Input validation
    • CORS configuration
    • API keys/tokens
  4. Infrastructure Security
    • Network segmentation
    • Firewalls
    • DDoS protection
    • Security groups

Monitoring & Observability

The Three Pillars

  1. Metrics
    • Response time (p50, p95, p99)
    • Error rate
    • Request rate
    • Resource utilization
  2. Logs
    • Structured logging
    • Centralized logging (ELK)
    • Log levels
    • Correlation IDs
  3. Traces
    • Distributed tracing
    • Request flow visualization
    • Bottleneck identification
    • Service dependencies

Best Practices

  1. Start Simple - Don't over-engineer
  2. Design for Failure - Assume components will fail
  3. Eventual Consistency - Accept when appropriate
  4. Idempotency - Make operations repeatable safely
  5. API Versioning - Plan for changes
  6. Documentation - Keep architecture docs updated
  7. Cost Optimization - Consider operational costs
  8. Testing Strategy - Unit, integration, E2E tests

Architecture Decision Records (ADR)

Template:

# ADR-001: Use PostgreSQL for Primary Database

## Status
Accepted

## Context
We need a reliable database for our e-commerce platform
handling transactions and user data.

## Decision
We will use PostgreSQL as our primary database.

## Consequences
Pros:
- ACID compliance
- Strong consistency
- Mature ecosystem

Cons:
- Vertical scaling limits
- Complex sharding setup

## Alternatives Considered
- MongoDB - rejected due to consistency requirements
- MySQL - rejected due to PostgreSQL's better JSON support

This skill ensures well-architected, scalable, and maintainable systems designed for long-term success.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.