senior-backend
alirezarezvani/claude-skills
REST API, 마이크로서비스, 데이터베이스 아키텍처, 인증 흐름, 보안 강화 등을 포함한 백엔드 시스템을 설계하고 구현합니다. 이 과정에서는Node.js/Express/Fastify개발, PostgreSQL 최적화, API 보안, 백엔드 아키텍처 패턴 등을 다룹니다.
...모든 것을 확장하십시오선임 백엔드 엔지니어
백엔드 개발 패턴, API 설계, 데이터베이스 최적화 및 보안 관행.
빠른 시작
# Generate API routes from OpenAPI spec
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
# Analyze database schema and generate migrations
python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze
# Load test an API endpoint
python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30
도구 개요
1. API 스캐폴더
스키마 정의로부터 API 라우트 핸들러, 미들웨어 및 OpenAPI 사양을 생성합니다.
입력: OpenAPI 사양(YAML/JSON) 또는 데이터베이스 스키마 출력: 라우트 핸들러, 유효성 검사 미들웨어, TypeScript 타입
사용법:
# Generate Express routes from OpenAPI spec
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
# Output: Generated 12 route handlers, validation middleware, and TypeScript types
# Generate from database schema
python scripts/api_scaffolder.py --from-db postgres://localhost/mydb --output src/routes/
# Generate OpenAPI spec from existing routes
python scripts/api_scaffolder.py src/routes/ --generate-spec --output openapi.yaml
지원되는 프레임워크:
- Express.js (
--framework express) - Fastify (
--framework fastify) - Koa (
--framework koa)
2. 데이터베이스 마이그레이션 도구
데이터베이스 스키마를 분석하고, 변경 사항을 감지하며, 롤백 기능을 지원하는 마이그레이션 파일을 생성합니다.
입력: 데이터베이스 연결 문자열 또는 스키마 파일 출력: 마이그레이션 파일, 스키마 차이점 보고서, 최적화 제안
사용법:
# Analyze current schema and suggest optimizations
python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze
# Output: Missing indexes, N+1 query risks, and suggested migration files
# Generate migration from schema diff
python scripts/database_migration_tool.py --connection postgres://localhost/mydb \
--compare schema/v2.sql --output migrations/
# Dry-run a migration
python scripts/database_migration_tool.py --connection postgres://localhost/mydb \
--migrate migrations/20240115_add_user_indexes.sql --dry-run
3. API 부하 테스터
설정 가능한 동시 접속 수로 HTTP 부하 테스트를 수행하며, 지연 시간 백분위수와 처리량을 측정합니다.
입력: API 엔드포인트 URL 및 테스트 구성 출력: 지연 시간 분포, 오류율, 처리량 지표가 포함된 성능 보고서
사용법:
# Basic load test
python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30
# Output: Throughput (req/sec), latency percentiles (P50/P95/P99), error counts, and scaling recommendations
# Test with custom headers and body
python scripts/api_load_tester.py https://api.example.com/orders \
--method POST \
--header "Authorization: Bearer token123" \
--body '{"product_id": 1, "quantity": 2}' \
--concurrency 100 \
--duration 60
# Compare two endpoints
python scripts/api_load_tester.py https://api.example.com/v1/users https://api.example.com/v2/users \
--compare --concurrency 50 --duration 30
백엔드 개발 워크플로우
API 설계 워크플로우
새로운 API를 설계하거나 기존 엔드포인트를 리팩토링할 때 사용합니다.
1단계: 리소스 및 작업 정의
# openapi.yaml
openapi: 3.0.3
info:
title: User Service API
version: 1.0.0
paths:
/users:
get:
summary: List users
parameters:
- name: "limit"
in: query
schema:
type: integer
default: 20
post:
summary: Create user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUser'
2단계: 라우트 스캐폴딩 생성
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
3단계: 비즈니스 로직 구현
// src/routes/users.ts (generated, then customized)
export const createUser = async (req: Request, res: Response) => {
const { email, name } = req.body;
// Add business logic
const user = await userService.create({ email, name });
res.status(201).json(user);
};
4단계: 유효성 검사 미들웨어 추가
# Validation is auto-generated from OpenAPI schema
# src/middleware/validators.ts includes:
# - Request body validation
# - Query parameter validation
# - Path parameter validation
5단계: 업데이트된 OpenAPI 사양 생성
python scripts/api_scaffolder.py src/routes/ --generate-spec --output openapi.yaml
데이터베이스 최적화 워크플로
쿼리 속도가 느리거나 데이터베이스 성능 개선이 필요한 경우 사용합니다.
1단계: 현재 성능 분석
python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
2단계: 느린 쿼리 식별
-- Check query execution plans
EXPLAIN ANALYZE SELECT * FROM orders
WHERE user_id = 123
ORDER BY created_at DESC
LIMIT 10;
-- Look for: Seq Scan (bad), Index Scan (good)
3단계: 인덱스 마이그레이션 생성
python scripts/database_migration_tool.py --connection $DATABASE_URL \
--suggest-indexes --output migrations/
4단계: 마이그레이션 테스트(시뮬레이션)
python scripts/database_migration_tool.py --connection $DATABASE_URL \
--migrate migrations/add_indexes.sql --dry-run
5단계: 적용 및 검증
# Apply migration
python scripts/database_migration_tool.py --connection $DATABASE_URL \
--migrate migrations/add_indexes.sql
# Verify improvement
python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
보안 강화 워크플로우
API를本番 환경에 배포하기 전이나 보안 검토 후 사용할 때.
1단계: 인증 설정 검토
// Verify JWT configuration
const jwtConfig = {
secret: process.env.JWT_SECRET, // Must be from env, never hardcoded
expiresIn: '1h', // Short-lived tokens
algorithm: 'RS256' // Prefer asymmetric
};
2단계: 요청 제한 추가
import rateLimit from 'express-rate-limit';
const apiLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // 100 requests per window
standardHeaders: true,
legacyHeaders: false,
});
app.use('/api/', apiLimiter);
3단계: 모든 입력값 검증
import { z } from 'zod';
const CreateUserSchema = z.object({
email: z.string().email().max(255),
name: z.string().min(1).max(100),
age: z.number().int().positive().optional()
});
// Use in route handler
const data = CreateUserSchema.parse(req.body);
4단계: 공격 패턴을 활용한 부하 테스트
# Test rate limiting
python scripts/api_load_tester.py https://api.example.com/login \
--concurrency 200 --duration 10 --expect-rate-limit
# Test input validation
python scripts/api_load_tester.py https://api.example.com/users \
--method POST \
--body '{"email": "not-an-email"}' \
--expect-status 400
5단계: 보안 헤더 검토
import helmet from 'helmet';
app.use(helmet({
contentSecurityPolicy: true,
crossOriginEmbedderPolicy: true,
crossOriginOpenerPolicy: true,
crossOriginResourcePolicy: true,
hsts: { maxAge: 31536000, includeSubDomains: true },
}));
참조 문서
| 파일 | 포함 내용 | 사용 시점 |
|---|---|---|
references/api_design_patterns.md |
REST 대 GraphQL, 버전 관리, 오류 처리, 페이지 분할 | 새로운 API 설계 |
references/database_optimization_guide.md |
인덱싱 전략, 쿼리 최적화, N+1 문제 해결 방안 | 느린 쿼리 수정 |
references/backend_security_practices.md |
OWASP Top 10, 인증 패턴, 입력 유효성 검사 | 보안 강화 |
일반적인 패턴 빠른 참조
REST API 응답 형식
{
"data": { "id": 1, "name": "John" },
"meta": { "requestId": "abc-123" }
}
오류 응답 형식
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid email format",
"details": [{ "field": "email", "message": "must be valid email" }]
},
"meta": { "requestId": "abc-123" }
}
HTTP 상태 코드
| 코드 | 사용 사례 |
|---|---|
| 200 | 성공 (GET, PUT, PATCH) |
| 201 | 생성됨 (POST) |
| 204 | 콘텐츠 없음 (DELETE) |
| 400 | 유효성 검사 오류 |
| 401 | 인증 필요 |
| 403 | 권한 거부됨 |
| 404 | 리소스를 찾을 수 없음 |
| 429 | 요청 제한 초과 |
| 500 | 서버 내부 오류 |
데이터베이스 인덱스 전략
-- Single column (equality lookups)
CREATE INDEX idx_users_email ON users(email);
-- Composite (multi-column queries)
CREATE INDEX idx_orders_user_status ON orders(user_id, status);
-- Partial (filtered queries)
CREATE INDEX idx_orders_active ON orders(created_at) WHERE status = 'active';
-- Covering (avoid table lookup)
CREATE INDEX idx_users_email_name ON users(email) INCLUDE (name);
일반적인 명령어
# API Development
python scripts/api_scaffolder.py openapi.yaml --framework express
python scripts/api_scaffolder.py src/routes/ --generate-spec
# Database Operations
python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
python scripts/database_migration_tool.py --connection $DATABASE_URL --migrate file.sql
# Performance Testing
python scripts/api_load_tester.py https://api.example.com/endpoint --concurrency 50
python scripts/api_load_tester.py https://api.example.com/endpoint --compare baseline.json
가정 및 검증 가능한 성공 기준 (카르파티 원칙)
이 스킬이 스캐폴딩을 수행하거나, 패턴을 권장하거나, 스키마를 수정하기 전에 다음 네 가지 가정을 반드시 확인해야 합니다. 알려지지 않은 가정이 하나라도 있으면, 스킬은 중단되고 대신 강제 질문 라이브러리를 실행합니다.
- 읽기/쓰기 비율 + 1년 p99 QPS — DB, 캐시, 큐 및 파티셔닝 선택을 결정합니다. Kleppmann, DDIA (2017).
- 테넌시 모델 — 단일 테넌트, 공유 다중 테넌트, 격리된 다중 테넌트. 데이터 액세스 패턴을 결정합니다.
- 데이터 민감도 등급 — 공개 / 내부 / PII / PHI / PCI. 최소 준수 기준을 결정합니다.
- SLO + 명명된 오류 예산 소비자 — Google SRE 워크북의 정석. SLO가 없으면 신뢰성 작업의 우선순위 지정도 불가능합니다.
검증 가능한 성공 기준(Karpathy #4) — 이 스킬이 제시하는 모든 권장 사항에는 다음이 포함되어야 합니다:
- 지연 시간 목표치(p50, p95, p99, 단위: ms)
- 가동 시간 / SLO 목표
- RPO + RTO
이 세 가지 중 하나라도 명시되지 않았다면, 해당 권장 사항은 불완전한 것이므로 강제 질문 라이브러리의 Q7로 돌아가십시오.
이 scripts/backend_decision_engine.py 도구는 이러한 확인 사항을 반영하여, 읽기/쓰기 비율 + QPS + 테넌시 + 데이터 민감도 + 패턴 선호도가 지정되지 않은 프로필에 대해서는 권장 사항을 제공하지 않습니다.
사용자 지정 프로필
다음과 같은 네 가지 기본 제공 프로필이 profiles/ 모든 권장 사항을 보정합니다:
| 프로필 | 선택 시점 | 패턴 | 최소 지연 시간 (p99) |
|---|---|---|---|
node-express |
TS 팀, 엔지니어 15명 미만, 고객 대상 SaaS | Postgres 기반의 모듈식 모놀리식 아키텍처 | 600ms |
fastapi-python |
Python 팀, 엔지니어 20명 미만, 머신러닝 관련 | Postgres 기반의 모듈식 모놀리식 아키텍처 (비동기) | 500ms |
django-monolith |
콘텐츠 중심의 CRUD + 관리 기능, 엔지니어 25명 미만 | Postgres 기반의 모듈식 모놀리식 아키텍처 | 800ms |
go-or-rust-microservice |
서비스 분리, 엔지니어 30명 이상, 플랫폼 팀, QPS 1000 이상 | 서비스 분리 | 200ms |
다음 방법을 통해 프로필을 선택하세요:
python scripts/backend_decision_engine.py \
--team-size 8 --qps-p99 50 --read-write-ratio 20 \
--tenancy shared-multi-tenant --data-sensitivity pii \
--pattern modular-monolith --language-preference typescript
이 도구는 가장 적합한 프로필, 차선책(15% 이내인 경우), 스택 추천, 안티패턴, 지정된 승인자 및 SLO 하한값을 반환합니다. 이 도구는 절대 자동 승인을 하지 않습니다.
사용자 정의 프로필을 추가하려면: 복사 profiles/node-express.json 다음 위치에 profiles/ 로 복사한 후 constraints + success_thresholds + named_approver_chain.
구성 맵
이 스킬은 POWERFUL 등급 전문가들이 소유한 범위를 재구현하지 않습니다. 해당 전문가들의 스킬로 분기됩니다. 전체 라우팅 테이블은 references/composition_map.md 를 참조하십시오. 주요 분기점:
| 관심사 | 다음으로 분기 |
|---|---|
| API 계약 / 호환성 변경 위험 | engineering/skills/api-design-reviewer/ |
| 스키마 설계 + ERD + 인덱싱 | engineering/skills/database-designer/ |
| 다운타임 없는 스키마 마이그레이션 | engineering/skills/migration-architect/ |
| SLO + SLI + 오류 허용 한도 | engineering/slo-architect/ |
| 가시성 / 골든 시그널 | engineering/skills/observability-designer/ |
| CI/CD 파이프라인 | engineering/skills/ci-cd-pipeline-builder/ |
| 보안 / 위협 모델 | engineering-team/skills/senior-security/, adversarial-reviewer |
| 규정 준수 증빙 자료 (HIPAA / ISO 27001) | ra-qm-team/ |
| 커밋 전 카르파티 검토 | engineering/karpathy-coder/ |
| 실행 전 아키텍처 심층 검토 | engineering/grill-me/ |
이 cs-backend-engineer 에이전트는 다음을 통해 이러한 포크를 조정합니다 context: fork. 다른 에이전트에서 다음을 사용하여 이를 호출합니다. Agent({subagent_type: "cs-backend-engineer", prompt: "..."}) 또는 /cs:backend-review .
강제 질문 라이브러리(Matt Pocock grill)를 통해 호출할 수 있습니다
백엔드 결정을 확정하기 전에, references/forcing_questions.md. 준수 사항:
- 한 턴에 한 가지 질문만. 여러 질문을 묶지 마십시오.
- 항상 정설(canon)을 인용하여 답변을 제시하십시오.
- 답변은
/tmp/backend-grill-..md - 살해 기준이 발동되면 중단하십시오. 해결되지 않은 공백을 둘러싼 추측은 하지 마십시오.
- Q7 이후,
backend_decision_engine.py일곱 가지 답변을 바탕으로 진행하십시오.
요약:
- 읽기/쓰기 비율 + p99 QPS 예측?
- 테넌시 모델 — 단일 / 공유 / 격리?
- 동기식 / 비동기식 / 이벤트 기반 — 기본값 + 예외?
- 데이터 민감도 등급 — PII / PHI / PCI?
- 모놀리스 / 모듈식 모놀리스 / 마이크로서비스 — 팀 규모에 따른 타당성?
- RPO + RTO?
- SLO + 지정된 오류 허용 한도 소비자?
다른 에이전트 및 스킬에서의 호출
세 가지 인터페이스:
- 슬래시 명령어:
/cs:backend-review— 전체 그리드 + 의사결정 엔진 + 조합 라우팅. - 에이전트 서브에이전트:
Agent({subagent_type: "cs-backend-engineer", prompt: "..."})— 컨텍스트를 분기하고, 200단어 이하의 요약문을 반환합니다. - 도구 직접 호출:
python scripts/backend_decision_engine.py ...— 입력값이 알려진 경우 결정론적 프로필 매칭.
전체 호출 계약에 대해서는 agents/engineering/cs-backend-engineer.md 전체 호출 계약에 대해서는 여기를 참조하십시오.
---
name: senior-backend
description: Designs and implements backend systems including REST APIs, microservices, database architectures, authentication flows, and security hardening. Covers Node.js/Express/Fastify development, PostgreSQL optimization, API security, and backend architecture patterns.
---
# Senior Backend Engineer
Backend development patterns, API design, database optimization, and security practices.
---
## Quick Start
```bash
# Generate API routes from OpenAPI spec
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
# Analyze database schema and generate migrations
python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze
# Load test an API endpoint
python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30
```
---
## Tools Overview
### 1. API Scaffolder
Generates API route handlers, middleware, and OpenAPI specifications from schema definitions.
**Input:** OpenAPI spec (YAML/JSON) or database schema
**Output:** Route handlers, validation middleware, TypeScript types
**Usage:**
```bash
# Generate Express routes from OpenAPI spec
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
# Output: Generated 12 route handlers, validation middleware, and TypeScript types
# Generate from database schema
python scripts/api_scaffolder.py --from-db postgres://localhost/mydb --output src/routes/
# Generate OpenAPI spec from existing routes
python scripts/api_scaffolder.py src/routes/ --generate-spec --output openapi.yaml
```
**Supported Frameworks:**
- Express.js (`--framework express`)
- Fastify (`--framework fastify`)
- Koa (`--framework koa`)
---
### 2. Database Migration Tool
Analyzes database schemas, detects changes, and generates migration files with rollback support.
**Input:** Database connection string or schema files
**Output:** Migration files, schema diff report, optimization suggestions
**Usage:**
```bash
# Analyze current schema and suggest optimizations
python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze
# Output: Missing indexes, N+1 query risks, and suggested migration files
# Generate migration from schema diff
python scripts/database_migration_tool.py --connection postgres://localhost/mydb \
--compare schema/v2.sql --output migrations/
# Dry-run a migration
python scripts/database_migration_tool.py --connection postgres://localhost/mydb \
--migrate migrations/20240115_add_user_indexes.sql --dry-run
```
---
### 3. API Load Tester
Performs HTTP load testing with configurable concurrency, measuring latency percentiles and throughput.
**Input:** API endpoint URL and test configuration
**Output:** Performance report with latency distribution, error rates, throughput metrics
**Usage:**
```bash
# Basic load test
python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30
# Output: Throughput (req/sec), latency percentiles (P50/P95/P99), error counts, and scaling recommendations
# Test with custom headers and body
python scripts/api_load_tester.py https://api.example.com/orders \
--method POST \
--header "Authorization: Bearer token123" \
--body '{"product_id": 1, "quantity": 2}' \
--concurrency 100 \
--duration 60
# Compare two endpoints
python scripts/api_load_tester.py https://api.example.com/v1/users https://api.example.com/v2/users \
--compare --concurrency 50 --duration 30
```
---
## Backend Development Workflows
### API Design Workflow
Use when designing a new API or refactoring existing endpoints.
**Step 1: Define resources and operations**
```yaml
# openapi.yaml
openapi: 3.0.3
info:
title: User Service API
version: 1.0.0
paths:
/users:
get:
summary: List users
parameters:
- name: "limit"
in: query
schema:
type: integer
default: 20
post:
summary: Create user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUser'
```
**Step 2: Generate route scaffolding**
```bash
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
```
**Step 3: Implement business logic**
```typescript
// src/routes/users.ts (generated, then customized)
export const createUser = async (req: Request, res: Response) => {
const { email, name } = req.body;
// Add business logic
const user = await userService.create({ email, name });
res.status(201).json(user);
};
```
**Step 4: Add validation middleware**
```bash
# Validation is auto-generated from OpenAPI schema
# src/middleware/validators.ts includes:
# - Request body validation
# - Query parameter validation
# - Path parameter validation
```
**Step 5: Generate updated OpenAPI spec**
```bash
python scripts/api_scaffolder.py src/routes/ --generate-spec --output openapi.yaml
```
---
### Database Optimization Workflow
Use when queries are slow or database performance needs improvement.
**Step 1: Analyze current performance**
```bash
python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
```
**Step 2: Identify slow queries**
```sql
-- Check query execution plans
EXPLAIN ANALYZE SELECT * FROM orders
WHERE user_id = 123
ORDER BY created_at DESC
LIMIT 10;
-- Look for: Seq Scan (bad), Index Scan (good)
```
**Step 3: Generate index migrations**
```bash
python scripts/database_migration_tool.py --connection $DATABASE_URL \
--suggest-indexes --output migrations/
```
**Step 4: Test migration (dry-run)**
```bash
python scripts/database_migration_tool.py --connection $DATABASE_URL \
--migrate migrations/add_indexes.sql --dry-run
```
**Step 5: Apply and verify**
```bash
# Apply migration
python scripts/database_migration_tool.py --connection $DATABASE_URL \
--migrate migrations/add_indexes.sql
# Verify improvement
python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
```
---
### Security Hardening Workflow
Use when preparing an API for production or after a security review.
**Step 1: Review authentication setup**
```typescript
// Verify JWT configuration
const jwtConfig = {
secret: process.env.JWT_SECRET, // Must be from env, never hardcoded
expiresIn: '1h', // Short-lived tokens
algorithm: 'RS256' // Prefer asymmetric
};
```
**Step 2: Add rate limiting**
```typescript
import rateLimit from 'express-rate-limit';
const apiLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // 100 requests per window
standardHeaders: true,
legacyHeaders: false,
});
app.use('/api/', apiLimiter);
```
**Step 3: Validate all inputs**
```typescript
import { z } from 'zod';
const CreateUserSchema = z.object({
email: z.string().email().max(255),
name: z.string().min(1).max(100),
age: z.number().int().positive().optional()
});
// Use in route handler
const data = CreateUserSchema.parse(req.body);
```
**Step 4: Load test with attack patterns**
```bash
# Test rate limiting
python scripts/api_load_tester.py https://api.example.com/login \
--concurrency 200 --duration 10 --expect-rate-limit
# Test input validation
python scripts/api_load_tester.py https://api.example.com/users \
--method POST \
--body '{"email": "not-an-email"}' \
--expect-status 400
```
**Step 5: Review security headers**
```typescript
import helmet from 'helmet';
app.use(helmet({
contentSecurityPolicy: true,
crossOriginEmbedderPolicy: true,
crossOriginOpenerPolicy: true,
crossOriginResourcePolicy: true,
hsts: { maxAge: 31536000, includeSubDomains: true },
}));
```
---
## Reference Documentation
| File | Contains | Use When |
|------|----------|----------|
| `references/api_design_patterns.md` | REST vs GraphQL, versioning, error handling, pagination | Designing new APIs |
| `references/database_optimization_guide.md` | Indexing strategies, query optimization, N+1 solutions | Fixing slow queries |
| `references/backend_security_practices.md` | OWASP Top 10, auth patterns, input validation | Security hardening |
---
## Common Patterns Quick Reference
### REST API Response Format
```json
{
"data": { "id": 1, "name": "John" },
"meta": { "requestId": "abc-123" }
}
```
### Error Response Format
```json
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid email format",
"details": [{ "field": "email", "message": "must be valid email" }]
},
"meta": { "requestId": "abc-123" }
}
```
### HTTP Status Codes
| Code | Use Case |
|------|----------|
| 200 | Success (GET, PUT, PATCH) |
| 201 | Created (POST) |
| 204 | No Content (DELETE) |
| 400 | Validation error |
| 401 | Authentication required |
| 403 | Permission denied |
| 404 | Resource not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
### Database Index Strategy
```sql
-- Single column (equality lookups)
CREATE INDEX idx_users_email ON users(email);
-- Composite (multi-column queries)
CREATE INDEX idx_orders_user_status ON orders(user_id, status);
-- Partial (filtered queries)
CREATE INDEX idx_orders_active ON orders(created_at) WHERE status = 'active';
-- Covering (avoid table lookup)
CREATE INDEX idx_users_email_name ON users(email) INCLUDE (name);
```
---
## Common Commands
```bash
# API Development
python scripts/api_scaffolder.py openapi.yaml --framework express
python scripts/api_scaffolder.py src/routes/ --generate-spec
# Database Operations
python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
python scripts/database_migration_tool.py --connection $DATABASE_URL --migrate file.sql
# Performance Testing
python scripts/api_load_tester.py https://api.example.com/endpoint --concurrency 50
python scripts/api_load_tester.py https://api.example.com/endpoint --compare baseline.json
```
---
## Assumptions and Verifiable Success Criteria (Karpathy discipline)
Before this skill scaffolds, recommends a pattern, or modifies a schema, the following four assumptions MUST be surfaced. If any are unknown, the skill stops and walks the [Forcing-question library](#forcing-question-library-matt-pocock-grill) instead.
1. **Read/write ratio + one-year p99 QPS** — drives DB, cache, queue, and partitioning choices. Kleppmann, *DDIA* (2017).
2. **Tenancy model** — single-tenant, shared multi-tenant, isolated multi-tenant. Drives data-access pattern.
3. **Data sensitivity tier** — public / internal / PII / PHI / PCI. Drives compliance floor.
4. **SLO + named error-budget consumer** — Google SRE Workbook canon. No SLO = no reliability work prioritization.
**Verifiable success criteria** (Karpathy #4) — every recommendation this skill emits must include:
- Latency targets (p50, p95, p99 in ms)
- Uptime / SLO target
- RPO + RTO
If any of those three is not stated, the recommendation is incomplete — return to Q7 of the forcing-question library.
The `scripts/backend_decision_engine.py` tool encodes these checks: it refuses to recommend a profile without read/write ratio + QPS + tenancy + data sensitivity + pattern preference.
---
## Customization profiles
Four built-in profiles in `profiles/` calibrate every recommendation:
| Profile | When to pick | Pattern | Latency floor (p99) |
|---|---|---|---|
| `node-express` | TS team, < 15 eng, customer-facing SaaS | Modular monolith on Postgres | 600ms |
| `fastapi-python` | Python team, < 20 eng, ML-adjacent | Modular monolith on Postgres (async) | 500ms |
| `django-monolith` | Content-heavy CRUD + admin, < 25 eng | Modular monolith on Postgres | 800ms |
| `go-or-rust-microservice` | Extracted service, ≥ 30 eng, platform team, QPS ≥ 1000 | Extracted service | 200ms |
Pick a profile via:
```bash
python scripts/backend_decision_engine.py \
--team-size 8 --qps-p99 50 --read-write-ratio 20 \
--tenancy shared-multi-tenant --data-sensitivity pii \
--pattern modular-monolith --language-preference typescript
```
The tool returns the best-fit profile, runner-up tradeoff (if within 15%), stack picks, anti-patterns, named approvers, and SLO floor. **This tool never auto-approves.**
To add a custom profile: copy `profiles/node-express.json` to `profiles/<your-org>.json` and adjust `constraints` + `success_thresholds` + `named_approver_chain`.
---
## Composition map
This skill does NOT reimplement scope owned by the POWERFUL-tier specialists. It forks into them. See `references/composition_map.md` for the full routing table. Key forks:
| Concern | Fork into |
|---|---|
| API contract / breaking-change risk | `engineering/skills/api-design-reviewer/` |
| Schema design + ERD + indexing | `engineering/skills/database-designer/` |
| Zero-downtime schema migration | `engineering/skills/migration-architect/` |
| SLO + SLI + error-budget | `engineering/slo-architect/` |
| Observability / golden signals | `engineering/skills/observability-designer/` |
| CI/CD pipeline | `engineering/skills/ci-cd-pipeline-builder/` |
| Security / threat model | `engineering-team/skills/senior-security/`, `adversarial-reviewer` |
| Compliance evidence (HIPAA / ISO 27001) | `ra-qm-team/` |
| Pre-commit Karpathy review | `engineering/karpathy-coder/` |
| Pre-flight architecture grill | `engineering/grill-me/` |
The `cs-backend-engineer` agent orchestrates these forks via `context: fork`. Invoke it from another agent with `Agent({subagent_type: "cs-backend-engineer", prompt: "..."})` or via `/cs:backend-review <your problem>`.
---
## Forcing-question library (Matt Pocock grill)
Before locking any backend decision, walk the seven forcing questions in `references/forcing_questions.md`. Discipline:
1. One question per turn. No bundling.
2. Always recommend the answer with cited canon.
3. Track answers in `/tmp/backend-grill-<date>.md`.
4. If a kill criterion trips, stop. Don't scaffold around an unresolved gap.
5. After Q7, run `backend_decision_engine.py` with the seven answers.
Summary:
1. Read/write ratio + p99 QPS forecast?
2. Tenancy model — single / shared / isolated?
3. Sync / async / event-driven — default + exceptions?
4. Data sensitivity tier — PII / PHI / PCI?
5. Monolith / modular monolith / microservices — team-size justification?
6. RPO + RTO?
7. SLO + named error-budget consumer?
---
## Invocation from other agents and skills
Three surfaces:
1. **Slash command:** `/cs:backend-review <prompt>` — full grill + decision engine + composition routing.
2. **Agent subagent:** `Agent({subagent_type: "cs-backend-engineer", prompt: "..."})` — forks context, returns ≤ 200-word digest.
3. **Direct tool call:** `python scripts/backend_decision_engine.py ...` — deterministic profile match when inputs are known.
See `agents/engineering/cs-backend-engineer.md` for the full invocation contract.
모든 파일
0개 파일senior-backend 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/alirezarezvani/claude-skills/tree/main/engineering-team/skills/senior-backend # Copy SKILL.md to your .claude/skills/ directory
복사





집
