Skip to main content
ClaudeWave
Skill209 repo starsupdated 7d ago

algo-hr-turnover

Build employee turnover prediction models to identify flight risk and retention drivers. Use this skill when the user needs to predict which employees are likely to leave, identify retention risk factors, or prioritize HR interventions — even if they say 'attrition prediction', 'who is going to quit', or 'employee retention model'.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/asgard-ai-platform/skills /tmp/algo-hr-turnover && cp -r /tmp/algo-hr-turnover/algo-hr-turnover ~/.claude/skills/algo-hr-turnover
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Employee Turnover Prediction

## Overview

Turnover prediction uses classification models (logistic regression, random forest, XGBoost) to estimate the probability an employee will leave within a defined period (typically 6-12 months). Features include tenure, compensation, performance, promotion history, and engagement signals.

## When to Use

**Trigger conditions:**
- Identifying employees at high risk of voluntary departure
- Quantifying which factors drive turnover for targeted interventions
- Prioritizing retention budgets toward highest-impact employees

**When NOT to use:**
- For involuntary termination planning (different process and ethics)
- When headcount is < 200 (insufficient data for reliable modeling)

## Algorithm

```
IRON LAW: Turnover Models Predict RISK, Not Certainty
A predicted 80% turnover probability means "employees with similar
profiles historically left 80% of the time." It does NOT mean this
specific employee WILL leave. Never use model outputs as sole basis
for employment decisions — that creates legal and ethical liability.
```

### Phase 1: Input Validation
Collect: employee demographics, tenure, compensation (relative to market), last promotion date, performance ratings, manager change history, engagement survey scores, commute distance. Outcome: voluntary departure within N months.
**Gate:** Minimum 200 turnover events, features available before departure date.

### Phase 2: Core Algorithm
1. Feature engineering: tenure buckets, comp ratio (salary/market median), time since last promotion, manager tenure, engagement trend
2. Handle class imbalance: turnover rate typically 10-20%. Use SMOTE or class weights.
3. Train: logistic regression (interpretable, HR-preferred) or GBDT (higher accuracy)
4. Output: probability of departure + top risk factors per employee

### Phase 3: Verification
Evaluate: AUC, precision-recall (at actionable thresholds). Backtest: did the model correctly flag employees who left in the past 6 months?
**Gate:** AUC > 0.70, precision > 50% at top decile.

### Phase 4: Output
Return risk scores with driver analysis.

## Output Format

```json
{
  "risk_scores": [{"employee_id": "E123", "turnover_prob": 0.72, "risk_tier": "high", "top_drivers": ["low_comp_ratio", "no_promotion_3yr"]}],
  "metadata": {"model": "xgboost", "auc": 0.78, "prediction_window_months": 12}
}
```

## Examples

### Sample I/O
**Input:** Employee: 4yr tenure, comp ratio 0.85, no promotion in 3yr, engagement score declining
**Expected:** High risk (>0.6). Top drivers: below-market compensation, stalled career progression.

### Edge Cases
| Input | Expected | Why |
|-------|----------|-----|
| New hire (< 6 months) | Unreliable prediction | Insufficient behavioral data |
| Top performer, high comp | Still could leave | Non-financial factors (manager, culture) matter |
| Post-reorg period | Model drift likely | Unusual conditions distort patterns |

## Gotchas

- **Survivorship bias**: Training data only includes people who were hired and stayed long enough to observe. Early-stage leavers may be underrepresented.
- **Feature leakage**: "Started job searching" or "updated LinkedIn" are strong predictors but ethically and legally problematic to use. Stick to internal HR data.
- **Self-fulfilling prophecy**: If managers treat "high risk" employees differently (less investment, fewer projects), the model prediction becomes self-fulfilling.
- **Legal constraints**: Using protected attributes (age, gender, ethnicity) directly or via proxies may violate employment law. Audit for disparate impact.
- **Retention intervention timing**: Identifying risk is only useful if HR acts. Build the model into a retention workflow with specific intervention triggers.

## References

- For feature engineering from HR data, see `references/hr-features.md`
- For ethical AI in HR applications, see `references/ethical-hr-ai.md`
algo-ad-biddingSkill

Implement and select ad bidding strategies from manual CPC to automated target-CPA and target-ROAS. Use this skill when the user needs to choose a bidding strategy, set up automated bidding, or optimize bid parameters — even if they say 'what bidding strategy should I use', 'target CPA setup', or 'smart bidding configuration'.

algo-ad-budgetSkill

Optimize advertising budget allocation across campaigns using marginal returns analysis. Use this skill when the user needs to distribute budget across multiple campaigns, optimize spend pacing, or maximize overall ROAS under budget constraints — even if they say 'how to split my ad budget', 'campaign budget optimization', or 'diminishing returns on ad spend'.

algo-ad-ctrSkill

Build CTR prediction models for estimating ad click-through rates from features. Use this skill when the user needs to predict click probability, build an ad ranking model, or evaluate ad creative performance — even if they say 'predict click rate', 'ad relevance scoring', or 'which ad will get more clicks'.

algo-ad-gspSkill

Implement Generalized Second Price auction for ad slot allocation and pricing. Use this skill when the user needs to understand search ad auctions, compute ad positions and costs-per-click, or analyze bidding dynamics — even if they say 'how does Google Ads auction work', 'ad rank calculation', or 'second price auction for ads'.

algo-ad-vcgSkill

Implement VCG mechanism for incentive-compatible ad slot allocation with truthful bidding. Use this skill when the user needs to design a truthful auction mechanism, compute externality-based payments, or understand why platforms may prefer GSP over VCG — even if they say 'truthful auction design', 'VCG payments', or 'incentive-compatible mechanism'.

algo-blockchain-basicsSkill

Explain blockchain fundamentals including distributed ledger architecture, consensus mechanisms, and block structure. Use this skill when the user needs to understand blockchain concepts, evaluate whether blockchain fits a use case, or design a blockchain-based solution — even if they say 'how does blockchain work', 'do I need blockchain', or 'distributed ledger'.

algo-blockchain-smart-contractSkill

Design and implement smart contracts as self-executing programmatic agreements on blockchain. Use this skill when the user needs to build automated on-chain logic, evaluate smart contract security, or design tokenized business rules — even if they say 'smart contract development', 'automated agreement', or 'on-chain logic'.

algo-ecom-bm25Skill

Implement BM25 ranking function for e-commerce product search relevance scoring. Use this skill when the user needs to build a text-based product search engine, improve search result relevance, or replace basic TF-IDF with a more robust ranking function — even if they say 'product search ranking', 'search relevance', or 'BM25 implementation'.