Context Is Everything
The most powerful thing you can give Claude Code isn’t a perfect prompt — it’s the right context. When Claude Code can see your existing code, it produces results that fit seamlessly.
The @file pattern
In Claude Code, prefix a filename with @ to include it in context:
@style.css 에 정의된 CSS 변수를 사용해서 카드 컴포넌트를 만들어줘.
배경은 --bg-2, 텍스트는 --text, 테두리는 --border 사용.
Claude Code reads style.css, sees your design tokens, and generates code that uses them — not hardcoded values that break your theme.
Design system as context
If you have a design system (even a small one), share it upfront:
다음 디자인 시스템 토큰을 사용해:
--color-primary: #2563eb
--space-4: 16px
--radius-md: 8px
--font-sans: 'Inter', sans-serif
이 토큰으로 pricing card 컴포넌트를 만들어줘.
Every component generated in that session will stay on-system automatically.
Existing code as context
When modifying something, always share what you have:
@components/nav.html 이 파일을 보고,
스크롤 시 배경이 흰색으로 바뀌는 효과를 추가해줘.
backdrop-filter: blur(12px) 도 적용하고.
기존 CSS는 건드리지 마, 새 클래스만 추가해.
The instruction “기존 CSS는 건드리지 마” is a constraint. Without it, the AI might refactor your entire stylesheet.
Demo walkthrough
The demo shows two versions of the same card component:
- Without context — hardcoded values, standalone
- With context — uses CSS custom properties, adapts to light/dark mode
Toggle the dark mode switch to see how the context-aware version adapts automatically.
Claude Code에게 줄 수 있는 가장 강력한 것은 완벽한 프롬프트가 아닙니다 — 올바른 컨텍스트입니다. Claude Code가 기존 코드를 볼 수 있을 때 자연스럽게 맞는 결과물을 만듭니다.
@file 패턴
Claude Code에서 파일명 앞에 @를 붙이면 컨텍스트에 포함됩니다:
@style.css 에 정의된 CSS 변수를 사용해서 카드 컴포넌트를 만들어줘.
배경은 --bg-2, 텍스트는 --text, 테두리는 --border 사용.
Claude Code가 style.css를 읽고 디자인 토큰을 파악하여, 테마를 깨는 하드코딩 값이 아닌 토큰을 사용한 코드를 생성합니다.
디자인 시스템을 컨텍스트로
디자인 시스템이 있다면 처음부터 공유하세요:
다음 디자인 시스템 토큰을 사용해:
--color-primary: #2563eb
--space-4: 16px
--radius-md: 8px
--font-sans: 'Inter', sans-serif
이 토큰으로 pricing card 컴포넌트를 만들어줘.
그 세션에서 생성되는 모든 컴포넌트가 자동으로 시스템을 따릅니다.
기존 코드를 컨텍스트로
무언가를 수정할 때는 항상 가진 것을 공유하세요:
@components/nav.html 이 파일을 보고,
스크롤 시 배경이 흰색으로 바뀌는 효과를 추가해줘.
backdrop-filter: blur(12px) 도 적용하고.
기존 CSS는 건드리지 마, 새 클래스만 추가해.
*"기존 CSS는 건드리지 마"*는 제약입니다. 없으면 AI가 전체 스타일시트를 리팩토링할 수 있습니다.
데모 안내
데모는 동일한 카드 컴포넌트의 두 버전을 보여줍니다:
- 컨텍스트 없음 — 하드코딩 값, 독립 실행
- 컨텍스트 있음 — CSS 커스텀 프로퍼티 사용, 라이트/다크 모드 적응
다크 모드 스위치를 토글해 컨텍스트 인식 버전이 자동으로 적응하는 것을 확인하세요.