**Version**: 1.0.0
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
agents/ml-expert-specialist.promptexamples/ensemble-methods-example.shexamples/feature-engineering-example.jsexamples/neural-architecture-example.pyreadme.mdresources/architecture-template.yamlresources/ensemble-builder.shresources/ensemble-strategy.yamlresources/feature-config.jsonresources/feature-engineer.jsresources/ml-debugger.pyresources/model-architect.pytests/test_ensemble_builder.pytests/test_feature_engineer.pytests/test_model_architect.pyname: ml-expert description: 'Version: 1.0.0' version: 1.0.0 category: specialists tags:
Version: 1.0.0 Type: Agent-based skill with SDK implementation Domain: Machine learning model implementation, training, and optimization
Implement machine learning solutions including model architectures, training pipelines, optimization strategies, and performance improvements. This skill spawns a specialist ML implementation agent with deep expertise in PyTorch, deep learning architectures, training techniques, and production ML systems.
Use this skill when implementing new ML models, fixing training issues, optimizing performance, implementing research papers, or building production ML pipelines.
This skill activates when users request:
The skill handles:
The ML expert agent handles:
{
"task": "Implement TRM × Titans-MAG architecture",
"requirements": {
"model_type": "transformer",
"parameters": "25M target",
"features": ["sliding_window_attention", "long_term_memory", "ACT"],
"framework": "pytorch",
"constraints": {
"vram": "6GB",
"inference_speed": "real-time"
}
},
"existing_code": {
"files": ["model.py", "config.py"],
"status": "partial_implementation"
},
"reference_materials": {
"papers": ["TRM.pdf", "Titans-MAG.pdf"],
"implementations": ["reference_model.py"]
}
}
{
"status": "implementation_complete",
"deliverables": {
"code_files": [
{
"path": "src/model/titans_mag.py",
"description": "Titans-MAG backbone implementation",
"loc": 350,
"tested": true
}
],
"tests": [
{
"path": "tests/test_model.py",
"coverage": 95,
"all_passing": true
}
],
"documentation": {
"architecture_diagram": "docs/architecture.md",
"usage_examples": "examples/train.py"
}
},
"performance_metrics": {
"parameter_count": "25.6M",
"inference_time": "45ms (GPU)",
"vram_usage": "5.2GB"
},
"validation": {
"unit_tests": "48/48 passing",
"integration_tests": "12/12 passing",
"manual_verification": "Forward/backward pass successful"
}
}
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import asyncio
async def execute_ml_expert(context: dict):
"""Spawn ML implementation specialist agent."""
# Load specialist agent prompt
with open('agents/ml-expert-specialist.prompt', 'r') as f:
specialist_prompt = f.read()
# Configure agent with write permissions (plan mode for safety)
options = ClaudeAgentOptions(
model='claude-sonnet-4-5',
system_prompt=specialist_prompt,
permission_mode='plan', # Show intent before editing
allowed_tools=['Read', 'Write', 'Edit', 'Bash', 'Grep'],
setting_sources=['project']
)
client = ClaudeSDKClient(options)
try:
await client.connect()
# Format task for agent
task = f"""Implement ML solution:
Requirements: {context['requirements']}
Existing code: {context['existing_code']}
Reference materials: {context['reference_materials']}
Deliver production-quality implementation with tests and documentation."""
await client.query(task)
# Collect implementation results
results = []
async for message in client.receive_messages():
if message.type == 'assistant':
results.append(message.content)
return parse_implementation(results)
finally:
await client.disconnect()
scripts/init_model_template.py - Generate model boilerplatescripts/test_model.py - Model testing utilitiesscripts/profile_performance.py - Performance profilingscripts/validate_architecture.py - Architecture validationreferences/pytorch-best-practices.md - PyTorch coding standardsreferences/architecture-patterns.md - Common ML architecture patternsreferences/optimization-techniques.md - Training optimization guidereferences/testing-guide.md - ML testing best practicestemplates/model_template.py - Base model class templatetemplates/trainer_template.py - Training loop templatetemplates/config_template.py - Configuration dataclass templatecreate_model_skeleton() - Generate model file structureadd_tests() - Create test cases for model componentsbenchmark_model() - Performance benchmarkingUser: "Implement the TRM × Titans-MAG architecture from these papers with 25M parameters"
Skill gathers:
- Paper PDFs with architecture details
- Target parameter count constraint
- PyTorch as framework
- GPU memory constraint (6GB)
Agent implements:
- Titans-MAG backbone (sliding window attention, LMM, MAG gate)
- TRM wrapper (multi-pass reasoning)
- ACT head (adaptive computation)
- Full model integration
- Unit tests (95% coverage)
- Usage examples
- Architecture documentation
Deliverables:
- src/model/titans_mag.py (350 LOC)
- src/model/trm_wrapper.py (180 LOC)
- src/model/act_head.py (120 LOC)
- src/model/full_model.py (200 LOC)
- tests/test_*.py (48 tests, all passing)
- docs/architecture.md
User: "The ACT head has variance=0 issue. Add diversity regularization."
Skill gathers:
- Current ACT head implementation
- Diagnosis from ml-training-debugger skill
- Recommended fix (diversity loss)
Agent implements:
- Modify compute_act_loss() method
- Add diversity regularization term
- Update docstrings
- Add test for variance>0
- Verify training runs without warning
Deliverables:
- Modified src/model/act_head.py
- New test: tests/test_act_diversity.py
- Validation: Warning eliminated in training
User: "Model inference is too slow. Optimize for real-time performance."
Skill gathers:
- Current model code
- Profiling results
- Performance requirements (< 100ms)
Agent optimizes:
- Enable gradient checkpointing
- Fuse operations where possible
- Use torch.compile() for JIT optimization
- Optimize tensor operations
- Add caching for repeated computations
Deliverables:
- Optimized model code
- Performance benchmarks (45ms → 28ms)
- Memory usage reduced (6.2GB → 5.2GB)
- All tests still passing
The ML expert agent must:
This skill works with:
If the agent cannot implement the solution:
The agent should NEVER:
Test the skill with:
agents/ml-expert-specialist.promptindex.pyml-expert-process.dottests/README.mdNext Steps: