safe-css-append
预览截图
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "safe-css-append":https://skillpi.com/zh/skills/deepskill-78dc3abec7b35a7732a40dfabf2d1eb557a60350be54d51dc6f295af92fbf180。安装前核对上游来源和版本:https://github.com/HKUDS/OpenSpace。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
通过识别缺失规则、适配 CSS 变量并验证更改,安全地将一个文件中的 CSS 样式追加到另一个文件中。
介绍来源: third_party · HKUDS · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 通过识别缺失规则、调整 CSS 变量以及验证更改,将 CSS 样式从一个文件安全附加到另一个文件
- 适合谁
- 复制组件样式同时保留现有规则 添加新的 CSS 规则而不重复或与现有样式冲突 调整样式以使用不同的 CSS 变量
- 实测状态
- 未测试
文件浏览
Frontmatter
name: safe-css-append
description: Safely append CSS styles from one file to another by identifying missing rules, adapting CSS variables, and verifying changesSafe 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
- Overwriting instead of appending: Always use
>>, never> - Variable mismatch: Ensure all CSS variables exist in the destination or are properly defined
- Duplicate selectors: Check for existing rules before adding complete selector blocks
- Missing verification: Always verify changes after appending
Tips
- Use
wc -lbefore 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
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- Safe CSS Append 提供了一套系统化的 CSS 样式安全迁移流程,适用于前端开发中的常见需求,实用价值高。
- 功能闭环完整,包含分析、适配、追加、验证等关键步骤,能有效避免样式冲突和变量不匹配问题。
待提升项
-
触发词不全 原报告严重程度:轻微
description 描述了功能但未提供清晰的触发关键词,用户可能难以通过自然语言精准触发。
改进建议:建议在 description 或 skill_body 开头添加明确的触发关键词,如“css append”、“merge css styles”、“safe css migration”等。
亮点
- 结构非常完整,包含使用场景、详细步骤、完整示例、安全检查清单和常见陷阱,便于用户理解和执行。
- 提供了端到端的完整示例和验证机制,frontmatter 完整,文档长度适中。
待提升项
-
未覆盖文件不存在等系统异常 原报告严重程度:轻微
执行流程未显式处理文件不存在、权限错误等系统级异常情况。
改进建议:建议在步骤中添加对文件存在性和权限的检查,例如使用 `test -f` 或 `ls` 验证文件,并提示用户处理异常。
亮点
- 提供了具体的 bash 命令和 CSS 示例,工具来源明确,参数正确。
- 覆盖了主要异常场景(重复选择器、变量映射、追加 vs 覆盖),并有验证机制确保操作成功。
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。