跳到正文
cccskills
免费在 GitHub 公开

safe-css-append

Transfer CSS styles between files by comparing existing rules and adding missing styles. The workflow preserves existing content, maps CSS variables to the destination’s names, and checks the appended rules after the update.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Safely append CSS styles from one file to another by identifying missing rules, adapting CSS variables, and verifying changes

查看安装方法

适用场景

  • Moving styles between projects
  • Reusing component styles while preserving existing rules
  • Matching CSS variables to the destination
  • Adding missing style properties

包含的文件(2)

  • SKILL.md5.2 KB
  • .skill_id29 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Safe CSS Append Workflow

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 all changes are verified.

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:

# Append new CSS rules
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

Confirm that the styles were added correctly:

# View the last N lines to see appended content
tail -n 20 /path/to/destination/styles.css

# Verify specific selectors were added
grep "new-selector-name" /path/to/destination/styles.css

# Check the complete file if needed
cat /path/to/destination/styles.css | tail -n 50

Complete Example

Here's a full example workflow:

# 1. Read source CSS and identify target
cat project-a/components.css | grep -A 10 ".button-primary"

# 2. Check destination for conflicts
grep ".button-primary" project-b/main.css
grep "^[[:space:]]*--btn-" project-b/main.css

# 3. Identify that .button-primary is missing, and variables need mapping:
#    --btn-color → --primary-color (exists in destination)
#    --btn-padding → create inline value

# 4. Append adapted styles
cat >> project-b/main.css << 'EOF'

/* Button styles from project-a */
.button-primary {
    background-color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
}
EOF

# 5. Verify
tail -n 10 project-b/main.css
grep ".button-primary" project-b/main.css

Safety Checklist

  • Source file read and analyzed
  • Destination file checked for existing rules
  • Missing styles identified
  • CSS variables mapped correctly
  • Append operation used (not overwrite)
  • Changes verified with tail/grep
  • No duplicate selectors created
  • All variable references exist in destination

Common Pitfalls

  1. Overwriting instead of appending: Always use >>, never >
  2. Variable mismatch: Ensure all CSS variables exist in the destination or are properly defined
  3. Duplicate selectors: Check for existing rules before adding complete selector blocks
  4. Missing verification: Always verify changes after appending

Tips

  • Use wc -l before and after to confirm lines were added
  • Keep a mapping document for complex variable transformations
  • Consider using a temporary file to preview changes before appending
  • Group related selectors together when appending multiple rules

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

中文简介正在准备中。当前显示英语简介。

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace77572026年8月13日 更新

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

中文简介正在准备中。当前显示英语简介。

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace77572026年8月13日 更新

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

中文简介正在准备中。当前显示英语简介。

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace77572026年8月13日 更新

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

中文简介正在准备中。当前显示英语简介。

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace77572026年8月13日 更新

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

中文简介正在准备中。当前显示英语简介。

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace77572026年8月13日 更新

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

中文简介正在准备中。当前显示英语简介。

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace77572026年8月13日 更新

查看 HKUDS 的全部技能

报告此技能的问题