add-provider
Checklist for adding a new AI provider (image, video, text, audio) that satisfies all 5 integration principles — ACL, bulkhead, idempotency, observability, and…
Pre-flight checklist that must complete before writing the first line of code for any new feature. Load this skill when starting a new endpoint, service method, or integration. Prevents the most common AI-coding failure mode — writing code before defining layer boundaries, which
$ npx -y skills add yerdaulet-damir/vibe-coding-rules --skill new-feature --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/new-featureContext preview
The summary Claude sees to decide when to auto-load this skill.
Pre-flight checklist that must complete before writing the first line of code for any new feature. Load this skill when starting a new endpoint, service method, or integration. Prevents the most common AI-coding failure mode — writing code before defining layer boundaries, which
name: new-feature description: Pre-flight checklist that must complete before writing the first line of code for any new feature. Load this skill when starting a new endpoint, service method, or integration. Prevents the most common AI-coding failure mode — writing code before defining layer boundaries, which leads to features that work today and break in 3 months.
Do not open any file for editing until all 5 steps below are completed.
---
Write the contract in plain text before any code. Answer these 4 questions:
Endpoint: POST /generate/image
Request: { prompt: str, model_id: str, width: int, height: int }
Response: { task_id: str, status: "queued" }
Side effect: creates a task, holds creditsIf you cannot answer all 4 in 2 sentences, the feature scope is unclear. Stop and clarify with the user.
---
Use this decision matrix to know which files you will create or modify:
| What the feature needs | Layers touched | Files | |----------------------|----------------|-------| | New HTTP endpoint only | Router | `routers/<domain>.py` | | Endpoint + business logic | Router + Service | + `services/<domain>/` | | Logic + database | Router + Service + Repo | + `repositories/protocols.py`, `repositories/sqlalchemy/<domain>.py` | | Logic + external API | Router + Service + Provider | + `providers/<name>.py` | | Logic + credits charge | All of the above + Credits | + `services/credits/user.py` (read-only — single writer!) |
**Write the list:** "This feature touches: Router, Service, Repo."
Do not touch more layers than listed. If you discover you need more, stop and re-plan.
---
Write the test scenario before code. Two scenarios minimum:
# Scenario 1: happy path # Given: user has 10.00 credits, valid prompt # When: POST /generate/image with correct payload # Then: 202 response, task_id returned, credits held # Scenario 2: edge case # Given: user has 0.00 credits # When: POST /generate/image # Then: 402 response, no task created, no credits touched
These become your actual pytest tests in `tests/unit/` or `tests/integration/`.
---
Always build in this order. Never start from the router.
1. Repository (if new data access needed) └── Add method to CreditsRepoProtocol └── Implement in SQLAlchemyCreditsRepo └── Implement in FakeCreditsRepo (tests/conftest.py) 2. Service └── Accepts repo via Protocol (never imports SQLAlchemy) └── Contains all business logic └── Raises domain exceptions (ValueError, not HTTPException) 3. Router └── Thin: validate schema → call service → return response └── Maps domain exceptions to HTTP codes └── No logic beyond 10 lines per endpoint handler 4. Schema └── Request and response Pydantic models └── Goes in schemas/<domain>.py, never inside routers/
Code template for a new router endpoint:
@router.post("/<resource>", response_model=ResourceResponse, status_code=202)
async def create_resource(
body: ResourceRequest,
user_id: str = Depends(get_current_user_id),
service: ResourceService = Depends(get_resource_service),
) -> ResourceResponse:
try:
result = await service.create(user_id=user_id, **body.model_dump())
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
return ResourceResponse.model_validate(result)---
Run through this checklist before calling the feature done:
# Architecture lint — must exit 0 bash scripts/lint-architecture.sh # No SQLAlchemy in service layer grep -rn "AsyncSession\|from sqlalchemy" app/services/<new-service>/ # Auth on every new endpoint grep -n "get_current_user_id" app/routers/<new-router>.py # user_id scoping in every new query grep -n "user_id" app/repositories/sqlalchemy/<new-repo>.py
| Principle | Check | |-----------|-------| | A1 — folder if 3+ endpoints in domain | `ls app/routers/<domain>/` | | A7 — file under 400 LOC | `wc -l app/services/<file>.py` | | B1 — no SQLAlchemy in service | grep above | | B2 — service via Protocol, not concrete | constructor accepts `Protocol` type | | B10 — credits only via CreditsUserService | no direct `repo.hold()` calls |
---
The skill was applied correctly when:
54 production architecture principles your AI coding agent (Claude Code, Cursor) follows automatically. Drop-in CLAUDE.md, .cursor/rules/, and .claude/skills/ for FastAPI, Next.js 15, and Go 1.22+. MIT.
Repo: yerdaulet-damir/vibe-coding-rules
Checklist for adding a new AI provider (image, video, text, audio) that satisfies all 5 integration principles — ACL, bulkhead, idempotency, observability, and…
Systematic 5-step backend debugging flow for AI-coded FastAPI apps. Load this skill when a bug is reported, a test fails, or unexpected behavior appears in any…
Systematic 5-step debugging flow for Next.js 15 + React 19 + TypeScript apps. Load when a UI bug is reported, hydration error appears, Server Action returns…
Systematic 5-step debugging flow for Go 1.22+ services. Load when a test fails, a goroutine leaks, a downstream provider hangs, errors lose context, or…
Pre-flight checklist for adding a new feature to a Go 1.22+ service. Load when creating a new endpoint, internal package, external integration, or background…
Pre-flight checklist for adding a new feature to a Next.js 15 + TypeScript app. Load when creating a new page, route, server action, or feature module. Forces…