skills/professional/model-optimization/SKILL.md
Optimize ML models for edge deployment through quantization, pruning, format conversion (TensorRT/TFLite/ONNX), and accuracy/latency benchmarking. Use when preparing models for resource-constrained devices.
npx skillsauth add michaelalber/ai-toolkit model-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
"Quantization is not about making models worse. It is about finding the representation that preserves what matters while discarding what does not." -- adapted from Benoit Jacob, Google Quantization Team
This skill covers the complete model optimization pipeline: profiling baseline performance, applying quantization and pruning, converting between inference formats, and benchmarking the results. Every optimization decision is driven by measurement, not intuition — optimize for speed subject to an accuracy floor, never the other way around.
Non-Negotiable Constraints:
Full principle table, KB lookups, pre-flight checklist, decision trees, discipline rules,
anti-patterns, and error recovery live in references/conventions.md.
PROFILE → OPTIMIZE → BENCHMARK → VALIDATE → PACKAGE
baseline quantize/ speedup + accuracy deploy-ready
metrics convert compression within tol artifact
PROFILE Run the pre-flight checklist (conventions.md). Measure baseline latency (100+ iters +
warmup), accuracy on the test set, size, and memory. Record all in the state block.
OPTIMIZE Pick the path from the quantization/pruning decision trees (conventions.md) by target
device. Apply ONE optimization at a time. (Strategy: quantization-workflows.md;
conversions: conversion-pipelines.md.) Validate preprocessing compatibility after each conversion.
BENCHMARK Measure on target hardware when available (set power mode, lock clocks, 5+ min sustained
for thermal throttling). Report P50/P95/P99, not just mean. Label host-only runs as estimates.
VALIDATE Compare accuracy against the floor. If outside tolerance → STOP, report exact numbers,
present alternatives, let the user decide. Never proceed silently past a violation.
PACKAGE Emit the deployment artifact with benchmark report, preprocessing config, and provenance.
Exit criteria: baseline measured and recorded; optimizations applied one at a time and benchmarked; accuracy within the stated tolerance (or the tradeoff explicitly accepted by the user); deployment artifact packaged with metadata. The original model is untouched.
<model-opt-state>
phase: PROFILE | OPTIMIZE | BENCHMARK | VALIDATE | PACKAGE
model_name: [name]
source_format: pytorch | tensorflow | onnx | tflite | tensorrt
target_device: jetson-orin-nano | raspberry-pi-5 | raspberry-pi-4 | cpu-generic
baseline_latency_ms: [number or "unmeasured"]
baseline_accuracy: [number or "unmeasured"]
accuracy_tolerance: [percentage, e.g., "2%"]
optimizations_applied: [comma-separated list or "none"]
current_best_latency_ms: [number or "unmeasured"]
current_best_accuracy: [number or "unmeasured"]
original_model_path: [absolute path to original model file]
last_action: [what was just done]
next_action: [what should happen next]
blockers: [any issues]
</model-opt-state>
references/output-templates.md.references/quantization-workflows.md.references/conversion-pipelines.md.references/conventions.md.| Skill | Relationship |
|-------|-------------|
| edge-cv-pipeline | After optimizing, build the full inference pipeline (camera capture, pre/postprocessing, result publishing). The optimized model becomes the CV pipeline's inference engine. |
| jetson-deploy | After optimizing for Jetson, containerize the deployment, build the TensorRT engine on-device, configure power modes, and set up tegrastats/jtop monitoring. |
development
Interviews the user relentlessly about a plan, decision, or idea — one question at a time, each with a recommended answer. Shared engine behind "grill-me" and "grill-with-docs". Use on any "grill" trigger phrase or to stress-test thinking. Do NOT use to build the plan; it ends at shared understanding, not implementation.
testing
Runs a relentless interview to sharpen a plan or design, capturing the decisions as ADRs and a glossary along the way. Use when the user wants to be grilled AND wants the session to leave durable domain documentation behind. Do NOT use for a throwaway stress-test with no artifacts; use grill-me instead.
tools
OWASP-based security review of Vue/TypeScript front-ends. Detects framework (Vite/Vue CLI/Nuxt), entry points, and data flows; scans the OWASP Top 10 (2025) mapped to Vue client-side risks (raw-HTML XSS via v-html, URL/protocol injection, bundled secrets, insecure token storage, dependency CVEs, missing CSP, open redirects, router guard bypass); emits an exec summary plus graded findings. Use to audit Vue for vulnerabilities. Not for architecture grading (vue-architecture-checklist).
tools
Analyzes legacy Vue codebases and produces actionable modernization plans. Primary migration paths include Options API to Composition API, Vue 2 to Vue 3, Vue CLI to Vite, JavaScript to TypeScript, Vue Test Utils/Karma/Mocha to Vitest + Vue Testing Library, legacy Vuex to Pinia, and removed-in-Vue-3 pattern cleanup (filters, event bus, `$listeners`). Does NOT perform the migration — assesses, quantifies risk, and plans.