docs: Struktur .claude/docs versionieren, working/, Gitea-Index, Regeln
- .gitignore: .claude/docs, rules, commands tracken; settings.local weiter ignorieren - DOCUMENTATION.md: verbindliche Ablage functional/technical/working/issues - .claude/README.md: Agent-Einstieg; GITEA_ISSUES_INDEX aus MCP (Stand 2026-04-08) - Arbeitspapiere von docs/ nach .claude/docs/working/ verschoben - docs/MEMBERSHIP_SYSTEM.md als Stub; kanonisch technical/MEMBERSHIP_SYSTEM.md - CLAUDE.md Pflichtlektüre und Links angepasst; docs/README.md vereinfacht Made-with: Cursor
This commit is contained in:
1 parent
24daeeb83c
commit
7940dc7560
115 files changed
+45622
-1063
No files matched your search
@@ -0,0 +1,93 @@
|
||||
# Coding Rules – Mitai Jinkendo
|
||||
|
||||
Diese Regeln IMMER befolgen. Sie basieren auf Erfahrungen aus der Entwicklung.
|
||||
|
||||
## Backend
|
||||
|
||||
### 1. Auth auf jeden Endpoint
|
||||
```python
|
||||
# Jeder neue Endpoint braucht Auth:
|
||||
@router.get("/neuer-endpoint")
|
||||
def neuer_endpoint(session: dict = Depends(require_auth)):
|
||||
pid = session['profile_id']
|
||||
```
|
||||
|
||||
### 2. Profile-ID aus Session – nie aus Header
|
||||
```python
|
||||
pid = session['profile_id'] # ✅
|
||||
# Nicht: request.headers.get('X-Profile-Id') ❌
|
||||
```
|
||||
|
||||
### 3. bcrypt für Passwörter
|
||||
```python
|
||||
from auth import hash_pin, verify_pin
|
||||
hashed = hash_pin(plain_password) # ✅
|
||||
# Nicht: hashlib.sha256(...) ❌
|
||||
```
|
||||
|
||||
### 4. PostgreSQL-Syntax
|
||||
```python
|
||||
cur.execute("SELECT * FROM t WHERE id = %s AND active = true", (id,))
|
||||
# Nicht: ? und active = 1 (SQLite-Syntax)
|
||||
```
|
||||
|
||||
### 5. Rate Limiting für sensitive Endpoints
|
||||
```python
|
||||
from slowapi import Limiter
|
||||
@router.post("/sensitive")
|
||||
@limiter.limit("5/minute")
|
||||
def sensitive(request: Request, ...):
|
||||
```
|
||||
|
||||
## Frontend
|
||||
|
||||
### 1. api.js für alle API-Calls
|
||||
```javascript
|
||||
await api.listWeight() // ✅
|
||||
await fetch('/api/weight') // ❌ kein Token
|
||||
```
|
||||
|
||||
### 2. Fehlerbehandlung in async Funktionen
|
||||
```javascript
|
||||
try {
|
||||
const data = await api.meinEndpoint()
|
||||
} catch(e) {
|
||||
setError(e.message) // api.js wirft bereits Error mit detail-Text
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Kein TypeScript
|
||||
Das Projekt nutzt bewusst kein TypeScript – keine .ts/.tsx Dateien erstellen.
|
||||
|
||||
### 4. Keine neuen npm-Pakete ohne Absprache
|
||||
Erst fragen, dann installieren.
|
||||
|
||||
### 5. CSS-Variablen statt Hardcoded-Farben
|
||||
```javascript
|
||||
// ✅ Richtig:
|
||||
style={{color: 'var(--accent)'}}
|
||||
|
||||
// ❌ Falsch:
|
||||
style={{color: '#1D9E75'}}
|
||||
```
|
||||
|
||||
## Git & Deployment
|
||||
|
||||
### 1. Nie direkt auf main pushen
|
||||
Immer über Pull Request in Gitea: develop → main
|
||||
|
||||
### 2. develop Branch nie löschen
|
||||
Er ist permanent – nicht nach Merge löschen.
|
||||
|
||||
### 3. .env nie committen
|
||||
Steht in .gitignore – nie entfernen.
|
||||
|
||||
### 4. Commit-Message Format
|
||||
```
|
||||
feat: neues Feature
|
||||
fix: Bugfix
|
||||
refactor: Umbau ohne Funktionsänderung
|
||||
docs: Dokumentation
|
||||
ci: CI/CD Änderungen
|
||||
chore: Maintenance
|
||||
```
|
||||
Reference in new issue
Block a user