मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)7.8k · #13044

css-append-selector-verify

यह क्या करती है

यह स्किल AI एजेंट को मौजूदा नियम बदले बिना CSS स्टाइल एक फ़ाइल से दूसरी में कॉपी करने का तरीका बताती है। यह उन डेवलपर्स के लिए है जो प्रोजेक्ट के बीच स्टाइल ले जाते हैं या स्टाइलशीट में नियम जोड़ते हैं।

कब इस्तेमाल करें

  • ✓जब आप एक प्रोजेक्ट से दूसरे प्रोजेक्ट में कंपोनेंट स्टाइल ले जा रहे हों।
  • ✓जब आपको मौजूदा नियमों को दोहराए या तोड़े बिना नए CSS नियम जोड़ने हों।
  • ✓जब स्टाइल को अलग CSS वेरिएबल के सेट के अनुसार ढालना हो।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/css-append-selector-verify/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/css-append-selector-verify/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“पुरानी स्टाइलशीट से पैनल टैब की स्टाइल मेरी स्टाइलशीट में कॉपी कीजिए, मेरे मौजूदा नियमों को न छेड़िए, और जाँचिए कि हर सिलेक्टर पहुंच गया है।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट स्रोत और गंतव्य CSS पढ़ता है, मौजूदा नियम और वेरिएबल नोट करता है, फिर नए नियम जोड़ता है। हर जोड़ के बाद वह हर सिलेक्टर को नाम से खोजकर पुष्टि करता है, ताकि कटा हुआ नियम पकड़ में आए।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Safe CSS Append Workflow (with Per-Selector Verification)

This skill provides a systematic approach for safely appending CSS styles from a source file to a destination file. The workflow ensures no content is overwritten, CSS variables are properly adapted, and every appended selector is individually confirmed present — so silent heredoc truncation of long lines is caught immediately rather than being masked by a passing line-count check.

When to Use This Skill

  • Migrating styles between projects
  • Copying component styles while preserving existing rules
  • Adding new CSS rules without duplicating or conflicting with existing styles
  • Adapting styles to use a different set of CSS variables

Workflow Steps

1. Read and Analyze Source CSS

First, examine the source CSS file to identify the selectors and rules you want to transfer:

# Read the source CSS file
cat /path/to/source/styles.css

# Identify specific selectors if needed
grep "selector-pattern" /path/to/source/styles.css

Document:

  • Target selectors (e.g., .panel-tab, .header-nav)
  • CSS variables used (e.g., --primary-color, --spacing-unit)
  • Complete rule sets for each selector

2. Read and Check Destination CSS

Examine the destination file to understand existing rules and avoid duplication:

# Read the destination CSS file
cat /path/to/destination/styles.css

# Check if specific selectors already exist
grep "selector-name" /path/to/destination/styles.css

# Check for existing CSS variables
grep "^[[:space:]]*--" /path/to/destination/styles.css | head -20

Identify:

  • Existing selectors that might conflict
  • CSS variable naming conventions in the destination
  • Any existing rules for the target selectors

3. Identify Missing Styles and Required Adaptations

Compare source and destination to determine:

  • Which selectors are completely missing
  • Which properties are missing from existing selectors
  • How CSS variables need to be mapped (source → destination)

Example variable mapping:

Source: --panel-bg → Destination: --background-secondary
Source: --text-primary → Destination: --color-text-primary
Source: --border-radius → Keep as-is (if already defined in destination)

4. Prepare Adapted CSS Content

Create the CSS content to append, adapting variables as needed:

/* Example adapted CSS */
.new-selector {
    background-color: var(--background-secondary);  /* was --panel-bg */
    color: var(--color-text-primary);               /* was --text-primary */
    border-radius: var(--border-radius);            /* unchanged */
    padding: 8px 16px;
}

.existing-selector {
    /* Only add missing properties, not the entire rule */
    new-property: value;
}

5. Safely Append to Destination

Use append operations (never overwrite) to add the new styles.

Record the line count BEFORE appending (use this in step 6):

BEFORE=$(wc -l < /path/to/destination/styles.css)

Then append:

cat >> /path/to/destination/styles.css << 'EOF'

/* Added styles from source project */
.selector-name {
    property: value;
    variable-property: var(--adapted-variable);
}
EOF

Best practices:

  • Add a comment indicating the source or purpose
  • Include a blank line before the new content for readability
  • Use >> (append) never > (overwrite)

6. Verify the Changes (Per-Selector Grep + Tail)

Confirm that the styles were added correctly. Do not rely on tail or wc -l alone — a heredoc can silently truncate an overly long line, leaving a selector block incomplete while the line count still increases. The required approach is to grep for every selector that was just appended.

6a. Line-count delta

AFTER=$(wc -l < /path/to/destination/styles.css)
echo "Lines added: $((AFTER - BEFORE))"

6b. Per-selector grep — one grep per appended selector

# Repeat for every selector appended in step 5
grep -n "\.selector-name"      /path/to/destination/styles.css || echo "MISSING: .selector-name"
grep -n "\.another-selector"   /path/to/destination/styles.css || echo "MISSING: .another-selector"

If any grep prints "MISSING", the append was incomplete — re-run step 5.

6c. Automation helper for many selectors

If many selectors were appended, use a loop:

DEST=/path/to/destination/styles.css
MISSING=0
for selector in \
    ".selector-name" \
    ".another-selector" \
    ".yet-another"; do
  if ! grep -q "$selector" "$DE
अक्सर पूछे जाने वाले सवाल

हर सिलेक्टर क्यों जाँचें?

लाइन गिनती सही दिख सकती है, भले ही कोई लंबी लाइन कट गई हो, इसलिए स्किल हर सिलेक्टर नाम से जाँचती है।

क्या CSS वेरिएबल बदले जाते हैं?

स्किल कहती है कि ज़रूरत पड़ने पर स्टाइल को गंतव्य के CSS वेरिएबल के अनुसार ढाला जाए।

क्या मौजूदा नियम ओवरराइट होंगे?

स्किल का लक्ष्य बिना ओवरराइट किए जोड़ना है, इसलिए एजेंट पहले गंतव्य फ़ाइल पढ़ता है।

जानकारी

लेखक का मूल विवरण

Safely append CSS styles from one file to another, with per-selector grep verification after every append to catch silent truncation that tail or wc-l alone would miss

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#13044
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills