# Ai 코딩 팁 2 (한국어)

* 발표 자료: [https://gamma.app/docs/AI--2a52e7tk3eb1ch1](https://gamma.app/docs/AI--2a52e7tk3eb1ch1)
    

AI 활용법 관련해서 간단하게 발표를 했다. 발표 자료 앞쪽은 [전에 블로그에 올린 글](https://kdy1.dev/2026-1-5-ai-coding-agent-tips)이랑 같은 내용이다. 이 글에서는 기존 글에서 다루지 않은 내용들을 다루겠다.

## 에러 메시지 및 로깅

## 구체적 타입 및 스키마 활용

`any` 타입은 사람에게도 위험하지만, AI에게는 더 위험하다.

마찬가지로,

* `JSON.parse`처럼 아무 제약 없는 파싱
    
* 느슨한 인터페이스
    
* 암묵적인 데이터 구조
    

이런 것들은 AI가 **너무 많은 가정을 하게 만든다**.

문제는 그 가정이 틀리면, 이후의 모든 판단이 연쇄적으로 꼬인다는 점이다.

그래서 가능한 한 다음을 지향한다.

* `any` 타입 대신 최대한 구체적인 타입 사용
    
* 단순 파싱 대신 스키마 기반 파서 사용  
    (예: `JSON.parse` 대신 Zod, Yup 같은 라이브러리)
    

이렇게 하면 AI가 가정을 하더라도,

* 그 가정이 틀릴 확률이 줄어들고
    
* 틀렸을 경우 즉시 실패하도록 만들 수 있다
    

즉, **AI가 잘못된 추론을 끝까지 끌고 가는 상황을 예방**할 수 있다.

## GitHub Actions 활용

GitHub Actions를 잘 보면 꽤 괜찮은 특징을 갖고 있다.

* 완전히 격리된 환경
    
* 구성하기 쉬움
    
* 이미 잘 구성된 예제가 많음
    

이걸 단순히 CI 용도로만 쓰지 않고,  
**개발용 가상 머신**처럼 사용하는 접근을 했다.

AI에게도 마찬가지다.

> “로컬에서 개발자가 할 수 있는 걸  
> AI도 똑같이 할 수 있게 만들어준다”

라는 관점이다.

### Claude Code를 위한 개발 환경 구성

* 실제 코드: [https://github.com/delinoio/delidev/blob/abed0d02fd30524bfb2f77f7227bf9560092e949/.github/workflows/claude.yml](https://github.com/delinoio/delidev/blob/abed0d02fd30524bfb2f77f7227bf9560092e949/.github/workflows/claude.yml)
    

```yaml
name: Claude Code

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]
  pull_request_review:
    types: [submitted]

jobs:
  claude:
    if: |
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: read
      issues: read
      id-token: write
      actions: read # Required for Claude to read CI results on PRs
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      # Setup pnpm 
      - name: Setup pnpm
        uses: pnpm/action-setup@v4.2.0

      - uses: actions/checkout@v4

      - name: Install Tauri dependencies
        run: |
            sudo apt-get update
            sudo apt-get install -y \
              libwebkit2gtk-4.1-dev \
              libappindicator3-dev \
              librsvg2-dev \
              patchelf

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable
  
      - name: Run Claude Code
        id: claude
        uses: anthropics/claude-code-action@v1
        with:
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

          # This is an optional setting that allows Claude to read CI results on PRs
          additional_permissions: |
            actions: read

          claude_args: |
            --allowed-tools Bash,WebFetch,WebSearch,Skill
            --model opus
```

GitHub Actions에서:

* 패키지 매니저 설치
    
* 빌드 명령 실행 (`pnpm build`, `cargo build` 등)
    
* 테스트 실행
    

까지 모두 가능하게 구성해두면,  
Claude Code는 사실상 **로컬 개발 환경과 거의 동일한 조건**에서 동작한다.

이렇게 환경이 갖춰져 있으면 AI의 작업 품질이 눈에 띄게 좋아진다.

* 추측으로 답하지 않고
    
* 실제 실행 결과를 기반으로 판단하고
    
* “이론상 맞는 코드” 대신 “실제로 도는 코드”를 만든다
    

### AI로 커밋 메시지 예쁘게 관리하기

![](https://cdn.gamma.app/369hvd746fpmyb6/9780314e609f49c496cb045817adfa33/original/seukeurinsyas-2026-01-30-ohu-5.29.37.png align="left")

### PR 본문 스팸 방지

* 실제 코드: [https://github.com/delinoio/delidev/blob/abed0d02fd30524bfb2f77f7227bf9560092e949/.github/workflows/claude-code-review.yml#L34-L55](https://github.com/delinoio/delidev/blob/abed0d02fd30524bfb2f77f7227bf9560092e949/.github/workflows/claude-code-review.yml#L34-L55)
    

```yaml
name: Claude Code Review

on:
  pull_request:
    types: [opened, synchronize]
    # Optional: Only run on specific file changes
    # paths:
    #   - "src/**/*.ts"
    #   - "src/**/*.tsx"
    #   - "src/**/*.js"
    #   - "src/**/*.jsx"

jobs:
  claude-review:
    # Optional: Filter by PR author
    # if: |
    #   github.event.pull_request.user.login == 'external-contributor' ||
    #   github.event.pull_request.user.login == 'new-developer' ||
    #   github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      issues: read
      id-token: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Dismiss old Claude bot comments
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          # Get PR comments from claude[bot] and hide them as outdated
          REPO="${{ github.repository }}"
          PR_NUMBER="${{ github.event.pull_request.number }}"

          # Get issue comments (gh pr comment creates issue comments, not review comments)
          gh api "repos/$REPO/issues/$PR_NUMBER/comments" --jq '.[] | select(.user.login == "claude[bot]") | .node_id' | while read -r comment_node_id; do
            if [ -n "$comment_node_id" ]; then
              echo "Hiding review comment: $comment_node_id"
              gh api graphql -f query='
                mutation($id: ID!) {
                  minimizeComment(input: {subjectId: $id, classifier: OUTDATED}) {
                    minimizedComment {
                      isMinimized
                    }
                  }
                }' -f id="$comment_node_id"
            fi
          done
        
      - name: Run Claude Code Review
        id: claude-review
        uses: anthropics/claude-code-action@v1
        with:
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          allowed_bots: '*'
          prompt: |
            REPO: ${{ github.repository }}
            PR NUMBER: ${{ github.event.pull_request.number }}

            Please review this pull request and provide feedback on:
            - Code quality and best practices
            - Potential bugs or issues
            - Performance considerations
            - Security concerns
            - Test coverage

            Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

            Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

          # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
          # or https://code.claude.com/docs/en/cli-reference for available options
          claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
```

Claude Code GitHub 리뷰 액션에는 버그가 하나 있다. 리뷰 코멘트를 **너무 많이 남긴다**.

이 때문에 PR이 리뷰 댓글로 도배되는 문제가 생긴다.

## AI 리뷰 활용법

### 기본 접근

전제부터 분명히 하자.

* 인간 리뷰는 느리다
    
* 인간 리뷰는 비싸다
    

그래서 **인간 리뷰를 최소화해야 한다**.

이를 위해 선택한 전략은 다음과 같다.

1. AI 리뷰 + CI를 먼저 통과시킨다
    
2. AI가 OK를 내릴 때까지는 인간이 개입하지 않는다
    
3. 테스트와 자동 리뷰가 모두 통과된 경우에만
    
4. 사람이 최종 리뷰를 한다
    

즉,

> 인간은 “최종 승인자” 역할만 맡는다

1. ### GitHub 앱 활용
    

AI 리뷰를 GitHub 앱 형태로 붙이면, PR 생성과 동시에 자동 리뷰가 시작된다.

이 단계에서는:

* 코드 스타일
    
* 명백한 버그
    
* 구조적인 문제
    

같은 것들을 AI가 먼저 걸러낸다.

2. ### GitHub Actions를 사용해서 반영  
    
    ![](https://cdn.gamma.app/369hvd746fpmyb6/9151ee873c544e18a87b6143de64214c/original/image.png align="left")
    
    스크린샷과 같이 Claude Code GitHub Action등을 사용해서 반영해야 병렬 처리가 쉽다. 로컬에 체크아웃하는 것은 사람의 테스팅처럼 로컬에서 해야만 하는 상황에만 하는 것을 추천한다.
    
3. ### CI 활용
    

![](https://cdn.gamma.app/369hvd746fpmyb6/5afe35a1a3714b81976456d41f3bbdcb/original/seukeurinsyas-2026-01-30-ohu-5.33.30.png align="left")

중요한 건 CI를 단순한 테스트 도구가 아니라,

> **AI와 인간 사이의 방파제**

로 사용하는 것이다. AI가 통과시키지 못한 변경사항은, 인간에게 도달하지 않게 만드는 것만으로도 리뷰 비용은 크게 줄어든다.

---

## Q&A

### MCP가 필요없는 스펙인 이유

특정 MCP 서버랑 똑같은 기능을 가진 CLI가 있다고 생각해보자. MCP를 통해서 수행할 수 있는 모든 건 CLI를 통해서도 수행할 수 있을 것이다. Vercel이 MCP를 만들지 않고 CLI 명령어를 개선한 것은 그래서이다.
