Model Versioning
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Model versioning is practice of tracking and managing different versions of machine learning models throughout their lifecycle. This skill covers versioning strategies, model registries, metadata management, lineage tracking, artifact storage, promotion workflows, A/B testing, and model comparison tools.
Why This Matters
- Traceability: Track model changes and lineage
- Reproducibility: Know which model produced which results
- Rollback: Revert to previous versions if needed
- A/B Testing: Compare model versions in production
- Compliance: Meet regulatory requirements for model tracking
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions
- MLflow server is available
- Model artifacts can be stored
- Versioning strategy is agreed upon
- Sufficient metadata is available
Compatibility
- Python: Full support
- MLflow: Full support
- Git: Full support
- PostgreSQL: Full support
- MinIO: Full support
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
1---2name: model-versioning3description: Model versioning is practice of tracking and managing different versions of machine learning models throughout their lifecycle. This skill covers versioning strategies, model registries, metadata mana4---5
6# Model Versioning
7
8## Skill Profile
9*(Select at least one profile to enable specific modules)*
10- [ ] **DevOps**
11- [x] **Backend**
12- [ ] **Frontend**
13- [ ] **AI-RAG**
14- [ ] **Security Critical**
15
16## Overview
17Model versioning is practice of tracking and managing different versions of machine learning models throughout their lifecycle. This skill covers versioning strategies, model registries, metadata management, lineage tracking, artifact storage, promotion workflows, A/B testing, and model comparison tools.
18
19## Why This Matters
20- **Traceability**: Track model changes and lineage
21- **Reproducibility**: Know which model produced which results
22- **Rollback**: Revert to previous versions if needed
23- **A/B Testing**: Compare model versions in production
24- **Compliance**: Meet regulatory requirements for model tracking
25
26## Core Concepts & Rules
27
28### 1. Core Principles
29- Follow established patterns and conventions
30- Maintain consistency across codebase
31- Document decisions and trade-offs
32
33### 2. Implementation Guidelines
34- Start with the simplest viable solution
35- Iterate based on feedback and requirements
36- Test thoroughly before deployment
37
38
39## Inputs / Outputs / Contracts
40#
41
42## Skill Composition
43* **Depends on**: None
44* **Compatible with**: None
45* **Conflicts with**: None
46* **Related Skills**: None
47
48## Quick Start / Implementation Example
49
501. Review requirements and constraints
512. Set up development environment
523. Implement core functionality following patterns
534. Write tests for critical paths
545. Run tests and fix issues
556. Document any deviations or decisions
56
57```python
58# Example implementation following best practices
59def example_function():
60 # Your implementation here
61 pass
62```
63
64
65## Assumptions
66- MLflow server is available
67- Model artifacts can be stored
68- Versioning strategy is agreed upon
69- Sufficient metadata is available
70
71## Compatibility
72- Python: Full support
73- MLflow: Full support
74- Git: Full support
75- PostgreSQL: Full support
76- MinIO: Full support
77
78## Test Scenario Matrix (QA Strategy)
79
80| Type | Focus Area | Required Scenarios / Mocks |
81| :--- | :--- | :--- |
82| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
83| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |
84| **E2E** | User Journey | Critical user flows to test |
85| **Performance** | Latency / Load | Benchmark requirements |
86| **Security** | Vuln / Auth | SAST/DAST or dependency audit |
87| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
88
89
90## Technical Guardrails & Security Threat Model
91
92### 1. Security & Privacy (Threat Model)
93* **Top Threats**: Injection attacks, authentication bypass, data exposure
94- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII
95- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager
96- [ ] **Authorization**: Validate user permissions before state changes
97
98### 2. Performance & Resources
99- [ ] **Execution Efficiency**: Consider time complexity for algorithms
100- [ ] **Memory Management**: Use streams/pagination for large data
101- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks
102
103### 3. Architecture & Scalability
104- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection
105- [ ] **Modularity**: Decouple logic from UI/Frameworks
106
107### 4. Observability & Reliability
108- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`
109- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`
110- [ ] **Error Handling**: Standardized error codes, no bare except
111- [ ] **Observability Artifacts**:
112 - **Log Fields**: timestamp, level, message, request_id
113 - **Metrics**: request_count, error_count, response_time
114 - **Dashboards/Alerts**: High Error Rate > 5%
115
116
117## Agent Directives & Error Recovery
118*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*
119
120- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.
121- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
122- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.
123- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.
124
125
126## Definition of Done (DoD) Checklist
127
128- [ ] Tests passed + coverage met
129- [ ] Lint/Typecheck passed
130- [ ] Logging/Metrics/Trace implemented
131- [ ] Security checks passed
132- [ ] Documentation/Changelog updated
133- [ ] Accessibility/Performance requirements met (if frontend)
134
135
136## Anti-patterns / Pitfalls
137
138* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries
139* ⚠️ **Watch out for**: Common symptoms and quick fixes
140* 💡 **Instead**: Use proper error handling, pagination, and logging
141
142
143## Reference Links & Examples
144
145* Internal documentation and examples
146* Official documentation and best practices
147* Community resources and discussions
148
149
150## Versioning & Changelog
151
152* **Version**: 1.0.0
153* **Changelog**:
154 - 2026-02-22: Initial version with complete template structure