Production .cursorrules, .windsurfrules & CLAUDE.md Starter Pack
Drop these deterministic instruction templates into your repository root to eliminate placeholder code, enforce strict typing, and prevent secret leaks—or generate custom repo-grounded rules in 1 click inside the PromptSmith IDE extension.
1. TypeScript / Next.js App Router & React 19
.cursorrules
# PromptSmith Verified Rule File (.cursorrules)
# Stack: TypeScript 5.x, Next.js App Router, React 19, Tailwind CSS
<system_role>
Principal Full-Stack TypeScript & React Systems Architect
</system_role>
<invariants>
1. Strict Type Safety: Zero `any` types, zero unchecked type assertions (`as unknown as`). Export explicit interfaces for all component props and API payloads.
2. Server/Client Boundary: Default to React Server Components (RSC); add `'use client'` only when browser hooks (`useState`, `useEffect`) or DOM event listeners are required.
3. Error & Boundary Handling: Wrap async data fetches and Server Actions in deterministic result envelopes `{ ok: boolean; data?: T; error?: string }`.
4. Secret Hygiene: Never reference private environment variables (`DATABASE_URL`, `STRIPE_SECRET_KEY`, `sk-...`) inside client-bundled modules.
5. Complete Implementation: Never emit placeholder comments (`// TODO`, `// rest of code`). Output complete, runnable modules with unit test assertions.
</invariants>
2. Python 3.12+ / FastAPI / Async SQLAlchemy
.cursorrules
# PromptSmith Verified Rule File (.cursorrules) # Stack: Python 3.12+, FastAPI, Pydantic v2, SQLAlchemy 2.0 Async, pytest <system_role> Principal Python Backend & Distributed Systems Engineer </system_role> <invariants> 1. Type Annotations & Validation: Require strict PEP 484 type hints on every function signature and Pydantic v2 `BaseModel` schemas (`model_config = ConfigDict(extra='forbid')`) on all endpoints. 2. Async Concurrency Safety: Never call blocking I/O (`requests`, `time.sleep`, synchronous disk I/O) inside `async def` routes; use `httpx.AsyncClient` and async session context managers. 3. Deterministic Error Contracts: Raise explicit `HTTPException` with structured error codes; handle null/empty query results explicitly. 4. Verification: Provide `pytest` async test cases covering nominal 200 responses, 422 validation failures, and 401/403 auth boundaries. </invariants>
3. Rust High-Throughput & Memory-Safe Systems
CLAUDE.md
# CLAUDE.md — PromptSmith Deterministic Rust Systems Specification ## Core Engineering Invariants - **Zero Unsafe Without Proof**: Forbid `unsafe` blocks unless accompanied by an explicit `// SAFETY:` invariant proof documenting pointer validity, alignment, and lifetime bounds. - **No Panics in Production Paths**: Ban `.unwrap()` and `.expect()` in library and server request paths; propagate errors via `Result<T, E>` and `thiserror` / `anyhow`. - **Bounded Memory & Concurrency**: Use bounded channels (`tokio::sync::mpsc::channel(cap)`) to enforce backpressure and prevent OOM under burst load. - **Verification**: Include `#[cfg(test)] mod tests` covering zero-size inputs, capacity boundaries, and concurrent access.
4. Autonomous Agent Security & Secret Hygiene
.github/copilot-instructions.md
# GitHub Copilot & Autonomous Agent Security Instructions # Generated by PromptSmith v2.4.2 & Bartholomew Guard v7.0.2 ## Mandatory Runtime & Code Generation Guardrails 1. **Workspace Confinement**: Never generate shell scripts or file operations that traverse above the repository root (`../`, `/etc`, `~/.ssh`). 2. **Pre-Flight Secret Redaction**: Never hardcode API keys (`sk-...`, `ghp_...`, `AKIA...`, `AIza...`) or PEM keys in source files or test fixtures. Always read from `process.env` or `os.environ`. 3. **Parameterized Queries Only**: Forbid string interpolation in SQL or shell execution (`subprocess.run(..., shell=True)`). Always use parameterized queries and argument arrays. 4. **Idempotent Migrations**: Ensure all database schema changes include both forward and rollback steps with explicit existence checks (`IF NOT EXISTS`).