scaffold-archipy-interceptorlisted
Install: claude install-skill SyntaxArc/archipy-plugin
# Scaffold ArchiPy Interceptor
## Scope
**Only** `helpers/interceptors/`. Do not create utils or decorators here.
## Before writing files
1. Inspect app bootstrap, existing interceptors/middleware, DI wiring, and the installed ArchiPy version.
2. Infer framework and sync/async style from the repository.
3. Ask only for an unresolved cross-cutting concern or framework choice. Prefer an ArchiPy interceptor whenever it
fits.
4. Preserve existing registration order and modules; do not overwrite.
## Prefer ArchiPy
Check `archipy.helpers.interceptors` (FastAPI / gRPC). Prefer AppUtils auto-registration for stock interceptors. Show
registration via DI or framework APIs from docs / `../archipy-docs/reference.md` (Interceptors).
## Custom interceptor
Create under `helpers/interceptors/` — FastAPI middleware sketch:
```python
from __future__ import annotations
import logging
import time
import uuid
from collections.abc import Awaitable, Callable
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import Response
logger = logging.getLogger(__name__)
class RequestIdMiddleware(BaseHTTPMiddleware):
"""Attach/propagate an X-Request-ID header — cross-cutting only."""
async def dispatch(
self,
request: Request,
call_next: Callable[[Request], Awaitable[Response]],
) -> Response:
request_id = request.headers.get("x-request-id") or str(uuid.uuid4())
started =