swap-analyzer

Analyze swap compatibility and safety. Use when evaluating proposed schedule swaps to ensure they maintain ACGME compliance and operational coverage.

⭐2stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

The Swap Analyzer is a specialized Claude skill designed to evaluate the feasibility, safety, and regulatory compliance of personnel schedule swaps. It specifically targets complex environments like medical residency programs by automating the verification of ACGME requirements (such as 80-hour limits and 1-in-7 rules) and assessing operational coverage impact. By providing data-driven risk assessments and recommendations, it streamlines administrative decision-making and ensures organizational safety standards are maintained.

Use Cases

  • Evaluating medical resident swap requests to ensure strict adherence to ACGME labor regulations and duty hour limits.
  • Analyzing the impact of holiday or emergency shift trades on departmental coverage and minimum staffing requirements.
  • Performing risk assessments on multi-party schedule changes to prevent fatigue-related safety issues and supervision gaps.
  • Generating detailed feasibility reports for program coordinators to approve or deny schedule modifications based on automated compliance checks.
  • Simulating proposed schedule changes to quantify the impact on individual workloads and rotation-specific training requirements.
nameswap-analyzer
descriptionAnalyze swap compatibility and safety. Use when evaluating proposed schedule swaps to ensure they maintain ACGME compliance and operational coverage.
model_tieropus
can_parallel_with[code-review, test-writer]
must_serialize_with[acgme-compliance, safe-schedule-generation]
preferred_batch_size2
max_file_context20
compression_level1
requires_git_contextfalse
requires_db_contexttrue
- pattern"incompatible|infeasible"
reason"Swaps creating violations need escalation"
- keyword["violation", "coverage gap"]

Swap Analyzer Skill

Comprehensive analysis of schedule swap compatibility and impact assessment.

When This Skill Activates

  • Faculty requests schedule swap
  • Evaluating swap feasibility
  • Checking swap impact before execution
  • Investigating swap-related issues
  • Pre-validating swap proposals

Swap Analysis Framework

Phase 1: Swap Type Classification

Identify Swap Pattern:

Swap types:
1. One-to-one swap
   - Resident A's rotation swapped with Resident B
   - Most common, usually feasible

2. Absorb swap
   - Resident A gives shift to Resident B
   - Requires accepting extra load

3. Multi-party swap
   - Chain involving 3+ residents
   - Complex validation needed

4. Faculty/coverage swap
   - Change faculty assignments
   - Affects supervision ratios

Phase 2: Feasibility Analysis

Step 2.1: Rotation Compatibility

For proposed swap:
1. Is rotation type switchable?
   - Can A work B's rotation?
   - Required credentials?
   - Skill match?

2. Are residents trained for rotations?
   - Check rotation requirements
   - Verify prerequisite training
   - Confirm no conflicts

Step 2.2: ACGME Compliance Check

For each resident involved:
1. 80-hour rule impact
   - Would swap cause violation?
   - Check weeks affected
   - Estimate new hours

2. 1-in-7 rule impact
   - Would swap violate days off rule?
   - Check consecutive duty days after swap

3. Supervision impact
   - Ratio still compliant?
   - Adequate supervision in each rotation?

Step 2.3: Coverage Impact

1. Original coverage
   - Who covers each shift?
   - Is there redundancy?

2. After swap coverage
   - Any coverage gaps created?
   - Minimum staffing maintained?
   - Critical rotations still covered?

3. Backup availability
   - Can gaps be filled?
   - Backup cost/impact?

Phase 3: Impact Assessment

Step 3.1: Quantify Changes

For each resident:
1. Hours change
   - Current: X hours
   - After swap: Y hours
   - Difference: ±Z hours

2. Rotation change
   - Current: [Rotation A]
   - After swap: [Rotation B]
   - Type change: Clinical/Admin/Procedure/etc

3. Work load impact
   - Fair? Too much? Too light?

Step 3.2: Risk Assessment

Risk factors:
1. Compliance risk: [LOW/MEDIUM/HIGH]
2. Coverage risk: [LOW/MEDIUM/HIGH]
3. Fairness risk: [LOW/MEDIUM/HIGH]
4. Overall risk: [SAFE / PROCEED WITH CAUTION / UNSAFE]

Phase 4: Recommendation

Step 4.1: Generate Recommendation

Possible outcomes:
1. APPROVED
   - Swap is safe and compliant
   - No issues identified

2. APPROVED WITH CONDITIONS
   - Swap approved if conditions met
   - List specific conditions

3. BLOCKED
   - Swap creates violations
   - Explain specific issues

4. NEEDS MODIFICATION
   - Swap feasible with adjustments
   - Suggest alternative dates/residents

Swap Analysis Report

## Swap Feasibility Report

**Swap Type:** [TYPE]
**Requested By:** [NAME]
**Date Requested:** [DATE]

### Proposed Swap
- Resident A: [Current] → [Proposed]
- Resident B: [Current] → [Proposed]
- Dates: [START] to [END]

### Feasibility Analysis

#### Rotation Compatibility
- [x] Rotation A can be done by Resident B
- [x] Resident B has required credentials
- [x] No prerequisite issues

#### ACGME Compliance
- 80-hour impact: [A: ±Z hours, B: ±Z hours]
- 1-in-7 impact: [Compliant/Violation detail]
- Supervision impact: [Compliant/Violation detail]

#### Coverage Impact
- Gaps created: [None/List gaps]
- Coverage maintained: [YES/NO]
- Backup available: [YES/NO]

### Recommendation

**APPROVED** / **BLOCKED** / **CONDITIONAL**

Reasoning: [Explanation]

### Conditions (if applicable)
1. [Condition 1]
2. [Condition 2]

### Alternative Suggestions
1. [Alternative 1]
2. [Alternative 2]

Common Swap Scenarios

Scenario 1: One-to-One Procedural Swap

Request: Swap inpatient block for clinic block Analysis:

  • Rotation compatibility: Check
  • Skill match: Check
  • Hours impact: Usually minor
  • Coverage: Usually safe Typical outcome: APPROVED

Scenario 2: Holiday Coverage Request

Request: Swap holiday duties Analysis:

  • Often stacks hours dangerously
  • Check 4-week rolling average impact
  • Verify 80-hour rule not violated Typical outcome: CONDITIONAL or BLOCKED

Scenario 3: Night Float Swap

Request: Swap night float blocks Analysis:

  • Coverage critical
  • 6-night limit impact
  • Supervision in night float important Typical outcome: Varies widely

Scenario 4: Last-Minute Absence Coverage

Request: Absorb shift due to emergency Analysis:

  • Fair distribution check
  • Fatigue/safety concern
  • Must not exceed 80-hour rule Typical outcome: Usually BLOCKED unless fairness maintained

Integration with swap-execution

After analysis:

  1. If APPROVED: Pass to swap-execution for implementation
  2. If BLOCKED: Deny swap with explanation
  3. If CONDITIONAL: Send conditions to requester
  4. If NEEDS MODIFICATION: Propose alternatives

Quick Analysis Commands

# Analyze proposed swap
python -m app.swaps.analyzer --resident1=A --resident2=B --dates=START-END

# Check impact on 80-hour rule
python -m app.swaps.analyzer --resident1=A --rule=80-hour --dates=START-END

# Simulate swap to see hours impact
python -m app.swaps.analyzer --resident1=A --simulate --dates=START-END

Validation Checklist

  • Swap type identified correctly
  • Rotation compatibility verified
  • ACGME rules checked
  • Coverage impact assessed
  • Risk level determined
  • Recommendation clear and justified
  • Conditions (if any) specific and measurable
  • Alternative suggestions provided if BLOCKED

Error Handling

If swap analysis fails:

  1. Check if schedule data is valid
  2. Verify swap parameters are correct
  3. Confirm residents/dates exist
  4. Escalate if data is inconsistent

If result is ambiguous:

  1. Re-run with more specific parameters
  2. Check for data quality issues
  3. Request human review

References

  • Swap management procedures in swap-management skill
  • ACGME rules in acgme-compliance skill
  • Swap execution in swap-execution skill