google/google-cloud-solution-n-tier-serverless-web-app
>- Guides agents to interactively discover customer requirements for a Secure n-tier serverless web application and generate a tailored cloud multi-product solution that incorporates opinionated best practices and architecture guidance. Use when users need agentic assistance with designing and creating a multi-product solution in the cloud for Secure n-tier serverless web application. Don't use when designing VM or GKE-based architectures or when not using Google Cloud.
npx skills add https://github.com/google/skills --skill google-cloud-solution-n-tier-serverless-web-app
<!-- disableFinding(all) -->
<!-- mdlint off -->
This skill guides agents through the workflow of designing and implementing a
secure serverless web application with as many architectural design layers as
specified by the user. It uses Cloud Run for the serverless layers and Cloud SQL
for PostgreSQL as the data layer. A three-tier web application might be
represented in three architectural layers: a Cloud Run presentation layer, a
Cloud Run application layer, and a Cloud SQL for PostgreSQL database layer.
The architecture enforces strict physical and network isolation across all tiers (T1 to TN):
INGRESS_TRAFFIC_INTERNAL_ONLY), reachable exclusively via upstream VPC routing (egress = "ALL_TRAFFIC" with Private Google Access on the subnet for *.run.app URLs, or egress = "PRIVATE_RANGES_ONLY" via an internal Application Load Balancer).Redis for caching, reachable exclusively from authorized application tiers.
> [!TIP]
> Optional MCP Server Integration: If your AI coding client supports the Model Context Protocol (MCP), you can connect the Google Developer Knowledge MCP Server (npx -y @google/mcp-developer-knowledge-server) to dynamically query real-time Google Cloud documentation (cloud.google.com/docs) alongside this skill's offline knowledge base (references/related-guidance.md).
The solution design and implementation workflow is divided into the following
phases:
requirements, constraints, dependencies, and current state.
assets/main.tf and adhering to all Phase 3 specifications) alongside the solution architecture during this phase. This allows the user to immediately review and iteratively modify the code as the conversation continues. However, if the user explicitly states they do not want code, confirm their preference before proceeding.requirements of the workload.
--------------------------------------------------------------------------------
To prevent multi-turn interview fatigue and maintain trajectory determinism across evaluations, adopt an opinionated 80% default golden path unless the user explicitly requests deviations:
80% Baseline):frontend Cloud Run -> backend application Cloud Run -> Cloud SQL PostgreSQL).us-central1.POSTGRES_18) Enterprise Edition via Private Service Connect (psc_enabled = true).sqli-v33-stable) and Cloud CDN (enable_cdn = true).ALL_TRAFFIC), run.app. Cloud DNS private zone, least-privilege egress firewalls (TCP 5432, 443), and Cloud SQL Auth Proxy sidecar (DB_SOCKET_PATH with IAM Auth).Maximum 2 Optional Questions):If the user's initial prompt leaves requirements open-ended (and is not fast-forwarding with exact specs), do not present a multi-topic questionnaire. Only ask up to 2 optional disambiguation questions concisely before confirmation:
Private Services Access) alongside Cloud SQL to accelerate read queries?references/non-negotiable-architectural-rules.md and product mapping from references/related-guidance.md. *Important*: Use the retrieved content to ground your design and verify the report audit checklist before TF generation (assets/main.tf is the Single Source of Truth for exact HCL). If the Google Developer Knowledge MCP Server is connected, query docs dynamically in real time.references/related-guidance.md:INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER), Cloud Armor (sqli-v33-stable), Cloud CDN (if global Application Load Balancer). Note: When deploying a regional external Application Load Balancer, an explicit proxy-only subnet (purpose = "REGIONAL_MANAGED_PROXY") is required in the VPC and network must be specified on the regional forwarding rule.INGRESS_TRAFFIC_INTERNAL_ONLY), Direct VPC Egress configured with egress = "ALL_TRAFFIC", Private Google Access enabled on the subnet, and a Cloud DNS Managed Private Zone (google_dns_managed_zone) for run.app. bound to vpc_network mapping *.run.app directly to Private Google Access VIPs (199.36.153.4/30 / 199.36.153.8/30) when calling internal *.run.app URLs (to prevent queries from resolving via public Google DNS to 216.58.x.x and hitting deny_all_egress or failing VPC-internal ingress checks), or egress = "PRIVATE_RANGES_ONLY" when routing via an internal Application Load Balancer, deployed from specified/placeholder container image.199.36.153.4/30, 199.36.153.8/30 on allow_backend_db_egress so the Cloud SQL Auth Proxy sidecar can query sqladmin.googleapis.com and exchange tokens for ephemeral IAM certs on startup without crashing), and optional VPC Service Controls.assets/output-template.md) illustrating the multi-tier request and data flow across entry point, public reverse proxy, private microservice compute tiers, and private database/caching endpoints.gcloud CLI code:Compile the requirements, technical decomposition, product mapping,
architecture diagram, design recommendations, AND the complete
Infrastructure as Code (`Terraform based on assets/main.tf alongside a
self-contained sequence of gcloud CLI deployment commands adhering to all
Phase 3 mandatory specifications`) into a single Markdown file structured
strictly per the standardized Google Cloud Solution Architecture output
template at assets/output-template.md and present them to the user.
When saving or outputting the report artifact, append an ISO 8601 UTC timestamp and ensure the filename strictly ends with the .md extension (e.g., workload_name_architecture_report-20260701T212820Z.md). Verify that all 9 security boundaries from assets/main.tf are documented cleanly in your report.
gcloud script, or validation script if generated) to the user and request feedback. Modify and refine both the architecture and code iteratively as the conversation continues.--------------------------------------------------------------------------------
assets/ directory.*Important*: Use the code in assets/main.tf as the
foundation for your Terraform implementation plan (assets/output-template.md for architecture structure).
run.googleapis.com,sqladmin.googleapis.com, redis.googleapis.com,
servicenetworking.googleapis.com, secretmanager.googleapis.com,
monitoring.googleapis.com, dns.googleapis.com).
Architectural Specifications):Retrieve relevant architectural and hierarchy guidance from
references/non-negotiable-architectural-rules.md. Base code strictly on the building blocks in
assets/main.tf (Section 5.1 for Tier 1, Section 5.2 for Tiers 2..N), ensuring database_version = "POSTGRES_18" is preserved exactly. Do NOT generate from memory/v1 legacy resources or revert to older database versions like POSTGRES_15.
README.md artifact), ensuring you include:terraform init, terraform apply). Zero-Install Environment Recommendation: Explicitly recommend running terraform commands and your generated automated validation script inside Google Cloud Shell (https://shell.cloud.google.com), where python3, gcloud, and terraform are 100% pre-installed and authenticated out of the box so developers without local SDKs can deploy and validate immediately.gcloud CLI Deployment Commands (Bottom-Up Wiring): In Section 6.3 ("Step-by-step gcloud CLI deployment commands") inside assets/output-template.md, provide a complete, self-contained sequence of gcloud CLI commands required to deploy this exact architecture without Terraform. These commands must enforce reverse/bottom-up order (VPC/subnets -> data tiers -> internal microservices -> public gateway -> load balancer), specify --database-version=POSTGRES_18 when provisioning Cloud SQL, and extract downstream container URLs (gcloud run services describe... --format='value(status.url)') into shell variables to dynamically pass them via --update-env-vars into upstream services.enable_vpc_sc variable.run.googleapis.com), Cloud SQL (sqladmin.googleapis.com), and Secret Manager (secretmanager.googleapis.com) when enable_vpc_sc = true.google_dns_managed_zone) configuration for run.app. bound to vpc_network, mapping *.run.app directly to Private Google Access VIPs (199.36.153.4/30 / 199.36.153.8/30), alongside external DNS records and database schema initialization.approval. Iterate as needed.
--------------------------------------------------------------------------------
google_compute_managed_ssl_certificate) becomes ACTIVE (checking --global status or regional equivalents).*.run.app URL is blocked (HTTP 403 Forbidden from edge screening).*.run.app URLs (INGRESS_TRAFFIC_INTERNAL_ONLY) is blocked across all internal microservice tiers (HTTP 404 Not Found or HTTP 403 Forbidden).HTTP 200 to 399)./?id=1%20OR%201=1 on the custom domain) is intercepted and blocked (HTTP 403 Forbidden from Cloud Armor).Logs Explorer) and database connection pooling telemetry (Cloud SQL Query Insights) that tier 1 -> tier 2 -> data tier queries succeed over private VPC fiber (Direct VPC Egress + Private Service Connect / Private Services Access).urllib / subprocess libraries, or a cross-platform bash/PowerShell script) customized precisely to the user's deployed domain, SSL certificate name, and exact multi-tier *.run.app URIs.macOS, Linux, Windows PowerShell, or zero-install Google Cloud Shell (https://shell.cloud.google.com)).assets/output-template.md.Take google/google-cloud-solution-n-tier-serverless-web-app from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npx.
Without those the skill loads but fails at the first command.