backend-server-playbook

backend-server-playbook is a skill for Claude Code, Codex from tienenwu/fables. It costs 89 tokens per session (1,757 once invoked), scanned A, original, MIT.

A set of rules for building and debugging backend servers, which are the parts of an application that handle requests, data, authentication, and other work behind the user interface. It focuses on Node.js and TypeScript, with separate guidance for Go.

In plain words
What is it for?
Use it when working on REST endpoints, response formats, pagination, database queries, indexes, migrations, authentication, passwords, secrets, asynchronous code, or deployment problems.
Why use it?
It helps avoid failures caused by unclear API contracts, unsafe input, incorrect error responses, database races, slow queries, deployment order, or missing shutdown handling.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tienenwu/fables/backend-server
Any agent
npx skills add tienenwu/fables --skill backend-server
Clone the repo
git clone --depth 1 https://github.com/tienenwu/fables

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-server-playbook

README.md
[![agentmods](https://agentmods.dev/badge/skills/tienenwu/fables/backend-server.svg)](https://agentmods.dev/skills/tienenwu/fables/backend-server)
Your own site
<a href="https://agentmods.dev/skills/tienenwu/fables/backend-server"><img src="https://agentmods.dev/badge/skills/tienenwu/fables/backend-server.svg" alt="Measured on agentmods" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,757 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00089 $0.01757
Opus 5 $0.00044 $0.00879
Sonnet 5 $0.00018 $0.00351
Haiku 4.5 $0.00009 $0.00176

Measured 4d ago against content hash 76b84c76407a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

backend-server-playbook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

backend-server/SKILL.md · 63 lines

How it starts

The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🌐 English version · 繁體中文(正本 / canonical)

後端 Server 開發判準手冊

主線為 Node.js/TypeScript;Go 為獨立參考檔(references/go.md),帶著 Node/TS 思維寫 Go 的坑集中在那。

核心原則

  1. 邊界不信任、內層信任型別:所有外部輸入(HTTP body、query、DB 以外的來源)只在進入邊界時驗一次(zod/struct tag),驗過就相信型別,內層不重複防禦性檢查。
  2. 狀態碼與錯誤格式是 API 契約:狀態碼不是裝飾,用錯(把 403 當 404、把驗證失敗回 500)會讓呼叫端無法自動化處理;錯誤一律走單一 envelope 含 machine-readable code。
  3. 交易邊界=一個請求內、一個一致性單位:跨請求維持交易是紅線;一個 HTTP 請求對應一個交易,出邊界即提交或回滾。
  4. 本機綠燈不算數的東西:graceful shutdown、migration 順序、連線池耗盡、時區、secrets 遮罩——這些只在部署/高併發才爆,本機零證據力。
  5. 並發下沒有「應該不會同時發生」:check-then-act 一定要用 DB 約束、樂觀鎖或 SELECT FOR UPDATE 收斂,不能靠「先查再寫中間沒人插入」的祈禱。

開工分流

情境 路徑 先讀
設計/改 endpoint、狀態碼、錯誤格式、分頁、冪等 先定契約再寫 handler references/api-design.md
寫 query、加 index、交易、migration 先問鎖與相容性,再動 schema references/data-layer.md
列表變慢、query 數暴增 不要先加快取,先查 N+1 references/data-layer.md §N+1
登入、授權、密碼、token、secrets 逐條對紅線 references/auth-security.md
Node/TS 的 async、型別、event loop、依賴 查傳播模式與邊界驗證 references/node-ts.md
寫 Go(尤其剛從 Node/TS 過來) 先讀「Node 思維會踩的坑」 references/go.md
出 release / 部署 / 改啟動流程 逐條跑必查清單 references/release-checklist.md
部署後才爆、本機正常 先假設 shutdown/migration 順序/連線池/env references/release-checklist.md

紅線(絕對禁止)

  • 禁止跨 HTTP 請求持有開著的 DB 交易——連線被一個使用者鎖住,連線池很快耗盡,全服務 hang。
  • 禁止對驗證失敗、找不到、沒權限一律回 500 或一律回 200——狀態碼是契約,呼叫端靠它決定重試/報錯/導登入。
  • 禁止用可逆 hash 或 SHA-256 存密碼——必須 bcrypt/argon2id;外洩時可逆 hash 等於明文。
  • 禁止 secrets 進 git、進日誌、進錯誤回應——一次 commit 就永久外洩(git 歷史),token 進 logcat/APM 是真實資安事故。
  • 禁止 Go 裡 _ = err 或空 if err != nil {} 吞錯——每個 error 都要決定處理/包裝上拋/真的可忽略,吞掉=把生產故障變成靜默資料損毀。
  • 禁止 migration 用「先刪舊欄位/改名」一步到位——舊版程式還在跑時就讀不到欄位,部署窗口內 500 風暴;一律先加後刪兩步走。
  • 禁止改測試斷言讓 CI 變綠——連紅兩次是方向錯誤訊號,退回上一決策點。

失敗訊號(該回頭,不是重試)

徵兆 多半是 退回
每修一個慢 query 又冒出下一個 ORM lazy-load 造成 N+1,逐條治標 改 eager load / batch,見 data-layer §N+1
競態修了還偶發,加了更多 re-check check-then-act 沒收斂到 DB 層 改約束/樂觀鎖/FOR UPDATE
部署就有一小段 5xx 尖峰 沒有 graceful shutdown 或 migrate/deploy 順序錯 release-checklist §shutdown/順序
連線池 timeout 偶發於高峰 交易開太久或池太小/太大 data-layer §交易、release §連線池
Go 服務記憶體緩慢上漲 goroutine 洩漏(沒人讀的 channel、缺 context 取消) go.md §goroutine 洩漏
catch/error 分支越加越多才不炸 錯誤沒在邊界統一,散落各層 node-ts §錯誤傳播 / go.md §error

Read the full file on GitHub · 63 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 63 lines · 89 tokens per session scan A 76b84c76407a

Subscribe to this mod's changes

backend-server-playbook is a skill published in the GitHub repository tienenwu/fables (4 stars, last pushed 1mo ago), licensed MIT. It adds 89 tokens to every session and 1,757 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.