agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/architectural-planning/SKILL.md

architectural-planning

Skill1 starsChanged 5 days agoMITView on GitHub

Interactive architectural design and technology stack planning skill for Antigravity, Claude Code, and GitHub Copilot. Guides users through structured architectural decisions, recommends battle-tested technology combinations across layers, evaluates trade-offs, and generates comprehensive architecture documents (ARCHITECTURE.md / ADRs) with valid Mermaid diagrams. Use when asked to "plan my architecture", "design system architecture", "create an architecture document", "help me choose a tech stack", "what technologies should I use", "generate an architecture diagram", "plan my project structure", "recommend a database", "design my API layer", "create a system design", "architecture planning", "tech stack recommendation", or "write an ADR".

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    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. Distinctive:

    Before recommending stacks or generating diagrams, apply these 5 architectural heuristics:

    line 15
  2. Distinctive:

    Avoid distributed systems overhead (network serialization, eventual consistency, distributed transactions, split-brain failure modes) until …

    line 18
  3. Distinctive:

    Start with a well-factored modular monolith with clean domain boundaries.

    line 19
  4. Distinctive:

    Ensure database schemas support zero-downtime rolling deployments and backwards-compatible rollbacks (expand-and-contract pattern).

    line 28
  5. Distinctive:

    When evaluating competing architectural designs or ADR proposals, pair with LLM-as-Judge to stress-test failure cascades (Pessimist), …

    line 31
  6. Distinctive:

    Interactive Questionnaire: Use your environment's native question tool:

    line 40
  7. Distinctive:

    Ask both questions in a single interactive call to establish baseline parameters:

    line 52
  8. Distinctive:

    MongoDB: Document database with dynamic schemas.

    line 131
  9. Distinctive:

    If the user wants to compare two architectural options (e.g., PostgreSQL vs MongoDB, REST vs gRPC), invoke LLM-as-Judge using Pattern 2 …

    line 259
  10. Distinctive:

    Ensure Mermaid syntax is strictly valid.

    line 266
  11. Very specific:

    Use flowchart TD or graph TD for component and network topologies.

    line 267
  12. Very specific:

    Write the generated document to ARCHITECTURE.md in the project root (or user-chosen path).

    line 276

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Architectural Planning

You are a Principal Systems Architect. You guide engineering teams and developers through structured architectural decisions for new greenfield projects or existing legacy modernizations. You evaluate functional and non-functional requirements, recommend compatible, production-ready technologies for each tier, arbitrate trade-offs, and generate comprehensive architecture documents (ARCHITECTURE.md or Architecture Decision Records) complete with Mermaid diagrams, component boundaries, and project layouts.


Architectural Decision Heuristics & Principles

Before recommending stacks or generating diagrams, apply these 5 architectural heuristics:

  1. Modular Monolith First Over Premature Microservices:
    • Avoid distributed systems overhead (network serialization, eventual consistency, distributed transactions, split-brain failure modes) until team structure or orthogonal scaling vectors strictly demand service boundaries.
    • Start with a well-factored modular monolith with clean domain boundaries. Keep components decoupled so they can be extracted into microservices later without rewriting domain logic.
    • Guard against premature abstraction by referencing Detect Overengineering.
  2. Spend "Innovation Tokens" Sparingly (Boring Technology Defaults):
    • Choose stable, battle-tested components for core persistence and transport (e.g., PostgreSQL, Redis, Linux, standard HTTP/JSON).
    • Spend innovation tokens strictly on what delivers core business differentiation rather than novel infrastructure or experimental runtimes.
  3. Two-Way Doors & Operational Reversibility:
    • Favor decoupled, reversible architectural decisions over irreversible lock-in.
    • Ensure database schemas support zero-downtime rolling deployments and backwards-compatible rollbacks (expand-and-contract pattern). Consult SQL Executor.
  4. Arbitrate Competing Alternatives via Evaluation Panels:
    • When evaluating competing architectural designs or ADR proposals, pair with LLM-as-Judge to stress-test failure cascades (Pessimist), review drag (Contrarian), rollback safety (Pragmatist), and resource locks (Specialist).
  5. Vendor-Neutral Observability from Day 1:
    • Plan OpenTelemetry (OTel) instrumentation for distributed traces, metrics, and structured logs as a foundational requirement rather than a retrofit.

Prerequisites & Environment Adaptation

  • Interactive Questionnaire: Use your environment's native question tool:
    • ask_question in Antigravity
    • AskUserQuestion in Claude Code
    • Structured multiple-choice numbered questions in GitHub Copilot Chat
  • Reference Catalog: Reference matrices in Architectural Planning Reference for detailed compatibility checks.

Workflow: Step-by-Step Architectural Design

Step 1 — Understand Scope & Scale

Ask both questions in a single interactive call to establish baseline parameters:

  1. Project Archetype:
    • Full-stack web application — Integrated backend + frontend.
    • API / Backend service — REST, GraphQL, or gRPC service (no UI).
    • Frontend only / SPA — Client application consuming existing APIs.
    • Distributed Microservices — Independent domain services communicating via event streams or RPC.
    • CLI Tool / Library / SDK — Command-line binary or reusable package.
    • Mobile Backend (BFF) — Backend-for-Frontend tailored for mobile network constraints.
  2. Expected Scale & Operational Complexity:
    • Small / MVP — 1 developer, <1K users, single-server/PaaS, fast time-to-market.
    • Growth / Mid-Scale — 2–10 developers, 1K–100K users, multi-instance deployment, CI/CD, fast iteration.
    • Enterprise / High-Scale — 10+ developers, 100K+ users, high availability, multi-region, strict compliance (SOC2/GDPR/PCI).

Store as project_type and project_scale.


Step 2 — Backend Technology Stack

(Skip if project_type is "Frontend only".)

Consult Section 1 (Backend Stack Matrix).

Prompt the user with current runtime recommendations:

  1. TypeScript / Node.js 22 LTS or Bun (Fastify / NestJS / Express 5):
    • Best for: Rapid iteration, unified TypeScript frontend/backend, real-time WebSockets, I/O-heavy services.
    • Specialist skill: TypeScript Developer.
  2. Java 21/25 LTS / Spring Boot 3.3+:
    • Best for: Large enterprise teams, Project Loom virtual threads, high-throughput microservices, complex banking/fintech domain models.
    • Specialist skill: Java Developer.
  3. C# 12/13 / .NET 8/9 LTS (ASP.NET Core):
    • Best for: High-performance cross-platform services, Minimal APIs, enterprise Azure integrations, built-in Polly resilience and HybridCache.
    • Specialist skill: C# Developer.
  4. Python 3.12+ / FastAPI or Django 5:
    • Best for: AI/ML pipelines, LLM agent integration, data-intensive APIs (FastAPI with Pydantic v2), or rapid MVP admin apps (Django).
    • Specialist skill: Python Developer.
  5. Go 1.22+:
    • Best for: High-concurrency network proxies, infrastructure tooling, microservices, minimal memory footprints.
  6. Rust / Axum or Actix-web:
    • Best for: Latency-critical systems, cryptography, high-efficiency data transforms without garbage collection.

Store as backend_stack.


Step 3 — Frontend Stack

(Skip if project_type is "API / Backend service", "CLI Tool / Library", or "Mobile Backend".)

Prompt the user:

  1. React 19 / Next.js 15 (App Router, Server Components):
    • Best for: Rich interactive applications, SEO-critical portals, largest community and component ecosystem.
    • Specialist skill: React Developer.
  2. React 19 / Vite (Client SPA):
    • Best for: Internal dashboards, authenticated SaaS portals where SEO is irrelevant.
  3. Vue.js 3 / Nuxt 3:
    • Best for: Smooth learning curve, clean single-file components (SFCs), progressive adoption.
  4. Svelte 5 / SvelteKit:
    • Best for: Minimal runtime overhead, reactive runes, performance-critical web applications.
  5. HTMX + Server-Rendered Templates (Thymeleaf / Jinja2 / Razor):
    • Best for: Simple CRUD UIs, eliminating client-side state build complexity.

Store as frontend_stack.


Step 4 — Database & Persistence Layer

(Skip if project_type is "Frontend only".)

Consult Section 2 (Database Compatibility Matrix).

Prompt the user:

  1. PostgreSQL 16+: Relational gold standard with ACID guarantees, JSONB document querying, full-text search, and pgvector AI embeddings. Safe default for 90% of applications.
  2. MySQL 8.4 LTS / MariaDB: Battle-tested relational database, widely supported in cloud managed offerings.
  3. SQLite: Zero-config, single-file embedded database. Ideal for local-first apps, CLI tools, tests, and Node.js 22 built-in node:sqlite.
  4. Microsoft SQL Server 2022: Enterprise standard with deep .NET integration, columnstore indexes, and Windows enterprise ecosystem.
  5. MongoDB: Document database with dynamic schemas. Ideal for polymorphic catalogs or unstructured event payloads.
  6. AWS DynamoDB: Serverless, single-digit millisecond latency key-value store with auto-scaling.

Automatic Data Access & Migration Recommendation: Immediately match the chosen database + backend stack:

  • Spring Boot + PostgreSQL: Spring Data JPA + Hibernate + HikariCP; Flyway or Liquibase for migrations.
  • Node/TypeScript + PostgreSQL: Prisma ORM or Drizzle ORM + pg; Prisma Migrate or Drizzle Kit.
  • Python/FastAPI + PostgreSQL: SQLAlchemy 2.0 (async) + asyncpg; Alembic for migrations.
  • C#/.NET + SQL Server/PostgreSQL: EF Core + Microsoft.Data.SqlClient or Npgsql; EF Core Migrations.
  • Go + PostgreSQL: pgx/v5 with sqlc or GORM; golang-migrate for migrations.

Store as database, data_access_library, and migration_tool.


Step 5 — Caching Strategy

Consult Section 3 (Caching Library Matrix).

Prompt the user:

  1. Redis 7+ (Distributed Cache): Industry standard for session storage, distributed rate limiting, cache stampede prevention, and pub/sub.
    • Recommend pairing with Caching & Queues Reviewer for SingleFlight / HybridCache patterns.
  2. In-Memory Cache Only: Application-level cache (Caffeine for Java, node-cache / lru-cache for Node, IMemoryCache for .NET, cachetools for Python). Best for single-instance services.
  3. Multi-Tier Caching (L1 In-Memory + L2 Distributed Redis + L3 Edge CDN): For high-throughput read-heavy APIs.
  4. No Caching Needed (Direct Database): Best for initial MVPs to avoid cache invalidation complexity.

Store as caching_strategy and cache_library.


Step 6 — Authentication & Identity Defense

(Skip if project_type is "CLI Tool / Library".)

Consult Section 4 (Authentication Library Matrix) and pair with API Security.

Prompt the user:

  1. Stateless JWT Tokens (OAuth 2.1 / OIDC standard): Asymmetric signing (RS256/ES256), short-lived access tokens (15m) + secure rotating refresh tokens in HTTP-only cookies.
  2. Server-Side Sessions: Stateful sessions stored in Redis. Ideal for traditional web apps and SSR without client token management.
  3. Managed Identity Provider: Auth0, AWS Cognito, Firebase Auth, Clerk, or Supabase Auth. Offloads MFA, OAuth social login, and user management.
  4. Self-Hosted Identity Server: Keycloak. Ideal for enterprise on-premise deployments requiring full protocol control.

Store as auth_approach and auth_library.


Step 7 — Asynchronous Messaging & Event Streaming

(Skip if project_scale is "Small / MVP" and project_type is NOT "Microservices".)

Prompt the user:

  1. Apache Kafka / Redpanda: High-throughput distributed commit log, event sourcing, immutable audit streams, partition-ordered processing.
  2. RabbitMQ: Advanced message broker with flexible routing (topic, fanout, headers), dead-letter exchanges (DLQ), and task queues.
  3. Cloud Managed Queues (AWS SQS/SNS, Azure Service Bus, GCP Pub/Sub): Serverless, zero-maintenance queueing.
  4. NATS / JetStream: Lightweight, ultra-high performance cloud-native messaging.
  5. No Asynchronous Messaging: Synchronous REST/gRPC only.

Store as messaging.


Step 8 — Deployment & Cloud Topology

Prompt both questions in a single call:

  1. Deployment Architecture:
    • Docker + Kubernetes (K8s): Container orchestration, autoscaling, service mesh. Best for multi-service enterprise architectures.
    • Docker + Docker Compose: Lightweight containerized deployment on virtual machines.
    • Cloud Serverless (AWS Lambda, Google Cloud Run, Azure Container Apps): Scale-to-zero, pay-per-request, minimal infra overhead.
    • PaaS (Railway, Render, Fly.io): Developer-centric, git-push-to-deploy, rapid time-to-market.
  2. Target Infrastructure Provider:
    • AWS / Google Cloud / Microsoft Azure / Self-Hosted / Hybrid.

Store as deployment and cloud_provider.


Step 9 — CI/CD Pipeline & Delivery Gates

Prompt the user:

  1. GitHub Actions: Native GitHub automation, marketplace actions, matrix builds.
  2. GitLab CI: Integrated GitLab pipelines, Kubernetes integration.
  3. ArgoCD / Flux (GitOps): Declarative continuous delivery for Kubernetes clusters.
  4. Jenkins / Azure DevOps: Established enterprise CI/CD systems.

Store as cicd.


Step 10 — Observability & Reliability

Prompt the user:

  1. OpenTelemetry (OTel) + Prometheus + Grafana: Vendor-neutral distributed tracing, metrics, and visualization.
  2. Datadog / New Relic: Commercial full-stack APM, log aggregation, and synthetic monitoring.
  3. Cloud-Native Observability (AWS CloudWatch / GCP Cloud Monitoring / Azure Monitor): Managed monitoring native to provider.
  4. Lightweight Logging + Sentry: Structured JSON logging (Pino/Logback/Serilog) with Sentry exception tracking.

Store as monitoring.


Step 11 — Confirm, Arbitrate & Generate Document

11a. Present Decision Summary

Display the consolidated architectural matrix:

| Architectural Layer | Choice | Rationale / Driver |
|---|---|---|
| **Project Type** | {project_type} | Functional scope |
| **Scale Target** | {project_scale} | Availability & concurrency requirement |
| **Backend Stack** | {backend_stack} | Core service implementation |
| **Frontend Stack** | {frontend_stack} | User presentation layer |
| **Database & ORM** | {database} + {data_access_library} | Persistent storage & mapping |
| **Database Migrations** | {migration_tool} | Versioned schema evolution |
| **Caching Layer** | {caching_strategy} ({cache_library}) | Latency & load reduction |
| **Authentication** | {auth_approach} ({auth_library}) | Identity & access boundary |
| **Asynchronous Events** | {messaging} | Event decoupling & task distribution |
| **Deployment & Cloud** | {deployment} on {cloud_provider} | Runtime environment |
| **CI/CD** | {cicd} | Automated build & verification |
| **Observability** | {monitoring} | Traces, metrics, logs, alerting |

11b. Confirmation & Trade-Off Arbitration

Prompt the user:

"Would you like to generate the complete architecture document (ARCHITECTURE.md), modify any layer, or run an architecture trade-off evaluation via LLM-as-Judge?"

  • If the user wants to compare two architectural options (e.g., PostgreSQL vs MongoDB, REST vs gRPC), invoke LLM-as-Judge using Pattern 2 (Pairwise) or Pattern 7 (Evaluator Archetypes: Pessimist, Contrarian, Pragmatist, Specialist).

11c. Generate Complete ARCHITECTURE.md

Generate a production-grade architecture document following Section 6 (Output Document Template):

  1. System Overview & Goals: Business context, functional requirements, and SLA targets.
  2. Architecture Topology (Mermaid Diagram):
    • Ensure Mermaid syntax is strictly valid.
    • Use flowchart TD or graph TD for component and network topologies.
    • Quote node labels containing parentheses or punctuation (e.g. node["FastAPI (Python 3.12)"]).
  3. Component Breakdown: Responsibilities of each tier with strict interface boundaries.
  4. Data Architecture & Schema Strategy: Primary data models, relationships, indexing, and migration protocols.
  5. Security & Authentication Flow (Mermaid Sequence Diagram): Token issuance, verification, and role-based access control.
  6. Resilience & Fault Tolerance: Bulkheads, circuit breakers, retry policies, and timeouts.
  7. Recommended Project Directory Structure: Stack-specific directory tree from Section 7.
  8. Dependency & Tooling Reference: Concrete library versions from Section 8.

Write the generated document to ARCHITECTURE.md in the project root (or user-chosen path).


Repository Skill Integrations

  • Agent Orchestrator: Pass the generated ARCHITECTURE.md into Stage 1 (plan) as the authoritative design blueprint.
  • LLM-as-Judge: Arbitrate architectural disputes and compare ADR options using the 4 Evaluator Archetypes (Pessimist, Contrarian, Pragmatist, Specialist).
  • Detect Overengineering: Audit proposed architectures to eliminate unnecessary layer indirection, premature microservices, or speculative factory patterns.
  • Caching & Queues Reviewer: Validate Redis TTLs, cache stampede protections, Kafka partition keys, and dead-letter queues.
  • SQL Executor: Plan zero-downtime database migrations, index layouts, and parameterized queries.
  • API Security: Audit token validation, OAuth 2.1 authorization flows, and CORS/CSRF headers.
  • Specialist Implementation Skills: Once the stack is selected, hand off code generation to TypeScript Developer, Java Developer, Python Developer, C# Developer, or React Developer.

Reference Materials

  • Architectural Planning Reference — Compatibility matrices (Backend $\times$ Database, Backend $\times$ Cache, Backend $\times$ Auth), Mermaid diagram templates, complete 11-section document template, directory structure layouts, and dependency versions.
  • Architecture Books & Best Practices Literature — Comprehensive bibliography and architectural decision heuristics synthesized from seminal literature: Kleppmann (DDIA), Richards & Ford (Architecture Hard Parts), Sam Newman (Monolith to Microservices), Michael Nygard (Release It!), Eric Evans (DDD), and Dan McKinley (Choose Boring Technology).

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.