agentleFS
NoobyGainsNoobyGains/godmode/skills/system-design/SKILL.md

system-design

Skill107 starsChanged 9 months agoMITView on GitHub

Use when making technology or structural decisions - selecting databases, APIs, auth strategies, caching layers, file organization, or weighing monolith against services

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

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

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 2

    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:

    Core principle: Every structural decision must be driven by a current requirement, not a speculative future one.

    line 12
  2. Distinctive:

    If you cannot point to a concrete, current requirement that demands the complexity, choose the simpler option.

    line 22

“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

Select the simplest architecture that satisfies requirements. Introduce complexity only when evidence demands it.

Core principle: Every structural decision must be driven by a current requirement, not a speculative future one.

No exceptions. No workarounds. No shortcuts.

The Prime Directive

NO STRUCTURAL COMPLEXITY WITHOUT AN ESTABLISHED REQUIREMENT

If you cannot point to a concrete, current requirement that demands the complexity, choose the simpler option.

When to Use

Always before:

  • Selecting a database
  • Designing an API
  • Organizing a new project
  • Introducing a caching layer
  • Adding message queues or event systems
  • Choosing authentication strategy
  • Deciding on monolith vs services

Especially when:

  • "We might need to scale" (might = do not add complexity)
  • "What if we need X later?" (later = not now)
  • Multiple valid approaches exist

The Entry Protocol

BEFORE making ANY structural decision:

1. IDENTIFY: What concrete requirement drives this choice?
2. COMPARE: What is the simplest option that satisfies it?
3. JUSTIFY: Why is anything more complex necessary?
   - If no justification: Use the simple option
   - If justified: Record the requirement driving complexity
4. DECIDE: Choose. Document. Move on.

Skip any step = over-engineering

Decision Frameworks

Monolith vs Services

digraph structure_decision {
    start [label="New project?", shape=diamond];
    team [label="Multiple teams\nown separate\ndomains?", shape=diamond];
    scale [label="Components need\nindependent\nscaling NOW?", shape=diamond];
    deploy [label="Components need\nindependent\ndeploy cycles?", shape=diamond];
    mono [label="MONOLITH\nSimplest path", shape=box, style=filled, fillcolor="#ccffcc"];
    services [label="SERVICES\nEstablished need", shape=box, style=filled, fillcolor="#ffcccc"];

    start -> mono [label="yes"];
    start -> team [label="existing"];
    team -> services [label="yes"];
    team -> scale [label="no"];
    scale -> services [label="yes"];
    scale -> deploy [label="no"];
    deploy -> services [label="yes"];
    deploy -> mono [label="no"];
}

Default: Monolith. Extract services only when a specific component demonstrates it requires independent scaling or deployment.

Database Selection

RequirementSelectRationale
Structured data, relationships, transactionsPostgreSQLACID guarantees, mature, covers 90% of use cases
Document-oriented, genuinely variable schema per recordMongoDBOnly when schema truly differs per document
Key-value, caching, session storageRedisIn-memory speed, built-in TTL
Full-text search at volumeElasticsearchPurpose-built for search workloads
Time-series data (metrics, logs)TimescaleDB / InfluxDBOptimized for time-indexed writes
Graph traversal is the primary query modelNeo4jOnly when traversal IS the product
Embedded, zero-config, single-userSQLiteSimplest possible, no server needed

Default: PostgreSQL. It handles JSON, full-text search, and most workloads adequately. Switch only when PostgreSQL demonstrably cannot meet a requirement.

API Design

ContextSelectRationale
CRUD operations, public-facing APIRESTUniversal, cacheable, well-understood
Complex nested data, client-controlled shapeGraphQLEliminates over/under-fetching
Internal service-to-service, high throughputgRPCBinary protocol, generated stubs, streaming
Real-time bidirectional communicationWebSocketsPersistent connection, low latency
Simple webhooks, event notificationREST callbacksStateless, easy to troubleshoot

Default: REST. Adopt GraphQL only when clients genuinely need flexible queries. Adopt gRPC only for internal services where throughput is measured and proven insufficient with REST.

Authentication Strategy

ContextSelectRationale
Standard web applicationSession-based (cookies)Simple, secure, server-controlled revocation
SPA + API on different originsJWT (short-lived) + refresh tokensStateless API auth across domains
Third-party loginOAuth 2.0 / OIDCDelegated authentication standard
Machine-to-machineAPI keys + HMACSimple, auditable
Multi-tenant SaaSOIDC + tenant-scoped tokensIsolation per tenant

Default: Session-based auth with httpOnly cookies. JWTs are not inherently more secure. Use them only when stateless authentication across domains is a concrete requirement.

Caching Strategy

BEFORE introducing a cache:

1. Is there actually a measured performance problem?
2. Can the database query be optimized instead?
3. Is the data read-heavy with infrequent writes?

Only if YES to 1, NO to 2, YES to 3: Introduce cache.
LayerMechanismUse When
ApplicationIn-memory (LRU)Single instance, small dataset
DistributedRedis / MemcachedMulti-instance, shared state
HTTPCDN / reverse proxyStatic assets, public pages
DatabaseQuery cache / materialized viewsExpensive aggregations

Default: No cache. Optimize queries first. Introduce caching only after measuring a bottleneck.

Event-Driven Architecture

BEFORE introducing a message queue:

1. Do you need asynchronous processing? (Email delivery, image processing)
2. Do producers and consumers need to scale independently?
3. Do you need guaranteed delivery across service boundaries?

If NO to all: Direct function calls are sufficient.
NeedMechanismRationale
Simple task queueRedis + BullMQ / CeleryLightweight, familiar
Event streaming, replayKafkaHigh throughput, log-based
Cloud-native messagingSQS / Cloud Pub/SubManaged, serverless
Complex routingRabbitMQFlexible routing, mature

Default: Direct function calls. Queues add operational complexity. Introduce them only when async processing or decoupling is an established requirement.

File Organization Conventions

Organize by capability, not by layer:

# AVOID: organized by layer
src/
  controllers/
  models/
  services/
  validators/

# PREFER: organized by capability
src/
  users/
    user.controller.ts
    user.service.ts
    user.model.ts
    user.test.ts
  orders/
    order.controller.ts
    order.service.ts
    order.model.ts
    order.test.ts
  shared/
    database.ts
    auth.middleware.ts

Capability-based organization keeps related code together. Changing one capability touches one directory.

Cognitive Traps

RationalizationTruth
"We might need microservices later"Extract when needed. Monolith-first is faster to build and debug.
"NoSQL is more flexible"PostgreSQL handles JSON. Schema flexibility usually means schema confusion.
"GraphQL is the modern choice"REST is simpler for CRUD. Modern does not mean appropriate.
"JWTs are more secure"JWTs are harder to revoke. Sessions are simpler and server-controlled.
"We need a cache for performance"Have you optimized your queries? Measure first.
"Event-driven is more scalable"Direct calls are simpler. Scaling concerns are future concerns.
"This architecture handles future growth"The future is unpredictable. Solve current problems.

Guardrails - HALT and Simplify

  • Adding infrastructure for "future scale"
  • Selecting technology because it is "modern" or "industry standard"
  • Architecture diagram has more than 5 components for an MVP
  • Multiple databases without distinct access patterns
  • Message queues for synchronous workflows
  • Microservices with a single team
  • "Flexible" schemas without concrete varying fields
  • Caching before measuring

All of these mean: Simplify. Use the boring, proven option.

Integration

Complements:

  • godmode:performance-tuning — When structural choices affect performance
  • godmode:security-protocol — Auth patterns and data flow security
  • godmode:project-bootstrap — File organization and initial setup
  • godmode:task-planning — Structural decisions during planning phase

The Bottom Line

Simplest architecture that works > "best" architecture that might be needed

PostgreSQL. REST. Monolith. Sessions. No cache. Direct calls. Start there. Introduce complexity only when you have evidence it is necessary.

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.