@@ -14,6 +14,120 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1414
1515This project uses Biome for formatting and linting. Always run ` pnpm biome:check ` before committing changes. The project has a pre-commit hook (lefthook) that automatically runs Biome on staged files.
1616
17+ ## Git Workflow
18+
19+ ### Branch Strategy
20+ - ** Main branch** : ` main ` - production-ready code
21+ - ** Feature branches** : ` feature/description ` or ` feat/short-name ` for new features
22+ - ** Bug fixes** : ` fix/description ` or ` bugfix/issue-number ` for bug fixes
23+ - ** Documentation** : ` docs/description ` for documentation updates
24+
25+ ### Commit Message Convention
26+ Follow conventional commits format for clear, searchable history:
27+
28+ ```
29+ <type>: <description>
30+
31+ [optional body]
32+
33+ 🤖 Generated with [Claude Code](https://claude.ai/code)
34+
35+ Co-Authored-By: Claude <[email protected] > 36+ ```
37+
38+ ** Types:**
39+ - ` feat: ` - new features
40+ - ` fix: ` - bug fixes
41+ - ` docs: ` - documentation updates
42+ - ` config: ` - configuration changes
43+ - ` refactor: ` - code refactoring without feature changes
44+ - ` chore: ` - maintenance tasks, dependency updates
45+
46+ ** Examples:**
47+ - ` feat: 블로그 포스트 검색 기능 추가 `
48+ - ` fix: 모바일에서 네비게이션 메뉴 깨짐 수정 `
49+ - ` docs: CLAUDE.md에 Git 워크플로우 가이드 추가 `
50+
51+ ### Pull Request Process
52+ 1 . Create feature branch from ` main `
53+ 2 . Implement changes with descriptive commits
54+ 3 . Run ` pnpm biome:check ` and ensure build passes
55+ 4 . Create PR with clear title and description
56+ 5 . Link related issues if applicable
57+ 6 . Merge after review (if working in team) or directly (if solo)
58+
59+ ### Pre-commit Hooks
60+ The project uses lefthook to automatically run quality checks:
61+ - Biome formatting and linting on staged files
62+ - Prevents commits with linting errors
63+ - Ensures consistent code style across the project
64+
65+ ## Claude Code Workflow Instructions
66+
67+ ** IMPORTANT** : Claude Code must follow this PR-based workflow for ALL development tasks:
68+
69+ ### 1. Before Starting Any Task
70+ ``` bash
71+ # Ensure you're on main and up to date
72+ git checkout main
73+ git pull origin main
74+
75+ # Create a new feature branch
76+ git checkout -b < type> /< description>
77+ ```
78+
79+ ### 2. Branch Naming Convention
80+ - ` feat/기능명 ` - New features (e.g., ` feat/search-functionality ` )
81+ - ` fix/버그명 ` - Bug fixes (e.g., ` fix/mobile-nav-issue ` )
82+ - ` docs/문서명 ` - Documentation updates (e.g., ` docs/readme-update ` )
83+ - ` config/설정명 ` - Configuration changes (e.g., ` config/eslint-setup ` )
84+ - ` refactor/리팩터명 ` - Code refactoring (e.g., ` refactor/component-structure ` )
85+ - ` chore/작업명 ` - Maintenance tasks (e.g., ` chore/dependency-update ` )
86+
87+ ### 3. After Completing Work
88+ ``` bash
89+ # Stage and commit changes
90+ git add .
91+ git commit -m " conventional commit message"
92+
93+ # Push to remote
94+ git push -u origin < branch-name>
95+
96+ # Create PR immediately
97+ gh pr create --title " PR Title" --body " $( cat << 'EOF '
98+ ## Summary
99+ - Brief description of changes
100+ - Key implementation details
101+
102+ ## Test plan
103+ - [ ] Checklist item 1
104+ - [ ] Checklist item 2
105+
106+ 🤖 Generated with [Claude Code](https://claude.ai/code)
107+ EOF
108+ ) "
109+ ```
110+
111+ ### 4. PR Requirements
112+ - ** Always create PRs** : Never commit directly to main
113+ - ** Clear titles** : Use conventional commit format in PR titles
114+ - ** Detailed descriptions** : Include Summary and Test plan sections
115+ - ** Link issues** : Reference related GitHub issues when applicable
116+ - ** Quality checks** : Ensure CI passes before requesting review
117+
118+ ### 5. Work Scope Guidelines
119+ - ** One logical change per PR** : Keep PRs focused and reviewable
120+ - ** Complete features** : Don't leave work in broken state
121+ - ** Test your changes** : Run ` pnpm biome:check ` and ` pnpm build ` before committing
122+ - ** Document breaking changes** : Clearly explain any breaking changes
123+
124+ ### 6. After PR Creation
125+ - Wait for CI checks to pass
126+ - Address any review feedback
127+ - Merge only after approval (if working in team) or when CI is green (if solo)
128+
129+ ** Remember** : This workflow ensures clean git history, proper code review, and CI validation for all changes.
130+
17131## Architecture Overview
18132
19133### Next.js Blog with MDX
@@ -24,15 +138,42 @@ This is a Next.js 15 blog application configured for static export with MDX supp
24138- Next.js 15 with App Router
25139- MDX for blog content with rehype-pretty-code syntax highlighting
26140- Tailwind CSS for styling
141+ - shadcn/ui for UI components
27142- TypeScript
28143- Biome for code formatting/linting
29144
30145### Directory Structure
31146
32- - ` src/app/ ` - Next.js App Router pages and layouts
147+ All client-side code is organized under ` src/app/ ` following Next.js App Router conventions with a package-like structure:
148+
149+ - ` src/app/ ` - Next.js App Router root directory
150+ - ` _components/ ` - Global reusable React components (underscore prevents routing)
151+ - ` _hooks/ ` - Global custom React hooks (underscore prevents routing)
152+ - ` _fonts/ ` - Font configurations (underscore prevents routing)
153+ - ` _lib/ ` - Global utility functions and libraries (underscore prevents routing)
154+ - ` about/ ` - About page route
155+ - ` _components/ ` - Components specific to about page only
156+ - ` _hooks/ ` - Hooks specific to about page only
157+ - ` page.tsx ` - About page component
158+ - ` blog/ ` - Blog routes
159+ - ` _components/ ` - Components specific to blog functionality
160+ - ` _hooks/ ` - Hooks specific to blog functionality
161+ - ` [slug]/ ` - Dynamic blog post pages
162+ - ` page.tsx ` - Blog index page
163+ - ` layout.tsx ` - Root layout component
164+ - ` page.tsx ` - Home page
165+ - ` not-found.tsx ` - 404 error page
166+ - ` globals.css ` - Global styles
167+ - ` src/api/ ` - Server-side utilities (outside app directory)
168+ - ` posts.ts ` - Blog post data fetching utilities
33169- ` src/contents/ ` - MDX blog posts (* .mdx files)
34- - ` src/api/posts.ts ` - Blog post data fetching utilities
35- - ` src/app/blog/[slug]/ ` - Dynamic blog post pages
170+
171+ ** Naming Convention:**
172+ - Use underscore prefix (` _ ` ) for folders that should not be treated as routes by Next.js App Router
173+ - Follow Java package-like structure: components and hooks are organized by their scope
174+ - Global scope: ` src/app/_components/ ` , ` src/app/_hooks/ `
175+ - Page/Feature scope: ` src/app/[route]/_components/ ` , ` src/app/[route]/_hooks/ `
176+ - This ensures components and logic are co-located with their usage while maintaining clear boundaries
36177
37178### Content Management
38179
@@ -50,9 +191,21 @@ The app is configured for static export (`output: 'export'` in next.config.ts) a
50191### Styling
51192
52193- Uses Tailwind CSS with custom configuration
194+ - shadcn/ui components with "new-york" style and stone base color
195+ - CSS variables for theming (light/dark mode support)
53196- Noto Sans KR font for Korean language support
54197- Prose styling for blog content rendering
55198
199+ ### UI Components
200+
201+ This project uses shadcn/ui for consistent, high-quality UI components:
202+ - ** Installation** : Use ` npx shadcn@latest add <component> ` to add new components
203+ - ** Location** : UI components are placed in ` src/app/_components/ui/ `
204+ - ** Style** : Configured with "new-york" style and stone base color
205+ - ** Theming** : Full CSS variables support for light/dark themes
206+ - ** Icons** : Uses Lucide React for icons
207+ - ** Utilities** : ` cn() ` function in ` src/app/_lib/utils.ts ` for conditional styling
208+
56209### Build Output
57210
58211Static files are generated in the ` out/ ` directory during build.
0 commit comments