@claude-code-mastery/starter-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/.starter-kit/profiles/clean.md +113 -0
- package/.claude/.starter-kit/profiles/go.md +458 -0
- package/.claude/.starter-kit/profiles/node.md +429 -0
- package/.claude/.starter-kit/profiles/python.md +475 -0
- package/.claude/.starter-kit/shared/analytics-rybbit.md +55 -0
- package/.claude/.starter-kit/shared/claude-md-base.md +93 -0
- package/.claude/.starter-kit/shared/deployment-dokploy.md +158 -0
- package/.claude/.starter-kit/shared/feature-manifest.md +43 -0
- package/.claude/.starter-kit/shared/mcp-and-pooler.md +38 -0
- package/.claude/.starter-kit/shared/mongo-setup.md +20 -0
- package/.claude/.starter-kit/shared/profile-config.md +65 -0
- package/.claude/.starter-kit/shared/seo.md +113 -0
- package/.claude/.starter-kit/shared/sql-setup.md +37 -0
- package/.claude/commands/add-feature.md +349 -0
- package/.claude/commands/add-project-setup.md +156 -0
- package/.claude/commands/architecture.md +27 -0
- package/.claude/commands/commit.md +61 -0
- package/.claude/commands/convert-project-to-starter-kit.md +508 -0
- package/.claude/commands/create-api.md +385 -0
- package/.claude/commands/create-e2e.md +230 -0
- package/.claude/commands/diagram.md +301 -0
- package/.claude/commands/help.md +120 -0
- package/.claude/commands/install-global.md +145 -0
- package/.claude/commands/new-project.md +244 -0
- package/.claude/commands/optimize-docker.md +352 -0
- package/.claude/commands/progress.md +61 -0
- package/.claude/commands/projects-created.md +79 -0
- package/.claude/commands/quickstart.md +105 -0
- package/.claude/commands/refactor.md +267 -0
- package/.claude/commands/remove-project.md +95 -0
- package/.claude/commands/review.md +59 -0
- package/.claude/commands/security-check.md +77 -0
- package/.claude/commands/set-project-profile-default.md +79 -0
- package/.claude/commands/setup.md +337 -0
- package/.claude/commands/show-user-guide.md +58 -0
- package/.claude/commands/starter-kit.md +90 -0
- package/.claude/commands/test-plan.md +118 -0
- package/.claude/commands/update-project.md +413 -0
- package/.claude/commands/what-is-my-ai-doing.md +42 -0
- package/.claude/commands/worktree.md +124 -0
- package/.claude/hooks/block-dangerous-bash.py +55 -0
- package/.claude/hooks/check-branch.sh +116 -0
- package/.claude/hooks/check-e2e.sh +71 -0
- package/.claude/hooks/check-env-sync.sh +41 -0
- package/.claude/hooks/check-file-length.py +47 -0
- package/.claude/hooks/check-ports.sh +59 -0
- package/.claude/hooks/check-rulecatch.sh +33 -0
- package/.claude/hooks/check-rybbit.sh +63 -0
- package/.claude/hooks/lint-on-save.sh +59 -0
- package/.claude/hooks/verify-no-secrets.sh +80 -0
- package/.claude/settings.json +34 -0
- package/.claude/skills/api-conventions/SKILL.md +34 -0
- package/.claude/skills/code-review/SKILL.md +87 -0
- package/.claude/skills/code-review/references/mongodb-checks.md +25 -0
- package/.claude/skills/code-review/references/project-checks.md +38 -0
- package/.claude/skills/create-service/SKILL.md +222 -0
- package/.claude/skills/debugger/SKILL.md +39 -0
- package/.claude/skills/dependency-vetting/SKILL.md +46 -0
- package/.claude/skills/design-review/SKILL.md +50 -0
- package/.claude/skills/mcp-builder/SKILL.md +57 -0
- package/.claude/skills/mongodb-rules/SKILL.md +62 -0
- package/.claude/skills/terminal-tui/SKILL.md +106 -0
- package/.claude/skills/test-writer/SKILL.md +78 -0
- package/LICENSE +21 -0
- package/README.md +2152 -0
- package/bin/cli.js +205 -0
- package/claude-mastery-project.conf +220 -0
- package/global-claude-md/CLAUDE.md +212 -0
- package/global-claude-md/settings.json +3 -0
- package/package.json +81 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
<!-- Part of /new-project scaffolding. Read via .claude/commands/new-project.md when the selection requires it; not a standalone command. -->
|
|
2
|
+
|
|
3
|
+
> This profile builds its CLAUDE.md from `../shared/claude-md-base.md` (the universal rules) plus the profile-specific rules below. Read the base first.
|
|
4
|
+
|
|
5
|
+
## Python Mode — `python` / `py` / `fastapi` / `django` / `flask`
|
|
6
|
+
|
|
7
|
+
**If `python`, `py`, or a Python framework (`fastapi`, `django`, `flask`) is detected in arguments, OR the resolved profile has `language = python`, skip ALL of Steps 1-2 below and follow this section instead.**
|
|
8
|
+
|
|
9
|
+
Python Mode scaffolds a Python project with modern tooling: type hints, async support, pytest, ruff linter, and virtual environment management.
|
|
10
|
+
|
|
11
|
+
### Python Questions (skip any answered by arguments or profile)
|
|
12
|
+
|
|
13
|
+
#### Question P1: Project Type
|
|
14
|
+
"What type of Python project are you building?"
|
|
15
|
+
- **API** — REST API server (Recommended)
|
|
16
|
+
- **Web App** — Server-rendered web application
|
|
17
|
+
- **CLI** — Command-line tool
|
|
18
|
+
- **Full-Stack** — Python API backend + separate frontend
|
|
19
|
+
|
|
20
|
+
#### Question P2: Framework (based on project type)
|
|
21
|
+
|
|
22
|
+
**If API or Full-Stack:**
|
|
23
|
+
"Which Python framework?"
|
|
24
|
+
- **FastAPI** — Modern, async, automatic OpenAPI docs, type-safe (Recommended)
|
|
25
|
+
- **Django** — Full-featured, batteries-included, ORM, admin panel
|
|
26
|
+
- **Flask** — Lightweight, flexible, large ecosystem
|
|
27
|
+
|
|
28
|
+
**If CLI:**
|
|
29
|
+
- Use **Typer** or **Click** (no framework question needed)
|
|
30
|
+
|
|
31
|
+
**If Web App:**
|
|
32
|
+
- **Django** — Full-featured with templates (Recommended)
|
|
33
|
+
- **Flask** — Lightweight with Jinja2 templates
|
|
34
|
+
- **FastAPI** — With Jinja2 templates
|
|
35
|
+
|
|
36
|
+
#### Question P3: Database
|
|
37
|
+
"Which database?"
|
|
38
|
+
- **PostgreSQL** — Recommended for Python APIs
|
|
39
|
+
- **MySQL** — Widely deployed
|
|
40
|
+
- **SQLite** — Embedded, zero config
|
|
41
|
+
- **MongoDB** — Document database
|
|
42
|
+
- **None** — No database
|
|
43
|
+
|
|
44
|
+
#### Question P3.1: MongoDB Connection String (only if MongoDB selected in P3)
|
|
45
|
+
"Do you want to configure your MongoDB connection now?"
|
|
46
|
+
- **Yes, I have a connection string** — User pastes their full `mongodb+srv://...` or `mongodb://...` URI. Write it to `.env` as `STRICTDB_URI=<their-value>`.
|
|
47
|
+
- **No, I'll set it up later** — Skip. Leave `STRICTDB_URI` placeholder in `.env.example` only.
|
|
48
|
+
|
|
49
|
+
If the user provides a connection string:
|
|
50
|
+
1. Write `STRICTDB_URI=<value>` to the project's `.env`
|
|
51
|
+
2. If no database name in URI, ask: "What should the database be called?" and append it to the URI
|
|
52
|
+
|
|
53
|
+
#### Question P4: Package Manager
|
|
54
|
+
"Which package manager?"
|
|
55
|
+
- **pip + venv** — Standard, universal (Recommended)
|
|
56
|
+
- **uv** — Fast, modern pip replacement
|
|
57
|
+
- **poetry** — Dependency management + packaging
|
|
58
|
+
|
|
59
|
+
#### Question P5: Hosting / Deployment
|
|
60
|
+
"Where will this be deployed?" (same as Node.js options)
|
|
61
|
+
- **Dokploy on Hostinger VPS** — Self-hosted Docker containers (Recommended)
|
|
62
|
+
- **Vercel** — Serverless Python
|
|
63
|
+
- **None / Decide later** — Skip deployment scaffolding
|
|
64
|
+
|
|
65
|
+
#### Question P6: Extras (multi-select)
|
|
66
|
+
"What extras do you want to include?"
|
|
67
|
+
- **Docker** — Multi-stage build with python:3.12-slim (Recommended)
|
|
68
|
+
- **GitHub Actions CI** — Automated testing pipeline (pytest, ruff)
|
|
69
|
+
|
|
70
|
+
### Python Project Structure
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
project/
|
|
74
|
+
├── src/
|
|
75
|
+
│ └── app/
|
|
76
|
+
│ ├── __init__.py
|
|
77
|
+
│ ├── main.py # Entry point (FastAPI/Flask app)
|
|
78
|
+
│ ├── config.py # Pydantic BaseSettings for env vars
|
|
79
|
+
│ ├── core/
|
|
80
|
+
│ │ └── db.py # Database connection layer
|
|
81
|
+
│ ├── api/
|
|
82
|
+
│ │ └── v1/
|
|
83
|
+
│ │ ├── __init__.py
|
|
84
|
+
│ │ └── health.py # Health check endpoint
|
|
85
|
+
│ ├── models/
|
|
86
|
+
│ │ └── __init__.py # Pydantic/SQLAlchemy models
|
|
87
|
+
│ └── services/
|
|
88
|
+
│ └── __init__.py # Business logic
|
|
89
|
+
├── tests/
|
|
90
|
+
│ ├── conftest.py # pytest fixtures
|
|
91
|
+
│ ├── test_health.py # Example test
|
|
92
|
+
│ └── e2e/ # E2E tests (if web)
|
|
93
|
+
├── project-docs/
|
|
94
|
+
│ ├── ARCHITECTURE.md
|
|
95
|
+
│ ├── INFRASTRUCTURE.md
|
|
96
|
+
│ └── DECISIONS.md
|
|
97
|
+
├── .claude/
|
|
98
|
+
│ ├── commands/
|
|
99
|
+
│ ├── skills/
|
|
100
|
+
│ ├── hooks/
|
|
101
|
+
│ └── settings.json
|
|
102
|
+
├── pyproject.toml # Project metadata + tool config
|
|
103
|
+
├── requirements.txt # Production dependencies
|
|
104
|
+
├── requirements-dev.txt # Dev dependencies (pytest, ruff, etc.)
|
|
105
|
+
├── ruff.toml # Linter config
|
|
106
|
+
├── Makefile # dev, test, lint, format, run targets
|
|
107
|
+
├── Dockerfile # Multi-stage: python:3.12-slim
|
|
108
|
+
├── .env
|
|
109
|
+
├── .env.example
|
|
110
|
+
├── .gitignore # Python-specific (__pycache__, .venv, etc.)
|
|
111
|
+
├── .dockerignore
|
|
112
|
+
├── CLAUDE.md
|
|
113
|
+
├── CLAUDE.local.md
|
|
114
|
+
└── README.md
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Python Template: `src/app/main.py` (FastAPI)
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
"""FastAPI application entry point."""
|
|
121
|
+
import signal
|
|
122
|
+
import sys
|
|
123
|
+
from contextlib import asynccontextmanager
|
|
124
|
+
|
|
125
|
+
from fastapi import FastAPI
|
|
126
|
+
|
|
127
|
+
from app.config import settings
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@asynccontextmanager
|
|
131
|
+
async def lifespan(app: FastAPI):
|
|
132
|
+
"""Startup and shutdown events."""
|
|
133
|
+
# Startup
|
|
134
|
+
print(f"Starting server on port {settings.port}")
|
|
135
|
+
yield
|
|
136
|
+
# Shutdown
|
|
137
|
+
print("Shutting down...")
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
app = FastAPI(
|
|
141
|
+
title=settings.app_name,
|
|
142
|
+
version="0.1.0",
|
|
143
|
+
lifespan=lifespan,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@app.get("/health")
|
|
148
|
+
async def health_check() -> dict[str, str]:
|
|
149
|
+
"""Health check endpoint."""
|
|
150
|
+
return {"status": "ok"}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# API v1 routes
|
|
154
|
+
from app.api.v1 import health as health_router # noqa: E402
|
|
155
|
+
app.include_router(health_router.router, prefix="/api/v1")
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def handle_signal(signum: int, frame) -> None:
|
|
159
|
+
"""Handle termination signals gracefully."""
|
|
160
|
+
print(f"Received signal {signum}, shutting down...")
|
|
161
|
+
sys.exit(0)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
signal.signal(signal.SIGINT, handle_signal)
|
|
165
|
+
signal.signal(signal.SIGTERM, handle_signal)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Python Template: `src/app/config.py`
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
"""Application configuration via environment variables."""
|
|
172
|
+
from pydantic_settings import BaseSettings
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class Settings(BaseSettings):
|
|
176
|
+
"""Application settings loaded from environment."""
|
|
177
|
+
app_name: str = "My API"
|
|
178
|
+
port: int = 3001
|
|
179
|
+
debug: bool = False
|
|
180
|
+
database_url: str = ""
|
|
181
|
+
|
|
182
|
+
class Config:
|
|
183
|
+
env_file = ".env"
|
|
184
|
+
env_file_encoding = "utf-8"
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
settings = Settings()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Python Template: `tests/conftest.py`
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
"""Shared test fixtures."""
|
|
194
|
+
import pytest
|
|
195
|
+
from httpx import ASGITransport, AsyncClient
|
|
196
|
+
|
|
197
|
+
from app.main import app
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
@pytest.fixture
|
|
201
|
+
async def client():
|
|
202
|
+
"""Async HTTP client for testing."""
|
|
203
|
+
transport = ASGITransport(app=app)
|
|
204
|
+
async with AsyncClient(transport=transport, base_url="http://test") as ac:
|
|
205
|
+
yield ac
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Python Template: `tests/test_health.py`
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
"""Health check endpoint tests."""
|
|
212
|
+
import pytest
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@pytest.mark.anyio
|
|
216
|
+
async def test_health_returns_ok(client):
|
|
217
|
+
"""Health endpoint should return status ok."""
|
|
218
|
+
response = await client.get("/health")
|
|
219
|
+
assert response.status_code == 200
|
|
220
|
+
data = response.json()
|
|
221
|
+
assert data["status"] == "ok"
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@pytest.mark.anyio
|
|
225
|
+
async def test_api_v1_health(client):
|
|
226
|
+
"""API v1 health endpoint should be accessible."""
|
|
227
|
+
response = await client.get("/api/v1/health")
|
|
228
|
+
assert response.status_code == 200
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Python Template: `pyproject.toml`
|
|
232
|
+
|
|
233
|
+
```toml
|
|
234
|
+
[project]
|
|
235
|
+
name = "PROJECT_NAME"
|
|
236
|
+
version = "0.1.0"
|
|
237
|
+
requires-python = ">=3.12"
|
|
238
|
+
|
|
239
|
+
[tool.pytest.ini_options]
|
|
240
|
+
testpaths = ["tests"]
|
|
241
|
+
asyncio_mode = "auto"
|
|
242
|
+
|
|
243
|
+
[tool.ruff]
|
|
244
|
+
target-version = "py312"
|
|
245
|
+
line-length = 100
|
|
246
|
+
|
|
247
|
+
[tool.ruff.lint]
|
|
248
|
+
select = ["E", "F", "I", "N", "W", "UP", "B", "A", "SIM", "TCH"]
|
|
249
|
+
ignore = ["E501"]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Python Template: `Makefile`
|
|
253
|
+
|
|
254
|
+
```makefile
|
|
255
|
+
.PHONY: dev test lint format run install clean
|
|
256
|
+
|
|
257
|
+
install:
|
|
258
|
+
python -m venv .venv
|
|
259
|
+
.venv/bin/pip install -r requirements.txt -r requirements-dev.txt
|
|
260
|
+
|
|
261
|
+
dev:
|
|
262
|
+
.venv/bin/uvicorn app.main:app --reload --host 0.0.0.0 --port 3001
|
|
263
|
+
|
|
264
|
+
run:
|
|
265
|
+
.venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 3001
|
|
266
|
+
|
|
267
|
+
test:
|
|
268
|
+
.venv/bin/pytest -v
|
|
269
|
+
|
|
270
|
+
lint:
|
|
271
|
+
.venv/bin/ruff check src/ tests/
|
|
272
|
+
|
|
273
|
+
format:
|
|
274
|
+
.venv/bin/ruff format src/ tests/
|
|
275
|
+
|
|
276
|
+
clean:
|
|
277
|
+
rm -rf __pycache__ .pytest_cache .ruff_cache htmlcov .coverage
|
|
278
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Python Template: `Dockerfile` (multi-stage)
|
|
282
|
+
|
|
283
|
+
```dockerfile
|
|
284
|
+
# Stage 1: Builder
|
|
285
|
+
FROM python:3.12-slim AS builder
|
|
286
|
+
WORKDIR /app
|
|
287
|
+
|
|
288
|
+
COPY requirements.txt .
|
|
289
|
+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
|
290
|
+
|
|
291
|
+
# Stage 2: Runner
|
|
292
|
+
FROM python:3.12-slim AS runner
|
|
293
|
+
WORKDIR /app
|
|
294
|
+
|
|
295
|
+
# Non-root user
|
|
296
|
+
RUN groupadd --system app && useradd --system --gid app app
|
|
297
|
+
|
|
298
|
+
COPY --from=builder /install /usr/local
|
|
299
|
+
COPY src/ ./src/
|
|
300
|
+
|
|
301
|
+
USER app
|
|
302
|
+
EXPOSE 3001
|
|
303
|
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3001"]
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Python Template: `ruff.toml`
|
|
307
|
+
|
|
308
|
+
```toml
|
|
309
|
+
target-version = "py312"
|
|
310
|
+
line-length = 100
|
|
311
|
+
|
|
312
|
+
[lint]
|
|
313
|
+
select = ["E", "F", "I", "N", "W", "UP", "B", "A", "SIM", "TCH"]
|
|
314
|
+
ignore = ["E501"]
|
|
315
|
+
|
|
316
|
+
[lint.isort]
|
|
317
|
+
known-first-party = ["app"]
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Python Template: `.gitignore`
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
# Python
|
|
324
|
+
__pycache__/
|
|
325
|
+
*.py[cod]
|
|
326
|
+
*$py.class
|
|
327
|
+
*.so
|
|
328
|
+
.venv/
|
|
329
|
+
venv/
|
|
330
|
+
env/
|
|
331
|
+
|
|
332
|
+
# Testing
|
|
333
|
+
.pytest_cache/
|
|
334
|
+
htmlcov/
|
|
335
|
+
.coverage
|
|
336
|
+
|
|
337
|
+
# Environment
|
|
338
|
+
.env
|
|
339
|
+
.env.*
|
|
340
|
+
.env.local
|
|
341
|
+
|
|
342
|
+
# IDE
|
|
343
|
+
.idea/
|
|
344
|
+
.vscode/
|
|
345
|
+
*.swp
|
|
346
|
+
*.swo
|
|
347
|
+
|
|
348
|
+
# OS
|
|
349
|
+
.DS_Store
|
|
350
|
+
Thumbs.db
|
|
351
|
+
|
|
352
|
+
# Build
|
|
353
|
+
dist/
|
|
354
|
+
build/
|
|
355
|
+
*.egg-info/
|
|
356
|
+
|
|
357
|
+
# Claude local overrides
|
|
358
|
+
CLAUDE.local.md
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Python-Specific CLAUDE.md Rules
|
|
362
|
+
|
|
363
|
+
When creating a Python project, the CLAUDE.md MUST include these Python-specific rules:
|
|
364
|
+
|
|
365
|
+
```markdown
|
|
366
|
+
### Python Rules
|
|
367
|
+
|
|
368
|
+
#### Type Hints — ALWAYS
|
|
369
|
+
- EVERY function MUST have type hints for all parameters AND return type
|
|
370
|
+
- Use `str | None` (not `Optional[str]`) — Python 3.10+ union syntax
|
|
371
|
+
- Use `list[str]` (not `List[str]`) — built-in generics
|
|
372
|
+
- Pydantic models for all request/response shapes
|
|
373
|
+
|
|
374
|
+
#### Async/Await — Consistently
|
|
375
|
+
- FastAPI handlers MUST be `async def` when doing I/O
|
|
376
|
+
- Use `asyncpg` for PostgreSQL, `aiomysql` for MySQL
|
|
377
|
+
- NEVER mix sync and async database calls in the same project
|
|
378
|
+
|
|
379
|
+
#### Testing — pytest Only
|
|
380
|
+
- ALWAYS use pytest (never unittest)
|
|
381
|
+
- Use `httpx.AsyncClient` for testing FastAPI endpoints
|
|
382
|
+
- Use fixtures for shared setup (conftest.py)
|
|
383
|
+
- Table-driven tests with `@pytest.mark.parametrize`
|
|
384
|
+
|
|
385
|
+
#### Virtual Environment — MANDATORY
|
|
386
|
+
- ALWAYS use a virtual environment (.venv/)
|
|
387
|
+
- NEVER install packages globally
|
|
388
|
+
- requirements.txt for production, requirements-dev.txt for dev tools
|
|
389
|
+
|
|
390
|
+
#### API Versioning
|
|
391
|
+
- ALL endpoints MUST use `/api/v1/` prefix — same rule as Node.js and Go
|
|
392
|
+
|
|
393
|
+
#### Quality Gates
|
|
394
|
+
- No file > 300 lines (split into modules)
|
|
395
|
+
- No function > 50 lines (extract helper functions)
|
|
396
|
+
- `ruff check` must pass before committing
|
|
397
|
+
- `pytest` must pass before committing
|
|
398
|
+
|
|
399
|
+
#### Graceful Shutdown — MANDATORY
|
|
400
|
+
- Handle SIGINT and SIGTERM signals
|
|
401
|
+
- Close database connections before exiting
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Python Scaffolding Steps
|
|
405
|
+
|
|
406
|
+
1. Create project directory
|
|
407
|
+
2. Create Python directory structure: `src/app/`, `src/app/core/`, `src/app/api/v1/`, `src/app/models/`, `src/app/services/`, `tests/`
|
|
408
|
+
3. Write `src/app/main.py` (framework-specific entry point)
|
|
409
|
+
4. Write `src/app/config.py` (Pydantic BaseSettings)
|
|
410
|
+
5. Write `src/app/api/v1/health.py` (health check endpoint)
|
|
411
|
+
6. Write database layer `src/app/core/db.py` if database was selected
|
|
412
|
+
7. Write `tests/conftest.py` and `tests/test_health.py`
|
|
413
|
+
8. Create `pyproject.toml`, `requirements.txt`, `requirements-dev.txt`
|
|
414
|
+
9. Create `ruff.toml`
|
|
415
|
+
10. Create `Makefile` with dev, test, lint, format, run targets
|
|
416
|
+
11. Create `Dockerfile` (multi-stage with python:3.12-slim)
|
|
417
|
+
12. Create Python-specific CLAUDE.md (with Python rules + universal security rules)
|
|
418
|
+
13. Copy `.claude/` contents from starter kit — only commands with `scope: project` in frontmatter (skills, hooks, settings.json copied in full)
|
|
419
|
+
14. Create `project-docs/` templates (ARCHITECTURE.md, INFRASTRUCTURE.md, DECISIONS.md)
|
|
420
|
+
15. Create `.env`, `.env.example`, `.gitignore` (Python-specific), `.dockerignore`
|
|
421
|
+
16. Create `CLAUDE.local.md` template
|
|
422
|
+
17. Create `README.md` with Python-specific instructions
|
|
423
|
+
18. Create virtual environment: `python -m venv .venv`
|
|
424
|
+
19. Install dependencies: `.venv/bin/pip install -r requirements.txt -r requirements-dev.txt`
|
|
425
|
+
20. Initialize git, create initial commit: "Initial Python project scaffold"
|
|
426
|
+
21. Display verification checklist
|
|
427
|
+
|
|
428
|
+
### Python Verification Checklist
|
|
429
|
+
|
|
430
|
+
After creation, verify and report:
|
|
431
|
+
|
|
432
|
+
**Core files:**
|
|
433
|
+
- [ ] `pyproject.toml` exists with project metadata
|
|
434
|
+
- [ ] `requirements.txt` exists
|
|
435
|
+
- [ ] `requirements-dev.txt` exists
|
|
436
|
+
- [ ] `ruff.toml` exists
|
|
437
|
+
- [ ] `Makefile` exists with dev, test, lint targets
|
|
438
|
+
- [ ] `.env` exists
|
|
439
|
+
- [ ] `.env.example` exists
|
|
440
|
+
- [ ] `.gitignore` includes Python-specific entries (__pycache__, .venv)
|
|
441
|
+
- [ ] `.dockerignore` exists
|
|
442
|
+
- [ ] `CLAUDE.md` has Python-specific rules
|
|
443
|
+
- [ ] `CLAUDE.local.md` exists
|
|
444
|
+
|
|
445
|
+
**Structure:**
|
|
446
|
+
- [ ] `src/app/main.py` exists with entry point
|
|
447
|
+
- [ ] `src/app/config.py` exists with settings
|
|
448
|
+
- [ ] `src/app/api/v1/health.py` exists
|
|
449
|
+
- [ ] `tests/conftest.py` exists
|
|
450
|
+
- [ ] `tests/test_health.py` exists
|
|
451
|
+
- [ ] `project-docs/` has ARCHITECTURE.md, INFRASTRUCTURE.md, DECISIONS.md
|
|
452
|
+
- [ ] `.claude/` has `scope: project` commands only, skills, hooks, settings.json
|
|
453
|
+
|
|
454
|
+
**Testing:**
|
|
455
|
+
- [ ] `.venv/` directory exists (virtual environment)
|
|
456
|
+
- [ ] `make test` runs pytest successfully
|
|
457
|
+
- [ ] `make lint` runs ruff successfully
|
|
458
|
+
|
|
459
|
+
**Database (if selected):**
|
|
460
|
+
- [ ] `src/app/core/db.py` exists with connection layer
|
|
461
|
+
- [ ] Database URL in `.env.example`
|
|
462
|
+
|
|
463
|
+
**Docker (if selected):**
|
|
464
|
+
- [ ] `Dockerfile` exists with multi-stage build (python:3.12-slim)
|
|
465
|
+
|
|
466
|
+
**NOT present (Python projects should NOT have):**
|
|
467
|
+
- [ ] No `package.json` — this is a Python project
|
|
468
|
+
- [ ] No `tsconfig.json`
|
|
469
|
+
- [ ] No `node_modules/`
|
|
470
|
+
- [ ] No `go.mod`
|
|
471
|
+
|
|
472
|
+
Report any missing items.
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Part of /new-project scaffolding. Read via .claude/commands/new-project.md when the selection requires it; not a standalone command. -->
|
|
2
|
+
|
|
3
|
+
## Analytics: Rybbit (if selected)
|
|
4
|
+
|
|
5
|
+
When `rybbit` is selected as the analytics provider, scaffold tracking into the project:
|
|
6
|
+
|
|
7
|
+
### Required Environment Variables
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# .env.example additions
|
|
11
|
+
NEXT_PUBLIC_RYBBIT_SITE_ID=your_rybbit_site_id
|
|
12
|
+
NEXT_PUBLIC_RYBBIT_URL=https://app.rybbit.io
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Next.js Integration (layout.tsx)
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
<head>
|
|
19
|
+
{process.env.NEXT_PUBLIC_RYBBIT_SITE_ID && (
|
|
20
|
+
<script
|
|
21
|
+
src={`${process.env.NEXT_PUBLIC_RYBBIT_URL || 'https://app.rybbit.io'}/api/script.js`}
|
|
22
|
+
data-site-id={process.env.NEXT_PUBLIC_RYBBIT_SITE_ID}
|
|
23
|
+
defer
|
|
24
|
+
/>
|
|
25
|
+
)}
|
|
26
|
+
</head>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Vite / Astro / Static HTML Integration
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<script
|
|
33
|
+
src="https://app.rybbit.io/api/script.js"
|
|
34
|
+
data-site-id="YOUR_SITE_ID"
|
|
35
|
+
defer
|
|
36
|
+
></script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Docker Build Args (for Next.js on Dokploy)
|
|
40
|
+
|
|
41
|
+
When using both Rybbit + Dokploy + Next.js, the Rybbit env vars must be passed as build args:
|
|
42
|
+
|
|
43
|
+
```dockerfile
|
|
44
|
+
ARG NEXT_PUBLIC_RYBBIT_SITE_ID
|
|
45
|
+
ARG NEXT_PUBLIC_RYBBIT_URL
|
|
46
|
+
ENV NEXT_PUBLIC_RYBBIT_SITE_ID=$NEXT_PUBLIC_RYBBIT_SITE_ID
|
|
47
|
+
ENV NEXT_PUBLIC_RYBBIT_URL=$NEXT_PUBLIC_RYBBIT_URL
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Important
|
|
51
|
+
- Each website MUST have its own unique Rybbit site ID
|
|
52
|
+
- Create a new site in the Rybbit dashboard at https://app.rybbit.io
|
|
53
|
+
- NEVER reuse site IDs across different projects
|
|
54
|
+
- After deployment, verify the script is present in the page source
|
|
55
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<!-- Part of /new-project scaffolding. Read via .claude/commands/new-project.md when the selection requires it; not a standalone command. -->
|
|
2
|
+
|
|
3
|
+
### Clean CLAUDE.md content
|
|
4
|
+
|
|
5
|
+
The CLAUDE.md for `clean` mode contains ONLY universal, non-opinionated rules:
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# CLAUDE.md — Project Instructions
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Critical Rules
|
|
13
|
+
|
|
14
|
+
### 0. NEVER Publish Sensitive Data
|
|
15
|
+
|
|
16
|
+
- NEVER commit passwords, API keys, tokens, or secrets to git/npm/docker
|
|
17
|
+
- NEVER commit `.env` files — ALWAYS verify `.env` is in `.gitignore`
|
|
18
|
+
- Before ANY commit: verify no secrets are included
|
|
19
|
+
- NEVER output secrets in suggestions, logs, or responses
|
|
20
|
+
|
|
21
|
+
### 1. NEVER Hardcode Credentials
|
|
22
|
+
|
|
23
|
+
- ALWAYS use environment variables for secrets
|
|
24
|
+
- NEVER put API keys, passwords, or tokens directly in code
|
|
25
|
+
- NEVER hardcode connection strings — use environment variables from .env
|
|
26
|
+
|
|
27
|
+
### 2. ALWAYS Ask Before Deploying
|
|
28
|
+
|
|
29
|
+
- NEVER auto-deploy, even if the fix seems simple
|
|
30
|
+
- NEVER assume approval — wait for explicit "yes, deploy"
|
|
31
|
+
- ALWAYS ask before deploying to production
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## When Something Seems Wrong
|
|
36
|
+
|
|
37
|
+
Before jumping to conclusions:
|
|
38
|
+
|
|
39
|
+
- Missing UI element? → Check feature gates BEFORE assuming bug
|
|
40
|
+
- Empty data? → Check if services are running BEFORE assuming broken
|
|
41
|
+
- 404 error? → Check service separation BEFORE adding endpoint
|
|
42
|
+
- Auth failing? → Check which auth system BEFORE debugging
|
|
43
|
+
- Test failing? → Read the error message fully BEFORE changing code
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Project Documentation
|
|
48
|
+
|
|
49
|
+
| Document | Purpose | When to Read |
|
|
50
|
+
|----------|---------|--------------|
|
|
51
|
+
| `project-docs/ARCHITECTURE.md` | System overview & data flow | Before architectural changes |
|
|
52
|
+
| `project-docs/INFRASTRUCTURE.md` | Deployment details | Before environment changes |
|
|
53
|
+
| `project-docs/DECISIONS.md` | Architectural decisions | Before proposing alternatives |
|
|
54
|
+
|
|
55
|
+
**ALWAYS read relevant docs before making cross-service changes.**
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Git Workflow — Branch FIRST, Work Second
|
|
60
|
+
|
|
61
|
+
**Auto-branch hook is ON by default.** A hook blocks commits to `main`. **ALWAYS check and branch BEFORE editing any files:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# MANDATORY first step — do this BEFORE writing or editing anything:
|
|
65
|
+
git branch --show-current
|
|
66
|
+
# If on main → create a feature branch IMMEDIATELY:
|
|
67
|
+
git checkout -b feat/<task-name>
|
|
68
|
+
# NOW start working.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If you edit files on `main` and then try to commit, the hook will block you. Branch first — it takes 1 second and avoids wasted work.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Workflow Preferences
|
|
76
|
+
|
|
77
|
+
- Quality over speed — if unsure, ask before executing
|
|
78
|
+
- One task, one chat — `/clear` between unrelated tasks
|
|
79
|
+
- When testing: queue observations, fix in batch (not one at a time)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Naming — NEVER Rename Mid-Project
|
|
84
|
+
|
|
85
|
+
If you must rename packages, modules, or key variables:
|
|
86
|
+
|
|
87
|
+
1. Create a checklist of ALL files and references first
|
|
88
|
+
2. Use IDE semantic rename (not search-and-replace)
|
|
89
|
+
3. Full project search for old name after renaming
|
|
90
|
+
4. Check: .md files, .txt files, .env files, comments, strings, paths
|
|
91
|
+
5. Start a FRESH Claude session after renaming
|
|
92
|
+
```
|
|
93
|
+
|