GA

gas-backend-architecture

Defines architecture and standards for GAS backends.

Install

mkdir -p .claude/skills/gas-backend-architecture && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15852" && unzip -o skill.zip -d .claude/skills/gas-backend-architecture && rm skill.zip

Installs to .claude/skills/gas-backend-architecture

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Architectural rules, structure, and execution model for the Google Apps Script backend powering the OQM Registration system. Copilot must use this skill whenever generating or modifying backend routes, handlers, or shared utilities.
232 charsno explicit “when” trigger
Advanced

Key capabilities

  • Generate backend route handlers as pure functions
  • Validate sessionToken using CacheService and role-based access rules
  • Wrap all responses in the standard JSON format
  • Catch errors and convert them to `{ ok: false, error: "<code>" }`
  • Keep route handlers in `routes/` and shared logic in `core/`

How it works

This skill defines the architecture for a Google Apps Script Web App backend, mandating pure functions for route handlers, strict JSON response formats, and token-based access. It ensures adherence to a structured execution model.

Inputs & outputs

You give it
A request to generate or modify backend routes, handlers, or shared utilities for the OQM Registration system
You get back
Backend code adhering to the GAS backend architecture, including pure function route handlers and standard JSON responses

When to use gas-backend-architecture

  • Generate backend route handler
  • Validate gas architecture
  • Define api endpoint structure

About this skill

---
name: gas-backend-architecture
description: Architectural rules, structure, and execution model for the Google Apps Script backend powering the OQM Registration system. Copilot must use this skill whenever generating or modifying backend routes, handlers, or shared utilities.
license: MIT
---

# GAS Backend Architecture

Authoritative architecture for the OQM Google Apps Script backend.  
Defines entry points, routing model, sessionToken validation, response format, file structure, execution rules, and prohibited behavior.

---

# 1. Entry Points

## doGet(e)
Used for:
- public read-only routes  
- authenticated GET routes (sessionToken in query params)

## doPost(e)
Used for:
- login routes  
- write operations  
- authenticated POST routes (sessionToken in body)

Both must:
- parse input safely  
- dispatch to correct route handler  
- wrap responses in strict JSON format  
- catch errors → `{ ok: false, error: "<code>" }`  
- never return HTML  
- never return raw exceptions or stack traces  

---

# 2. Routing Model

Requests follow:
```json
{ "route": "<routeName>", "payload": { ... }, "sessionToken": "..." }

Route handlers must be pure functions:

function routeName_(payload, session) {
  // no side effects
}

Backend must not:

  • mutate global state
  • rely on undeclared globals
  • write Script Properties dynamically
  • generate alternative routing models
  • use dynamic eval

3. SessionToken Validation

Copilot must validate tokens using:

  • CacheService
  • role-based access rules
  • expiration timestamp

Rules:

  • validate before calling route handlers
  • invalid/expired → { ok: false, error: "unauthorized" }
  • admin-only routes require admin
  • coach routes allow coach or admin

4. Response Format (Strict)

All route responses must follow gas-response-format exactly:

  • success: { "ok": true, "data": ... }
  • error: { "ok": false, "error": "<error_code>" }

Do not generate alternative keys, partial objects, HTML, or raw exceptions.


5. File Structure

Recommended:

gas/
  main.gs
  routes/
    coach.gs
    trainee.gs
    admin.gs
  core/
    auth.gs
    errors.gs
    locking.gs
    sheets.gs
    utils.gs

Rules:

  • route handlers → routes/
  • shared logic → core/
  • no circular dependencies
  • no mixing route logic with shared utilities

6. Backend Execution Rules (Copilot-only)

6.1 No direct Google API calls from frontend

  • frontend must only call GAS Web App URL
  • backend is the only layer accessing SpreadsheetApp

6.2 Stable range rules

  • use stable column indexes
  • never use dynamic ranges
  • skip header rows
  • map rows to typed objects

6.3 No global mutable state

  • no global caches
  • no global arrays
  • no global counters
  • no global mutable objects

6.4 No side effects outside route handlers

  • no writes in doGet/doPost
  • no writes in utilities unless explicitly intended

7. Error Handling

Copilot must:

  • wrap route logic in try/catch
  • convert thrown errors → error codes
  • never leak stack traces
  • never return raw exceptions
  • use only error codes from gas-error-handling

8. Interaction With Other Skills

  • gas-error-handling — error codes + propagation
  • gas-sheet-operations — sheet read/write rules
  • gas-locking-and-concurrency — atomic write rules
  • auth-flow — login/session behavior
  • security-secrets — Script Properties rules
  • wire-react-to-gas — API contract
  • gas-response-format — strict JSON format
  • sheet-schema — column order + required fields

9. Prohibited Behavior

Copilot must not:

  • generate dynamic eval
  • generate global mutable state
  • generate alternative routing models
  • generate HTML output
  • generate non-JSON responses
  • generate direct Google API calls from frontend
  • bypass sessionToken validation
  • write Script Properties dynamically

10. Future Extensions

Architecture may evolve.
All changes to API contracts, sheet schemas, or backend architecture must be reflected in SKILL.md files.

When not to use it

  • The task involves mutating global state
  • The task requires generating alternative routing models
  • The task involves generating dynamic eval

Limitations

  • Backend must never mutate global state
  • Backend must never generate alternative routing models
  • Backend must never generate dynamic eval

How it compares

This workflow enforces a strict architectural pattern for GAS backends, including specific routing, response, and security rules, which provides a standardized and secure development approach compared to ad-hoc GAS scripting.

Compared to similar skills

gas-backend-architecture side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
gas-backend-architecture (this skill)01moNo flagsAdvanced
telegram-dev28moReviewIntermediate
shopify-apps14moReviewIntermediate
ccxt-typescript16moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

telegram-dev

2025Emma

Telegram 生态开发全栈指南 - 涵盖 Bot API、Mini Apps (Web Apps)、MTProto 客户端开发。包括消息处理、支付、内联模式、Webhook、认证、存储、传感器 API 等完整开发资源。

232

shopify-apps

alinaqi

Shopify app development - Remix, Admin API, checkout extensions

19

ccxt-typescript

ccxt

CCXT cryptocurrency exchange library for TypeScript and JavaScript developers (Node.js and browser). Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors. Use when working with crypto exchanges in TypeScript/JavaScript projects, trading bots, arbitrage systems, or portfolio management tools. Includes both REST and WebSocket examples.

15

route-handlers

davepoon

This skill should be used when the user asks to "create an API route", "add an endpoint", "build a REST API", "handle POST requests", "create route handlers", "stream responses", or needs guidance on Next.js API development in the App Router.

14

relational-database-web-cloudbase

TencentCloudBase

Use when building frontend Web apps that talk to CloudBase Relational Database via @cloudbase/js-sdk – provides the canonical init pattern so you can then use Supabase-style queries from the browser.

12

convex

waynesutton

Umbrella skill for all Convex development patterns. Routes to specific skills like convex-functions, convex-realtime, convex-agents, etc.

01

Search skills

Search the agent skills registry