diff --git a/CLAUDE.md b/CLAUDE.md index d2809be3..acb130e2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1 +1,4 @@ -1. treat `stream_step` and `stream_loop` as user code. they are convenience functions that could be reimplemented by the user, they *must* stay clean. +1. use `uv` to manage the project; `uv add` and `uv remove` to manage dependencies, `uv run` to run +2. after making changes run lint and typecheck: `uv run ruff check --fix src tests` and `uv run mypy src tests` +3. import by module (except `typing`) to improve readability via namespacing +4. treat `stream_step` and `stream_loop` as user code. they are convenience functions that could be reimplemented by the user, they *must* stay clean. diff --git a/skills/vercel-python-services/SKILL.md b/skills/vercel-python-services/SKILL.md index 67a27186..9460c5f4 100644 --- a/skills/vercel-python-services/SKILL.md +++ b/skills/vercel-python-services/SKILL.md @@ -10,7 +10,7 @@ Build multi-service projects using Vercel's `experimentalServices` API with a Py ## Setup 1. Create the project files (see references for the minimal working example). Choose frameworks for each service according to user's requests. -2. Ensure backend routes match the prefix specified in `vercel.json` (e.g. for `"routePrefix": "/api"` it is `@app.get("/api/health")`, not `@app.get("/health")`) +2. Define backend routes without the `/api` prefix (e.g. `@app.get("/health")`). Vercel strips the prefix before forwarding to the backend. 3. Validate services in `vercel.json` have `entrypoint` and `routePrefix`, but no extra unknown fields, otherwise that will cause preview to crash Only `vercel.json` lives at the root. Each service manages its own dependencies independently. @@ -18,5 +18,4 @@ Only `vercel.json` lives at the root. Each service manages its own dependencies ## Usage - Use `vercel dev -L` from the project root to run all services as one application. The CLI will handle each individual service's routing and dev server and put the application on port 3000. -- Backend routes MUST include the full path with `/api` prefix (e.g. `@app.get("/api/health")`). -- Frontend calls `/api/...` — no localhost URLs, no proxy needed. +- Frontend calls `/api/...` — Vercel routes these to the backend, which sees only the path after the prefix. No localhost URLs, no proxy needed. diff --git a/skills/vercel-python-services/references/fastapi-vite/backend/main.py b/skills/vercel-python-services/references/fastapi-vite/backend/main.py index 660dbf82..dd55e93d 100644 --- a/skills/vercel-python-services/references/fastapi-vite/backend/main.py +++ b/skills/vercel-python-services/references/fastapi-vite/backend/main.py @@ -12,6 +12,6 @@ ) -@app.get("/api/health") +@app.get("/health") async def health() -> dict[str, str]: return {"status": "ok"}