css-append-selector-verify
Fungsinya
Skill ini memandu agent AI untuk menyalin gaya CSS antar file tanpa menimpa aturan yang sudah ada. Skill ini ditujukan untuk pengembang yang memindahkan gaya antar proyek atau menambahkan aturan ke sebuah stylesheet.
Kapan dipakai
- βSaat Anda memindahkan gaya komponen dari satu proyek ke proyek lain.
- βSaat Anda perlu menambahkan aturan CSS baru tanpa menduplikasi atau merusak aturan yang sudah ada.
- βSaat Anda perlu menyesuaikan gaya dengan kumpulan variabel CSS yang berbeda.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/css-append-selector-verify/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βSalin gaya tab panel dari stylesheet lama ke stylesheet saya tanpa mengubah aturan yang sudah ada, dan periksa bahwa setiap selektor sudah masuk.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent membaca CSS sumber dan tujuan, mencatat aturan dan variabel yang sudah ada, lalu menambahkan aturan baru. Setelah setiap penambahan, agent mencari setiap selektor untuk memastikan selektor itu ada, sehingga aturan yang terpotong dapat ditangkap.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Mengapa setiap selektor diperiksa?
Jumlah baris bisa lolos meskipun baris yang panjang terpotong, sehingga skill ini memeriksa setiap selektor berdasarkan namanya.
Apakah variabel CSS diubah?
Skill ini meminta gaya disesuaikan dengan variabel CSS tujuan jika diperlukan.
Apakah aturan yang ada akan ditimpa?
Tujuan skill ini adalah menambahkan tanpa menimpa, dan agent membaca tujuan terlebih dahulu.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #13044
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- β¦
Skill lain dari repositori ini
agentpilot
7.8kMembantu agent Anda meningkatkan proyek langkah demi langkah dengan menyiapkan tugas dan menjalankan loop AgentPilot yang mengusulkan, menguji, dan memberi skor pada perubahan.
openspace
7.8kMembantu agent Anda menyiapkan OpenSpace, alat yang menyimpan dan mengambil skill agent, lalu menghubungkannya ke aplikasi AI Anda melalui MCP.
rsi-arena
7.8kMembantu agent Anda menyiapkan dan menjalankan tes benchmark AI standar, seperti AIME dan Terminal-Bench, untuk membandingkan berbagai metode perbaikan.
experiment-guide
7.8kMembantu agent Anda merencanakan eksperimen kecil, membaca hasilnya, dan mencatat temuan saat menyelidiki cara memperbaiki sebuah program.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.