cs-ml
ML: supervised/unsupervised/RL, CNN/RNN/Transformer, training, evaluation, MLOps, LLM fine-tuning
What this skill does
# cs-ml
## Purpose
This skill handles machine learning tasks, including supervised/unsupervised learning, reinforcement learning, CNN/RNN/Transformer models, training pipelines, evaluation metrics, MLOps workflows, and LLM fine-tuning. It integrates with OpenClaw to automate code generation and execution for ML projects.
## When to Use
Use this skill when building ML models from scratch, fine-tuning pre-trained models like BERT, deploying models via MLOps, or evaluating performance. Apply it for tasks involving large datasets, neural networks, or production pipelines, such as image recognition with CNNs or text generation with Transformers.
## Key Capabilities
- Train supervised models using algorithms like linear regression or decision trees via scikit-learn integration.
- Implement unsupervised learning with K-means clustering or PCA for dimensionality reduction.
- Build and train deep learning models: CNNs for images (e.g., using Keras), RNNs for sequences, or Transformers for NLP tasks.
- Handle RL environments with libraries like Stable Baselines, including Q-learning loops.
- Evaluate models with metrics like accuracy, F1-score, or ROC curves, and generate confusion matrices.
- Manage MLOps: model deployment to containers, monitoring with MLflow, and CI/CD integration.
- Fine-tune LLMs like GPT variants using Hugging Face Transformers, with techniques like LoRA for efficiency.
## Usage Patterns
Invoke this skill via OpenClaw's CLI or API to generate code snippets. For training, specify model type and data source; for evaluation, provide a trained model path. Always set environment variables for authentication, e.g., export $OPENCLAW_API_KEY=your_key. Patterns include:
- Pipeline mode: Chain training and evaluation in a single command.
- Interactive mode: Use for iterative fine-tuning, querying the skill for code adjustments.
- Example 1: Train a CNN for image classification – Call the skill with data path, then run the generated script.
- Example 2: Fine-tune an LLM – Provide a base model and dataset, get a fine-tuning script, and execute it with specified hyperparameters.
## Common Commands/API
Use OpenClaw's CLI for direct execution or API for programmatic access. Authentication requires $OPENCLAW_API_KEY in your environment.
- CLI Command for training a CNN:
`openclaw cs-ml train --model cnn --data /path/to/images --epochs 10 --batch-size 32`
This generates a Python script using TensorFlow:
```python
from tensorflow import keras
model = keras.Sequential([keras.layers.Conv2D(32, 3, activation='relu')])
model.fit(train_data, epochs=10)
```
- CLI Command for LLM fine-tuning:
`openclaw cs-ml fine-tune --model bert --dataset /path/to/text.json --learning-rate 5e-5`
Output script example:
```python
from transformers import BertForSequenceClassification
model = BertForSequenceClassification.from_pretrained('bert-base')
trainer = Trainer(model=model, train_dataset=dataset)
trainer.train()
```
- API Endpoint for evaluation:
POST to `https://api.openclaw.com/cs-ml/evaluate` with JSON body:
`{ "model_path": "/path/to/model.h5", "data_path": "/path/to/test.csv", "metrics": ["accuracy", "f1"] }`
Response includes metrics output.
- Config Format: Use YAML for hyperparameters, e.g.:
```yaml
model: transformer
params:
layers: 12
hidden_size: 768
```
## Integration Notes
Integrate this skill with other OpenClaw skills by chaining commands, e.g., use "data-processing" skill first for data cleaning, then pass output to cs-ml for training. For external tools, set up dependencies like installing TensorFlow via `pip install tensorflow` in your generated scripts. Use $OPENCLAW_API_KEY for API calls in custom code. For MLOps, link with cloud services: export model to S3 with AWS CLI, then deploy via cs-ml command. Ensure compatibility by specifying library versions, e.g., Transformers 4.20+.
## Error Handling
Common errors include data mismatches, authentication failures, or library version conflicts. Handle them as follows:
- Data errors: Check for shape issues in training commands, e.g., if `openclaw cs-ml train` fails with "Input shape mismatch", verify data with `--validate-data` flag.
- Authentication: If API calls fail with 401, ensure $OPENCLAW_API_KEY is set and not expired; retry with `openclaw cs-ml --retry-auth`.
- Runtime errors: For GPU issues in deep learning, add `--device cuda` and handle with try-except in generated code:
```python
try:
model.fit(data)
except RuntimeError as e:
print(f"Error: {e}, falling back to CPU")
```
- General: Log outputs with `--verbose` flag and debug generated scripts line-by-line.
## Graph Relationships
- Related to cluster: computer-science
- Connected tags: ml, deep-learning, neural-networks, transformers, cs
- Links to other skills: depends on "data-processing" for preprocessing; enhances "deployment" for MLOps pipelines; integrates with "nlp" for Transformer-based tasks
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.