Llm Serving
Skill Profile
(Select at least one profile to enable specific modules)
Overview
This is an alias skill so requirements/docs can reference 06-ai-ml-production/llm-serving. In this repo, serving guidance is split across multiple canonical skills for better organization and maintainability.
Why This Matters
LLM serving is critical for:
- Scalability: Handle production traffic efficiently
- Reliability: Ensure consistent model availability
- Performance: Optimize latency and throughput
- Cost Management: Control infrastructure costs
- Observability: Monitor serving metrics
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
- Canonical skills are available and up-to-date
- Basic understanding of serving concepts
- Infrastructure resources available
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
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
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: llm-serving3description: This is an **alias skill** so requirements/docs can reference `06-ai-ml-production/llm-serving`. Use when this capability is needed.4---56# Llm Serving78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17This is an **alias skill** so requirements/docs can reference `06-ai-ml-production/llm-serving`. In this repo, serving guidance is split across multiple canonical skills for better organization and maintainability.1819## Why This Matters20LLM serving is critical for:21- **Scalability**: Handle production traffic efficiently22- **Reliability**: Ensure consistent model availability23- **Performance**: Optimize latency and throughput24- **Cost Management**: Control infrastructure costs25- **Observability**: Monitor serving metrics2627---2829## Core Concepts & Rules3031### 1. Core Principles32- Follow established patterns and conventions33- Maintain consistency across codebase34- Document decisions and trade-offs3536### 2. Implementation Guidelines37- Start with the simplest viable solution38- Iterate based on feedback and requirements39- Test thoroughly before deployment404142## Inputs / Outputs / Contracts43#4445## Skill Composition46* **Depends on**: None47* **Compatible with**: None48* **Conflicts with**: None49* **Related Skills**: None5051## Quick Start / Implementation Example52531. Review requirements and constraints542. Set up development environment553. Implement core functionality following patterns564. Write tests for critical paths575. Run tests and fix issues586. Document any deviations or decisions5960```python61# Example implementation following best practices62def example_function():63 # Your implementation here64 pass65```666768## Assumptions69- Canonical skills are available and up-to-date70- Basic understanding of serving concepts71- Infrastructure resources available7273## Compatibility & Prerequisites7475* **Supported Versions**:76 - Python 3.8+77 - Node.js 16+78 - Modern browsers (Chrome, Firefox, Safari, Edge)79* **Required AI Tools**:80 - Code editor (VS Code recommended)81 - Testing framework appropriate for language82 - Version control (Git)83* **Dependencies**:84 - Language-specific package manager85 - Build tools86 - Testing libraries87* **Environment Setup**:88 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)899091## Test Scenario Matrix (QA Strategy)9293| Type | Focus Area | Required Scenarios / Mocks |94| :--- | :--- | :--- |95| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |96| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |97| **E2E** | User Journey | Critical user flows to test |98| **Performance** | Latency / Load | Benchmark requirements |99| **Security** | Vuln / Auth | SAST/DAST or dependency audit |100| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |101102103## Technical Guardrails & Security Threat Model104105### 1. Security & Privacy (Threat Model)106* **Top Threats**: Injection attacks, authentication bypass, data exposure107- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII108- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager109- [ ] **Authorization**: Validate user permissions before state changes110111### 2. Performance & Resources112- [ ] **Execution Efficiency**: Consider time complexity for algorithms113- [ ] **Memory Management**: Use streams/pagination for large data114- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks115116### 3. Architecture & Scalability117- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection118- [ ] **Modularity**: Decouple logic from UI/Frameworks119120### 4. Observability & Reliability121- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`122- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`123- [ ] **Error Handling**: Standardized error codes, no bare except124- [ ] **Observability Artifacts**:125 - **Log Fields**: timestamp, level, message, request_id126 - **Metrics**: request_count, error_count, response_time127 - **Dashboards/Alerts**: High Error Rate > 5%128129130## Agent Directives & Error Recovery131*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*132133- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.134- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.135- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.136- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.137138139## Definition of Done (DoD) Checklist140141- [ ] Tests passed + coverage met142- [ ] Lint/Typecheck passed143- [ ] Logging/Metrics/Trace implemented144- [ ] Security checks passed145- [ ] Documentation/Changelog updated146- [ ] Accessibility/Performance requirements met (if frontend)147148149## Anti-patterns / Pitfalls150151* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries152* ⚠️ **Watch out for**: Common symptoms and quick fixes153* 💡 **Instead**: Use proper error handling, pagination, and logging154155156## Reference Links & Examples157158* Internal documentation and examples159* Official documentation and best practices160* Community resources and discussions161162163## Versioning & Changelog164165* **Version**: 1.0.0166* **Changelog**:167 - 2026-02-22: Initial version with complete template structure168169---170> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.171<!-- tomevault:4.0:skill_md:2026-04-13 -->