---
name: verify-endpoint
description: Verifica end-to-end di un endpoint REST della Todo API. Usa quando l'utente chiede di "testare", "verificare", "smoke test" o "provare" un endpoint Express del backend.
---

# Verify endpoint (plugin skill)

Verifica rapidamente che un endpoint del backend Todo (`backend/index.js`, porta 3000) risponda correttamente.

## Quando usare questa skill

L'utente chiede di:
- "Verifica che GET /todos funzioni"
- "Smoke test dell'endpoint POST /todos"
- "Provami che PUT /todos/:id risponde 200"

## Passi

1. **Controlla che il server giri** sulla porta 3000:
   - Windows PowerShell: `Test-NetConnection localhost -Port 3000 -InformationLevel Quiet`
   - bash: `nc -z localhost 3000 && echo UP || echo DOWN`
2. Se non gira, avvialo in background: `node backend/index.js &` (Linux/macOS) o come job PowerShell.
3. **Invoca l'endpoint con `curl`** usando un payload realistico.
4. **Mostra status code + body** (formattato JSON).
5. **Cleanup** — se hai avviato tu il server, fermalo.

## Esempio: POST /todos

```bash
curl -i -X POST http://localhost:3000/todos \
  -H "Content-Type: application/json" \
  -d '{"text":"Smoke test todo"}'
```

Atteso: `201 Created` + `{ "id": <n>, "text": "Smoke test todo", "completed": 0 }`.

## Errori comuni

- **ECONNREFUSED** → backend non avviato.
- **400** → body mancante o `text` vuoto: rispetta la validazione del backend.
- **500** → guarda i log del processo backend per lo stack trace.
