Back to list
blt

rescue-optimization

by blt

Claude skills for experimenting with datadog-agent

0🍴 0📅 Jan 14, 2026

SKILL.md


name: rescue-optimization description: Salvages optimization work lacking benchmarks. Generates missing evidence, validates claims. Bugs discovered during rescue are valuable - invoke /validate-correctness.

Optimization Rescue

Salvage optimization work done without proper benchmarks. Generate evidence, validate claims, and discover bugs hiding in "optimizations."

Valuable Outcomes

OutcomeValueAction
Change validatedReal improvement provenKEEP, include in rescued branch
Change invalidatedNo improvementDISCARD, record lesson
Bug discoveredCorrectness issue foundInvoke /validate-correctness

Bugs found during rescue are SUCCESS, not failure.


Phase 0: Pre-flight

Run /preflight first.


Phase 1: Audit

git diff --name-only origin/main...HEAD | grep '\.go$'

For each change, categorize:

  • Preallocation
  • Pooling
  • Buffer reuse
  • Data structure change
  • Potential bug (suspicious patterns)

Phase 2: Triage

Hot Path?Decision
Yes (top 10%)INVESTIGATE
Warm (10-25%)SKEPTICAL
ColdLIKELY DISCARD
Looks buggyINVESTIGATE for correctness

Bug Warning Signs

  • make([]T, n) followed by append
  • Missing nil checks
  • Changed return semantics
  • Slice aliasing

Phase 3: Generate Evidence

Create Benchmarks

func BenchmarkFunction(b *testing.B) {
    data := createTestData()
    b.ReportAllocs()
    b.ResetTimer()
    for i := 0; i < b.N; i++ {
        _ = Function(data)
    }
}

Run Comparison

benchstat /tmp/baseline.txt /tmp/optimized.txt

Phase 4: Validate

benchstat ResultDecision
>=5% improvement, p<0.05KEEP
No significant changeDISCARD
Tests failPossible BUG → /validate-correctness
Behavior differsPossible BUG → /validate-correctness

Phase 5: Handle Bug Discovery

If rescue uncovers a bug instead of an optimization:

/validate-correctness

After validation:

  1. Record bug in validations.yaml (via validate-correctness)
  2. Record rescue as BUG_FOUND in rescues.yaml
  3. The bug fix becomes part of rescued branch (with tests!)

Phase 6: Reconstruct

git checkout main
git checkout -b mem-opt/<name>-rescued

Apply only:

  • KEEP changes (validated optimizations)
  • BUG_FOUND changes (with tests from /validate-correctness)

Discard everything else.


Phase 7: Record

# Append to rescues.yaml
  - branch: mem-opt/original
    date: 2026-01-06
    audited: 12
    kept: 3
    discarded: 7
    bugs_found: 2
    rescued_as: mem-opt/original-rescued
    lesson: "<pattern>"

Usage

/rescue-optimization

Score

Total Score

55/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon