enhance-typescript-ui-components
यह क्या करती है
यह स्किल AI एजेंट को TypeScript कंपोनेंट में थंबनेल, बैज और डेटा के अनुसार रंग जैसे दृश्य फ़ीचर जोड़ने का मार्गदर्शन देती है। यह उन डेवलपर्स के लिए है जो सूची आइटम और कार्ड को अधिक जानकारीपूर्ण दिखाना चाहते हैं।
कब इस्तेमाल करें
- ✓जब आप मौजूदा सूची आइटम या कार्ड में बैज या लेबल जोड़ना चाहते हों।
- ✓जब आइटम में थंबनेल चाहिए और इमेज न होने पर प्लेसहोल्डर दिखे।
- ✓जब रंग या स्टाइल डेटा के आधार पर बदलने चाहिए।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/enhance-typescript-ui-components/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी न्यूज़ सूची के हर आइटम में रंगीन श्रेणी बैज और थंबनेल जोड़िए। इमेज न हो तो प्लेसहोल्डर दिखाइए।”
हर हफ़्ते 5 नई skills, 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
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।