agentleFS
vndeevndee/engineering-skills/.claude/skills/system-design/SKILL.md

system-design

Skill3 starsChanged 9 months agoMITView on GitHub

Use when designing system architecture for a new project or major feature — service boundaries, data flow, API contracts, and technical trade-offs

35 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use web-design-guidelines, git-workflow and 8 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.
  • 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

  • OpenAISkill

    verification-before-completion

    Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

    Also in 3 projects that use this

  • SentrySkill

    security-review

    Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After product-spec, before scaffolding

    line 19
  2. Very specific:

    REQUIRED: Use data-model skill for detailed schema design.

    line 107
  3. Distinctive:

    Document every significant technical decision:

    line 111

“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

Overview

Design the architecture before writing code. Define service boundaries, data flow, API contracts, and infrastructure. Make trade-off decisions explicit.

Core principle: Architecture mistakes are 100x more expensive to fix than code mistakes. Think first, build second.

When to Use

  • Starting a new project or microservice
  • Adding a major feature that changes system boundaries
  • Scaling beyond current architecture
  • After product-spec, before scaffolding

Design Process

1. Requirements Extraction

From the product spec, extract:

## Technical Requirements

### Functional
- [What the system must do — derived from user stories]

### Non-Functional
- **Throughput:** [requests/sec, messages/sec]
- **Latency:** [p50, p95, p99 targets]
- **Availability:** [uptime target, e.g., 99.9%]
- **Data volume:** [storage growth rate, retention policy]
- **Consistency:** [strong vs eventual, where each applies]
- **Security:** [auth, encryption, compliance]

2. High-Level Architecture

Define the system components and how they interact:

## Architecture

### Components
- **API Gateway** — entry point, auth, rate limiting
- **Service A** — handles [domain area]
- **Service B** — handles [domain area]
- **Database** — PostgreSQL for [what data]
- **Cache** — Redis for [what purpose]
- **Queue** — [Redis Pub/Sub / NATS / Kafka] for [what events]

### Data Flow
[Client] → [API Gateway] → [Service] → [Database]
                                     → [Cache]
                                     → [Queue] → [Worker]

For most indie/startup projects, start as a modular monolith:

Single Go/Python service with clean architecture
  → Split into microservices only when you have a clear reason
  → Reasons: independent scaling, different team ownership, different deploy cadence

3. API Contract Design

Define the interface between components before implementing:

## API Contracts

### POST /api/v1/resources
Request: { field: type }
Response: { data: Resource }
Errors: 400 (validation), 401 (auth), 409 (conflict)

### GET /api/v1/resources?limit=20&offset=0
Response: { items: Resource[], pagination: { limit, offset, total } }

4. Data Model

High-level entity relationships:

## Data Model

### Entities
- User (id, email, name, role, created_at)
- Organization (id, name, plan, created_at)
- Membership (user_id, org_id, role)

### Relationships
- User → many Organizations (through Membership)
- Organization → many Users (through Membership)

### Indexes
- users: email (unique), org_id
- memberships: (user_id, org_id) unique, org_id

REQUIRED: Use data-model skill for detailed schema design.

5. Trade-Off Decisions

Document every significant technical decision:

## Trade-Offs

### Decision: Monolith vs Microservices
- **Chose:** Modular monolith
- **Why:** Team of 1-3, single deploy pipeline, shared database is fine at current scale
- **Revisit when:** Service needs independent scaling or different team owns a domain

### Decision: PostgreSQL vs [alternative]
- **Chose:** PostgreSQL
- **Why:** ACID transactions, JSONB for flexible data, mature ecosystem
- **Trade-off:** Horizontal scaling harder than NoSQL (acceptable at our scale)

6. Infrastructure

## Infrastructure

### Local Development
- Docker Compose: API + Postgres + Redis
- Hot reload: air (Go) / uvicorn --reload (Python)

### Production
- [Cloud provider]: [services used]
- Database: managed Postgres
- Cache: managed Redis
- CDN: [for frontend assets]
- CI/CD: GitHub Actions → Docker → [deployment target]

7. Risk Assessment

## Risks & Mitigations

| Risk | Impact | Mitigation |
|------|--------|-----------|
| DB becomes bottleneck | High | Read replicas, query optimization, caching layer |
| Third-party API downtime | Medium | Circuit breaker, retry with backoff, fallback |
| Data loss | Critical | Automated backups, point-in-time recovery |

Quick Reference: When to Split Services

SignalAction
Same team, same deploy cadenceKeep as monolith
Different scaling needs (CPU vs I/O)Consider splitting
Different data ownershipConsider splitting
Shared database works fineKeep as monolith
Cross-service transactions neededKeep as monolith
Team > 5 engineers on same codebaseConsider splitting

Chains

  • Before: product-spec for requirements
  • After: data-model for detailed schema → adr for documenting decisions
  • Then: Scaffold skills for implementation

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.