Auto consolidator

From oyi77/1ai-skills · View interactive version

Auto consolidator is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when consolidating overlapping or redundant skills across the 1ai-skills library by demoting narrow skills into sub-reference tables inside canonical parent skills without deleting physical SKILL.md files. Prevents router prefix collisions, context bloat, and redundant dispatch.

How to use this skill

Skill file

Auto-Consolidator

Overview

Auto-Consolidator maintains the skill library's density by detecting overlapping, redundant, or prefix-colliding skills and demoting them into sub-reference tables inside canonical parent skills. It implements the Zero Deletion Invariant: physical SKILL.md files are never removed (preserving broken-link safety and external references), but the skill is relocated to _demoted/ at repo root — outside every SKILL_DIRS entry, so lint-skills.py --write never re-registers it — and linked from the canonical parent's ## Sub-Skills & Specialized Playbooks table.

This prevents router prefix collisions (e.g., 14 gate-* skills competing for the same query token), reduces context bloat, and keeps the active registry count manageable while preserving all 1,419+ physical playbooks.

When to Use

Trigger phrases:

Use directly when:

When NOT to Use

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "Deleting redundant SKILL.md files saves disk space." | Physical files preserve external references, check-broken-links.py passes, and agents can still read them via direct path. Deleting breaks links. |

| "All skills should be individually routable for maximum discoverability." | 1,400 flat skills cause ~75k token context bloat and accuracy drops below 65%. Hierarchical dispatch is required at scale. |

| "Prefix families are fine as long as triggers are specific." | Triggers help but don't eliminate collision. A single parent router with sub-references routes more deterministically than 14 competing siblings. |

| "Consolidation is a one-time cleanup." | New imports and skill creation continuously add overlaps. Consolidation is a recurring maintenance operation. |

Workflow

1. Detect Overlap Groups

Scan SKILLS.json for prefix families and near-duplicate names:

from collections import defaultdict
import json

d = json.load(open("SKILLS.json"))
groups = defaultdict(list)
for s in d["skills"]:
    parts = s["name"].split("-")
    if len(parts) >= 2:
        groups[parts[0]].append(s["name"])

# Flag groups with >3 members
for prefix, members in groups.items():
    if len(members) > 3:
        print(f"COLLISION GROUP: {prefix}-* ({len(members)} skills)")

2. Identify Canonical Parent

For each overlap group, determine the canonical parent skill:

3. Demote Sub-Skills

For each non-canonical member:

  1. Keep the physical SKILL.md on disk (Zero Deletion Invariant).
  2. Relocate the skill directory to _demoted/ at repo root, outside every SKILL_DIRS entry — this is what makes the demotion durable:
mkdir -p _demoted
git mv content/<skill> _demoted/<skill>
  1. Add a sub-reference row in the canonical parent's ## Sub-Skills & Specialized Playbooks table pointing at the relocated path:
| Sub-Skill | Path | Purpose |
|---|---|---|
| `seo-technical` | `_demoted/seo-technical/SKILL.md` | Technical SEO audit across 9 categories |
| `seo-geo` | `_demoted/seo-geo/SKILL.md` | AI Overviews and GEO optimization |
  1. Repoint every inbound [SKILL.md](../<skill>/SKILL.md) link in other skills to ../../_demoted/<skill>/SKILL.md (or ../_demoted/<skill>/SKILL.md from a category root).
  1. Repoint scripts/generate-site.py hardcoded example lists if they name the demoted skill.

Why not "remove the SKILLS.json entry"? lint-skills.py --write rebuilds SKILLS.json from a glob of every SKILL_DIRS entry. A skill inside a category dir gets re-registered on every ladder run — the strip only survives until the next mandatory gate. Relocation outside SKILL_DIRS is the only idempotent demotion. generate-site-data.py walks REPO root, so it carries an inline if '_demoted' in dirs: dirs.remove('_demoted') filter (added in 73128660); do not duplicate that filter via a config-level SKIP_DIRS.

  1. Remove the orphaned runtime copy: rm -rf ~/.agents/skills/<skill> (sync-skills.sh only scans CATEGORIES, so relocated skills are never auto-removed).

4. Re-Index and Verify

python3 scripts/lint-skills.py --write
python3 scripts/sync-counts.py
python3 scripts/check-broken-links.py
python3 scripts/test-skills.py --quick
bash scripts/sync-skills.sh

5. Audit Router Collision Score

Run the router on a representative query from the overlap group and confirm the parent skill scores highest:

python3 scripts/skill_router.py "seo audit technical"
# Expected: parent scores > any individual sub-skill

Verification

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.