Expertise in architecting, implementing, reviewing, and debugging hierarchical matching systems. Use when working with: (1) Two-sided matching (Gale-Shapley, hospital-resident, student-school), (2) Assignment/optimization problems (Hungarian algorithm, bipartite matching), (3) Multi-level hierarchy matching (org charts, taxonomies, nested categories), (4) Entity resolution and record linkage across hierarchies. Triggers: debugging match quality issues, reviewing matching algorithms, translating business requirements into constraints, validating match correctness, architecting new matching systems, fixing unstable matches, resolving constraint violations, diagnosing preference misalignment.
View on GitHubskills/hierarchical-matching-systems/SKILL.md
February 5, 2026
Select agents to install to:
npx add-skill https://github.com/petekp/agent-skills/blob/main/skills/hierarchical-matching-systems/SKILL.md -a claude-code --skill hierarchical-matching-systemsInstallation paths:
.claude/skills/hierarchical-matching-systems/# Hierarchical Matching Systems This skill provides rigid diagnostic and architectural procedures for hierarchical matching systems. Follow checklists exactly—matching bugs often hide in skipped steps. ## Quick Reference - **Algorithm selection**: See [references/decision-guide.md](references/decision-guide.md) - **Algorithm details**: See [references/algorithms.md](references/algorithms.md) --- ## 1. Problem Classification Checklist Before any work, classify the problem. Check ALL that apply: ``` □ TWO-SIDED: Both sides have preferences (students↔schools, workers↔jobs) □ ONE-SIDED: Only one side has preferences (tasks→workers, items→bins) □ HIERARCHICAL: Entities exist at multiple levels (org→dept→team→person) □ WEIGHTED: Matches have costs/scores to optimize □ CONSTRAINED: Hard limits exist (capacity, exclusions, required pairings) □ STABLE: Solution must resist defection (no blocking pairs) □ OPTIMAL: Solution must minimize/maximize objective function □ FUZZY: Entities may partially match (entity resolution, deduplication) ``` Classification determines algorithm family. Proceed to Section 2 for architecture or Section 3 for debugging. --- ## 2. Architecture Procedure Follow these phases in order when designing a new matching system. ### Phase 2.1: Requirements Translation Convert each business requirement into formal constraints: | Business Requirement | Constraint Type | Formal Expression | |---------------------|-----------------|-------------------| | "Each student gets one school" | Capacity | `|matches(s)| = 1 ∀ student s` | | "Schools have seat limits" | Capacity | `|matches(school)| ≤ capacity` | | "Siblings must be together" | Coupling | `school(s1) = school(s2) if siblings(s1,s2)` | | "Student X cannot attend Y" | Exclusion | `(X, Y) ∉ matches` | | "Priority for residents" | Preference ordering | `rank(resident) < rank(non-resident)` | **Checklist:** ``` □ List ALL business requirements □ Classify each as: capacity | coupling | exclusion |