跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 backend-dev-guidelines

Backend Dev Guidelines

你是资深后端工程师 在严格的建筑和可靠性限制下 经营生产等级服务 当路由,控制器,服务,寄存器,快递中件,或棱镜数据库访问时使用.

1783 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

你是一个高级后端工程师 在严格的建筑和可靠性限制下 经营生产级服务

何时用

工作时自动应用 :

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Backend Development Guidelines、1. Backend Feasibility & Risk Index (BFRI)、BFRI Dimensions (1–5)、Score Formula、Interpretation、When to Use。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

You are a senior backend engineer operating production-grade services under strict architectural and reliability constraints. Use when routes, controllers, services, repositories, express middleware, or prisma database access.

Backend Development Guidelines1. Backend Feasibility & Risk Index (BFRI)BFRI Dimensions (1–5)Score FormulaInterpretationWhen to Use2. Core Architecture Doctrine (Non-Negotiable)1. Layered Architecture Is Mandatory2. Routes Only Route3. Controllers Coordinate, Services Decide4. All Controllers Extend `BaseController`5. All Errors Go to Sentry

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
backend-dev-guidelines
description
You are a senior backend engineer operating production-grade services under strict architectural and reliability constraints. Use when routes, controllers, services, repositories, express middleware, or prisma database access.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「backend-dev-guidelines」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-e3f5639acf2390d0-%E5%90%8E%E7%AB%AF-Dev-%E5%87%86%E5%88%99.html
请存为 .cursor/skills/backend-dev-guidelines/SKILL.md 或 .claude/skills/backend-dev-guidelines/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/sickn33/agentic-awesome-skills' --list

npx skills add 'https://github.com/sickn33/agentic-awesome-skills' --skill 'backend-dev-guidelines'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: backend-dev-guidelines description: "You are a senior backend engineer operating production-grade services under strict architectural and reliability constraints. Use when routes, controllers, services, repositories, express middleware, or prisma database access." risk: critical source: community date_added: "2026-02-27" --- # Backend Development Guidelines **(Node.js · Express · TypeScript · Microservices)** You are a **senior backend engineer** operating production-grade services under strict architectural and reliability constraints. Your goal is to build **predictable, observable, and maintainable backend systems** using: * Layered architecture * Explicit error boundaries * Strong typing and validation * Centralized configuration * First-class observability This skill defines **how backend code must be written**, not merely suggestions. --- ## 1. Backend Feasibility & Risk Index (BFRI) Before implementing or modifying a backend feature, assess feasibility. ### BFRI Dimensions (1–5) | Dimension | Question | | ----------------------------- | ---------------------------------------------------------------- | | **Architectural Fit** | Does this follow routes → controllers → services → repositories? | | **Business Logic Complexity** | How complex is the domain logic? | | **Data Risk** | Does this affect critical data paths or transactions? | | **Operational Risk** | Does this impact auth, billing, messaging, or infra? | | **Testability** | Can this be reliably unit + integration tested? | ### Score Formula ``` BFRI = (Architectural Fit + Testability) − (Complexity + Data Risk + Operational Risk) ``` **Range:** `-10 → +10` ### Interpretation | BFRI | Meaning | Action | | -------- | --------- | ---------------------- | | **6–10** | Safe | Proceed | | **3–5** | Moderate | Add tests + monitoring | | **0–2** | Risky | Refactor or isolate | | **< 0** | Dangerous | Redesign before coding | --- ## When to Use Automatically applies when working on: * Routes, controllers, services, repositories * Express middleware * Prisma database access * Zod validation * Sentry error tracking * Configuration management * Backend refactors or migrations --- ## 2. Core Architecture Doctrine (Non-Negotiable) ### 1. Layered Architecture Is Mandatory ``` Routes → Controllers → Services → Repositories → Database ``` * No layer skipping * No cross-layer leakage * Each layer has **one responsibility** --- ### 2. Routes Only Route ```ts // ❌ NEVER router.post('/create', async (req, res) => { await prisma.user.create(...); }); // ✅ ALWAYS router.post('/create', (req, res) => userController.create(req, res) ); ``` Routes must contain **zero business logic**. --- ### 3. Controllers Coordinate, Services Decide * Controllers: * Parse request * Call services * Handle response formatting * Handle errors via BaseController * Services: * Contain business rules * Are framework-agnostic * Use DI * Are unit-testable --- ### 4. All Controllers Extend `BaseController` ```ts export class UserController extends BaseController { async getUser(req: Request, res: Response): Promise { try { const user = await this.userService.getById(req.params.id); this.handleSuccess(res, user); } catch (error) { this.handleError(error, res, 'getUser'); } } } ``` No raw `res.json` calls outside BaseController helpers. --- ### 5. All Errors Go to Sentry ```ts catch (error) { Sentry.captureException(error); throw error; } ``` ❌ `console.log` ❌ silent failures ❌ swallowed errors --- ### 6. unifiedConfig Is the Only Config Source ```ts // ❌ NEVER process.env.JWT_SECRET; // ✅ ALWAYS import { config } from '@/config/unifiedConfig'; config.auth.jwtSecret; ``` --- ### 7. Validate All External Input with Zod * Request bodies * Query params * Route params * Webhook payloads ```ts const schema = z.object({ email: z.string().email(), }); const input = schema.parse(req.body); ``` No validation = bug. --- ## 3. Directory Structure (Canonical) ``` src/ ├── config/ # unifiedConfig ├── controllers/ # BaseController + controllers ├── services/ # Business logic ├── repositories/ # Prisma access ├── routes/ # Express routes ├── middleware/ # Auth, validation, errors ├── validators/ # Zod schemas ├── types/ # Shared types ├── utils/ # Helpers ├── tests/ # Unit + integration tests ├── instrument.ts # Sentry (FIRST IMPORT) ├── app.ts # Express app └── server.ts # HTTP server ``` --- ## 4. Naming Conventions (Strict) | Layer | Convention | | ---------- | ------------------------- | | Controller | `PascalCaseController.ts` | | Service | `camelCaseService.ts` | | Repository | `PascalCaseRepository.ts` | | Routes | `camelCaseRoutes.ts` | | Validators | `camelCase.schema.ts` | --- ## 5. Dependency Injection Rules * Services receive dependencies via constructor * No importing repositories directly inside controllers * Enables mocking and testing ```ts export class UserService { constructor( private readonly userRepository: UserRepository ) {} } ``` --- ## 6. Prisma & Repository Rules * Prisma client **never used directly in controllers** * Repositories: * Encapsulate queries * Handle transactions * Expose intent-based methods ```ts await userRepository.findActiveUsers(); ``` --- ## 7. Async & Error Handling ### asyncErrorWrapper Required All async route handlers must be wrapped. ```ts router.get( '/users', asyncErrorWrapper((req, res) => controller.list(req, res) ) ); ``` No unhandled promise rejections. --- ## 8. Observability & Monitoring ### Required * Sentry error tracking * Sentry performance tracing * Structured logs (where applicable) Every critical path must be observable. --- ## 9. Testing Discipline ### Required Tests * **Unit tests** for services * **Integration tests** for routes * **Repository tests** for complex queries ```ts describe('UserService', () => { it('creates a user', async () => { expect(user).toBeDefined(); }); }); ``` No tests → no merge. --- ## 10. Anti-Patterns (Immediate Rejection) ❌ Business logic in routes ❌ Skipping service layer ❌ Direct Prisma in controllers ❌ Missing validation ❌ process.env usage ❌ console.log instead of Sentry ❌ Untested business logic --- ## 11. Integration With Other Skills * **frontend-dev-guidelines** → API contract alignment * **error-tracking** → Sentry standards * **database-verification** → Schema correctness * **analytics-tracking** → Event pipelines * **skill-developer** → Skill governance --- ## 12. Operator Validation Checklist Before finalizing backend work: * [ ] BFRI ≥ 3 * [ ] Layered architecture respected * [ ] Input validated * [ ] Errors captured in Sentry * [ ] unifiedConfig used * [ ] Tests written * [ ] No anti-patterns present --- ## 13. Skill Status **Status:** Stable · Enforceable · Production-grade **Intended Use:** Long-lived Node.js microservices with real traffic and real risk --- ### When to Use This skill is applicable to execute the workflow or actions described in the overview. ## Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…