본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)7.8k · #13044

css-append-selector-verify

하는 일

이 스킬은 기존 규칙을 덮어쓰지 않고 AI 에이전트가 CSS 스타일을 파일 사이에 옮기도록 안내합니다. 프로젝트 사이에서 스타일을 옮기거나 스타일시트에 규칙을 추가하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓컴포넌트 스타일을 한 프로젝트에서 다른 프로젝트로 옮길 때.
  • ✓기존 규칙을 중복하거나 망가뜨리지 않고 새 CSS 규칙을 추가해야 할 때.
  • ✓스타일을 다른 CSS 변수 세트에 맞춰야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/css-append-selector-verify/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“예전 스타일시트에서 패널 탭 스타일을 복사해 제 파일에 넣어 주세요. 기존 규칙은 건드리지 말고, 각 선택자가 들어갔는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 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
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬