syncing-submodules

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Intelligent Submodule Sync System

智能子模块同步系统

This skill provides a sophisticated framework for syncing components from git submodules while ensuring consistency, avoiding duplicates, and maintaining quality.
本技能提供了一套成熟的框架,用于同步git子模块中的组件,同时确保一致性、避免重复并维持质量。

Core Principles

核心原则

  1. No Duplicates - Same concept should exist only once
  2. No Near-Duplicates - Similar concepts should be merged
  3. Quality Over Quantity - Better to have fewer excellent components than many mediocre ones
  4. Semantic Analysis - Compare meaning, not just names
  5. Synthesis Over Copying - Create superior merged versions

  1. 无重复 - 同一概念仅保留一份
  2. 无近似重复 - 相似概念应进行合并
  3. 质量优先于数量 - 宁少勿滥,优先保留优质组件
  4. 语义分析 - 比较内容含义,而非仅名称
  5. 合成而非复制 - 创建更优的合并版本

Phase 1: Deep Discovery

第一阶段:深度发现

1.1 Scan All Submodules

1.1 扫描所有子模块

bash
undefined
bash
undefined

Update submodules

更新子模块

git submodule update --remote --merge
git submodule update --remote --merge

Create inventory

创建清单

for submodule in submodules//; do echo "=== $submodule ===" find "$submodule" -name "SKILL.md" -o -name ".md" -path "/commands/" -o -name ".md" -path "/agents/*" done
undefined
for submodule in submodules//; do echo "=== $submodule ===" find "$submodule" -name "SKILL.md" -o -name ".md" -path "/commands/" -o -name ".md" -path "/agents/*" done
undefined

1.2 Extract Component Metadata

1.2 提取组件元数据

For EACH discovered component, extract:
yaml
component:
  name: "component-name"
  type: "skill|agent|command|hook"
  source: "submodule-name"
  path: "full/path/to/file"

  # Deep analysis fields
  primary_purpose: "One sentence describing main function"
  keywords: ["keyword1", "keyword2", "keyword3"]
  capabilities: ["capability1", "capability2"]
  target_audience: "who uses this"
  domain: "core|engineering|data|devops|design|product|github"

针对每个发现的组件,提取如下元数据:
yaml
component:
  name: "component-name"
  type: "skill|agent|command|hook"
  source: "submodule-name"
  path: "full/path/to/file"

  # 深度分析字段
  primary_purpose: "一句话描述主要功能"
  keywords: ["keyword1", "keyword2", "keyword3"]
  capabilities: ["capability1", "capability2"]
  target_audience: "目标用户"
  domain: "core|engineering|data|devops|design|product|github"

Phase 2: Semantic Similarity Analysis

第二阶段:语义相似度分析

2.1 Similarity Detection Matrix

2.1 相似度检测矩阵

For each pair of components (existing + new), calculate similarity:
Similarity TypeWeightDetection Method
Name Similarity15%Levenshtein distance, common prefixes
Keyword Overlap25%Jaccard similarity of extracted keywords
Purpose Overlap30%Semantic comparison of descriptions
Capability Overlap30%Function/feature comparison
针对每一对组件(现有组件+新组件),计算相似度:
相似度类型权重检测方法
名称相似度15%编辑距离、共同前缀
关键词重叠度25%提取关键词的杰卡德相似度
用途重叠度30%描述内容的语义比较
能力重叠度30%功能/特性比较

2.2 Similarity Thresholds

2.2 相似度阈值

ScoreClassificationAction
90-100%DuplicateKeep best, discard other
70-89%Near-DuplicateMerge into single component
50-69%RelatedConsider consolidation
30-49%Tangentially RelatedKeep separate, cross-reference
0-29%DistinctAdd if quality threshold met
分数分类操作
90-100%重复项保留优质版本,舍弃其他
70-89%近似重复项合并为单一组件
50-69%相关项考虑整合
30-49%弱相关项单独保留,添加交叉引用
0-29%完全不同若达到质量阈值则添加

2.3 Semantic Comparison Checklist

2.3 语义比较检查表

When comparing two similar components:
markdown
undefined
比较两个相似组件时使用:
markdown
undefined

Comparison: [Component A] vs [Component B]

对比:[组件A] vs [组件B]

Purpose Analysis

用途分析

  • A's purpose: ___
  • B's purpose: ___
  • Overlap: ___% | Distinct: ___%
  • A的用途: ___
  • B的用途: ___
  • 重叠度: ___% | 差异度: ___%

Content Comparison

内容对比

AspectComponent AComponent BBetter
Completeness1-101-10A/B
Clarity1-101-10A/B
ExamplescountcountA/B
Edge casescountcountA/B
Actionability1-101-10A/B
维度组件A组件B更优选项
完整性1-101-10A/B
清晰度1-101-10A/B
示例数量countcountA/B
边缘案例覆盖countcountA/B
可操作性1-101-10A/B

Unique Features

独有特性

  • Only in A: ___
  • Only in B: ___
  • 仅A具备: ___
  • 仅B具备: ___

Decision: [KEEP_A | KEEP_B | MERGE | KEEP_BOTH]

决策: [保留A | 保留B | 合并 | 同时保留]

Rationale: ___

理由: ___


---

---

Phase 3: Quality Scoring

第三阶段:质量评分

3.1 Component Quality Rubric

3.1 组件质量评估标准

Score each component 0-100:
CriterionWeightScoring
Completeness20%Covers topic thoroughly
Clarity20%Easy to understand and follow
Actionability15%Provides concrete steps
Examples15%Has good, relevant examples
Edge Cases10%Handles exceptions
Formatting10%Proper markdown, structure
CSO Optimization10%Good trigger phrases in description
对每个组件进行0-100分评分:
评估维度权重评分标准
完整性20%全面覆盖主题内容
清晰度20%易于理解和遵循
可操作性15%提供具体执行步骤
示例质量15%具备优质、相关的示例
边缘案例处理10%覆盖异常场景
格式规范10%正确使用Markdown格式,结构清晰
CSO优化10%描述中包含优质触发短语

3.2 Quality Thresholds

3.2 质量阈值

ScoreQuality LevelAction
80-100ExcellentAdd/keep as-is
60-79GoodAdd with minor improvements
40-59MediocreOnly add if fills gap, improve first
0-39PoorDo not add

分数质量等级操作
80-100优秀直接添加/保留
60-79良好添加并进行小幅优化
40-59一般仅在填补空白时添加,且需先优化
0-39较差不添加

Phase 4: Conflict Resolution

第四阶段:冲突解决

4.1 Same Concept, Different Names

4.1 同一概念,不同名称

Example: "verification" vs "validation" vs "checking-work"
Resolution Process:
  1. Identify all variants
  2. Analyze each for unique value
  3. Choose canonical name (most intuitive)
  4. Merge all content into canonical
  5. Ensure description covers ALL trigger phrases
示例:"verification" vs "validation" vs "checking-work"
解决流程:
  1. 识别所有变体
  2. 分析每个变体的独特价值
  3. 选择标准名称(最直观的)
  4. 将所有内容合并到标准名称下
  5. 确保描述涵盖所有触发短语

4.2 Same Name, Different Purposes

4.2 同一名称,不同用途

Example: Two "debug" commands doing different things
Resolution Process:
  1. Determine which aligns with ltk's existing conventions
  2. Rename the other to be more specific
  3. Or merge if they're complementary
示例:两个名为"debug"的命令功能不同
解决流程:
  1. 判断哪个符合ltk的现有惯例
  2. 将另一个重命名为更具体的名称
  3. 若互补则进行合并

4.3 Conflicting Advice

4.3 冲突建议

Example: One says "always use X", another says "never use X"
Resolution Process:
  1. Identify the CONTEXT for each piece of advice
  2. Create nuanced guidance with conditions
  3. Add examples for each scenario
  4. Document when each applies
示例:一个建议“始终使用X”,另一个建议“永远不要使用X”
解决流程:
  1. 识别每条建议的适用场景
  2. 创建带有条件的细致指导
  3. 为每个场景添加示例
  4. 记录各建议的适用情况

4.4 Decision Tree

4.4 决策树

Is this component new to ltk?
├── YES → Quality score >= 60?
│   ├── YES → Add with ltk conventions
│   └── NO → Skip or improve first
└── NO → Similar exists in ltk
    ├── Similarity >= 90% (Duplicate)
    │   └── Compare quality scores → Keep better one
    ├── Similarity 70-89% (Near-Duplicate)
    │   └── Merge: combine best of both
    ├── Similarity 50-69% (Related)
    │   └── Evaluate: consolidate or keep separate?
    └── Similarity < 50% (Distinct enough)
        └── Quality score >= 60? → Add

该组件是否为ltk新增?
├── 是 → 质量评分 >=60?
│   ├── 是 → 按照ltk惯例添加
│   └── 否 → 跳过或先优化
└── 否 → ltk中存在相似组件
    ├── 相似度 >=90%(重复项)
    │   └── 比较质量评分 → 保留更优版本
    ├── 相似度70-89%(近似重复项)
    │   └── 合并:整合两者的优势
    ├── 相似度50-69%(相关项)
    │   └── 评估:整合还是单独保留?
    └── 相似度 <50%(差异足够大)
        └── 质量评分 >=60? → 添加

Phase 5: Domain-Specific Placement

第五阶段:特定领域放置

5.1 Domain Classification

5.1 领域分类

DomainPluginIndicators
Context/Memory/Agentsltk-core"context", "memory", "agent", "prompt", "LLM"
Code/Testing/Architectureltk-engineering"code", "test", "refactor", "architecture"
Data/ML/Analyticsltk-data"data", "SQL", "ML", "analytics", "database"
Infrastructure/Securityltk-devops"deploy", "k8s", "docker", "security", "CI/CD"
UI/UX/Accessibilityltk-design"design", "UI", "UX", "accessibility", "CSS"
Marketing/Sales/Businessltk-product"marketing", "sales", "SEO", "content", "business"
Git/GitHub/PRsltk-github"git", "PR", "commit", "GitHub", "branch"
领域插件识别关键词
上下文/记忆/Agentltk-core"context", "memory", "agent", "prompt", "LLM"
代码/测试/架构ltk-engineering"code", "test", "refactor", "architecture"
数据/ML/分析ltk-data"data", "SQL", "ML", "analytics", "database"
基础设施/安全ltk-devops"deploy", "k8s", "docker", "security", "CI/CD"
UI/UX/无障碍ltk-design"design", "UI", "UX", "accessibility", "CSS"
营销/销售/业务ltk-product"marketing", "sales", "SEO", "content", "business"
Git/GitHub/PRltk-github"git", "PR", "commit", "GitHub", "branch"

5.2 Cross-Domain Components

5.2 跨领域组件

Some components span domains. Place in PRIMARY domain, cross-reference in others:
yaml
undefined
部分组件跨多个领域。放置在主要领域,并在其他领域添加交叉引用:
yaml
undefined

In primary location

在主要位置


name: component-name related:
  • ltk-engineering/skills/related-skill
  • ltk-devops/agents/related-agent


---

name: component-name related:
  • ltk-engineering/skills/related-skill
  • ltk-devops/agents/related-agent


---

Phase 6: Merge Strategies

第六阶段:合并策略

6.1 Skill Merge Template

6.1 技能合并模板

markdown
---
name: merged-skill-name
description: [Combined CSO-optimized description covering ALL trigger phrases]
version: 1.0.0
sources: [source1, source2]  # Attribution
---
markdown
---
name: merged-skill-name
description: [整合所有触发短语的CSO优化描述]
version: 1.0.0
sources: [source1, source2]  # 来源归属
---

[Skill Title]

[技能标题]

[Best introduction from all sources]
[从所有来源中选取的最佳介绍]

[Section from Source A - if superior]

[来源A的章节 - 若更优]

[Content]
[内容]

[Section from Source B - if unique]

[来源B的章节 - 若独有]

[Content]
[内容]

[Merged section - combining both]

[合并章节 - 整合两者优势]

[Synthesized content taking best from each]
<!-- Merge Notes: - Took X from source1 because: reason - Took Y from source2 because: reason - Combined Z because: reason -->
undefined
[综合两者精华的内容]
<!-- 合并说明: - 从source1选取X,原因: ... - 从source2选取Y,原因: ... - 合并Z,原因: ... -->
undefined

6.2 Agent Merge Strategy

6.2 Agent合并策略

markdown
---
agent: merged-agent-name
description: |
  [Combined description with all use cases]
  <example>...</example>
  <example>...</example>  # Include examples from ALL sources
model: [keep more capable model]
tools: [union of all tools needed]
color: [consistent with ltk conventions]
sources: [source1, source2]
---
markdown
---
agent: merged-agent-name
description: |
  [整合所有使用场景的描述]
  <example>...</example>
  <example>...</example>  # 包含所有来源的示例
model: [保留功能更强的模型]
tools: [整合所有所需工具]
color: [符合ltk惯例]
sources: [source1, source2]
---

[Agent Title]

[Agent标题]

[Synthesized capabilities from all sources]
[整合所有来源的能力描述]

Workflow

工作流程

[Best workflow, enhanced with steps from other sources]
undefined
[最佳工作流程,结合其他来源的步骤进行增强]
undefined

6.3 Command Merge Strategy

6.3 命令合并策略

Commands should generally NOT be merged - they're distinct actions. Instead:
  • Keep the more complete version
  • Add unique features from other version
  • Ensure no naming conflicts

命令通常不应合并——它们是独立的操作。替代方案:
  • 保留更完整的版本
  • 添加其他版本的独有特性
  • 确保无命名冲突

Phase 7: Deduplication Audit

第七阶段:去重审计

7.1 Pre-Sync Audit

7.1 同步前审计

Before syncing, audit EXISTING ltk components:
bash
undefined
同步前,审计现有ltk组件:
bash
undefined

Find potential duplicates by keyword analysis

通过关键词分析发现潜在重复项

for skill in plugins//skills//SKILL.md; do echo "=== $skill ===" grep -i "description:" "$skill" done | sort | uniq -c | sort -rn
undefined
for skill in plugins//skills//SKILL.md; do echo "=== $skill ===" grep -i "description:" "$skill" done | sort | uniq -c | sort -rn
undefined

7.2 Duplicate Detection Patterns

7.2 重复项检测模式

PatternLikely Duplicate
Same verb + noun"code review" / "reviewing code"
Synonym usage"validate" / "verify" / "check"
Same domain + action"git commit" / "committing changes"
Acronym vs full"TDD" / "test driven development"
模式可能为重复项
相同动词+名词"code review" / "reviewing code"
使用同义词"validate" / "verify" / "check"
同一领域+相同操作"git commit" / "committing changes"
缩写与全称"TDD" / "test driven development"

7.3 Post-Sync Verification

7.3 同步后验证

After sync, verify no duplicates introduced:
bash
undefined
同步后,验证未引入重复项:
bash
undefined

Check for duplicate skill names

检查重复的技能名称

find plugins -name "SKILL.md" -exec basename {} ; | sort | uniq -c | sort -rn | head -20
find plugins -name "SKILL.md" -exec basename {} ; | sort | uniq -c | sort -rn | head -20

Check for duplicate agent names

检查重复的Agent名称

find plugins//agents -name ".md" -exec basename {} .md ; | sort | uniq -c | sort -rn | head -20
find plugins//agents -name ".md" -exec basename {} .md ; | sort | uniq -c | sort -rn | head -20

Check for duplicate command names

检查重复的命令名称

find plugins//commands -name ".md" -exec basename {} .md ; | sort | uniq -c | sort -rn | head -20

---
find plugins//commands -name ".md" -exec basename {} .md ; | sort | uniq -c | sort -rn | head -20

---

Phase 8: Output Report Format

第八阶段:输出报告格式

markdown
undefined
markdown
undefined

Submodule Sync Report

子模块同步报告

Date: YYYY-MM-DD Submodules Analyzed: N Components Discovered: N Components Added: N Components Merged: N Duplicates Removed: N
日期: YYYY-MM-DD 分析的子模块数量: N 发现的组件数量: N 添加的组件数量: N 合并的组件数量: N 移除的重复项数量: N

Similarity Analysis Summary

相似度分析摘要

ComparisonSimilarityDecision
A vs B85%Merged → A
C vs D95%Duplicate, kept C
E vs F45%Kept both
对比项相似度决策
A vs B85%合并 → A
C vs D95%重复项,保留C
E vs F45%同时保留

Quality Scores

质量评分

ComponentSourceScoreDecision
skill-xsubmodule-182Added
agent-ysubmodule-255Improved, then added
command-zsubmodule-335Rejected (low quality)
组件来源分数决策
skill-xsubmodule-182添加
agent-ysubmodule-255优化后添加
command-zsubmodule-335拒绝(质量过低)

Components Added

添加的组件

TypeNameDomainSourceNotes
skillnameltk-coresub1New capability
类型名称领域来源备注
skillnameltk-coresub1新增能力

Components Merged

合并的组件

ResultSourcesMerge Strategy
skill-askill-a1 + skill-a2Combined best sections
结果来源合并策略
skill-askill-a1 + skill-a2整合最优章节

Duplicates Resolved

已解决的重复项

KeptRemovedReason
A (ltk)A' (submodule)ltk version more complete
保留项移除项原因
A (ltk)A' (submodule)ltk版本更完整

Rejected (Quality)

因质量拒绝的组件

ComponentSourceScoreReason
skill-xsub335Poor formatting, incomplete
组件来源分数原因
skill-xsub335格式混乱,内容不完整

Action Items

行动项

  • Review merged component: X
  • Test new command: Y
  • Consider consolidating: Z1 + Z2

---
  • 审核合并组件:X
  • 测试新命令:Y
  • 考虑整合:Z1 + Z2

---

Remember

注意事项

  1. Always do semantic analysis - Names can be deceiving
  2. Quality gates are mandatory - Don't add mediocre content
  3. Merge > Add - Prefer enhancing existing over adding similar
  4. Attribution matters - Credit sources
  5. Test after sync - Verify nothing broke
  6. Document decisions - Future you will thank present you
  1. 始终进行语义分析 - 名称可能具有误导性
  2. 质量检查是强制性的 - 不要添加平庸内容
  3. 优先合并而非添加 - 优先增强现有组件而非添加相似组件
  4. 归属很重要 - 注明来源
  5. 同步后测试 - 验证未出现问题
  6. 记录决策 - 未来的你会感谢现在的你