cohesion
Use when 한 기능 수정 시 여러 디렉토리를 건드리거나, 같은 숫자/상수가 여러 파일에 흩어져 있거나, import 경로가 `../../..`처럼 길어질 때
- License 许可
- MIT
- 最近更新
- 2026-03-27
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- cohesion
- description
- Use when 한 기능 수정 시 여러 디렉토리를 건드리거나, 같은 숫자/상수가 여러 파일에 흩어져 있거나, import 경로가 `../../..`처럼 길어질 때
03 SKILL.md 正文
응집도
함께 수정되는 코드는 함께 있어야 한다.
핵심 패턴
함께 수정되는 파일을 같은 디렉토리에 두기
❌ 종류별 분리 (의존 관계 파악 어려움):
src/
├── components/UserForm.tsx
├── hooks/useUserValidation.ts
├── types/userTypes.ts
└── api/userApi.ts
✅ 도메인별 배치:
src/
├── components/ # 전역 공유
└── domains/User/ # User 관련 코드 모음
├── UserForm.tsx
├── useUserValidation.ts
├── types.ts
└── api.ts
매직 넘버 제거
같은 숫자가 여러 곳에 있으면 한쪽만 수정되어 버그 발생.
❌ 분산:
// Pagination.tsx
const pages = Math.ceil(total / 20);
// useItems.ts
const offset = (page - 1) * 20;
✅ 상수로 통합:
export const PAGE_SIZE = 20;
import { PAGE_SIZE } from './constants';
빠른 참조
| 코드 냄새 | 개선 방법 |
|---|---|
| 같은 매직 넘버 3곳 이상 | 공유 상수로 추출 |
기능이 components/, hooks/, types/ 모두 수정 |
domains/featureName/으로 배치 |
긴 상대 경로 ../../.. |
파일들을 가까이 배치 |
| 타입 정의가 사용처와 멀리 떨어짐 | 사용하는 코드와 함께 배치 |
예외: 중복이 나은 경우
- 두 기능이 다르게 발전할 가능성이 높을 때
- 공유 시 원치 않는 의존성이 생길 때
- 공유 코드가 5줄 미만으로 단순할 때
참고: https://frontend-fundamentals.com/code-quality/cohesive/
04 同仓库更多 Skills
zustand
Zustand state management guide. Use when working with store code (src/store/**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.
web-vitals
暂无简介
vercel-storage
Vercel storage expert guidance — Blob, Edge Config, and Marketplace storage (Neon Postgres, Upstash Redis). Use when choosing, configuring, or using data storage with Vercel applications.
vercel-functions
Vercel Functions expert guidance — Serverless Functions, Edge Functions, Fluid Compute, streaming, Cron Jobs, and runtime configuration. Use when configuring, debugging, or optimizing server-side code running on Vercel.
ui-ux-pro-max
UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn/ui MCP for component search and examples.
turborepo
Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.