Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问clear审计异常

senior-backend高级后端

Agent Skill

senior-backend 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,832

周安装

155

GitHub Stars

103

下载量

1,203
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:senior-backend(高级后端)
来源仓库:https://github.com/borghei/claude-skills
仓库路径:skills/senior-backend
安装命令:
npx skills add https://github.com/borghei/claude-skills --skill senior-backend
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/borghei/claude-skills --skill senior-backend

简介

senior-backend 提供 API 脚手架与数据库迁移自动化工具。

  • 支持 Express、FastAPI 等主流框架与 PostgreSQL、MongoDB 等数据库。
  • 集成负载测试与安全加固建议,提升后端健壮性。
  • 生产环境修改前应完成测试覆盖与回滚方案设计。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Senior Backend Engineer

Backend development patterns, API design, database optimization, and security practices.

Table of Contents

- API Scaffolder - Database Migration Tool - API Load Tester

- API Design Workflow - Database Optimization Workflow - Security Hardening Workflow


Quick Start

# 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:

# Generate Express routes from OpenAPI spec
python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/

# Output:
# Generated 12 route handlers in src/routes/
# - GET /users (listUsers)
# - POST /users (createUser)
# - GET /users/{id} (getUser)
# - PUT /users/{id} (updateUser)
# - DELETE /users/{id} (deleteUser)
# ...
# Created validation middleware: src/middleware/validators.ts
# Created TypeScript types: src/types/api.ts

# 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:

# Analyze current schema and suggest optimizations
python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze

# Output:
# === Database Analysis Report ===
# Tables: 24
# Total rows: 1,247,832
#
# MISSING INDEXES (5 found):
#   orders.user_id - 847ms avg query time, ADD INDEX recommended
#   products.category_id - 234ms avg query time, ADD INDEX recommended
#
# N+1 QUERY RISKS (3 found):
#   users -> orders relationship (no eager loading)
#
# SUGGESTED MIGRATIONS:
#   1. Add index on orders(user_id)
#   2. Add index on products(category_id)
#   3. Add composite index on order_items(order_id, product_id)

# Generate migration from schema diff
python scripts/database_migration_tool.py --connection postgres://localhost/mydb \
  --compare schema/v2.sql --output migrations/

# Output:
# Generated migration: migrations/20240115_add_user_indexes.sql
# Generated rollback: migrations/20240115_add_user_indexes_rollback.sql

# 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:

# Basic load test
python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30

# Output:
# === Load Test Results ===
# Target: https://api.example.com/users
# Duration: 30s | Concurrency: 50
#
# THROUGHPUT:
#   Total requests: 15,247
#   Requests/sec: 508.2
#   Successful: 15,102 (99.0%)
#   Failed: 145 (1.0%)
#
# LATENCY (ms):
#   Min: 12
#   Avg: 89
#   P50: 67
#   P95: 198
#   P99: 423
#   Max: 1,247
#
# ERRORS:
#   Connection timeout: 89
#   HTTP 503: 56
#
# RECOMMENDATION: P99 latency (423ms) exceeds 200ms target.
# Consider: connection pooling, query optimization, or horizontal scaling.

# 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

# 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

python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/

Step 3: Implement business logic

// 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

# 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

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

python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze

Step 2: Identify slow queries

-- 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

python scripts/database_migration_tool.py --connection $DATABASE_URL \
  --suggest-indexes --output migrations/

Step 4: Test migration (dry-run)

python scripts/database_migration_tool.py --connection $DATABASE_URL \
  --migrate migrations/add_indexes.sql --dry-run

Step 5: Apply and verify

# 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

// 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

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

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

# 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

import helmet from 'helmet';

app.use(helmet({
  contentSecurityPolicy: true,
  crossOriginEmbedderPolicy: true,
  crossOriginOpenerPolicy: true,
  crossOriginResourcePolicy: true,
  hsts: { maxAge: 31536000, includeSubDomains: true },
}));

Reference Documentation

FileContainsUse When
references/api_design_patterns.mdREST vs GraphQL, versioning, error handling, paginationDesigning new APIs
references/database_optimization_guide.mdIndexing strategies, query optimization, N+1 solutionsFixing slow queries
references/backend_security_practices.mdOWASP Top 10, auth patterns, input validationSecurity hardening

Common Patterns Quick Reference

REST API Response Format

{
  "data": { "id": 1, "name": "John" },
  "meta": { "requestId": "abc-123" }
}

Error Response Format

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid email format",
    "details": [{ "field": "email", "message": "must be valid email" }]
  },
  "meta": { "requestId": "abc-123" }
}

HTTP Status Codes

CodeUse Case
200Success (GET, PUT, PATCH)
201Created (POST)
204No Content (DELETE)
400Validation error
401Authentication required
403Permission denied
404Resource not found
429Rate limit exceeded
500Internal server error

Database Index Strategy

-- 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

# 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

Troubleshooting

ProblemCauseSolution
api_scaffolder.py generates empty route filesOpenAPI spec missing operationId fields or paths use unsupported HTTP methodsAdd operationId to each operation; verify methods are GET, POST, PUT, PATCH, or DELETE
database_migration_tool.py parses zero tablesSQL file uses non-standard DDL syntax or multi-line comments break regex parsingEnsure CREATE TABLE statements end with ; and remove block comments (/*... */) before analysis
Load tester reports 100% failure rateTarget URL unreachable, SSL verification failing, or firewall blocking concurrent connectionsVerify URL manually with curl; try --no-verify-ssl for self-signed certs; reduce --concurrency
Generated TypeScript types show unknown for all fieldsOpenAPI schema uses $ref references to external files or missing components/schemas sectionInline referenced schemas or ensure all $ref targets exist within the same spec file
Migration diff reports "No changes" when changes existColumn type differences are case-sensitive; VARCHAR(255) vs varchar(255) treated as differentNormalize casing in schema files; the parser converts types to uppercase internally
Load tester hangs after duration expiresWorker threads blocked on slow connections that exceed the default 30s timeoutSet --timeout lower than --duration (e.g., --timeout 5 --duration 30) to prevent thread starvation
Zod validators missing for nested objectsDeeply nested $ref chains not fully resolved by the scaffolderFlatten nested schemas in the OpenAPI spec or manually extend the generated validators

Success Criteria

  • API p99 latency under 200ms at production concurrency levels, verified by api_load_tester.py
  • Zero N+1 query patterns detected in schema analysis via database_migration_tool.py --analyze
  • All foreign key columns indexed with no "missing index" warnings from the migration tool
  • 100% of generated routes include input validation middleware (Zod schemas auto-generated from OpenAPI spec)
  • Success rate above 99.5% during sustained load tests at target concurrency for 60+ seconds
  • Every migration paired with a rollback script to enable zero-downtime deployment reversals
  • API response format consistency across all endpoints following the standardized data/error/meta envelope pattern

Scope & Limitations

What this skill covers:

  • REST API design, scaffolding, and OpenAPI-driven code generation for Express, Fastify, and Koa
  • PostgreSQL schema analysis, index optimization, migration generation with rollback support
  • HTTP load testing with latency percentile analysis, throughput measurement, and endpoint comparison
  • Backend security patterns including JWT configuration, rate limiting, input validation, and security headers

What this skill does NOT cover:

  • Frontend development, UI components, or client-side state management -- see senior-frontend
  • Infrastructure provisioning, container orchestration, or CI/CD pipeline setup -- see senior-devops
  • GraphQL schema design, resolvers, or subscriptions -- see senior-fullstack
  • Application performance monitoring (APM), distributed tracing, or log aggregation -- see senior-secops

Integration Points

SkillIntegrationData Flow
senior-fullstackAPI routes generated here feed into fullstack project scaffoldingOpenAPI spec → fullstack scaffolder consumes as API contract
senior-devopsMigration scripts output here are consumed by CI/CD deployment pipelinesmigrations/ directory → deployment workflow applies and verifies
senior-securityLoad test results and security hardening output feed into security reviewLoad test JSON → security audit validates rate limiting and error handling
senior-qaGenerated route handlers and validators provide test surface for QA automationRoute files + Zod schemas → QA generates integration test suites
senior-frontendTypeScript types generated by the scaffolder are shared with frontend consumerstypes.ts → frontend imports API types for type-safe client code
code-reviewerSchema analysis issues and migration diffs feed into code review checklistsAnalysis report → reviewer validates index coverage and naming conventions

Tool Reference

api_scaffolder.py

Purpose: Generate Express.js/Fastify/Koa route handlers, Zod validators, and TypeScript types from an OpenAPI specification.

Usage:

python scripts/api_scaffolder.py <spec> [flags]

Flags:

FlagShortTypeDefaultDescription
specpositional*(required)*Path to OpenAPI specification file (YAML or JSON)
--output-ostring./generatedOutput directory for generated files
--framework-fchoiceexpressTarget framework: express, fastify, or koa
--types-onlyflagfalseGenerate only TypeScript type definitions, skip routes and validators
--verbose-vflagfalseEnable verbose output (shows spec title/version)
--jsonflagfalseOutput results summary as JSON

Example:

python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/ --verbose
API Scaffolder - Express
Spec: openapi.yaml
Output: src/routes/
--------------------------------------------------
Loaded: User Service API v1.0.0
  Generated: src/routes/types.ts
  Generated: src/routes/validators.ts
  Generated: src/routes/users.routes.ts (5 handlers)
  Generated: src/routes/index.ts
--------------------------------------------------
Generated 5 route handlers
Generated 3 type definitions
Output: src/routes/

Output Formats: Human-readable console output by default. Add --json for machine-readable JSON with status, generated_files, routes_count, and types_count fields.


database_migration_tool.py

Purpose: Analyze SQL schema files for issues, compare schemas to generate migrations with rollback scripts, and suggest missing indexes.

Usage:

python scripts/database_migration_tool.py <schema> [flags]

Flags:

FlagShortTypeDefaultDescription
schemapositional*(required)*Path to SQL schema file
--analyzeflagfalseAnalyze schema for issues and optimizations (default mode if no other mode specified)
--comparestringPath to a second schema file to compare against and generate migration
--suggest-indexesflagfalseGenerate index suggestions for foreign keys, filter columns, and timestamps
--output-ostringOutput directory for generated migration files
--verbose-vflagfalseEnable verbose output (shows parsed table count and info-level suggestions)
--jsonflagfalseOutput results as JSON

Example:

python scripts/database_migration_tool.py schema.sql --analyze --verbose
Database Migration Tool
Schema: schema.sql
--------------------------------------------------
Parsed 8 tables

Analysis Results:
  Tables: 8
  Errors: 1
  Warnings: 3
  Suggestions: 7

ERRORS:
  [audit_log] Table 'audit_log' has no primary key
    Suggestion: Add a primary key column (e.g., 'id SERIAL PRIMARY KEY')

WARNINGS:
  [orders] Foreign key column 'user_id' is not indexed
    Suggestion: CREATE INDEX idx_orders_user_id ON orders(user_id);

Output Formats: Human-readable console output by default. Add --json for structured JSON with issues_detail array containing severity, category, table, message, and suggestion for each finding. When using --compare --output, generates timestamped _migration.sql and _migration_rollback.sql files.


api_load_tester.py

Purpose: Perform HTTP load testing with configurable concurrency, measuring latency percentiles (p50/p90/p95/p99), throughput, error rates, and optional endpoint comparison.

Usage:

python scripts/api_load_tester.py <urls...> [flags]

Flags:

FlagShortTypeDefaultDescription
urlspositional*(required)*One or more URLs to test
--method-mchoiceGETHTTP method: GET, POST, PUT, PATCH, or DELETE
--body-bstringRequest body as a JSON string
--header-Hstring (repeatable)HTTP header in "Name: Value" format; can be specified multiple times
--concurrency-cint10Number of concurrent request threads
--duration-dfloat10.0Test duration in seconds
--timeout-tfloat30.0Per-request timeout in seconds
--compareflagfalseCompare two endpoints side-by-side (requires two URLs)
--no-verify-sslflagfalseDisable SSL certificate verification
--verbose-vflagfalseEnable verbose output (shows transfer bytes and throughput Mbps)
--jsonflagfalseOutput results as JSON
--output-ostringFile path to write JSON results

Example:

python scripts/api_load_tester.py https://api.example.com/users \
  --method GET \
  --header "Authorization: Bearer tok_abc123" \
  --concurrency 50 \
  --duration 30 \
  --verbose
============================================================
LOAD TEST RESULTS
============================================================

Target: https://api.example.com/users
Method: GET
Duration: 30.2s
Concurrency: 50

THROUGHPUT:
  Total requests: 14,832
  Requests/sec: 491.1
  Successful: 14,710 (99.2%)
  Failed: 122

LATENCY (ms):
  Min: 11.3
  Avg: 92.4
  P50: 71.2
  P90: 165.8
  P95: 201.3
  P99: 387.6
  Max: 1,102.5
  StdDev: 89.2

TRANSFER:
  Total bytes: 45,291,520
  Throughput: 12.01 Mbps

RECOMMENDATIONS:
  Warning: P99 latency (388ms) exceeds 500ms
    Consider: Connection pooling, query optimization, caching
  Performance looks good for this load level
============================================================

Output Formats: Human-readable console report by default with latency distribution and recommendations. Add --json for structured JSON output. Use --output results.json to write results to a file. When using --compare with two URLs, outputs a side-by-side metric comparison table.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.85%
按下载量换算323

OpenCode

23.31%
按下载量换算280

Gemini CLI

17.3%
按下载量换算208

Antigravity

13.34%
按下载量换算160

Cursor

7%
按下载量换算84

windsurf

3.2%
按下载量换算38

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills