Gemma Python Code Assistant
A specialized AI skill leveraging the fine-tuned Gemma 2 2B Instruct model optimized for Python code assistance. This lightweight yet powerful model has been trained using Unsloth for 2x faster inference and is quantized in GGUF format for efficient local execution.
What This Skill Does
This skill provides an AI-powered Python coding assistant that can:
Generate Python code from natural language descriptionsDebug and fix Python code errorsOptimize existing Python implementationsExplain Python code concepts and patternsSuggest best practices and improvementsThe model is based on Google's Gemma 2 2B architecture, fine-tuned specifically for Python development tasks, making it ideal for developers who need quick, reliable coding assistance without requiring large GPU resources.
Instructions for the AI Agent
When this skill is activated, follow these steps:
1. Environment Setup
First, verify the execution environment supports GGUF model inference:
Check for available libraries: `llama-cpp-python`, `transformers`, or compatible GGUF runtimesConfirm Python 3.8+ is availableIf needed, guide the user to install required dependencies: ```bash
pip install llama-cpp-python transformers
```
2. Model Loading
Load the Gemma 2 2B Python Code Assistant model:
Model identifier: `Agnuxo/gemma-2-2b-instruct-python_CODE_assistant-GGUF_16bit`Use 16-bit quantization for optimal balance of performance and qualityConfigure inference parameters: - Temperature: 0.2-0.7 (lower for code generation, higher for explanations)
- Max tokens: 512-2048 depending on task complexity
- Top-p: 0.9
- Repetition penalty: 1.1
3. Task Processing
Process user requests according to these patterns:
**For Code Generation:**
Parse the user's natural language requestConstruct a prompt: "Generate Python code to [task description]"Include any specific requirements (libraries, constraints, input/output format)Return complete, executable code with comments**For Debugging:**
Accept code snippets with error descriptionsConstruct a prompt: "Debug this Python code: [code]\nError: [error message]"Analyze the issue and provide corrected code with explanation**For Optimization:**
Accept existing Python codeConstruct a prompt: "Optimize this Python code for [performance/readability/memory]: [code]"Return improved version with explanation of changes**For Explanations:**
Accept code or concept queriesConstruct a prompt: "Explain this Python code/concept: [code or topic]"Provide clear, educational responses4. Response Formatting
Format all responses with:
Clear section headers (## Generated Code, ## Explanation, ## Improvements)Syntax-highlighted code blocks with ```python markersInline comments in generated codeStep-by-step explanations when debuggingPerformance or complexity notes for optimizations5. Quality Assurance
Before returning results:
Verify code syntax is valid PythonCheck for common security issues (SQL injection, unsafe eval, etc.)Ensure imports are standard library or commonly available packagesAdd type hints where appropriate (Python 3.6+ style)Include docstrings for functions and classes6. Error Handling
If the model cannot complete a request:
Clearly state the limitationSuggest alternative approachesOffer to break the problem into smaller sub-tasksProvide relevant documentation links when appropriateUsage Examples
Example 1: Code Generation
```
User: Create a function to parse CSV files and return a list of dictionaries