{ "rules": [ { "type": "prd", "content": "# 제품 요구사항 문서 (PRD)\n\n## 1. 개요\n인플루언서와 벤더사가 문서 교환 없이 웹 기반으로 수·발주 및 정산을 수행할 수 있는 통합 플랫폼 구축. 배송·정산·고객응대 전 과정을 자동화해 거래 속도와 신뢰도를 향상시킨다.\n\n## 2. 문제 정의\n- 엑셀·PDF 등 오프라인 문서 교환으로 인한 오류·지연\n- 송장번호 수기 입력, 재고·배송 상태 불일치\n- 계약·정산 내역 확인이 어렵고 가시성 부족\n- 인플루언서 파트너 탐색 과정의 비효율\n\n## 3. 목표 및 목적\n- 1차 목표: 발주·승인·송장·정산 전 프로세스 웹 자동화\n- 2차 목표: 파트너 매칭, 서브계정 관리, OCR 기반 송장 인식\n- 성공지표\n - 발주 승인 평균 소요시간 50% 단축\n - 송장 입력 오류율 90% ↓\n - 월간 활성 인플루언서 수 1,000명\n - 거래액 월 10억 원\n\n## 4. 타깃 사용자\n### 주요 사용자\n- 인플루언서: SNS 영향력 보유, 공동구매 운영, 재고·배송 부담 최소화 희망\n- 벤더사: 상품 공급, 재고·배송·정산 자동화 필요\n### 부차 사용자\n- 통합 벤더사/유통업체, CS 담당자, 회계팀\n\n## 5. 사용자 스토리\n- “인플루언서로서 벤더사 제품을 조회·발주해 판매 준비를 간편히 하고 싶다.”\n- “벤더사 담당자로서 인플루언서 요청을 클릭 한 번에 승인·거절하고 싶다.”\n- “CS 담당자로서 주문 상태를 실시간 파악해 문의에 즉시 대응하고 싶다.”\n- “벤더사 마스터로서 서브계정을 생성해 팀별 권한을 차등 부여하고 싶다.”\n\n## 6. 기능 요구사항\n### 핵심 기능\n1. 벤더사 포털 \n - 상품 등록/수정/상태관리(배송중, 품절 등) \n Acceptance: 상품 등록 시 필수 필드 검증, 상태 변경시 실시간 알림 \n - 주문 관리: 인플루언서 수주 승인/거절, 일괄처리 \n - 배송 관리 \n - 송장번호 엑셀 업로드·다운로드 \n - 송장 사진 OCR → 자동 입력 \n - 정산 관리: 월간 계약·정산 내역 확인, CSV 다운로드 \n - 인플루언서 승인 및 제안: 가입 요청 승인 및 파트너 제안 발송 \n2. 인플루언서 포털 \n - SNS 간편 로그인(Google, Kakao, Naver) \n - 벤더사 가입 요청 및 제안 수락 \n - 연결된 벤더사 상품 리스트 조회 \n - 상품 수주 요청, 송장번호 엑셀 다운로드 \n3. 매칭 시스템 \n - 벤더사 조건(카테고리·팔로워 수) 기반 추천 알고리즘 \n4. 알림 센터 \n - 이메일·푸시·웹 소켓 알림: 주문 상태, 승인 결과, 정산 완료 \n### 보조 기능\n- 벤더사 서브계정 관리(역할·권한 설정)\n- 고객센터 게시판(FAQ, 1:1 문의)\n- 대시보드(매출, 주문, 정산 현황)\n\n## 7. 비기능 요구사항\n- 성능: 평균 응답 300ms 이하, 동시 5,000사용자\n- 보안: JWT 인증, OAuth2 SNS 로그인, HTTPS, 데이터 암호화\n- 사용성: 반응형 UI, 접근성 WCAG 2.1 AA\n- 확장성: 모듈화된 Micro Frontend, RESTful API\n- 호환성: 최신 크롬·사파리·엣지, 모바일 브라우저\n\n## 8. 기술 고려사항\n- 프론트엔드: Vue3 + Composition API, Nuxt3, Vuetify, TypeScript, Axios\n- 백엔드: CodeIgniter4 + Node.js BFF\n- DB: MySQL(RDS), Redis 캐시\n- 배포: Docker, K8s, GitHub Actions CI/CD\n- OCR: Google Cloud Vision API\n- 통합: 택배사 API(송장 추적), 회계 시스템 ERP 연동\n- 로깅·모니터링: ELK, Grafana\n\n## 9. 성공 지표(KPI)\n- DAU / MAU, 유입·활성률\n- 주문 승인 건수, 배송 완료율\n- 거래 총액, 재구매율\n- 서버 오류율 <1%, 가용성 99.9%\n\n## 10. 일정 및 마일스톤\n- Phase 1 (M+2): 로그인, 상품·주문·배송 기본, MVP 런칭\n- Phase 2 (M+4): 정산 모듈, 매칭 시스템, 알림 센터\n- Phase 3 (M+6): OCR, 서브계정, 대시보드, 모바일 최적화\n- Phase 4 (M+9): AI 수요 예측, 글로벌 배송 연동\n\n## 11. 위험 및 대응\n- 데이터 정확도: OCR 오류 → 수동 검증 UI 제공\n- 사용 미정착: 온보딩 튜토리얼, FAQ 운영\n- 벤더사 API 변경: 버전 관리, 어댑터 패턴\n- 개인정보 유출: 정기 보안 점검, 침투 테스트\n\n## 12. 향후 고려사항\n- 인플루언서 커미션 자동 분배, 블록체인 정산\n- 다국어 지원, 환율 자동 적용\n- 모바일 앱(iOS/Android) 출시\n- AI 기반 악성 주문 탐지, 인플루언서 등급제 도입", "writedAt": "2025-07-25T01:49:47.278Z" }, { "type": "architecture", "content": "# Technical Requirements Document (TRD)\n\n## 1. Executive Technical Summary\n- **프로젝트 개요** \n 인플루언서와 벤더사 간 수·발주, 배송, 정산, 알림을 웹 기반으로 자동화하는 통합 플랫폼. 오프라인 문서 교환 제거, 실시간 상태 관리, 파트너 매칭 기능 제공.\n- **핵심 기술 스택** \n Frontend: Vue 3 + Nuxt3, Vuetify, TypeScript \n Backend: CodeIgniter4 REST API + Node.js BFF \n DB: MySQL(RDS), Redis 캐시 \n 배포: Docker, Kubernetes, GitHub Actions CI/CD \n OCR: Google Cloud Vision API \n 모니터링: ELK 스택, Grafana \n- **주요 기술 목표** \n 평균 응답시간 300ms 이하, 동시 5,000 사용자 처리, 가용성 99.9%, 서버 오류율 <1%\n- **주요 가정** \n - 초기 규모: 월 거래액 10억, DAU 1,000+ \n - 클라우드 인프라(AWS/GCP) 사용 \n - 외부 택배사·ERP API 연동 가능성 상시 고려 \n\n## 2. Tech Stack\n\n| Category | Technology / Library | Reasoning (선택 이유) |\n| ------------------ | ------------------------------ | ----------------------------------------------------------------- |\n| Frontend Framework | Vue 3 + Nuxt3 | SSR/SSG 지원으로 초기 로딩 최적화, SEO 강화 |\n| UI Library | Vuetify | 머티리얼 디자인 기반, 빠른 UI 컴포넌트 구성 |\n| Language | TypeScript | 정적 타입 검사로 코드 안정성 및 가독성 확보 |\n| State Management | Pinia | Composition API 친화적, 러닝 커브 완만 |\n| HTTP Client | Axios | Promise 기반, 요청/응답 인터셉터 활용 용이 |\n| Backend Framework | CodeIgniter 4 | 경량 PHP 프레임워크, 빠른 개발 및 유지보수 |\n| API Layer (BFF) | Node.js + Express | 프론트엔드 맞춤형 API 어댑터, 비즈니스 로직 경량 분리 |\n| Database | MySQL (RDS) | 관계형 데이터 안정성·확장성, RDS 관리 편의성 |\n| Cache | Redis | 세션 관리, 빈번한 조회 데이터 캐싱으로 응답 속도 개선 |\n| Containerization | Docker | 환경 일관성 확보, 배포 자동화 |\n| Orchestration | Kubernetes | 자동 스케일링, 자가 복구, 클러스터 관리 |\n| CI/CD | GitHub Actions | 코드 푸시 시 빌드·테스트·배포 자동화 |\n| OCR | Google Cloud Vision API | 높은 정확도, 이미지→텍스트 자동 변환 |\n| Monitoring | ELK (Elasticsearch, Logstash, Kibana), Grafana | 로그 집계·시각화, 메트릭 모니터링 |\n| Authentication | JWT, OAuth2 (Google/Kakao/Naver) | 보안성 높은 인증, SNS 간편 로그인 지원 |\n| Real-time | WebSocket (Socket.IO) | 실시간 알림(주문 상태, 승인 결과) |\n| Integration | Courier API, ERP REST API | 택배사 송장 조회, 회계 시스템 자동 연동 |\n\n## 3. System Architecture Design\n\n### Top-Level building blocks\n- Frontend (Nuxt3): SSR 페이지, 컴포넌트, 인증/알림 UI \n- BFF (Node.js + Express): Frontend 전용 경량 API 어댑터, 실시간 채널 관리 \n- Backend API (CI4): 핵심 비즈니스 로직, DB CRUD, 권한 관리 \n- Database & Cache: MySQL RDS, Redis 캐시 서버 \n- External Integrations: Google Vision OCR, 택배사 API, ERP API \n- Monitoring & Logging: ELK 스택, Grafana 알림\n\n### Top-Level Component Interaction Diagram\n```mermaid\ngraph TD\n F[Nuxt3 Frontend] --> BFF(BFF: Node.js)\n BFF --> API[Backend API: CI4]\n API --> DB[MySQL(RDS)]\n API --> Cache[Redis]\n API --> OCR[Google Vision API]\n API --> Courier[택배사 API]\n API --> ERP[ERP API]\n Monitoring --> API\n Monitoring --> BFF\n```\n- Nuxt3 프론트엔드가 BFF로 요청 전달 \n- BFF는 세션/인증 관리 후 CI4 API 호출 \n- CI4 API는 MySQL/Redis, 외부 OCR·택배·ERP 연동 \n- ELK·Grafana로 전체 서비스 상태 모니터링 \n\n### Code Organization & Convention\n**Domain-Driven Organization Strategy** \n- **도메인 분리**: 사용자, 주문, 배송, 정산, 매칭 등 비즈니스 도메인별 모듈 \n- **레이어 아키텍처**: Presentation, Application, Domain, Infrastructure \n- **기능 기반 모듈화**: 각 도메인 기능을 독립 패키지로 관리 \n- **공유 컴포넌트**: Utils, Types, 공통 미들웨어, 인터셉터\n\n**Universal File & Folder Structure**\n```\n/\n├── app.vue\n├── assets\n│ ├── font\n│ │ ├── Inter-Medium.woff\n│ │ ├── NotoSansKR-Black.otf\n│ │ ├── NotoSansKR-Black.woff\n│ │ ├── NotoSansKR-Black.woff2\n│ │ ├── NotoSansKR-Bold.otf\n│ │ ├── NotoSansKR-Bold.woff\n│ │ ├── NotoSansKR-Bold.woff2\n│ │ ├── NotoSansKR-DemiLight.otf\n│ │ ├── NotoSansKR-DemiLight.woff\n│ │ ├── NotoSansKR-DemiLight.woff2\n│ │ ├── NotoSansKR-Light.otf\n│ │ ├── NotoSansKR-Light.woff\n│ │ ├── NotoSansKR-Light.woff2\n│ │ ├── NotoSansKR-Medium.otf\n│ │ ├── NotoSansKR-Medium.woff\n│ │ ├── NotoSansKR-Medium.woff2\n│ │ ├── NotoSansKR-Regular.otf\n│ │ ├── NotoSansKR-Regular.woff\n│ │ ├── NotoSansKR-Regular.woff2\n│ │ ├── NotoSansKR-Regular(1).woff\n│ │ ├── NotoSansKR-Thin.otf\n│ │ ├── NotoSansKR-Thin.woff\n│ │ └── NotoSansKR-Thin.woff2\n│ ├── img\n│ │ ├── bg_login.svg\n│ │ ├── bg_otp_reg.png\n│ │ ├── bg_popup.svg\n│ │ ├── bg_tab_off.svg\n│ │ ├── bg_tab_on.svg\n│ │ ├── bg_tooltip.svg\n│ │ ├── bg_tooltip2.svg\n│ │ ├── bg_tooltip3.svg\n│ │ ├── bg_tooltip4.svg\n│ │ ├── btn_app_store.svg\n│ │ ├── btn_goolge_play.svg\n│ │ ├── btn.png\n│ │ ├── caution_bg.jpg\n│ │ ├── db_set_list01.svg\n│ │ ├── db_set_list02.svg\n│ │ ├── db_set_list03.svg\n│ │ ├── head_flip_btn.svg\n│ │ ├── ic_add.svg\n│ │ ├── ic_allview.svg\n│ │ ├── ic_arrow_right_chv.svg\n│ │ ├── ic_avg01.svg\n│ │ ├── ic_avg02.svg\n│ │ ├── ic_avg03.svg\n│ │ ├── ic_avg04.svg\n│ │ ├── ic_card_nodata.svg\n│ │ ├── ic_card_off.svg\n│ │ ├── ic_card_on.svg\n│ │ ├── ic_chv_arrow.svg\n│ │ ├── ic_chv.svg\n│ │ ├── ic_close.svg\n│ │ ├── ic_drop_down_on.svg\n│ │ ├── ic_drop_down.svg\n│ │ ├── ic_ds.svg\n│ │ ├── ic_end_close_cl.svg\n│ │ ├── ic_end_close_x.svg\n│ │ ├── ic_end_close.png\n│ │ ├── ic_end_close.svg\n│ │ ├── ic_end_red.svg\n│ │ ├── ic_equip01.svg\n│ │ ├── ic_equip02.svg\n│ │ ├── ic_equip03.svg\n│ │ ├── ic_equip04.svg\n│ │ ├── ic_excel_green.svg\n│ │ ├── ic_excel.svg\n│ │ ├── ic_gear.svg\n│ │ ├── ic_google.svg\n│ │ ├── ic_grid_box.png\n│ │ ├── ic_home_arrow.svg\n│ │ ├── ic_info.svg\n│ │ ├── ic_issue_flag.svg\n│ │ ├── ic_kakao.svg\n│ │ ├── ic_list_off.svg\n│ │ ├── ic_list_on.svg\n│ │ ├── ic_map_card.svg\n│ │ ├── ic_map_pin.svg\n│ │ ├── ic_mapt_chv.svg\n│ │ ├── ic_more_btn.svg\n│ │ ├── ic_more_plust_gray.svg\n│ │ ├── ic_naver.svg\n│ │ ├── ic_no_img.svg\n│ │ ├── ic_no_tree.svg\n│ │ ├── ic_preview_nw.svg\n│ │ ├── ic_radio_off.svg\n│ │ ├── ic_radio_on.svg\n│ │ ├── ic_sch_nw.svg\n│ │ ├── ic_sts.svg\n│ │ ├── ic_tab01.svg\n│ │ ├── ic_tab02.svg\n│ │ ├── ic_tab03.svg\n│ │ ├── ic_tab04.svg\n│ │ ├── ic_tack_off.svg\n│ │ ├── ic_tack_on.svg\n│ │ ├── ic_tenant_small_white.svg\n│ │ ├── ic_tenant_small.svg\n│ │ ├── ic_tenant01.svg\n│ │ ├── ic_tenant02.svg\n│ │ ├── ic_tenant03.svg\n│ │ ├── ic_tenant04.svg\n│ │ ├── ic_wifi_dis.svg\n│ │ ├── ic_wifi.svg\n│ │ ├── ic_x_btn.svg\n│ │ ├── ic_x_btn2.svg\n│ │ ├── ic_xcircle.svg\n│ │ ├── ico_alarm_blue.svg\n│ │ ├── ico_alarm_gray.svg\n│ │ ├── ico_alarm_green.svg\n│ │ ├── ico_alarm_red.svg\n│ │ ├── ico_alarm1.svg\n│ │ ├── ico_alarm2.svg\n│ │ ├── ico_alarm3.svg\n│ │ ├── ico_alarm4.svg\n│ │ ├── ico_all_pop.svg\n│ │ ├── ico_arrow_next.svg\n│ │ ├── ico_arrow_prev.svg\n│ │ ├── ico_backup1.svg\n│ │ ├── ico_backup2.svg\n│ │ ├── ico_backup3.svg\n│ │ ├── ico_backup4.svg\n│ │ ├── ico_ban.svg\n│ │ ├── ico_bar.svg\n│ │ ├── ico_black_pin.svg\n│ │ ├── ico_blue_pin.svg\n│ │ ├── ico_btn1.svg\n│ │ ├── ico_btn2.svg\n│ │ ├── ico_btn3.svg\n│ │ ├── ico_cal_dis.svg\n│ │ ├── ico_cal.svg\n│ │ ├── ico_calendar.svg\n│ │ ├── ico_cancel_disabled.svg\n│ │ ├── ico_cancel.svg\n│ │ ├── ico_cate.svg\n│ │ ├── ico_certify_n.svg\n│ │ ├── ico_certify_y.svg\n│ │ ├── ico_certify_y2.svg\n│ │ ├── ico_certify_y3.svg\n│ │ ├── ico_check_indeterminate.svg\n│ │ ├── ico_chk_circle_disabled.svg\n│ │ ├── ico_chk_circle.svg\n│ │ ├── ico_chk_off.svg\n│ │ ├── ico_chk_off2.svg\n│ │ ├── ico_chk_on.svg\n│ │ ├── ico_chk.svg\n│ │ ├── ico_close_gray.svg\n│ │ ├── ico_close.svg\n│ │ ├── ico_core_alarm1.svg\n│ │ ├── ico_core_alarm2.svg\n│ │ ├── ico_date_pic.svg\n│ │ ├── ico_del_disabled.svg\n│ │ ├── ico_del_disabled2.svg\n│ │ ├── ico_del.svg\n│ │ ├── ico_del2.svg\n│ │ ├── ico_download.svg\n│ │ ├── ico_end.svg\n│ │ ├── ico_equip.svg\n│ │ ├── ico_eraser.svg\n│ │ ├── ico_eraser2.svg\n│ │ ├── ico_error.svg\n│ │ ├── ico_event_pop.svg\n│ │ ├── ico_event_view_black.png\n│ │ ├── ico_event_view_black.svg\n│ │ ├── ico_event_view_down.svg\n│ │ ├── ico_event_view.svg\n│ │ ├── ico_excel_d.svg\n│ │ ├── ico_excel.svg\n│ │ ├── ico_excel2.svg\n│ │ ├── ico_eye.svg\n│ │ ├── ico_eye2.svg\n│ │ ├── ico_gray_pin.svg\n│ │ ├── ico_grid_sort.svg\n│ │ ├── ico_grid_sort2.svg\n│ │ ├── ico_id_off.svg\n│ │ ├── ico_id_on.svg\n│ │ ├── ico_info.svg\n│ │ ├── ico_lang_english.svg\n│ │ ├── ico_lang_korea.svg\n│ │ ├── ico_lang_korea2.svg\n│ │ ├── ico_link.svg\n│ │ ├── ico_list_white.svg\n│ │ ├── ico_list.svg\n│ │ ├── ico_location_arr.svg\n│ │ ├── ico_location_home.svg\n│ │ ├── ico_logo.svg\n│ │ ├── ico_logout.svg\n│ │ ├── ico_map.svg\n│ │ ├── ico_menu_arr.svg\n│ │ ├── ico_menu_arr2.svg\n│ │ ├── ico_menu_minus.svg\n│ │ ├── ico_menu_nodata.svg\n│ │ ├── ico_menu_plus.svg\n│ │ ├── ico_menu.svg\n│ │ ├── ico_minus.svg\n│ │ ├── ico_mod_disabled.svg\n│ │ ├── ico_mod.svg\n│ │ ├── ico_mod2.svg\n│ │ ├── ico_mode_dark.svg\n│ │ ├── ico_mode_white.svg\n│ │ ├── ico_mode_white2.svg\n│ │ ├── ico_ne_add.svg\n│ │ ├── ico_ne_del_d.svg\n│ │ ├── ico_ne_del.svg\n│ │ ├── ico_no_data_nw.svg\n│ │ ├── ico_no_data.svg\n│ │ ├── ico_no_data2.svg\n│ │ ├── ico_no_table_dt.svg\n│ │ ├── ico_not_excel.svg\n│ │ ├── ico_otp_step1.svg\n│ │ ├── ico_otp_step2.svg\n│ │ ├── ico_otp_step3.svg\n│ │ ├── ico_otp_step4.svg\n│ │ ├── ico_otp_step5.svg\n│ │ ├── ico_paging_more.svg\n│ │ ├── ico_paging_next.svg\n│ │ ├── ico_paging_next1.svg\n│ │ ├── ico_paging_next2.svg\n│ │ ├── ico_paging_prev.svg\n│ │ ├── ico_paging_prev1.svg\n│ │ ├── ico_paging_prev2.svg\n│ │ ├── ico_performance1.svg\n│ │ ├── ico_performance2.svg\n│ │ ├── ico_pin_off.svg\n│ │ ├── ico_pin_on.svg\n│ │ ├── ico_pip.svg\n│ │ ├── ico_pip2.svg\n│ │ ├── ico_plus.svg\n│ │ ├── ico_pop_close.svg\n│ │ ├── ico_pos.svg\n│ │ ├── ico_ran_arrow_gray.svg\n│ │ ├── ico_ran_arrow_white.svg\n│ │ ├── ico_red_pin.svg\n│ │ ├── ico_refresh_dis.svg\n│ │ ├── ico_refresh.svg\n│ │ ├── ico_reg_disabled.svg\n│ │ ├── ico_reg.svg\n│ │ ├── ico_save_disabled.svg\n│ │ ├── ico_save.svg\n│ │ ├── ico_search.svg\n│ │ ├── ico_set_blue.svg\n│ │ ├── ico_set.svg\n│ │ ├── ico_setting.svg\n│ │ ├── ico_slt.svg\n│ │ ├── ico_slt2.svg\n│ │ ├── ico_sort.svg\n│ │ ├── ico_square.svg\n│ │ ├── ico_state1.svg\n│ │ ├── ico_state2.svg\n│ │ ├── ico_state3.svg\n│ │ ├── ico_status1.svg\n│ │ ├── ico_status2.svg\n│ │ ├── ico_status3.svg\n│ │ ├── ico_step_arr.svg\n│ │ ├── ico_step_arr2.svg\n│ │ ├── ico_tenant1.svg\n│ │ ├── ico_tenant2.svg\n│ │ ├── ico_tenant3.svg\n│ │ ├── ico_tenant4.svg\n│ │ ├── ico_time_disabled.svg\n│ │ ├── ico_time.svg\n│ │ ├── ico_tit_arr.svg\n│ │ ├── ico_tool.svg\n│ │ ├── ico_trash_nw.svg\n│ │ ├── ico_tree_add.svg\n│ │ ├── ico_tree_arr.svg\n│ │ ├── ico_tree_save.svg\n│ │ ├── ico_tree1.svg\n│ │ ├── ico_tree2.svg\n│ │ ├── ico_tree3_core.svg\n│ │ ├── ico_tree3_ran.svg\n│ │ ├── ico_tree3.svg\n│ │ ├── ico_trend.svg\n│ │ ├── ico_view_del.svg\n│ │ ├── ico_view_list.svg\n│ │ ├── ico_view_list2.svg\n│ │ ├── ico_wifi.svg\n│ │ ├── ico-arrow-right.svg\n│ │ ├── ico-check-on.svg\n│ │ ├── img_mode_dark.svg\n│ │ ├── img_mode_white.svg\n│ │ ├── img_popup.svg\n│ │ ├── img_qr.svg\n│ │ ├── img_system.svg\n│ │ ├── inf_bg.png\n│ │ ├── is_disconnect.svg\n│ │ ├── logo_foot.svg\n│ │ ├── logo_foot2.svg\n│ │ ├── logo_login.svg\n│ │ ├── logo_new.svg\n│ │ ├── logo_sams_sds.svg\n│ │ ├── logo_sams.svg\n│ │ ├── mail_logo1.png\n│ │ ├── mail_logo2.png\n│ │ ├── map_kangwon.svg\n│ │ ├── pf_sample.svg\n│ │ ├── pin.png\n│ │ ├── rlt_bg.png\n│ │ ├── round.png\n│ │ └── ven_bg.png\n│ └── scss\n│ ├── default.scss\n│ ├── main.scss\n│ ├── mode-w-m.scss\n│ ├── roulette.scss\n│ ├── sample.scss\n│ └── style.scss\n├── components\n│ ├── cellRenderer\n│ │ ├── customActionTypeTextColor.vue\n│ │ ├── customBackUpBtn.vue\n│ │ ├── customBackUpBtnR.vue\n│ │ ├── customButtonSms.vue\n│ │ ├── customHeaderText.vue\n│ │ ├── customInhibitSelect.vue\n│ │ ├── customIpConnTextColor.vue\n│ │ ├── customIpNotConnTextColor.vue\n│ │ ├── customLicenseBtn.vue\n│ │ ├── customLogLevelSelect.vue\n│ │ ├── customNullValue.vue\n│ │ ├── customRadio.vue\n│ │ ├── customResultTextDivBg.vue\n│ │ ├── customSessionSetTextField.vue\n│ │ ├── customStatusBox.vue\n│ │ ├── customTextColor.vue\n│ │ ├── customTextDivSession.vue\n│ │ └── customUseYNTextColor.vue\n│ ├── common\n│ │ ├── confirmDialog.vue\n│ │ ├── customLoading.vue\n│ │ ├── excelUpload.vue\n│ │ ├── footer\n│ │ │ └── eventDetailView.vue\n│ │ ├── footer.vue\n│ │ ├── header\n│ │ │ └── modal\n│ │ │ ├── myInfoUpdate.vue\n│ │ │ ├── passwordCheck.vue\n│ │ │ └── privacyPop.vue\n│ │ ├── header.vue\n│ │ ├── leftMenu.vue\n│ │ ├── location.vue\n│ │ ├── pagination.vue\n│ │ ├── topologyPop.vue\n│ │ └── topologyPopMgmt.vue\n│ ├── home\n│ │ ├── dashboard\n│ │ │ ├── common\n│ │ │ │ ├── coreDetailModal.vue\n│ │ │ │ ├── map\n│ │ │ │ │ ├── mapBusan.vue\n│ │ │ │ │ ├── mapChungbuk.vue\n│ │ │ │ │ ├── mapChungnam.vue\n│ │ │ │ │ ├── mapDaegu.vue\n│ │ │ │ │ ├── mapDaejeon.vue\n│ │ │ │ │ ├── mapGwangju.vue\n│ │ │ │ │ ├── mapGyeongbuk.vue\n│ │ │ │ │ ├── mapGyeonggido.vue\n│ │ │ │ │ ├── mapGyeongnam.vue\n│ │ │ │ │ ├── mapIncheon.vue\n│ │ │ │ │ ├── mapJeju.vue\n│ │ │ │ │ ├── mapJeonbuk.vue\n│ │ │ │ │ ├── mapJeonnam.vue\n│ │ │ │ │ ├── mapKangwon.vue\n│ │ │ │ │ ├── mapSejong.vue\n│ │ │ │ │ ├── mapSeoul.vue\n│ │ │ │ │ └── mapUlsan.vue\n│ │ │ │ ├── pagination.vue\n│ │ │ │ ├── ranCardGroupDetailModal.vue\n│ │ │ │ ├── ranMapGroupDetailModal.vue\n│ │ │ │ └── ranMapNeDetailModal.vue\n│ │ │ ├── layout01\n│ │ │ │ ├── core\n│ │ │ │ │ ├── layout01Core.vue\n│ │ │ │ │ ├── layout01CoreWidgetM.vue\n│ │ │ │ │ └── layout01CoreWidgetS.vue\n│ │ │ │ ├── layout01.vue\n│ │ │ │ ├── ran\n│ │ │ │ │ └── layout01Ran.vue\n│ │ │ │ └── user\n│ │ │ │ ├── layout01User.vue\n│ │ │ │ ├── layout01UserWidgetM.vue\n│ │ │ │ ├── layout01UserWidgetS.vue\n│ │ │ │ └── layout01UserWidgetT.vue\n│ │ │ ├── layout02\n│ │ │ │ ├── core\n│ │ │ │ │ ├── layout02Core.vue\n│ │ │ │ │ ├── layout02CoreWidgetM.vue\n│ │ │ │ │ └── layout02CoreWidgetS.vue\n│ │ │ │ ├── layout02.vue\n│ │ │ │ ├── ran\n│ │ │ │ │ └── layout02Ran.vue\n│ │ │ │ └── user\n│ │ │ │ ├── layout02User.vue\n│ │ │ │ ├── layout02UserWidgetM.vue\n│ │ │ │ ├── layout02UserWidgetS.vue\n│ │ │ │ └── layout02UserWidgetT.vue\n│ │ │ ├── layout03\n│ │ │ │ ├── core\n│ │ │ │ │ ├── layout03Core.vue\n│ │ │ │ │ ├── layout03CoreWidgetM.vue\n│ │ │ │ │ └── layout03CoreWidgetS.vue\n│ │ │ │ ├── layout03.vue\n│ │ │ │ ├── ran\n│ │ │ │ │ ├── layout03Ran.vue\n│ │ │ │ │ └── ranMapComponent.vue\n│ │ │ │ └── user\n│ │ │ │ ├── layout03User.vue\n│ │ │ │ ├── layout03UserWidgetM.vue\n│ │ │ │ └── layout03UserWidgetS.vue\n│ │ │ ├── settingModal.vue\n│ │ │ └── test.json\n│ │ ├── jobNoti\n│ │ │ └── jobNotiModal.vue\n│ │ ├── tenant\n│ │ │ ├── chart\n│ │ │ │ ├── doughnut.vue\n│ │ │ │ ├── trendBar.vue\n│ │ │ │ └── userDoughnut.vue\n│ │ │ ├── common\n│ │ │ │ └── ranGroupDetailModal.vue\n│ │ │ ├── tenantRan.vue\n│ │ │ ├── tenantTrend.vue\n│ │ │ └── tenantUser.vue\n│ │ └── trend\n│ │ └── headerChart.vue\n│ ├── login\n│ │ └── privacyPop.vue\n│ ├── search\n│ │ └── searchModules.vue\n│ └── sunEdt.vue\n├── composables\n│ ├── useApi.js\n│ ├── useAxios.js\n│ ├── useChart.js\n│ ├── useEnumCode.js\n│ ├── useEnumCodeEn.js\n│ ├── useEnumCodeKr.js\n│ ├── useErrorHandler.js\n│ ├── useHangul.js\n│ ├── useMenuConstants.js\n│ ├── useSunEditor.js\n│ ├── useToastEditor.ts\n│ ├── useUrlHandler.js\n│ ├── useUtil.js\n│ ├── useValid.js\n│ └── useWatchFocusValidate.js\n├── error.vue\n├── lang\n│ ├── en.js\n│ └── kr.js\n├── layouts\n│ ├── default.vue\n│ ├── designdefault.vue\n│ ├── designloginlayout.vue\n│ ├── loginlayout.vue\n│ ├── roulette.vue\n│ └── samplelayout.vue\n├── middleware\n│ └── auth.global.js\n├── nuxt.config.ts\n├── package-lock.json\n├── package.json\n├── pages\n│ ├── auth\n│ │ ├── join.vue\n│ │ └── popupClose.vue\n│ ├── index.vue\n│ └── view\n│ ├── cs\n│ │ ├── financial.vue\n│ │ └── index.vue\n│ ├── deli\n│ │ ├── index.vue\n│ │ ├── mngAdd.vue\n│ │ └── mngListDeleted.vue\n│ ├── item\n│ │ ├── add.vue\n│ │ ├── evtListClosed.vue\n│ │ ├── evtListOngoing.vue\n│ │ ├── evtListPending.vue\n│ │ └── index.vue\n│ ├── log\n│ │ └── logList.vue\n│ ├── order\n│ │ └── index.vue\n│ ├── settle\n│ │ ├── curationAdd.vue\n│ │ ├── curationList.vue\n│ │ ├── index.vue\n│ │ ├── irAdd.vue\n│ │ ├── mediaAdd.vue\n│ │ ├── mediaList.vue\n│ │ ├── newsAdd.vue\n│ │ └── newsList.vue\n│ └── vendor\n│ ├── dashboard\n│ │ └── index.vue\n│ └── index.vue\n├── plugins\n│ ├── fontawesome.js\n│ ├── i18n.js\n│ ├── log.js\n│ ├── mitt.js\n│ ├── toast.js\n│ ├── userAgent.js\n│ ├── vue-cool-lightbox.js\n│ ├── vue3-editor.js\n│ └── vuetify.js\n├── public\n│ ├── favicon.ico\n│ ├── ft_logo.png\n│ ├── js\n│ │ └── jquery-3.7.1.min.js\n│ └── logo.png\n├── README.md\n├── server\n│ └── tsconfig.json\n├── stores\n│ ├── auth.js\n│ ├── detail.js\n│ ├── lang.js\n│ ├── loading.js\n│ └── tenantMgmt.js\n├── toast-editor.d.ts\n├── tsconfig.json\n└── vite-plugin-sri.d.ts\n```\n\n### Data Flow & Communication Patterns\n- **Client-Server 통신**: RESTful API, JWT 인증 헤더, Axios 인터셉터 \n- **Database 상호작용**: CI4 Query Builder/Model, 트랜잭션 관리, Redis 캐시 사용 \n- **외부 서비스 연동**: 비동기 메시지 큐 없이 HTTP 호출, 에러 리트라이 로직 \n- **실시간 통신**: Socket.IO 기반 WebSocket 연결, 주문·승인 알림 \n- **데이터 동기화**: 캐시 무효화 패턴, 이벤트 기반 상태 업데이트 \n\n## 4. Performance & Optimization Strategy\n- HTTP 응답 캐싱: Redis로 빈번 조회 데이터 캐싱 \n- DB 인덱싱 및 쿼리 튜닝: 주요 조회 쿼리 Explain 분석 \n- 코드 스플리팅·지연 로딩: Nuxt3 동적 import 활용 \n- 로드 밸런싱: Kubernetes HPA 기반 자동 스케일링 \n\n## 5. Implementation Roadmap & Milestones\n\n### Phase 1: Foundation (MVP Implementation)\n- Core Infrastructure: Docker/K8s 환경, CI/CD 파이프라인 \n- Essential Features: 로그인·회원가입, 상품 조회·발주, 주문 승인, 송장 엑셀 업로드 \n- Basic Security: JWT 인증, HTTPS, OAuth2 SNS 로그인 \n- Development Setup: 로컬 개발 환경, 코드 린팅·테스트 프레임워크 \n- Timeline: M+2\n\n### Phase 2: Feature Enhancement\n- Advanced Features: 정산 모듈, 파트너 매칭 시스템, 알림 센터 \n- Performance Optimization: 캐시 전략, DB 튜닝 \n- Enhanced Security: 권한 관리 강화, OWASP 점검 \n- Monitoring Implementation: ELK 대시보드, Grafana 알림 \n- Timeline: M+4\n\n### Phase 3: Scaling & Optimization\n- Scalability Implementation: HPA/Cluster Autoscaler, DB 리드 리플리카 \n- Advanced Integrations: ERP 연동, 다중 택배사 API 연결 \n- Enterprise Features: 서브계정 관리, 대시보드 \n- Compliance & Auditing: GDPR, 데이터 암호화 심화 \n- Timeline: M+6\n\n## 6. Risk Assessment & Mitigation Strategies\n\n### Technical Risk Analysis\n- **기술 리스크**: OCR 인식률 저하 → 수동 검증 UI 제공 \n- **성능 리스크**: 동시 사용자 증가 시 DB 병목 → 읽기/쓰기 분리, 캐시 활용 \n- **보안 리스크**: 토큰 탈취 → 짧은 만료, 리프레시 토큰 설계 \n- **통합 리스크**: 외부 API 변경 → 버전 관리, 어댑터 패턴 적용 \n- **Mitigation**: 대체 흐름, 로깅·모니터링 알림, 자동 테스트\n\n### Project Delivery Risks\n- **일정 리스크**: 기능 지연 → MVP 단계별 우선순위 조정 \n- **자원 리스크**: 전문 인력 부족 → 외부 컨설팅·아웃소싱 검토 \n- **품질 리스크**: 테스트 커버리지 부족 → CI/CD 자동화 테스트 강화 \n- **배포 리스크**: 프로덕션 오류 → 블루/그린 배포 전략 채택 \n- **Contingency**: 페이즈별 핵심 기능 최소화, 백업 환경 준비 \n\n--- \n*본 문서는 PRD 기반 최소 기능 중심으로 설계되었으며, 차후 요구사항 변화에 따라 단계별 확장이 가능합니다.*", "writedAt": "2025-07-25T01:49:47.278Z" }, { "type": "guideline", "content": "# Code Guidelines for Influencer–Vendor Automation Platform\n\n## 1. Project Overview \nA unified web platform to automate ordering, shipping, settlement, and notifications between influencers and vendors. \nKey architectural decisions: \n- Frontend: Vue 3 + Nuxt 3 (SSR/SSG), Composition API, TypeScript, Pinia, Vuetify, Axios \n- BFF: Node.js + Express (ES Modules), Socket.IO for real-time \n- Backend API: CodeIgniter 4 RESTful controllers, MySQL (RDS), Redis cache \n- Deployment: Docker → Kubernetes, CI/CD via GitHub Actions \n- Integrations: Google Cloud Vision OCR, Courier & ERP REST APIs, JWT/OAuth2 authentication \n\n---\n\n## 2. Core Principles \n1. Single Responsibility: each function/module addresses one concern; max 200 lines. \n2. Strong Typing: avoid `any`; define interfaces for props, DTOs, API responses. \n3. Consistent Error Handling: centralize and standardize error responses and logs. \n4. DRY & Reusable: extract shared logic into composables, services, or utilities. \n5. Domain-Driven Modules: group files by business domain (order, shipping, finance). \n\n---\n\n## 3. Language-Specific Guidelines \n\n### 3.1 Vue 3 + Nuxt 3 + TypeScript \n- File Organization: \n - `/pages` → route pages \n - `/components/{domain}` → feature components \n - `/composables` → reusable logic hooks (prefixed `useXxx`) \n - `/stores/{domain}` → Pinia modules (one per domain) \n - `/plugins`, `/middleware`, `/assets`, `/layouts` \n- Imports & Aliases: \n - Use Nuxt aliases: `import X from '~/components/order/OrderList.vue'` \n - Group imports: external packages → aliased aliases → relative (sorted alphabetically) \n- Error Handling: \n - Global error plugin `~/plugins/error.ts` to catch and display Axios errors \n - In composable: \n ```ts\n export async function useFetchOrders() {\n try {\n const { data } = await $axios.get('/api/orders')\n return data\n } catch (error: unknown) {\n throw new ApiError(error)\n }\n }\n ``` \n\n### 3.2 Node.js + Express (BFF) \n- Folder Structure: \n ```\n /src\n /controllers\n /services\n /routes\n /middlewares\n /utils\n app.js\n ```\n- Dependency Management: \n - Use ES Modules (`\"type\": \"module\"`) or TypeScript. \n - Version-lock in `package.json`; run `npm audit` in CI. \n- Error Handling: \n - Create `HttpError` class in `/utils/HttpError.js` \n - Middleware `errorHandler.js` at the end: \n ```js\n app.use((err, req, res, next) => {\n logger.error(err)\n res.status(err.statusCode || 500).json({\n success: false,\n message: err.message || 'Internal Server Error'\n })\n })\n ``` \n\n### 3.3 CodeIgniter 4 (REST API) \n- Controllers: one per resource, extend `ResourceController` \n- Models: use Entities and Query Builder; keep business logic in Services \n- Validation & Responses: \n ```php\n public function create()\n {\n $rules = ['order_id' => 'required|integer', /* ... */];\n if (! $this->validate($rules)) {\n return $this->fail($this->validator->getErrors());\n }\n $entity = new OrderEntity($this->request->getPost());\n $this->orderService->save($entity);\n return $this->respondCreated($entity);\n }\n ```\n- Error Handling: use `HTTPException` for 404/403, global logging in `app/Filters`. \n\n---\n\n## 4. Code Style Rules \n\n### 4.1 MUST Follow \n- **Use Strict Typescript** \n Rationale: catch errors at compile time. \n ```jsonc\n // tsconfig.json\n {\n \"compilerOptions\": {\n \"strict\": true,\n \"noImplicitAny\": true,\n \"forceConsistentCasingInFileNames\": true\n }\n }\n ``` \n- **One Component per File** \n Rationale: clarity, reusability, smaller diffs. \n- **Composition API & `\n ``` \n- **Pinia Stores for State** \n Rationale: predictable global state with actions, getters. \n ```ts\n import { defineStore } from 'pinia'\n export const useOrderStore = defineStore('order', {\n state: () => ({ list: [] as Order[] }),\n actions: {\n async fetch() { this.list = await fetchOrders() }\n }\n })\n ``` \n- **RESTful API Design** \n Rationale: consistency and predictability. \n - Use resource paths: `/vendors/{id}/orders` \n - HTTP verbs: GET/POST/PUT/DELETE \n - Standard response envelope: \n ```json\n { \"success\": true, \"data\": {...}, \"error\": null }\n ``` \n- **Centralized Error Handler** \n Rationale: unified logging and client messages. \n\n### 4.2 MUST NOT Do \n- **Avoid `any` or disabling lint rules** \n Rationale: loses type-safety. \n- **No Large “God” Modules** \n Rationale: hard to test and maintain. \n- **No Inline Styles or Scripts** \n Rationale: separates concerns; use Vuetify theme or SCSS. \n- **No Nested Callbacks (Callback Hell)** \n Rationale: use async/await or Promises. \n- **No Direct DOM Manipulation** \n Rationale: Vue manages DOM; use refs or directives. \n\n---\n\n## 5. Architecture Patterns \n\n### 5.1 Component & Module Structure \n- Domain-Driven Folders: \n ```\n /components/order\n /components/shipping\n /composables/order\n /stores/order\n /services/api/order.ts\n ``` \n- Layers in BFF: \n - **Routes** → **Controllers** → **Services** → **Data Access** \n\n### 5.2 Data Flow \n- **Frontend**: Props ↓, Events ↑, Store (Pinia) for shared state, Composables for side-effects. \n- **API Calls**: Axios interceptors attach JWT, handle 401 globally, retry logic for idempotent GETs. \n- **Real-time**: Socket.IO client in plugin; update Pinia store on events. \n\n### 5.3 State Management \n- Local state in component for UI-only values (`ref`, `reactive`). \n- Global state in Pinia: one store per domain; expose typed actions/getters. \n- Keep store actions async, commit minimal state changes. \n\n### 5.4 API Design Standards \n- Base URL per domain: `/api/v1/orders`, `/api/v1/vendors` \n- Pagination: standard query `?page=1&limit=20`, return `{ items, total, page, limit }`. \n- Filtering & Sorting: query params `?status=shipped&sort=-date`. \n- Consistent Error Payload: \n ```json\n {\n \"success\": false,\n \"error\": {\n \"code\": \"VALIDATION_FAILED\",\n \"message\": \"Invalid field: quantity\"\n }\n }\n ``` \n\n---\n\n## 6. Example Code Snippets \n\n### 6.1 Vue Composition & API Call \n```ts\n// MUST: composable with typed response and error handling\nimport { ref } from 'vue'\nimport { Order } from '~/types'\nimport { useApi } from '~/composables/useApi'\n\nexport function useOrders() {\n const list = ref([])\n const error = ref(null)\n async function fetchOrders() {\n try {\n const res = await useApi().get('/orders')\n list.value = res.data\n } catch (e) {\n error.value = e.message\n }\n }\n return { list, error, fetchOrders }\n}\n```\n\n```ts\n// MUST NOT: direct Axios calls in component, untyped any\nsetup() {\n axios.get('/orders').then(res => {\n this.orders = res.data\n })\n}\n```\n\n### 6.2 Node.js Express Route & Error \n```js\n// MUST: clean controller and error propagation\n// src/routes/order.js\nimport { Router } from 'express'\nimport { listOrders } from '../controllers/order.js'\nconst router = Router()\nrouter.get('/', listOrders)\nexport default router\n\n// src/controllers/order.js\nexport async function listOrders(req, res, next) {\n try {\n const orders = await OrderService.fetchAll()\n res.json({ success: true, data: orders })\n } catch (err) {\n next(new HttpError(500, 'Failed to fetch orders'))\n }\n}\n```\n\n```js\n// MUST NOT: catch without forwarding or unstructured response\napp.get('/orders', async (req, res) => {\n try {\n const orders = await OrderService.fetchAll()\n res.send(orders)\n } catch (err) {\n res.status(500).send('Error')\n }\n})\n```\n\n### 6.3 CodeIgniter4 Controller \n```php\n// MUST: validate, use entity, consistent response\nclass OrderController extends ResourceController\n{\n public function create()\n {\n $rules = ['vendor_id'=>'required|integer', 'items'=>'required|array'];\n if (! $this->validate($rules)) {\n return $this->failValidationErrors($this->validator->getErrors());\n }\n $order = new OrderEntity($this->request->getPost());\n $this->orderService->create($order);\n return $this->respondCreated(['order' => $order]);\n }\n}\n```\n\n```php\n// MUST NOT: raw SQL in controller, no validation\nclass OrderController extends BaseController\n{\n public function create()\n {\n $db->query(\"INSERT INTO orders ...\"); // anti-pattern\n }\n}\n```\n\n---\n\nEnd of Guidelines. \nFollow these rules as the single source of truth for code quality, maintainability, and consistency.", "writedAt": "2025-07-25T01:49:47.278Z" }, { "type": "step-by-step", "content": "\n## Core Directive\nYou are a senior software engineer AI assistant. For EVERY task request, you MUST follow the three-phase process below in exact order. Each phase must be completed with expert-level precision and detail.\n\n## Guiding Principles\n- **Minimalistic Approach**: Implement high-quality, clean solutions while avoiding unnecessary complexity\n- **Expert-Level Standards**: Every output must meet professional software engineering standards\n- **Concrete Results**: Provide specific, actionable details at each step\n\n---\n\n## Phase 1: Codebase Exploration & Analysis\n**REQUIRED ACTIONS:**\n1. **Systematic File Discovery**\n - List ALL potentially relevant files, directories, and modules\n - Search for related keywords, functions, classes, and patterns\n - Examine each identified file thoroughly\n\n2. **Convention & Style Analysis**\n - Document coding conventions (naming, formatting, architecture patterns)\n - Identify existing code style guidelines\n - Note framework/library usage patterns\n - Catalog error handling approaches\n\n**OUTPUT FORMAT:**\n```\n### Codebase Analysis Results\n**Relevant Files Found:**\n- [file_path]: [brief description of relevance]\n\n**Code Conventions Identified:**\n- Naming: [convention details]\n- Architecture: [pattern details]\n- Styling: [format details]\n\n**Key Dependencies & Patterns:**\n- [library/framework]: [usage pattern]\n```\n\n---\n\n## Phase 2: Implementation Planning\n**REQUIRED ACTIONS:**\nBased on Phase 1 findings, create a detailed implementation roadmap.\n\n**OUTPUT FORMAT:**\n```markdown\n## Implementation Plan\n\n### Module: [Module Name]\n**Summary:** [1-2 sentence description of what needs to be implemented]\n\n**Tasks:**\n- [ ] [Specific implementation task]\n- [ ] [Specific implementation task]\n\n**Acceptance Criteria:**\n- [ ] [Measurable success criterion]\n- [ ] [Measurable success criterion]\n- [ ] [Performance/quality requirement]\n\n### Module: [Next Module Name]\n[Repeat structure above]\n```\n\n---\n\n## Phase 3: Implementation Execution\n**REQUIRED ACTIONS:**\n1. Implement each module following the plan from Phase 2\n2. Verify ALL acceptance criteria are met before proceeding\n3. Ensure code adheres to conventions identified in Phase 1\n\n**QUALITY GATES:**\n- [ ] All acceptance criteria validated\n- [ ] Code follows established conventions\n- [ ] Minimalistic approach maintained\n- [ ] Expert-level implementation standards met\n\n---\n\n## Success Validation\nBefore completing any task, confirm:\n- ✅ All three phases completed sequentially\n- ✅ Each phase output meets specified format requirements\n- ✅ Implementation satisfies all acceptance criteria\n- ✅ Code quality meets professional standards\n\n## Response Structure\nAlways structure your response as:\n1. **Phase 1 Results**: [Codebase analysis findings]\n2. **Phase 2 Plan**: [Implementation roadmap] \n3. **Phase 3 Implementation**: [Actual code with validation]\n", "writedAt": "2025-07-25T01:49:47.278Z" }, { "type": "tdd", "content": "\n# TDD Process Guidelines - Cursor Rules\n\n## ⚠️ MANDATORY: Follow these rules for EVERY implementation and modification\n\n**This document defines the REQUIRED process for all code changes. No exceptions without explicit team approval.**\n\n## Core Cycle: Red → Green → Refactor\n\n### 1. RED Phase\n- Write a failing test FIRST\n- Test the simplest scenario\n- Verify test fails for the right reason\n- One test at a time\n\n### 2. GREEN Phase \n- Write MINIMAL code to pass\n- \"Fake it till you make it\" is OK\n\n- YAGNI principle\n\n### 3. REFACTOR Phase\n- Remove duplication\n- Improve naming\n- Simplify structure\n- Keep tests passing\n\n## Test Quality: FIRST Principles\n- **Fast**: Milliseconds, not seconds\n- **Independent**: No shared state\n- **Repeatable**: Same result every time\n- **Self-validating**: Pass/fail, no manual checks\n- **Timely**: Written just before code\n\n## Test Structure: AAA Pattern\n```\n// Arrange\nSet up test data and dependencies\n\n// Act\nExecute the function/method\n\n// Assert\nVerify expected outcome\n```\n\n## Implementation Flow\n1. **List scenarios** before coding\n2. **Pick one scenario** → Write test\n3. **Run test** → See it fail (Red)\n4. **Implement** → Make it pass (Green)\n5. **Refactor** → Clean up (Still Green)\n6. **Commit** → Small, frequent commits\n7. **Repeat** → Next scenario\n\n## Test Pyramid Strategy\n- **Unit Tests** (70%): Fast, isolated, numerous\n- **Integration Tests** (20%): Module boundaries\n- **Acceptance Tests** (10%): User scenarios\n\n## Outside-In vs Inside-Out\n- **Outside-In**: Start with user-facing test → Mock internals → Implement details\n- **Inside-Out**: Start with core logic → Build outward → Integrate components\n\n## Common Anti-patterns to Avoid\n- Testing implementation details\n- Fragile tests tied to internals \n- Missing assertions\n- Slow, environment-dependent tests\n- Ignored failing tests\n\n## When Tests Fail\n1. **Identify**: Regression, flaky test, or spec change?\n2. **Isolate**: Narrow down the cause\n3. **Fix**: Code bug or test bug\n4. **Learn**: Add missing test cases\n\n## Team Practices\n- CI/CD integration mandatory\n- No merge without tests\n- Test code = Production code quality\n- Pair programming for complex tests\n- Regular test refactoring\n\n## Pragmatic Exceptions\n- UI/Graphics: Manual + snapshot tests\n- Performance: Benchmark suites\n- Exploratory: Spike then test\n- Legacy: Test on change\n\n## Remember\n- Tests are living documentation\n- Test behavior, not implementation\n- Small steps, fast feedback\n- When in doubt, write a test\n", "writedAt": "2025-07-25T01:49:47.278Z" }, { "type": "clean-code", "content": "\n# Clean Code Guidelines\n\nYou are an expert software engineer focused on writing clean, maintainable code. Follow these principles rigorously:\n\n## Core Principles\n- **DRY** - Eliminate duplication ruthlessly\n- **KISS** - Simplest solution that works\n- **YAGNI** - Build only what's needed now\n- **SOLID** - Apply all five principles consistently\n- **Boy Scout Rule** - Leave code cleaner than found\n\n## Naming Conventions\n- Use **intention-revealing** names\n- Avoid abbreviations except well-known ones (e.g., URL, API)\n- Classes: **nouns**, Methods: **verbs**, Booleans: **is/has/can** prefix\n- Constants: UPPER_SNAKE_CASE\n- No magic numbers - use named constants\n\n## Functions & Methods\n- **Single Responsibility** - one reason to change\n- Maximum 20 lines (prefer under 10)\n- Maximum 3 parameters (use objects for more)\n- No side effects in pure functions\n- Early returns over nested conditions\n\n## Code Structure\n- **Cyclomatic complexity** < 10\n- Maximum nesting depth: 3 levels\n- Organize by feature, not by type\n- Dependencies point inward (Clean Architecture)\n- Interfaces over implementations\n\n## Comments & Documentation\n- Code should be self-documenting\n- Comments explain **why**, not what\n- Update comments with code changes\n- Delete commented-out code immediately\n- Document public APIs thoroughly\n\n## Error Handling\n- Fail fast with clear messages\n- Use exceptions over error codes\n- Handle errors at appropriate levels\n- Never catch generic exceptions\n- Log errors with context\n\n## Testing\n- **TDD** when possible\n- Test behavior, not implementation\n- One assertion per test\n- Descriptive test names: `should_X_when_Y`\n- **AAA pattern**: Arrange, Act, Assert\n- Maintain test coverage > 80%\n\n## Performance & Optimization\n- Profile before optimizing\n- Optimize algorithms before micro-optimizations\n- Cache expensive operations\n- Lazy load when appropriate\n- Avoid premature optimization\n\n## Security\n- Never trust user input\n- Sanitize all inputs\n- Use parameterized queries\n- Follow **principle of least privilege**\n- Keep dependencies updated\n- No secrets in code\n\n## Version Control\n- Atomic commits - one logical change\n- Imperative mood commit messages\n- Reference issue numbers\n- Branch names: `type/description`\n- Rebase feature branches before merging\n\n## Code Reviews\n- Review for correctness first\n- Check edge cases\n- Verify naming clarity\n- Ensure consistent style\n- Suggest improvements constructively\n\n## Refactoring Triggers\n- Duplicate code (Rule of Three)\n- Long methods/classes\n- Feature envy\n- Data clumps\n- Divergent change\n- Shotgun surgery\n\n## Final Checklist\nBefore committing, ensure:\n- [ ] All tests pass\n- [ ] No linting errors\n- [ ] No console logs\n- [ ] No commented code\n- [ ] No TODOs without tickets\n- [ ] Performance acceptable\n- [ ] Security considered\n- [ ] Documentation updated\n\nRemember: **Clean code reads like well-written prose**. Optimize for readability and maintainability over cleverness.\n", "writedAt": "2025-07-25T01:49:47.278Z" } ] }