Llm Local Deployment
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Comprehensive guide for deploying LLMs locally using Ollama, vLLM, and llama.cpp. Local deployment offers privacy, cost control, and reduced latency compared to cloud APIs. This skill covers everything from installation to production deployment.
Why This Matters
Local LLM deployment is critical for:
- Data Privacy: No data leaves your infrastructure
- Cost Control: No per-token API costs
- Latency: Zero network latency to model
- Customization: Fine-tune and deploy custom models
- Reliability: No dependency on external APIs
- Compliance: Meet data residency requirements
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
- GPU hardware available (NVIDIA CUDA preferred)
- Sufficient disk space for model storage
- Linux/Unix environment (Windows supported with limitations)
- Basic Docker knowledge
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-local-deployment3description: Comprehensive guide for deploying LLMs locally using Ollama, vLLM, and Use when this capability is needed.4---56# Llm Local Deployment78## 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## Overview17Comprehensive guide for deploying LLMs locally using Ollama, vLLM, and llama.cpp. Local deployment offers privacy, cost control, and reduced latency compared to cloud APIs. This skill covers everything from installation to production deployment.1819## Why This Matters20Local LLM deployment is critical for:21- **Data Privacy**: No data leaves your infrastructure22- **Cost Control**: No per-token API costs23- **Latency**: Zero network latency to model24- **Customization**: Fine-tune and deploy custom models25- **Reliability**: No dependency on external APIs26- **Compliance**: Meet data residency requirements2728---2930## Core Concepts & Rules3132### 1. Core Principles33- Follow established patterns and conventions34- Maintain consistency across codebase35- Document decisions and trade-offs3637### 2. Implementation Guidelines38- Start with the simplest viable solution39- Iterate based on feedback and requirements40- Test thoroughly before deployment414243## Inputs / Outputs / Contracts44#4546## Skill Composition47* **Depends on**: None48* **Compatible with**: None49* **Conflicts with**: None50* **Related Skills**: None5152## Quick Start / Implementation Example53541. Review requirements and constraints552. Set up development environment563. Implement core functionality following patterns574. Write tests for critical paths585. Run tests and fix issues596. Document any deviations or decisions6061```python62# Example implementation following best practices63def example_function():64 # Your implementation here65 pass66```676869## Assumptions70- GPU hardware available (NVIDIA CUDA preferred)71- Sufficient disk space for model storage72- Linux/Unix environment (Windows supported with limitations)73- Basic Docker knowledge7475## Compatibility & Prerequisites7677* **Supported Versions**:78 - Python 3.8+79 - Node.js 16+80 - Modern browsers (Chrome, Firefox, Safari, Edge)81* **Required AI Tools**:82 - Code editor (VS Code recommended)83 - Testing framework appropriate for language84 - Version control (Git)85* **Dependencies**:86 - Language-specific package manager87 - Build tools88 - Testing libraries89* **Environment Setup**:90 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)919293## Test Scenario Matrix (QA Strategy)9495| Type | Focus Area | Required Scenarios / Mocks |96| :--- | :--- | :--- |97| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |98| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |99| **E2E** | User Journey | Critical user flows to test |100| **Performance** | Latency / Load | Benchmark requirements |101| **Security** | Vuln / Auth | SAST/DAST or dependency audit |102| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |103104105## Technical Guardrails & Security Threat Model106107### 1. Security & Privacy (Threat Model)108* **Top Threats**: Injection attacks, authentication bypass, data exposure109- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII110- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager111- [ ] **Authorization**: Validate user permissions before state changes112113### 2. Performance & Resources114- [ ] **Execution Efficiency**: Consider time complexity for algorithms115- [ ] **Memory Management**: Use streams/pagination for large data116- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks117118### 3. Architecture & Scalability119- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection120- [ ] **Modularity**: Decouple logic from UI/Frameworks121122### 4. Observability & Reliability123- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`124- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`125- [ ] **Error Handling**: Standardized error codes, no bare except126- [ ] **Observability Artifacts**:127 - **Log Fields**: timestamp, level, message, request_id128 - **Metrics**: request_count, error_count, response_time129 - **Dashboards/Alerts**: High Error Rate > 5%130131132## Agent Directives & Error Recovery133*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*134135- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.136- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.137- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.138- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.139140141## Definition of Done (DoD) Checklist142143- [ ] Tests passed + coverage met144- [ ] Lint/Typecheck passed145- [ ] Logging/Metrics/Trace implemented146- [ ] Security checks passed147- [ ] Documentation/Changelog updated148- [ ] Accessibility/Performance requirements met (if frontend)149150151## Anti-patterns / Pitfalls152153* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries154* ⚠️ **Watch out for**: Common symptoms and quick fixes155* 💡 **Instead**: Use proper error handling, pagination, and logging156157158## Reference Links & Examples159160* Internal documentation and examples161* Official documentation and best practices162* Community resources and discussions163164165## Versioning & Changelog166167* **Version**: 1.0.0168* **Changelog**:169 - 2026-02-22: Initial version with complete template structure170171---172> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.173<!-- tomevault:4.0:skill_md:2026-04-13 -->