enhance-typescript-ui-components
하는 일
이 스킬은 썸네일, 배지, 데이터 기반 색상 같은 시각 기능을 TypeScript 컴포넌트에 추가하도록 AI 에이전트를 안내합니다. 목록 항목과 카드가 더 많은 정보를 보여 주기를 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓기존 목록 항목이나 카드에 배지나 라벨을 추가하고 싶을 때.
- ✓이미지가 없을 때 자리표시자를 보여 주는 썸네일이 필요할 때.
- ✓데이터에 따라 색상이나 스타일이 바뀌어야 할 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/enhance-typescript-ui-components/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“뉴스 목록의 각 항목에 색이 있는 분류 배지와 썸네일을 추가해 주세요. 이미지가 없으면 자리표시자를 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 TypeScript 파일 맨 위에 색 매핑과 크기 상수를 추가한 다음, 동적 색상과 변환을 위한 도우미 메서드를 씁니다. 그 뒤 새 시각 요소가 올바르게 보이도록 CSS를 업데이트합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Enhance TypeScript UI Components
A systematic workflow for adding visual enhancements to TypeScript UI components, including thumbnails, color-coded badges, and dynamic styling. This pattern applies to component files that render data items (lists, panels, cards, etc.).
When to Use This Skill
- Adding visual indicators (badges, labels, icons) to existing components
- Implementing thumbnail images with fallback placeholders
- Applying dynamic, data-driven colors or styles
- Coordinating TypeScript component logic with CSS styling
Workflow Steps
1. Add Constants at File Top
Define color mappings, size constants, and configuration data near the top of the TypeScript file, after imports but before the class definition.
// Color mappings for categories/sources
const SOURCE_COLORS: { [key: string]: string } = {
'Category A': '#FF6B6B',
'Category B': '#4ECDC4',
'Category C': '#45B7D1',
'default': '#95A5A6'
};
// Size constants
const THUMBNAIL_SIZE = 48; // pixels
const BADGE_HEIGHT = 20;
Why: Centralizes configuration for easy maintenance and avoids magic values scattered throughout code.
2. Implement Helper Methods
Create private helper methods for dynamic style calculations and data transformations. Place these before the main render method.
private getColorForItem(item: DataItem): string {
return SOURCE_COLORS[item.category] || SOURCE_COLORS['default'];
}
private sortItemsByDate(items: DataItem[]): DataItem[] {
return [...items].sort((a, b) =>
new Date(b.date).getTime() - new Date(a.date).getTime()
);
}
private getThumbnailUrl(item: DataItem): string {
return item.imageUrl || `https://via.placeholder.com/${THUMBNAIL_SIZE}`;
}
Why: Separates logic from presentation, makes code testable, and improves readability.
3. Sort Data Before Rendering
If displaying lists, apply sorting transformations before building HTML.
public render(): void {
const sortedItems = this.sortItemsByDate(this.items);
const html = sortedItems.map(item => this.renderItem(item)).join('');
this.container.innerHTML = html;
}
Why: Ensures consistent presentation order and separates data transformation from rendering.
4. Build HTML with Template Literals
Use template literals for HTML construction with conditional rendering for optional fields.
private renderItem(item: DataItem): string {
const itemColor = this.getColorForItem(item);
const thumbnailUrl = this.getThumbnailUrl(item);
return `
<div class="item-card">
${item.imageUrl ? `
<img
src="${thumbnailUrl}"
alt="${item.title}"
class="item-thumbnail"
/>
` : `
<div class="item-thumbnail-placeholder"></div>
`}
<div class="item-content">
<h3>${item.title}</h3>
${item.category ? `
<span
class="item-badge"
style="background-color: ${itemColor};"
>
${item.category}
</span>
` : ''}
<p>${item.description}</p>
</div>
</div>
`;
}
Why: Enables conditional rendering and keeps HTML structure clear. Dynamic values can be safely interpolated.
5. Apply Inline Styles for Dynamic Values Only
Use inline style attributes only for data-driven dynamic values (colors, sizes from data). Keep structural/layout styles in CSS.
// ✅ Good - dynamic color from data
style="background-color: ${this.getColorForItem(item)};"
// ❌ Bad - structural styling should be in CSS
style="display: flex; padding: 10px; background-color: ${color};"
// ✅ Better - split concerns
class="item-badge" style="background-color: ${color};"
Why: Maintains separation of concerns—data-driven values in TS, structural styles in CSS.
6. Create or Update Corresponding CSS
For each new HTML element or class added in TypeScript, add corresponding CSS rules. Focus on:
- Layout and positioning
- Static colors and backgrounds
- Sizing (when not dynamic)
- Spacing (margin, padding)
- Typography
/* Component container */
.item-card {
display: flex;
gap: 12px;
padding: 16px;
border-bottom: 1px solid #eee;
}
/* Thumbnail styles */
.item-thumbnail {
width: 48px;
height: 48px;
border-radius: 6px;
object-fit: cover;
flex-shrink: 0;
}
.item-thumbnail-placeholder {
width: 48px;
height: 48px;
border-radius: 6px;
background-color: #e0e0
자주 묻는 질문
색상 설정은 어디에 두나요?
쉽게 바꿀 수 있도록 색상 매핑과 크기 상수를 파일 위쪽에 둔다고 스킬은 설명합니다.
이미지가 없으면 어떻게 되나요?
스킬은 썸네일을 위한 대체 자리표시자를 포함합니다.
CSS도 업데이트하나요?
네, 스킬은 TypeScript 변경과 맞는 CSS 업데이트를 함께 조율합니다.
상세 정보
작성자의 원본 설명
Add visual features (thumbnails, badges, dynamic styling) to TypeScript components by coordinating TypeScript logic changes with CSS updates
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #13053
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
angular-developer
280k에이전트가 Angular 코드를 만들고 프로젝트 구조를 조언하도록 돕습니다. 새 프로젝트 시작, 코드 부분 생성, 성능과 접근성 개선에 유용합니다.
frontend-a11y
280k모든 사람이 웹 인터페이스를 쓸 수 있도록 에이전트를 돕습니다. 웹사이트와 앱이 화면 읽기 프로그램과 키보드 탐색에서 잘 작동하도록 합니다.
frontend-patterns
280k프론트엔드 개발의 현대적인 패턴을 적용하도록 에이전트를 돕습니다. React와 Next.js에서 성능을 최적화하고, 상태를 관리하며, 모범 사례를 따릅니다.