Files
repo_Claude/.claude/skills/init-jupyter/SKILL.md
T
egutierrez 4bf7f51613 feat: mejorar init-jupyter para detectar notebooks existentes
Ahora el skill detecta si ya hay archivos .ipynb en el repo o carpeta notebooks.
Si existen, simplemente inicia Jupyter via MCP sin reinicializar el proyecto.
Se garantiza que siempre use MCP para la integración con Claude.
Se agrega Glob a las herramientas permitidas para la detección.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-23 13:03:00 +01:00

117 lines
2.9 KiB
Markdown

---
name: init-jupyter
description: Inicializa o inicia Jupyter Lab via MCP. Detecta notebooks existentes automáticamente.
argument-hint: [ruta-proyecto]
disable-model-invocation: true
user-invocable: true
allowed-tools: Bash, Read, Write, Edit, Glob
---
# Inicializar/Iniciar Proyecto Jupyter via MCP
Este skill gestiona entornos Jupyter Lab integrados con Claude via MCP. Detecta automáticamente si ya existe un proyecto configurado.
## Flujo de decisión
### 1. Detectar notebooks existentes
Buscar archivos `.ipynb` en:
- Raíz del proyecto
- Carpeta `notebooks/`
- Cualquier subcarpeta
```bash
find [ruta] -name "*.ipynb" -type f 2>/dev/null | head -5
```
### 2. Si HAY notebooks existentes → Iniciar directamente
**2a. Verificar que MCP está configurado**
- Comprobar si existe `.claude/settings.local.json` con configuración de jupyter
- Si no existe, crearlo (ver paso 6 del flujo de inicialización)
**2b. Verificar que jupyter-mcp-server está instalado**
```bash
which jupyter-mcp-server || uv tool install jupyter-mcp-server
```
**2c. Iniciar Jupyter via MCP**
```bash
source .venv/bin/activate 2>/dev/null || true
jupyter lab --no-browser --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.disable_check_xsrf=True
```
**2d. Informar al usuario** que Jupyter está corriendo y puede usar las herramientas MCP de Jupyter desde Claude.
### 3. Si NO hay notebooks → Inicializar proyecto completo
Seguir estos pasos:
**3a. Validar ubicación**
- Si se proporciona `$1`, usar esa ruta
- Si no, usar el directorio actual
**3b. Inicializar proyecto con uv** (si no existe pyproject.toml)
```bash
cd [ruta] && uv init
```
**3c. Crear entorno virtual**
```bash
uv venv
```
**3d. Instalar dependencias**
```bash
uv add jupyter jupyter-collaboration
```
**3e. Instalar jupyter-mcp-server**
```bash
uv tool install jupyter-mcp-server
```
**3f. Configurar MCP para Claude**
Crear o actualizar `.claude/settings.local.json`:
```json
{
"mcpServers": {
"jupyter": {
"command": "jupyter-mcp-server",
"args": []
}
}
}
```
**3g. Crear carpeta notebooks** (opcional)
```bash
mkdir -p notebooks
```
**3h. Iniciar Jupyter via MCP**
```bash
source .venv/bin/activate
jupyter lab --no-browser --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.disable_check_xsrf=True
```
## Ejemplos de uso
**Iniciar/inicializar en directorio actual:**
```bash
/init-jupyter
```
**Iniciar/inicializar en ruta específica:**
```bash
/init-jupyter ~/proyectos/mi-analisis
```
## Notas importantes
- **Siempre usa MCP**: Jupyter se ejecuta siempre de forma que Claude pueda interactuar via MCP
- Si detecta notebooks existentes, NO reinicializa el proyecto, solo inicia Jupyter
- Si el proyecto ya tiene `pyproject.toml`, no ejecuta `uv init`
- La configuración MCP se guarda en `.claude/settings.local.json` del proyecto
- El servidor MCP permite a Claude crear, editar y ejecutar celdas de notebooks