본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #4006

backend-dev-guidelines

하는 일

이 가이드는 백엔드 시스템(데이터와 로직을 처리하는 애플리케이션의 '보이지 않는' 부분)을 체계적이고 안정적으로 만드는 방법을 알려 줍니다. 코드를 어떻게 작성할지 명확한 규칙을 정해, 이해하기 쉽고 유지보수가 쉬우며 오류를 빨리 찾을 수 있게 합니다.

사용하는 경우

  • ✓새로운 백엔드 기능을 만들 때.
  • ✓기존 시스템의 버그를 고칠 때.
  • ✓백엔드 코드를 정리하거나 재구성할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/backend-dev-guidelines/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/backend-dev-guidelines/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“새 사용자 로그인 기능의 코드를 어떻게 구조화해야 하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 가이드는 각 코드 조각이 특정 역할을 하는 '계층' 구조를 정합니다(라우트, 컨트롤러, 서비스 등). 또한 모든 오류는 Sentry라는 시스템에 기록하도록 하고, 입력 데이터는 Zod를 사용해 검증하여 버그를 막도록 요구합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

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

export class UserController extends BaseController {
  async getUser(req: Request, res: Response): Promise<void> {
    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

catch (error) {
  Sentry.captureException(error);
  throw error;
}

❌ console.log ❌ silent failures ❌ swallowed errors


6. unifiedConfig Is the Only Config Source

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

…
자주 묻는 질문

「백엔드 실현 가능성 및 위험 지수(BFRI)」란 무엇인가요?

새 기능을 안전하게 구현할 수 있는지, 아니면 재설계가 필요한지 판단하도록 돕는 점수입니다. 복잡성, 데이터 위험, 코드의 테스트 용이성 등을 고려합니다.

왜 라우트에 로직을 직접 넣으면 안 되나요?

라우트는 요청을 전달만 해야 합니다. 라우트에 로직을 넣으면 구성과 테스트가 어려워집니다. 비즈니스 로직은 「서비스」에 두어야 합니다.

백엔드 개발에서 「계층」이란 무엇인가요?

작업을 나누는 구조와 같습니다. 요청은 「라우트」에 도착해 「컨트롤러」를 호출하고, 「컨트롤러」는 「서비스」를 호출해 로직을 실행합니다. 「서비스」는 「리포지토리」를 사용해 데이터베이스에 접근합니다. 각 계층은 고유한 책임을 가집니다.

상세 정보

작성자의 원본 설명

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.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4006
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬