|
1 | 1 | # Repository Guidelines |
2 | 2 |
|
3 | | -## Always-Follow Rules |
4 | | -- Keep changes minimal and scoped to the task. Do not edit unrelated files. |
5 | | -- Preserve the current MDX pipeline. MDX must stay on the custom webpack rule with `@mdx-js/loader` in `next.config.mjs`; do not switch to Next.js built-in MDX unless the whole content pipeline is intentionally migrated. |
6 | | -- Keep visualization-heavy UI in `src/components/visualization/`. Do not move that code to other folders without a clear architectural reason. |
7 | | -- Never use `any`. Use concrete types or `unknown` with narrowing. |
8 | | -- Never use arbitrary Tailwind values such as `p-[13px]`. Use standard utilities, shared tokens, and existing style patterns. |
9 | | -- Do not replace feature-first structure with flat shared folders. Keep code in `src/features/`, `src/shared/`, and `src/domains/` by responsibility. |
10 | | -- Preserve blog content structure as `posts/**/index.mdx` with nearby `meta.json`, including nested series directories when present. |
11 | | - |
12 | | -## Project Structure |
13 | | -- `src/app/` — Next.js App Router pages, layouts, handlers |
14 | | -- `src/core/` — app-level providers and configuration composition |
15 | | -- `src/domains/` — cross-feature contracts and schemas |
16 | | -- `src/features/` — feature modules such as blog, home, resume, and search |
17 | | -- `src/shared/` — reusable UI, layout, analytics, SEO, and providers |
18 | | -- `src/components/visualization/` — animation and visualization-heavy components |
19 | | -- `src/styles/` — design tokens and global styles |
20 | | -- `posts/` — blog content, series entries, and metadata managed as nested `index.mdx` + `meta.json` |
21 | | -- `tests/` — Playwright end-to-end coverage |
22 | | -- `internal/` — scripts and tool configuration |
23 | | - |
24 | | -## Development Commands |
25 | | -- `npm run dev` — run the local dev server with webpack |
26 | | -- `npm run build` — create the production build |
27 | | -- `npm run lint` — run ESLint on source files |
28 | | -- `npm run lint:css:syntax` — check CSS syntax rules |
29 | | -- `npm run test:unit` — run Vitest unit tests |
30 | | -- `npm run test:components` — run component-focused Vitest tests |
31 | | -- `npm run test:e2e` — run Playwright scenarios |
32 | | -- `npm run test:ci` — run the main CI-equivalent validation set |
33 | | - |
34 | | -## Style & Testing |
35 | | -Use TypeScript with 2-space indentation, semicolons, single quotes, trailing commas (`es5`), and 80-column width; Prettier enforces this. Name components in `PascalCase`, hooks in `camelCase` with a `use` prefix, and tests as `*.test.ts` or `*.test.tsx`. Add targeted Vitest or Playwright coverage when changing logic, UI behavior, parsers, or app actions. Before opening a PR, run `npm run build` and the most relevant test command for the change. |
36 | | - |
37 | | -## Commits & PRs |
38 | | -Use commit messages like `type(scope): concise description`, for example `fix(home): preview 배포 타입 오류 수정`. Common types include `feat`, `fix`, `refactor`, `test`, and `chore`. Use branch names like `codex/<task>`. Follow `.github/pull_request_template.md`, link related issues or PRs, and include screenshots when UI changes are visible. Confirm mobile/desktop and dark/light behavior when layout or navigation changes. |
| 3 | +## 항상 지킬 규칙 |
| 4 | + |
| 5 | +- 변경은 작업 범위에 맞게 최소화한다. 관련 없는 파일은 수정하지 않는다. |
| 6 | +- 현재 MDX 파이프라인을 보존한다. MDX는 `next.config.mjs`의 `@mdx-js/loader` |
| 7 | + 기반 커스텀 webpack rule에 남겨둔다. 전체 콘텐츠 파이프라인을 의도적으로 |
| 8 | + 마이그레이션하지 않는 한 Next.js 내장 MDX로 바꾸지 않는다. |
| 9 | +- 시각화 중심 UI는 `src/components/visualization/`에 둔다. 명확한 |
| 10 | + 아키텍처 이유 없이 다른 폴더로 옮기지 않는다. |
| 11 | +- `any`를 사용하지 않는다. 구체 타입을 쓰거나 `unknown`과 narrowing을 |
| 12 | + 사용한다. |
| 13 | +- `p-[13px]` 같은 arbitrary Tailwind value를 사용하지 않는다. 표준 utility, |
| 14 | + shared token, 기존 스타일 패턴을 사용한다. |
| 15 | +- feature-first 구조를 flat shared folder 구조로 바꾸지 않는다. |
| 16 | + `src/features/`, `src/shared/`, `src/domains/`를 책임별로 유지한다. |
| 17 | +- 블로그 콘텐츠 구조는 `posts/**/index.mdx`와 주변 `meta.json`으로 유지한다. |
| 18 | + 중첩된 series 디렉터리도 보존한다. |
| 19 | +- 변경이 아래 ADR 작성 조건에 걸리면 반드시 ADR을 작성하거나 갱신한다. |
| 20 | + |
| 21 | +## ADR 작성 조건 |
| 22 | + |
| 23 | +아래 조건 중 하나라도 해당하면 `docs/adr/`에 ADR을 작성하거나 갱신한다. |
| 24 | + |
| 25 | +- 선택지가 2개 이상이고 트레이드오프가 존재한 경우. |
| 26 | +- 반복적으로 따라야 할 규칙이나 경계를 정의한 경우. |
| 27 | +- 테스트 전략이나 검증 방식이 결정의 핵심이었던 경우. |
| 28 | + |
| 29 | +ADR 작성 기준: |
| 30 | + |
| 31 | +- `docs/adr/` 아래에 번호가 붙은 파일을 만들고 `docs/adr/README.md`를 |
| 32 | + 갱신한다. |
| 33 | +- 배경, 결정, 결과, 검토한 대안, 가능하면 관련 커밋 히스토리를 기록한다. |
| 34 | +- 과거를 지우기 위해 기존 ADR을 고쳐 쓰지 않는다. 이전 결정을 대체하는 새 |
| 35 | + ADR을 작성한다. |
| 36 | +- ADR은 AI 협업 노트와 분리한다. ADR은 누가 초안을 작성했는지와 무관하게 |
| 37 | + 엔지니어링 결정을 기록하는 문서다. |
| 38 | + |
| 39 | +## 프로젝트 구조 |
| 40 | + |
| 41 | +- `src/app/`: Next.js App Router 페이지, 레이아웃, 핸들러 |
| 42 | +- `src/core/`: 앱 수준 provider와 설정 조합 |
| 43 | +- `src/domains/`: feature 사이에서 공유되는 계약과 스키마 |
| 44 | +- `src/features/`: blog, home, resume, search 같은 feature 모듈 |
| 45 | +- `src/shared/`: 재사용 가능한 UI, layout, analytics, SEO, provider |
| 46 | +- `src/components/visualization/`: animation과 시각화 중심 컴포넌트 |
| 47 | +- `src/styles/`: design token과 global style |
| 48 | +- `posts/`: 중첩 가능한 `index.mdx`와 `meta.json` 기반 블로그 콘텐츠 |
| 49 | +- `tests/`: Playwright E2E 테스트 |
| 50 | +- `internal/`: script와 tool configuration |
| 51 | + |
| 52 | +## 개발 명령 |
| 53 | + |
| 54 | +- `npm run dev`: webpack 기반 로컬 개발 서버 실행 |
| 55 | +- `npm run build`: production build 생성 |
| 56 | +- `npm run lint`: source file ESLint 실행 |
| 57 | +- `npm run lint:css:syntax`: CSS syntax rule 검사 |
| 58 | +- `npm run verify:docs`: ADR과 핵심 문서 하네스 검사 |
| 59 | +- `npm run test:unit`: Vitest unit test 실행 |
| 60 | +- `npm run test:components`: component 중심 Vitest test 실행 |
| 61 | +- `npm run test:e2e`: Playwright scenario 실행 |
| 62 | +- `npm run test:ci`: 주요 CI-equivalent validation set 실행 |
| 63 | + |
| 64 | +## 스타일과 테스트 |
| 65 | + |
| 66 | +TypeScript를 사용하고 2-space indentation, semicolon, single quote, trailing |
| 67 | +comma(`es5`), 80-column width를 따른다. Prettier가 이를 강제한다. Component는 |
| 68 | +`PascalCase`, hook은 `use` prefix가 붙은 `camelCase`, test는 `*.test.ts` |
| 69 | +또는 `*.test.tsx`로 작성한다. Logic, UI behavior, parser, app action을 바꿀 |
| 70 | +때는 대상 Vitest 또는 Playwright coverage를 추가한다. PR 전에는 |
| 71 | +`npm run build`와 변경에 가장 관련 있는 test command를 실행한다. |
| 72 | + |
| 73 | +## AI 작업 운영 |
| 74 | + |
| 75 | +- AI가 제안했더라도 이 저장소의 구조, ADR, 테스트 규칙을 우선한다. |
| 76 | +- 사용자나 다른 작업자가 만든 변경을 명시 요청 없이 되돌리지 않는다. |
| 77 | +- 작업 전 관련 문서와 현재 구현을 먼저 확인하고, 추측으로 구조를 바꾸지 |
| 78 | + 않는다. |
| 79 | +- 작업 후 변경 내용, 이유, 검증 방법을 짧게 요약한다. |
| 80 | +- 반복되는 AI 작업 절차는 새 중복 가이드보다 `AGENTS.md`, ADR, 실행 계획, |
| 81 | + 또는 기존 guide 중 가장 직접적인 문서에 흡수한다. |
| 82 | + |
| 83 | +## 커밋과 PR |
| 84 | + |
| 85 | +커밋 메시지는 `type(scope): concise description` 형식을 사용한다. 예: |
| 86 | +`fix(home): preview 배포 타입 오류 수정`. 주로 쓰는 type은 `feat`, `fix`, |
| 87 | +`refactor`, `test`, `chore`다. Branch name은 `codex/<task>` 형태를 사용한다. |
| 88 | +`.github/pull_request_template.md`를 따르고 관련 issue나 PR을 연결한다. UI 변경이 |
| 89 | +보이면 screenshot을 포함한다. Layout이나 navigation이 바뀌면 mobile/desktop, |
| 90 | +dark/light 동작을 확인한다. |
0 commit comments