Skip to content

Split View: AGENT.md, CLAUDE.md, Skills 완전 활용 가이드: AI 코딩 어시스턴트 마스터하기

|

AGENT.md, CLAUDE.md, Skills 완전 활용 가이드: AI 코딩 어시스턴트 마스터하기

목차

  1. CLAUDE.md / AGENT.md 란 무엇인가
  2. 효과적인 CLAUDE.md 작성법
  3. 금지 패턴과 규칙 설정의 핵심
  4. Skills 파일 완전 정복
  5. 프로젝트별 CLAUDE.md 실전 예시
  6. AI 코딩 생산성 10배 높이는 프롬프트 전략
  7. AI 코딩 워크플로 실전
  8. 팀 AI 활용 원칙 수립
  9. 멀티 에이전트 코딩 (미래 전망)
  10. 퀴즈

1. CLAUDE.md / AGENT.md 란 무엇인가

AI 코딩 어시스턴트의 기억 문제

AI 코딩 어시스턴트는 매우 강력하지만 근본적인 제약이 있습니다. 대화 세션이 끊기면 이전 컨텍스트를 잊어버립니다. "우리 프로젝트는 TypeScript를 사용하고, 함수는 50줄 이하로 작성하며, console.log는 프로덕션 코드에 사용하지 않는다"는 규칙을 매번 새 세션마다 다시 설명해야 한다면 엄청난 비효율이 발생합니다.

이 문제를 해결하는 것이 바로 CLAUDE.mdAGENT.md입니다.

두 파일의 차이

CLAUDE.md는 Anthropic의 Claude Code 전용 설정 파일입니다. Claude Code가 프로젝트를 열면 자동으로 이 파일을 읽어 프로젝트 컨텍스트를 파악합니다. Claude Code의 모든 기능과 깊이 통합되어 있으며, 메모리 시스템, 허용/금지 명령어 설정, 커스텀 명령어(Skills) 등과 연동됩니다.

AGENT.md는 범용 에이전트 설정 파일입니다. Claude Code 외에도 Cursor, GitHub Copilot Workspace, Devin, OpenHands 등 다양한 AI 코딩 도구에서 공통으로 사용할 수 있도록 설계된 표준 형식입니다. 여러 AI 도구를 함께 사용하는 팀이라면 AGENT.md를 기본으로 사용하고 도구별 특수 설정은 별도 파일로 분리하는 전략이 유효합니다.

파일 위치와 계층 구조

파일은 프로젝트 루트에 위치합니다.

my-project/
  CLAUDE.md          # 프로젝트 전체 설정
  src/
    CLAUDE.md        # src 디렉토리 특화 설정
    components/
      CLAUDE.md      # 컴포넌트 특화 설정
  backend/
    CLAUDE.md        # 백엔드 특화 설정

Claude Code는 현재 작업 중인 파일의 위치에서 루트 방향으로 올라가며 모든 CLAUDE.md를 읽고 합칩니다. 이를 통해 계층적 설정이 가능합니다.

  • 루트 CLAUDE.md: 전체 프로젝트 공통 규칙 (코딩 표준, 커밋 메시지 형식 등)
  • 서브디렉토리 CLAUDE.md: 해당 영역 특화 규칙 (백엔드 API 작성 시 반드시 OpenAPI 스펙 업데이트 등)

왜 이것이 중요한가

연구에 따르면 AI 어시스턴트에게 적절한 컨텍스트를 제공했을 때 코드 품질이 현저히 향상됩니다. CLAUDE.md가 없는 AI는 일반적인 베스트 프랙티스를 따르려 하지만, 프로젝트 고유의 컨벤션이나 아키텍처 결정 사항을 알 수 없습니다. 결과적으로 팀의 코드 스타일과 맞지 않는 코드를 생성하거나, 금지된 패턴을 사용하거나, 기존 유틸리티 함수를 재발명하는 실수를 반복합니다.

잘 작성된 CLAUDE.md는 AI를 팀의 시니어 개발자처럼 동작하게 만듭니다. 팀의 결정 사항과 컨벤션을 깊이 이해하고 그에 맞는 코드를 생성하게 됩니다.


2. 효과적인 CLAUDE.md 작성법

기본 구조

효과적인 CLAUDE.md는 다음 섹션들로 구성됩니다.

# Project Overview

프로젝트 목적, 기술 스택, 아키텍처 개요

# Tech Stack

- Language: TypeScript 5.x
- Framework: Next.js 15 (App Router)
- Database: PostgreSQL + Prisma ORM
- Testing: Vitest + Testing Library

# Project Structure

src/
app/ # Next.js App Router
components/ # React components
lib/ # Utility functions
types/ # TypeScript types

# Coding Standards

- 함수 최대 50줄
- 타입 any 사용 금지
- 모든 함수에 JSDoc 필수
- 컴포넌트는 named export만 사용

# Testing Requirements

- 모든 유틸 함수: 단위 테스트 필수
- API 라우트: 통합 테스트 필수
- 커버리지 80% 이상

# Git Conventions

- Conventional Commits 준수
- PR당 200줄 이하

# Forbidden Patterns

- console.log 프로덕션 코드에 금지
- any 타입 금지
- 하드코딩된 URL 금지

Project Overview 섹션

첫 번째 섹션은 AI가 프로젝트의 큰 그림을 이해하게 해줍니다. 여기에는 다음을 포함하세요.

프로젝트 목적: 무엇을 만드는가, 누가 사용하는가, 핵심 가치가 무엇인가를 2-3문장으로 명확히 기술합니다.

도메인 개념: 프로젝트 고유의 비즈니스 용어나 도메인 개념을 설명합니다. 예를 들어 "Order(주문)는 Draft, Pending, Confirmed, Shipped, Delivered 상태를 가지며 각 상태 전환에는 비즈니스 규칙이 있다"와 같은 정보는 AI가 올바른 코드를 생성하는 데 결정적입니다.

아키텍처 결정: 모노레포 vs 멀티레포, 마이크로서비스 vs 모놀리스, 레이어드 아키텍처 vs 헥사고날 아키텍처 등 주요 아키텍처 결정 사항을 기록합니다.

Tech Stack 섹션

버전까지 포함하는 것이 중요합니다. "React"가 아니라 "React 19"라고 명시해야 AI가 해당 버전의 최신 기능과 패턴을 사용합니다. Next.js 14의 Pages Router와 Next.js 15의 App Router는 코드 패턴이 완전히 다릅니다.

Project Structure 섹션

단순히 디렉토리를 나열하는 것보다 각 디렉토리의 역할을 주석으로 설명하는 것이 효과적입니다.

# Project Structure

src/
app/ # Next.js App Router - 페이지 및 레이아웃
(auth)/ # 인증 필요 라우트 그룹
(public)/ # 공개 라우트 그룹
api/ # API Route Handlers
components/ # 재사용 가능한 React 컴포넌트
ui/ # shadcn/ui 기반 기본 UI 컴포넌트
features/ # 기능별 컴포넌트 (auth, dashboard 등)
lib/ # 순수 유틸리티 함수 (프레임워크 의존성 없음)
hooks/ # 커스텀 React Hooks
stores/ # Zustand 상태 관리
types/ # TypeScript 타입 정의
server/ # 서버 전용 코드 (DB, 외부 API 등)

Coding Standards 섹션

이 섹션은 AI가 코드를 생성할 때 따라야 할 팀의 규칙을 정의합니다. 추상적인 원칙보다 구체적인 규칙이 효과적입니다.

좋지 않은 예: "클린 코드를 작성하라" 좋은 예: "함수는 50줄 이하, 파라미터는 4개 이하, 중첩 if 문은 2단계 이하"

좋지 않은 예: "에러 처리를 잘 하라" 좋은 예: "모든 async 함수는 try-catch로 감싸고, 에러는 반드시 logger.error()로 기록하며, 사용자 대면 에러 메시지는 'USER_FACING_ERROR' 태그를 붙인다"

최신 정보 유지

CLAUDE.md는 살아있는 문서여야 합니다. 새로운 라이브러리를 도입했다면 Tech Stack에 추가하고, 새로운 금지 패턴을 발견했다면 Forbidden Patterns에 추가하세요. 코드 리뷰에서 반복되는 피드백이 있다면 그것을 Coding Standards에 추가하면 AI가 처음부터 올바른 코드를 생성합니다.


3. 금지 패턴과 규칙 설정의 핵심

"하지 말아야 할 것" 명시의 중요성

AI 코딩 어시스턴트와 일하다 보면 특정 실수가 반복됨을 발견하게 됩니다. 예를 들어:

  • TypeScript 프로젝트에서 타입이 복잡해지면 any를 사용하는 경향
  • 임시로 추가한 console.log 디버그 코드를 제거하지 않는 경향
  • 환경 변수 없이 URL을 하드코딩하는 경향
  • 기존에 있는 유틸리티 함수를 찾지 않고 새로 만드는 경향

이런 패턴들을 CLAUDE.md의 Forbidden Patterns 섹션에 명시하면 AI가 처음부터 이를 피합니다.

실제 프로젝트에서 발견된 금지 패턴 목록

# Forbidden Patterns

## 타입 관련

- `any` 타입 사용 금지 → `unknown` 또는 구체적 타입 사용
- `@ts-ignore` 사용 금지 → 타입 오류의 근본 원인 해결
- `as any` 타입 캐스팅 금지

## 코드 품질

- `console.log`, `console.debug` 프로덕션 코드에 금지 → logger 사용
- TODO 주석 없이 코드 완성하지 않기 (TODO는 이슈 링크 필수)
- 매직 넘버 금지 → 명명된 상수로 추출

## 아키텍처

- 컴포넌트에서 직접 fetch 호출 금지 → custom hook 또는 server action 사용
- 클라이언트 컴포넌트에서 DB 직접 쿼리 금지
- 하드코딩된 URL 금지 → 환경 변수 사용

## 보안

- 사용자 입력 직접 SQL에 삽입 금지 → Prisma ORM 사용
- 클라이언트에 시크릿 키 노출 금지
- 인증 없이 관리자 API 엔드포인트 생성 금지

## 성능

- useEffect 내 무한 루프 유발 의존성 배열 오류 주의
- 큰 데이터셋을 클라이언트 사이드에서 필터링 금지 → DB 레벨 필터링

기존 패턴 우선 사용 지시

AI에게 "새로 만들기 전에 먼저 기존 코드를 찾아라"고 지시하는 것도 중요합니다.

# Before Creating New Code

새 코드를 작성하기 전에 항상 다음을 확인하라:

1. `src/lib/` 에 이미 구현된 유틸리티가 있는지
2. `src/hooks/` 에 유사한 커스텀 훅이 있는지
3. `src/components/ui/` 에 재사용 가능한 컴포넌트가 있는지
4. `src/server/` 에 재사용 가능한 서버 액션이 있는지

중복 구현은 코드베이스의 유지보수성을 심각하게 저하시킨다.

4. Skills 파일 완전 정복

Skills(커스텀 명령어)란

Skills는 재사용 가능한 AI 명령 템플릿입니다. 자주 사용하는 프롬프트를 파일로 저장해두고 슬래시(/) 명령어로 빠르게 실행할 수 있습니다. Claude Code에서는 .claude/commands/ 디렉토리에 마크다운 파일로 저장하며, 팀원 모두가 동일한 고품질 프롬프트를 일관되게 사용할 수 있게 해줍니다.

.claude/
  commands/
    commit.md
    pr-description.md
    test.md
    review.md
    docs.md
    refactor.md
    security-check.md
    performance-check.md

필수 Skills 상세 가이드

/commit - 지능형 커밋 메시지 생성

현재 staged 변경사항을 분석하고 Conventional Commits 형식으로
커밋 메시지를 작성해줘. 한국어로 작성.

형식:
type(scope): subject

body (선택, 변경 이유와 영향 설명)

footer (선택, Breaking Change 또는 이슈 번호)

type 선택 기준:

- feat: 새 기능 추가
- fix: 버그 수정
- refactor: 기능 변경 없는 코드 개선
- test: 테스트 추가/수정
- docs: 문서 변경
- chore: 빌드/설정 변경
- perf: 성능 개선

scope는 변경된 모듈/컴포넌트명 사용.
subject는 50자 이하, 명령형으로 작성.

/pr-description - PR 설명 자동 생성

현재 브랜치의 변경사항을 분석해서 PR 설명을 작성해줘.

## 변경 요약

- (bullet points로 핵심 변경사항 나열)

## 변경 이유

(왜 이 변경이 필요한지 설명)

## 테스트 방법

- [ ] (검증 방법 체크리스트)

## 스크린샷

(UI 변경이 있는 경우 스크린샷 필요 여부 표시)

## 참고 사항

(리뷰어가 알아야 할 특이사항)

/test - 테스트 코드 자동 생성

선택된 코드에 대한 단위 테스트를 작성해줘.
Vitest + Testing Library 사용.

다음을 포함할 것:

1. 정상 케이스 (happy path)
2. 경계값 테스트
3. 에러 케이스 (예외 처리)
4. 엣지 케이스 (null, undefined, 빈 배열 등)

테스트 네이밍: "should [expected behavior] when [condition]" 형식
Mock은 최소화하고 실제 구현에 가깝게 작성.

/review - 코드 리뷰 자동화

이 코드를 리뷰해줘. 다음 관점에서 분석하고
각 항목별로 심각도(Critical/Major/Minor)를 표시해줘:

1. 버그 가능성
   - 논리 오류, 엣지 케이스 미처리, 경쟁 조건 등

2. 보안 취약점
   - 인증/인가 오류, 인젝션 취약점, 민감 정보 노출 등

3. 성능 문제
   - 불필요한 렌더링, N+1 쿼리, 메모리 누수 등

4. 가독성 개선점
   - 복잡한 로직, 불명확한 변수명, 중복 코드 등

5. 테스트 가능성
   - 의존성 주입, 순수 함수 여부, Mock 용이성 등

각 지적사항에는 개선 코드 예시를 포함해줘.

/docs - 문서 자동 생성

이 코드의 JSDoc 문서를 작성해줘.

각 함수/클래스/타입에 대해:

- @description: 기능 설명 (2-3문장)
- @param: 각 파라미터의 타입, 설명, 예시값
- @returns: 반환값 타입과 설명
- @throws: 발생할 수 있는 예외
- @example: 실제 사용 예시 코드

복잡한 비즈니스 로직이 있는 경우 알고리즘 설명도 포함.

/refactor - 리팩토링 제안

이 코드를 리팩토링해줘.

목표:

- 중복 제거 (DRY 원칙)
- 가독성 향상 (복잡도 감소)
- SOLID 원칙 적용
- 테스트 가능성 향상

제약:

- 기존 기능은 변경하지 말 것
- 퍼블릭 API(함수 시그니처, 모듈 인터페이스)는 유지할 것
- 점진적으로 리팩토링 (한 번에 너무 많이 바꾸지 않음)

리팩토링 전/후를 비교해서 보여주고 각 변경의 이유를 설명해줘.

/security-check - 보안 취약점 점검

이 코드의 보안 취약점을 OWASP Top 10 기준으로 점검해줘.

특히 확인할 것:

1. Injection (SQL, Command, XSS)
2. 인증/인가 오류
3. 민감 데이터 노출
4. 보안 설정 오류
5. 알려진 취약점 있는 컴포넌트 사용

각 취약점에 대해:

- 위험도 (High/Medium/Low)
- 공격 시나리오 설명
- 수정 방법과 코드 예시

/performance-check - 성능 분석

이 코드의 성능 문제를 분석해줘.

확인 항목:

1. 알고리즘 복잡도 (시간/공간)
2. 불필요한 재연산 (메모이제이션 가능 여부)
3. 데이터베이스 쿼리 최적화 (N+1, 인덱스 활용)
4. 네트워크 요청 최적화 (배칭, 캐싱)
5. 렌더링 최적화 (React 컴포넌트의 경우)

각 문제에 대해 개선 예시 코드를 포함해줘.

Skills 작성 팁

좋은 Skill 파일의 특징:

  1. 명확한 출력 형식 지정: "분석해줘"보다 "다음 형식으로 분석 결과를 작성해줘"가 일관된 결과를 만듭니다.

  2. 제약 조건 명시: 무엇을 해야 하는지만큼 무엇을 하지 말아야 하는지도 중요합니다.

  3. 컨텍스트 자동 포함: $SELECTION, $FILE, $PROJECT 같은 변수를 활용해 현재 컨텍스트를 자동으로 포함시킵니다.

  4. 점진적 개선: Skill을 처음부터 완벽하게 만들려 하지 말고, 사용하면서 발견되는 부족한 점을 계속 보완합니다.


5. 프로젝트별 CLAUDE.md 실전 예시

Next.js 풀스택 앱

# E-Commerce Platform

## Overview

B2C 이커머스 플랫폼. 고객 쇼핑, 주문 관리, 관리자 대시보드로 구성.
MAU 50만, 일 주문 5천건 처리.

## Tech Stack

- Next.js 15 (App Router, RSC)
- TypeScript 5.x (strict mode)
- PostgreSQL 16 + Prisma ORM
- Redis (세션, 캐시)
- Stripe (결제)
- Vercel (배포)

## Domain Model

- User: 고객 계정, 다중 배송지 지원
- Product: SKU 기반 재고 관리, 카테고리 트리
- Order: Draft → Pending → Confirmed → Shipped → Delivered → Cancelled
- Cart: Redis 기반, 미로그인 사용자도 지원 (세션 기반)

## Architecture Rules

- 서버 컴포넌트에서 DB 직접 쿼리 (Prisma)
- 클라이언트에서 API 호출은 /api 라우트를 통해
- 복잡한 비즈니스 로직은 src/server/services/ 에 위치
- 결제 관련 코드는 반드시 서버 사이드에서만

## Forbidden

- 클라이언트 컴포넌트에서 Prisma 직접 사용
- 결제 금액 클라이언트에서 계산 (반드시 서버에서)
- any 타입
- 하드코딩된 가격/할인율

Go 마이크로서비스

# Order Service

## Overview

주문 처리 마이크로서비스. gRPC 내부 통신, REST 외부 노출.
초당 500 TPS 처리 목표.

## Tech Stack

- Go 1.23
- Fiber (HTTP), gRPC (내부 통신)
- PostgreSQL + sqlc (타입 세이프 쿼리)
- Redis (분산 잠금, 캐시)
- OpenTelemetry (분산 추적)

## Code Style

- 에러는 반드시 상위로 전파 (errors.Wrap 사용)
- 모든 DB 쿼리는 컨텍스트 포함 (ctx 파라미터 필수)
- 로그는 zerolog 구조화 로그만 사용
- 인터페이스 먼저 정의, 구현 나중에

## Project Layout (Standard Go Layout)

cmd/ # main 패키지
internal/ # 외부 공개 안 되는 코드
domain/ # 도메인 모델 및 인터페이스
service/ # 비즈니스 로직
repository/ # DB 접근 레이어
handler/ # HTTP/gRPC 핸들러
pkg/ # 외부 공개 가능한 유틸리티

## Forbidden

- 패닉 사용 금지 (recover 없이)
- context.Background() 핸들러에서 직접 사용 금지
- 전역 상태 금지
- goroutine 누수 유발 패턴

Java Spring Boot

# Payment Service

## Overview

결제 처리 서비스. PCI-DSS 준수 필수.
Kafka 이벤트 기반 비동기 처리.

## Tech Stack

- Java 21 (Virtual Threads 활용)
- Spring Boot 3.x
- Spring Data JPA + Hibernate
- Apache Kafka (이벤트 스트리밍)
- Vault (시크릿 관리)

## Architecture

Hexagonal Architecture (Ports & Adapters):

- domain/: 순수 도메인 모델 (의존성 없음)
- application/: 유즈케이스, 포트 인터페이스
- infrastructure/: 어댑터 (DB, Kafka, 외부 API)
- interfaces/: 컨트롤러, DTO

## Rules

- 도메인 레이어는 Spring 의존성 없음
- 모든 금액은 BigDecimal (double/float 절대 금지)
- 외부 결제 API 호출에는 Circuit Breaker 패턴 적용
- 보상 트랜잭션 패턴으로 분산 트랜잭션 처리

## Forbidden

- BigDecimal 대신 double로 금액 계산
- 결제 정보 로그 출력 (마스킹 없이)
- 동기 결제 API 호출 타임아웃 미설정

6. AI 코딩 생산성 10배 높이는 프롬프트 전략

Context-first 프롬프팅

AI에게 요청할 때 배경 → 제약 → 요청 순서로 프롬프트를 구성하면 더 좋은 결과를 얻습니다.

좋지 않은 예:

결제 처리 함수를 만들어줘

좋은 예:

[배경] 이커머스 플랫폼에서 Stripe를 사용해 결제를 처리한다.
현재 src/server/services/payment.ts 파일에 결제 관련 로직이 있다.

[제약]
- 금액은 반드시 서버에서 계산 (클라이언트 입력 신뢰 안 함)
- 결제 실패 시 재시도는 최대 3, 지수 백오프 사용
- 모든 결제 이벤트는 audit log 저장

[요청]
장바구니 체크아웃 시 Stripe Payment Intent를 생성하는
processCheckout 함수를 작성해줘. TypeScript, async/await 사용.

단계별 분해 요청

복잡한 기능을 한 번에 요청하면 AI가 중요한 세부사항을 놓치거나 잘못된 설계를 선택할 수 있습니다. 큰 기능을 작은 단위로 분해해서 단계별로 요청하세요.

1단계: "사용자 인증 시스템의 데이터베이스 스키마를 설계해줘"
2단계: "이 스키마를 기반으로 Prisma 모델을 작성해줘"
3단계: "로그인 비즈니스 로직을 서비스 레이어에 구현해줘"
4단계: "이 서비스를 사용하는 API 라우트 핸들러를 만들어줘"
5단계: "각 레이어에 대한 테스트를 작성해줘"

예시 제시하기 (Few-shot Prompting)

기존 코드 패턴을 예시로 제공하면 AI가 팀의 스타일에 맞는 코드를 생성합니다.

우리 프로젝트는 이런 패턴으로 API 라우트를 작성해:

[예시]
export async function GET(req: NextRequest) {
  try {
    const session = await getServerSession(authOptions)
    if (!session) return unauthorized()

    const data = await getUserData(session.user.id)
    return ok(data)
  } catch (error) {
    logger.error('Failed to get user data', { error })
    return internalError()
  }
}

이 패턴으로 주문 목록을 가져오는 API 라우트를 작성해줘.

"절대 하지 말아야 할 것" 명시

프롬프트에서도 금지 사항을 명확히 하면 AI의 일탈을 방지합니다.

상품 검색 기능을 구현해줘.

절대 하지 말아야 할 것:
- 클라이언트 사이드에서 전체 데이터를 가져와 필터링 (성능 이슈)
- 검색어를 SQL에 직접 삽입 (인젝션 취약점)
- 검색 결과 캐싱 없이 매 요청마다 DB 풀스캔

체인 오브 쏘트 유도

복잡한 문제는 AI에게 단계별로 생각하게 유도하면 더 정확한 결과를 얻습니다.

다음 코드에 성능 문제가 있는지 분석해줘.
분석 전에 먼저:
1. 코드가 어떤 작업을 하는지 설명
2. 시간/공간 복잡도 분석
3. 잠재적 병목 지점 식별
4. 개선 방안 제시

순서로 진행해줘.

7. AI 코딩 워크플로 실전

아침 루틴

효과적인 AI 코딩 하루 시작 방법:

  1. CLAUDE.md 확인: 어제 팀에서 새로운 규칙을 추가했는지 확인
  2. 이슈 파악: 오늘 처리할 이슈의 요구사항을 명확히 이해
  3. AI에게 구현 계획 요청: 코드 작성 전에 접근 방법 검토
  4. 단계별 구현: 계획된 순서로 AI에게 구현 요청
  5. 리뷰: /review skill로 AI 1차 리뷰, 사람 2차 리뷰

코드 리뷰 워크플로

AI 코드 리뷰와 사람 코드 리뷰를 조합하는 방식:

AI 1차 리뷰 (자동화):

  • PR 생성 시 CI에서 /review skill 자동 실행
  • 버그, 보안, 성능 문제 자동 탐지
  • 코딩 스탠다드 준수 여부 확인

사람 2차 리뷰 (핵심 집중):

  • AI가 발견한 기술적 문제는 이미 처리됨
  • 비즈니스 로직의 적합성에 집중
  • 아키텍처 결정의 장기적 영향 평가
  • 팀 지식 공유 및 멘토링

디버깅 워크플로

에러 발생 → 컨텍스트 수집 → AI에게 분석 요청 → 해결책 검증

컨텍스트 수집 체크리스트:
- 에러 메시지 전문 (스택 트레이스 포함)
- 에러 발생 시점의 입력값
- 최근 변경된 코드 (git diff)
- 관련 로그 (에러 전후 30)
- 환경 정보 (개발/스테이징/프로덕션)

AI에게 요청 시:
"위 에러가 발생했어. 가능한 원인을 3가지로 분석하고
각각의 디버깅 방법을 알려줘"

문서화 워크플로

코드 완성 후 문서화를 AI로 자동화:

  1. 기능 구현 완료
  2. /docs skill로 JSDoc 자동 생성
  3. 자동 생성된 문서 검토 및 비즈니스 컨텍스트 보완
  4. README 업데이트 (신규 기능의 경우)
  5. API 문서 자동 생성 (OpenAPI 스펙 업데이트)

8. 팀 AI 활용 원칙 수립

AI 사용 가이드라인 문서화

팀 전체가 AI를 일관되고 안전하게 활용하려면 명확한 가이드라인이 필요합니다.

# 팀 AI 활용 가이드라인

## 허용 범위

- 코드 생성 및 리팩토링
- 테스트 코드 작성
- 문서화 및 주석
- 디버깅 지원
- 코드 리뷰 보조

## 항상 사람이 검토해야 하는 영역

- 보안 관련 코드 (인증, 인가, 암호화)
- 결제 및 금융 처리 로직
- 개인정보 처리 코드
- 아키텍처 수준의 결정

## AI 생성 코드 관리

- AI가 생성한 코드라도 커밋 전 반드시 이해하고 리뷰
- "AI가 만들어줬으니 맞겠지"는 금지
- 이해하지 못한 코드는 AI에게 설명을 요청

AI 의존도 관리

AI 도구에 과도하게 의존하면 개발자의 핵심 역량이 퇴화할 수 있습니다. 건강한 균형을 유지하는 방법:

매일 직접 코딩: AI의 도움 없이 작은 기능이나 버그를 직접 해결하는 연습을 유지합니다. 이는 비상 상황(AI 도구 장애, 인터넷 없는 환경)에도 대비하고 기본 역량을 유지하게 합니다.

AI 결과물 이해: AI가 생성한 코드를 그냥 복사하지 말고, 왜 그렇게 작성했는지 이해합니다. 모르는 부분은 AI에게 설명을 요청하고, 이 과정이 학습의 기회가 됩니다.

판단력 유지: AI는 도구입니다. 아키텍처 결정, 비즈니스 로직의 적합성, 보안 검토 등 핵심 판단은 항상 사람이 합니다.

주니어 개발자를 위한 AI 가이드라인

주니어 개발자가 AI를 잘못 활용하면 성장이 저해될 수 있습니다.

권장하는 방식:

  • AI에게 코드를 생성시키고 그 코드를 학습 자료로 활용
  • AI에게 개념 설명을 요청하고 직접 구현 시도
  • AI 생성 코드의 대안을 스스로 생각해보기

피해야 하는 방식:

  • 이해 없이 AI 코드 복사
  • 에러가 나면 AI에게 바로 전달 (먼저 스스로 30분은 시도)
  • 설계 고민을 AI에게 전부 위임

9. 멀티 에이전트 코딩 (미래 전망)

여러 AI 에이전트가 동시에 코딩하는 시대

2026년 현재, 단일 AI 에이전트가 한 번에 하나의 작업을 처리하는 방식에서 여러 에이전트가 병렬로 서로 다른 기능을 동시에 개발하는 방식으로 전환이 시작되었습니다.

예를 들어:

  • 에이전트 A: 새 결제 API 구현 (feature/payment-v2 브랜치)
  • 에이전트 B: 결제 API 테스트 작성 (feature/payment-v2-tests 브랜치)
  • 에이전트 C: 기존 버그 수정 (fix/order-status-bug 브랜치)
  • 사람: 에이전트들의 PR 리뷰 및 머지 결정

에이전트 간 충돌 방지 전략

여러 에이전트가 동시에 작업하면 코드 충돌이 필연적으로 발생합니다. 이를 방지하는 전략:

작업 영역 분리: 각 에이전트에게 명확히 분리된 파일/모듈 영역을 할당합니다. 공유 파일(설정 파일, 타입 정의 등)은 한 번에 하나의 에이전트만 수정하도록 조율합니다.

빈번한 리베이스: 각 에이전트 브랜치를 main에 자주 리베이스해서 충돌을 조기에 발견하고 해결합니다.

인터페이스 우선 계약: 에이전트들이 공유하는 인터페이스(API 스펙, 타입 정의)를 먼저 확정하고, 각 에이전트가 독립적으로 구현합니다.

Worktree 기반 병렬 개발

Git Worktree를 활용하면 동일한 리포지토리에서 여러 브랜치를 동시에 체크아웃해 병렬 개발이 가능합니다.

# 기본 작업 공간
git worktree add ../project-feature-a feature/payment-v2

# 두 번째 작업 공간 (다른 디렉토리에 다른 브랜치)
git worktree add ../project-feature-b feature/user-profile-v2

# 워크트리 목록 확인
git worktree list

Claude Code는 이 워크트리 패턴을 인식하고 각 워크트리에서 독립적으로 동작할 수 있습니다. 미래에는 각 워크트리마다 AI 에이전트가 할당되어 팀의 개발 속도가 에이전트 수에 비례해 증가하는 시대가 올 것입니다.

CLAUDE.md의 미래

멀티 에이전트 시대에 CLAUDE.md는 더욱 중요해집니다. 여러 에이전트가 일관된 방식으로 코드를 작성하게 하는 유일한 "공통 언어"가 되기 때문입니다. 앞으로 CLAUDE.md는 단순한 설정 파일을 넘어, AI 에이전트 팀을 위한 팀 헌법이 될 것입니다.


10. 퀴즈

Q1. CLAUDE.md와 AGENT.md의 가장 큰 차이점은 무엇인가요?

정답: CLAUDE.md는 Claude Code 전용 설정 파일이고, AGENT.md는 여러 AI 도구에서 범용으로 사용할 수 있는 표준 형식입니다.

설명: CLAUDE.md는 Anthropic의 Claude Code와 깊이 통합되어 메모리 시스템, 허용/금지 명령어, Skills 등과 연동됩니다. AGENT.md는 Cursor, GitHub Copilot Workspace, Devin 등 다양한 AI 도구와 호환되는 범용 설정 형식입니다. 여러 AI 도구를 함께 사용하는 팀에서는 AGENT.md를 기본으로 사용하고 도구별 특화 설정은 별도 파일로 분리하는 전략이 유효합니다.

Q2. CLAUDE.md의 계층적 설정 구조에서, 서브디렉토리의 CLAUDE.md는 어떻게 적용되나요?

정답: Claude Code는 현재 작업 중인 파일 위치에서 루트 방향으로 올라가며 모든 CLAUDE.md를 읽고 합칩니다. 더 구체적인(하위 디렉토리의) 설정이 더 상위 설정을 덮어쓰거나 보완합니다.

설명: 루트 CLAUDE.md에 전체 프로젝트 공통 규칙을 정의하고, 서브디렉토리 CLAUDE.md에 해당 영역 특화 규칙을 추가합니다. 예를 들어 루트에는 TypeScript 표준을 정의하고, backend/ 디렉토리에는 "모든 API 엔드포인트 변경 시 OpenAPI 스펙 업데이트 필수"와 같은 백엔드 특화 규칙을 추가할 수 있습니다.

Q3. Skills(.claude/commands/) 파일을 사용하는 가장 큰 이점은 무엇인가요?

정답: 팀 전체가 일관된 고품질 프롬프트를 재사용할 수 있어, 개인 역량에 의존하지 않고 표준화된 방식으로 AI를 활용할 수 있습니다.

설명: Skills가 없다면 각자 다른 품질의 프롬프트를 사용하게 되어 AI 결과물의 품질이 팀원마다 달라집니다. /review skill을 공유하면 모든 팀원이 동일한 기준(버그, 보안, 성능, 가독성)으로 AI 코드 리뷰를 받을 수 있습니다. Skills는 버전 관리(Git)되므로 팀의 AI 활용 방식이 지속적으로 개선됩니다.

Q4. Context-first 프롬프팅에서 올바른 순서는 무엇인가요?

정답: 배경(Background) → 제약(Constraints) → 요청(Request) 순서입니다.

설명: 배경에서는 어떤 프로젝트인지, 어떤 기술 스택을 사용하는지, 관련 기존 코드는 무엇인지를 설명합니다. 제약에서는 성능 요구사항, 보안 요구사항, 사용해야 하는 패턴 등을 명시합니다. 마지막으로 구체적인 요청을 합니다. 이 순서는 AI가 요청을 처리할 때 가장 적합한 컨텍스트를 먼저 파악하고 제약 안에서 최선의 해결책을 찾도록 유도합니다.

Q5. 멀티 에이전트 코딩 환경에서 코드 충돌을 방지하는 가장 효과적인 전략은 무엇인가요?

정답: 작업 영역 분리, 빈번한 리베이스, 인터페이스 우선 계약의 세 가지 전략을 조합하는 것입니다.

설명: 각 에이전트에게 명확히 분리된 파일/모듈 영역을 할당하고(작업 영역 분리), 각 에이전트 브랜치를 main에 자주 리베이스해서 충돌을 조기 발견하며(빈번한 리베이스), 에이전트들이 공유하는 인터페이스를 먼저 확정하고 독립적으로 구현합니다(인터페이스 우선 계약). Git Worktree를 활용하면 동일한 리포지토리에서 여러 브랜치를 동시에 체크아웃해 병렬 개발이 가능합니다.


마치며

CLAUDE.md, AGENT.md, Skills는 단순한 설정 파일이 아닙니다. 이것들은 AI와 사람이 함께 일하는 방식을 정의하는 팀의 AI 협업 계약서입니다.

잘 작성된 CLAUDE.md 하나로 AI는 팀의 시니어 개발자처럼 행동하고, 잘 설계된 Skills로 팀 전체가 일관된 고품질 코드를 생산합니다. AI 도구가 발전할수록 이러한 설정 파일의 중요성은 더욱 커질 것입니다.

오늘 당장 프로젝트에 CLAUDE.md를 만들고, 가장 자주 사용하는 프롬프트 하나를 Skill로 만들어보세요. 처음에는 작게 시작하고, 사용하면서 점진적으로 발전시켜 나가는 것이 최선의 방법입니다.

AGENT.md, CLAUDE.md & Skills Complete Guide: Mastering AI Coding Assistants

Table of Contents

  1. What Are CLAUDE.md and AGENT.md?
  2. Writing an Effective CLAUDE.md
  3. The Core of Forbidden Patterns and Rule Configuration
  4. Mastering Skills Files
  5. Real-World CLAUDE.md Examples by Project Type
  6. Prompt Strategies to 10x Your AI Coding Productivity
  7. AI Coding Workflow in Practice
  8. Establishing Team AI Usage Principles
  9. Multi-Agent Coding (The Future)
  10. Quiz

1. What Are CLAUDE.md and AGENT.md?

The Memory Problem with AI Coding Assistants

AI coding assistants are incredibly powerful, but they have a fundamental limitation: when a conversation session ends, they forget everything from before. Having to re-explain "our project uses TypeScript, functions should be under 50 lines, and console.log must not appear in production code" every single new session creates enormous inefficiency.

CLAUDE.md and AGENT.md were created precisely to solve this problem.

The Difference Between the Two Files

CLAUDE.md is a configuration file exclusive to Anthropic's Claude Code. When Claude Code opens a project, it automatically reads this file to understand the project context. It is deeply integrated with all Claude Code features and connects with the memory system, allowed/forbidden command settings, custom commands (Skills), and more.

AGENT.md is a general-purpose agent configuration file. It is designed as a standard format that can be shared across a variety of AI coding tools beyond Claude Code — including Cursor, GitHub Copilot Workspace, Devin, and OpenHands. For teams that use multiple AI tools together, a solid strategy is to use AGENT.md as the baseline and separate tool-specific settings into dedicated files.

File Location and Hierarchy

Files are placed at the project root.

my-project/
  CLAUDE.md          # Project-wide settings
  src/
    CLAUDE.md        # src-specific settings
    components/
      CLAUDE.md      # Component-specific settings
  backend/
    CLAUDE.md        # Backend-specific settings

Claude Code reads upward from the current file's location to the root, merging all CLAUDE.md files it encounters. This enables hierarchical configuration.

  • Root CLAUDE.md: Common rules for the entire project (coding standards, commit message format, etc.)
  • Subdirectory CLAUDE.md: Rules specific to that area (e.g., "always update the OpenAPI spec when modifying backend API routes")

Why This Matters

When given appropriate context, AI assistants produce noticeably higher-quality code. Without CLAUDE.md, an AI follows generic best practices but cannot know a project's unique conventions or architectural decisions. As a result, it repeatedly makes mistakes: generating code that doesn't match the team's style, using forbidden patterns, or reinventing utilities that already exist.

A well-written CLAUDE.md makes the AI behave like a senior developer on your team — one who deeply understands the team's decisions and conventions and generates code that aligns with them.


2. Writing an Effective CLAUDE.md

Basic Structure

An effective CLAUDE.md consists of the following sections.

# Project Overview

Project purpose, tech stack, architecture overview

# Tech Stack

- Language: TypeScript 5.x
- Framework: Next.js 15 (App Router)
- Database: PostgreSQL + Prisma ORM
- Testing: Vitest + Testing Library

# Project Structure

src/
app/ # Next.js App Router
components/ # React components
lib/ # Utility functions
types/ # TypeScript types

# Coding Standards

- Functions max 50 lines
- No `any` type
- JSDoc required for all functions
- Components use named exports only

# Testing Requirements

- All utility functions: unit tests required
- API routes: integration tests required
- Coverage 80% or higher

# Git Conventions

- Follow Conventional Commits
- Max 200 lines per PR

# Forbidden Patterns

- No console.log in production code
- No any type
- No hardcoded URLs

The Project Overview Section

The first section helps the AI understand the big picture. Include the following:

Project Purpose: Describe in 2–3 sentences what is being built, who uses it, and what the core value is.

Domain Concepts: Explain terminology and domain concepts unique to the project. Information like "An Order goes through states: Draft, Pending, Confirmed, Shipped, Delivered — each transition governed by business rules" is critical for the AI to generate correct code.

Architectural Decisions: Record major architectural choices — monorepo vs. multi-repo, microservices vs. monolith, layered architecture vs. hexagonal architecture.

The Tech Stack Section

Including versions matters. Specifying "React 19" instead of just "React" ensures the AI uses features and patterns from that specific version. The code patterns for Next.js 14's Pages Router and Next.js 15's App Router are completely different.

The Project Structure Section

Rather than simply listing directories, annotating each with its role is far more effective.

# Project Structure

src/
app/ # Next.js App Router - pages and layouts
(auth)/ # Route group requiring authentication
(public)/ # Public route group
api/ # API Route Handlers
components/ # Reusable React components
ui/ # Base UI components (shadcn/ui)
features/ # Feature components (auth, dashboard, etc.)
lib/ # Pure utility functions (no framework deps)
hooks/ # Custom React Hooks
stores/ # Zustand state management
types/ # TypeScript type definitions
server/ # Server-only code (DB, external APIs)

The Coding Standards Section

Specific rules work far better than abstract principles.

Bad: "Write clean code" Good: "Functions max 50 lines, max 4 parameters, max 2 levels of nested if statements"

Bad: "Handle errors well" Good: "All async functions wrapped in try-catch; errors logged with logger.error(); user-facing error messages tagged with 'USER_FACING_ERROR'"

Keeping It Current

CLAUDE.md should be a living document. When you add a new library, add it to the Tech Stack. When you discover a new forbidden pattern, add it to Forbidden Patterns. Recurring code review feedback belongs in Coding Standards so the AI generates correct code from the start.


3. The Core of Forbidden Patterns and Rule Configuration

Why Specifying "Don'ts" Matters

Working with AI coding assistants, you start to notice certain mistakes repeat. For example:

  • Using any when TypeScript types get complex
  • Leaving temporary console.log debug code behind
  • Hardcoding URLs instead of using environment variables
  • Reinventing utility functions instead of finding existing ones

Listing these patterns explicitly in the Forbidden Patterns section of CLAUDE.md prevents the AI from making them in the first place.

Real-World Forbidden Pattern List

# Forbidden Patterns

## Types

- No `any` type → use `unknown` or a specific type
- No `@ts-ignore` → fix the root cause of the type error
- No `as any` type casting

## Code Quality

- No `console.log` or `console.debug` in production code → use logger
- No incomplete code left with TODO comments (TODOs require issue links)
- No magic numbers → extract to named constants

## Architecture

- No direct fetch calls in components → use custom hooks or server actions
- No direct DB queries in client components
- No hardcoded URLs → use environment variables

## Security

- No raw user input in SQL → use Prisma ORM
- No secrets exposed on the client
- No admin API endpoints without authentication

## Performance

- No useEffect dependency arrays that cause infinite loops
- No client-side filtering of large datasets → filter at DB level

Instructing to Reuse Existing Patterns

Telling the AI to "look before you create" is also important.

# Before Creating New Code

Before writing new code, always check:

1. Is there already an implementation in src/lib/?
2. Is there a similar custom hook in src/hooks/?
3. Is there a reusable component in src/components/ui/?
4. Is there a reusable server action in src/server/?

Duplicate implementations severely degrade codebase maintainability.

4. Mastering Skills Files

What Skills (Custom Commands) Are

Skills are reusable AI prompt templates. You save frequently-used prompts as files and execute them quickly with slash (/) commands. In Claude Code, they are stored as Markdown files in the .claude/commands/ directory, enabling the entire team to consistently use the same high-quality prompts.

.claude/
  commands/
    commit.md
    pr-description.md
    test.md
    review.md
    docs.md
    refactor.md
    security-check.md
    performance-check.md

Essential Skills in Detail

/commit - Intelligent Commit Message Generation

Analyze the current staged changes and write a commit message
in Conventional Commits format. Write in English.

Format:
type(scope): subject

body (optional, explains why and what impact)

footer (optional, Breaking Change or issue number)

Type selection guide:

- feat: new feature
- fix: bug fix
- refactor: code improvement without behavior change
- test: add/modify tests
- docs: documentation changes
- chore: build/config changes
- perf: performance improvement

Use the changed module/component name as scope.
Subject: 50 chars or less, imperative mood.

/pr-description - Auto-Generate PR Description

Analyze the changes in the current branch and write a PR description.

## Summary

- (key changes as bullet points)

## Motivation

(explain why this change is needed)

## How to Test

- [ ] (verification checklist)

## Screenshots

(indicate if screenshots needed for UI changes)

## Notes

(anything reviewers should know)

/test - Auto-Generate Test Code

Write unit tests for the selected code.
Use Vitest + Testing Library.

Include:

1. Happy path (normal case)
2. Boundary value tests
3. Error cases (exception handling)
4. Edge cases (null, undefined, empty arrays, etc.)

Test naming: "should [expected behavior] when [condition]" format
Minimize mocks; stay as close to the real implementation as possible.

/review - Automated Code Review

Review this code. Analyze from the following perspectives
and label each item with severity (Critical/Major/Minor):

1. Bug potential
   - Logic errors, unhandled edge cases, race conditions

2. Security vulnerabilities
   - Auth/authz errors, injection vulnerabilities, sensitive data exposure

3. Performance issues
   - Unnecessary re-renders, N+1 queries, memory leaks

4. Readability improvements
   - Complex logic, unclear variable names, duplicate code

5. Testability
   - Dependency injection, pure function usage, ease of mocking

Include improved code examples for each issue found.

/docs - Auto-Generate Documentation

Write JSDoc documentation for this code.

For each function/class/type:

- @description: Feature description (2-3 sentences)
- @param: Type, description, and example value for each parameter
- @returns: Return value type and description
- @throws: Possible exceptions
- @example: Real usage code example

Include algorithm explanations for complex business logic.

/refactor - Refactoring Suggestions

Refactor this code.

Goals:

- Eliminate duplication (DRY principle)
- Improve readability (reduce complexity)
- Apply SOLID principles
- Improve testability

Constraints:

- Do not change existing behavior
- Maintain public API (function signatures, module interfaces)
- Refactor incrementally (don't change too much at once)

Show before/after comparisons and explain the reason for each change.

/security-check - Security Vulnerability Audit

Audit this code for security vulnerabilities using OWASP Top 10 as the baseline.

Check specifically for:

1. Injection (SQL, Command, XSS)
2. Authentication/authorization errors
3. Sensitive data exposure
4. Security misconfiguration
5. Use of components with known vulnerabilities

For each vulnerability:

- Risk level (High/Medium/Low)
- Attack scenario description
- Fix method and code example

/performance-check - Performance Analysis

Analyze performance issues in this code.

Check:

1. Algorithm complexity (time/space)
2. Unnecessary recomputation (memoization candidates)
3. Database query optimization (N+1, index usage)
4. Network request optimization (batching, caching)
5. Rendering optimization (for React components)

Include improved example code for each issue.

Tips for Writing Good Skills

Characteristics of a good Skill file:

  1. Specify a clear output format: "Analyze it" produces inconsistent results; "Write analysis results in the following format" ensures consistency.

  2. State constraints explicitly: What not to do is just as important as what to do.

  3. Auto-include context: Use variables like $SELECTION, $FILE, $PROJECT to automatically include current context.

  4. Iterate gradually: Don't try to make a Skill perfect from the start — improve it continuously as you use it.


5. Real-World CLAUDE.md Examples by Project Type

Next.js Full-Stack App

# E-Commerce Platform

## Overview

B2C e-commerce platform. Consists of customer shopping,
order management, and admin dashboard.
500K MAU, processing 5K orders per day.

## Tech Stack

- Next.js 15 (App Router, RSC)
- TypeScript 5.x (strict mode)
- PostgreSQL 16 + Prisma ORM
- Redis (sessions, cache)
- Stripe (payments)
- Vercel (deployment)

## Domain Model

- User: customer account, supports multiple shipping addresses
- Product: SKU-based inventory management, category tree
- Order: Draft → Pending → Confirmed → Shipped → Delivered → Cancelled
- Cart: Redis-based, supports unauthenticated users (session-based)

## Architecture Rules

- Server components query DB directly (Prisma)
- Client-side API calls go through /api routes
- Complex business logic lives in src/server/services/
- Payment-related code must be server-side only

## Forbidden

- Using Prisma directly in client components
- Calculating payment amounts on the client (must be server-side)
- any type
- Hardcoded prices or discount rates

Go Microservice

# Order Service

## Overview

Order processing microservice. gRPC for internal communication,
REST for external exposure. Target: 500 TPS.

## Tech Stack

- Go 1.23
- Fiber (HTTP), gRPC (internal)
- PostgreSQL + sqlc (type-safe queries)
- Redis (distributed lock, cache)
- OpenTelemetry (distributed tracing)

## Code Style

- Errors must propagate upward (use errors.Wrap)
- All DB queries include context (ctx param required)
- Logging: zerolog structured logs only
- Define interfaces first, implement later

## Project Layout (Standard Go Layout)

cmd/ # main packages
internal/ # code not exported externally
domain/ # domain models and interfaces
service/ # business logic
repository/ # DB access layer
handler/ # HTTP/gRPC handlers
pkg/ # utilities that can be exported

## Forbidden

- No panics without recover
- No context.Background() directly in handlers
- No global state
- No goroutine leak patterns

Java Spring Boot

# Payment Service

## Overview

Payment processing service. PCI-DSS compliance required.
Kafka event-driven async processing.

## Tech Stack

- Java 21 (leveraging Virtual Threads)
- Spring Boot 3.x
- Spring Data JPA + Hibernate
- Apache Kafka (event streaming)
- Vault (secret management)

## Architecture

Hexagonal Architecture (Ports & Adapters):

- domain/: pure domain models (no dependencies)
- application/: use cases, port interfaces
- infrastructure/: adapters (DB, Kafka, external APIs)
- interfaces/: controllers, DTOs

## Rules

- Domain layer must have zero Spring dependencies
- All monetary values use BigDecimal (never double or float)
- Apply Circuit Breaker pattern for external payment API calls
- Saga pattern with compensating transactions for distributed transactions

## Forbidden

- Using double instead of BigDecimal for monetary calculations
- Logging payment information without masking
- Missing timeouts on synchronous payment API calls

6. Prompt Strategies to 10x Your AI Coding Productivity

Context-First Prompting

When making requests to AI, structuring your prompt as Background → Constraints → Request yields far better results.

Bad example:

Write a payment processing function

Good example:

[Background] This is an e-commerce platform that processes payments with Stripe.
Payment-related logic currently lives in src/server/services/payment.ts.

[Constraints]
- Amounts must always be calculated server-side (never trust client input)
- On payment failure, retry up to 3 times with exponential backoff
- All payment events must be saved to an audit log

[Request]
Write a processCheckout function that creates a Stripe Payment Intent
during cart checkout. Use TypeScript and async/await.

Breaking Down Requests Step by Step

Asking the AI to tackle a complex feature all at once risks missing important details or picking the wrong design. Break large features into smaller units and request them step by step.

Step 1: "Design the database schema for the user authentication system"
Step 2: "Write the Prisma model based on this schema"
Step 3: "Implement the login business logic in a service layer"
Step 4: "Create the API route handler that uses this service"
Step 5: "Write tests for each layer"

Few-Shot Prompting (Showing Examples)

Providing existing code patterns as examples gets the AI to generate code that matches your team's style.

Our project writes API routes with this pattern:

[Example]
export async function GET(req: NextRequest) {
  try {
    const session = await getServerSession(authOptions)
    if (!session) return unauthorized()

    const data = await getUserData(session.user.id)
    return ok(data)
  } catch (error) {
    logger.error('Failed to get user data', { error })
    return internalError()
  }
}

Using this pattern, write an API route that retrieves a list of orders.

Specifying Hard "Don'ts"

Explicitly stating what not to do in your prompt prevents the AI from going off the rails.

Implement a product search feature.

Never:
- Fetch all data on the client side and filter it there (performance issue)
- Insert search terms directly into SQL (injection vulnerability)
- Perform a full DB scan on every request without caching search results

Inducing Chain-of-Thought

For complex problems, prompting the AI to think step-by-step produces more accurate results.

Analyze whether this code has performance issues.
Before starting the analysis, proceed in this order:
1. Explain what the code is doing
2. Analyze time/space complexity
3. Identify potential bottlenecks
4. Suggest improvements

7. AI Coding Workflow in Practice

Morning Routine

An effective way to start an AI-coding day:

  1. Check CLAUDE.md: See if the team added new rules yesterday
  2. Understand the issue: Clearly grasp requirements before asking the AI to implement
  3. Request an implementation plan from the AI: Review the approach before writing code
  4. Implement step by step: Ask the AI to implement in the planned order
  5. Review: AI first review with /review skill, human second review

Code Review Workflow

Combining AI code review with human code review:

AI First-Pass Review (automated):

  • Automatically run /review skill on PR creation from CI
  • Auto-detect bugs, security, and performance issues
  • Verify coding standard compliance

Human Second-Pass Review (focused):

  • Technical issues already caught by AI
  • Focus on whether business logic is appropriate
  • Evaluate long-term impact of architectural decisions
  • Team knowledge sharing and mentoring

Debugging Workflow

Error occurs → Collect context → Ask AI for analysis → Validate solution

Context collection checklist:
- Full error message (with stack trace)
- Input values at the time of the error
- Recently changed code (git diff)
- Relevant logs (30 lines before/after the error)
- Environment info (dev/staging/prod)

When requesting AI help:
"This error occurred. Analyze 3 possible causes
and tell me how to debug each one."

Documentation Workflow

Automate documentation with AI after code is complete:

  1. Feature implementation complete
  2. Auto-generate JSDoc with /docs skill
  3. Review auto-generated docs and add business context
  4. Update README (for new features)
  5. Auto-generate API docs (update OpenAPI spec)

8. Establishing Team AI Usage Principles

Document Your AI Usage Guidelines

The team needs clear guidelines to use AI consistently and safely.

# Team AI Usage Guidelines

## Permitted Use

- Code generation and refactoring
- Writing test code
- Documentation and comments
- Debugging assistance
- Code review assistance

## Areas Always Requiring Human Review

- Security-related code (auth, authz, encryption)
- Payment and financial processing logic
- Personal data handling code
- Architecture-level decisions

## Managing AI-Generated Code

- All AI-generated code must be reviewed and understood before committing
- "The AI made it so it must be correct" is forbidden
- Ask the AI to explain code you don't understand

Managing AI Dependency

Over-reliance on AI tools can erode a developer's core competencies. How to maintain a healthy balance:

Code every day without AI: Keep practicing solving small features or bugs entirely on your own. This prepares you for emergencies (AI tool outages, no internet) and maintains foundational skills.

Understand AI output: Don't just copy AI-generated code — understand why it was written that way. Ask the AI to explain parts you don't understand; this process becomes a learning opportunity.

Maintain judgment: AI is a tool. Critical decisions around architecture, business logic correctness, and security reviews must always be made by humans.

AI Guidelines for Junior Developers

If junior developers misuse AI, their growth can be stunted.

Recommended approach:

  • Generate code with AI and use that code as study material
  • Ask AI to explain concepts, then try to implement on your own
  • Think of alternatives to AI-generated code yourself

Approach to avoid:

  • Copying AI code without understanding it
  • Immediately handing errors to the AI (try to solve it yourself for at least 30 minutes first)
  • Delegating all design thinking to AI

9. Multi-Agent Coding (The Future)

The Era of Multiple AI Agents Coding Simultaneously

In 2026, a shift has begun — from a single AI agent handling one task at a time to multiple agents developing different features in parallel simultaneously.

For example:

  • Agent A: Implement new payment API (feature/payment-v2 branch)
  • Agent B: Write tests for the payment API (feature/payment-v2-tests branch)
  • Agent C: Fix an existing bug (fix/order-status-bug branch)
  • Human: Review and decide to merge agents' PRs

Strategies to Prevent Agent Conflicts

When multiple agents work simultaneously, code conflicts are inevitable. Strategies to prevent them:

Separate Work Territories: Assign each agent a clearly isolated file/module domain. Coordinate so that only one agent at a time modifies shared files (config files, type definitions, etc.).

Frequent Rebasing: Rebase each agent's branch onto main often to discover and resolve conflicts early.

Interface-First Contracts: Finalize interfaces shared among agents (API specs, type definitions) first, then let each agent implement independently.

Worktree-Based Parallel Development

Using Git Worktree, you can check out multiple branches from the same repository simultaneously, enabling parallel development.

# First workspace
git worktree add ../project-feature-a feature/payment-v2

# Second workspace (different directory, different branch)
git worktree add ../project-feature-b feature/user-profile-v2

# List worktrees
git worktree list

Claude Code recognizes this worktree pattern and can operate independently in each worktree. In the future, each worktree will have its own AI agent assigned, and team development speed will scale proportionally with the number of agents.

The Future of CLAUDE.md

In the multi-agent era, CLAUDE.md becomes even more important. It is the only "common language" ensuring multiple agents write code in a consistent way. In the future, CLAUDE.md will transcend being a configuration file and become a team constitution for your AI agent team.


10. Quiz

Q1. What is the most significant difference between CLAUDE.md and AGENT.md?

Answer: CLAUDE.md is a configuration file exclusive to Claude Code, while AGENT.md is a standard format that can be used universally across multiple AI tools.

Explanation: CLAUDE.md is deeply integrated with Anthropic's Claude Code and connects with the memory system, allowed/forbidden commands, and Skills. AGENT.md is a general-purpose configuration format compatible with various AI tools like Cursor, GitHub Copilot Workspace, and Devin. Teams using multiple AI tools can use AGENT.md as a baseline and keep tool-specific settings in separate files.

Q2. In CLAUDE.md's hierarchical configuration, how does a subdirectory CLAUDE.md get applied?

Answer: Claude Code reads upward from the current file's location to the root, merging all CLAUDE.md files it finds. More specific (deeper directory) settings override or supplement higher-level settings.

Explanation: Define project-wide common rules in the root CLAUDE.md and add area-specific rules in subdirectory CLAUDE.md files. For example, the root can define TypeScript standards, while a backend/ directory can add backend-specific rules like "always update the OpenAPI spec when changing any API endpoint."

Q3. What is the greatest benefit of using Skills (.claude/commands/) files?

Answer: The entire team can reuse consistent, high-quality prompts, enabling standardized AI usage that doesn't depend on individual skill level.

Explanation: Without Skills, each person uses prompts of varying quality, making AI output quality inconsistent across team members. Sharing a /review skill means everyone gets AI code review against the same criteria (bugs, security, performance, readability). Since Skills are version-controlled (Git), the team's approach to AI usage improves continuously over time.

Q4. What is the correct order for context-first prompting?

Answer: Background → Constraints → Request.

Explanation: In Background, explain what project it is, what tech stack it uses, and what existing code is relevant. In Constraints, specify performance requirements, security requirements, and patterns to follow. Finally, make the specific request. This order guides the AI to first establish the most relevant context and then find the best solution within the given constraints.

Q5. What is the most effective strategy to prevent code conflicts in a multi-agent coding environment?

Answer: A combination of three strategies: separating work territories, frequent rebasing, and interface-first contracts.

Explanation: Assign each agent a clearly isolated file/module domain (work territory separation), rebase each agent's branch onto main frequently to catch conflicts early (frequent rebasing), and finalize interfaces shared among agents before implementing independently (interface-first contracts). Git Worktree enables checking out multiple branches from the same repository simultaneously, facilitating parallel development.


Closing Thoughts

CLAUDE.md, AGENT.md, and Skills are not merely configuration files. They are your team's AI collaboration contract — defining how humans and AI work together.

With a well-written CLAUDE.md, the AI behaves like a senior developer on the team. With well-designed Skills, the entire team produces consistent, high-quality code. As AI tools continue to evolve, the importance of these configuration files will only grow.

Start today: create a CLAUDE.md for your project and turn your most-used prompt into a Skill. Start small and improve it gradually as you use it — that's the best approach.