start-vibing-stacks 2.5.1 → 2.7.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/dist/detector.js +5 -2
- package/dist/index.js +16 -2
- package/dist/migrate.d.ts +27 -0
- package/dist/migrate.js +217 -0
- package/dist/scanner.js +91 -0
- package/dist/setup.js +10 -0
- package/package.json +1 -1
- package/stacks/_shared/agents/claude-md-compactor.md +1 -0
- package/stacks/_shared/agents/commit-manager.md +1 -0
- package/stacks/_shared/agents/documenter.md +1 -0
- package/stacks/_shared/agents/domain-updater.md +1 -0
- package/stacks/_shared/agents/research-web.md +1 -0
- package/stacks/_shared/agents/security-auditor.md +168 -0
- package/stacks/_shared/agents/tester.md +1 -0
- package/stacks/_shared/hooks/final-check.ts +205 -0
- package/stacks/_shared/hooks/stop-validator.ts +77 -1
- package/stacks/_shared/skills/accessibility-wcag22/SKILL.md +284 -0
- package/stacks/_shared/skills/ci-pipelines/SKILL.md +166 -0
- package/stacks/_shared/skills/codebase-knowledge/SKILL.md +5 -0
- package/stacks/_shared/skills/database-migrations/SKILL.md +256 -0
- package/stacks/_shared/skills/debugging-patterns/SKILL.md +5 -0
- package/stacks/_shared/skills/docker-patterns/SKILL.md +5 -0
- package/stacks/_shared/skills/docs-tracker/SKILL.md +5 -0
- package/stacks/_shared/skills/error-handling/SKILL.md +335 -0
- package/stacks/_shared/skills/final-check/SKILL.md +74 -37
- package/stacks/_shared/skills/git-workflow/SKILL.md +5 -0
- package/stacks/_shared/skills/hook-development/SKILL.md +5 -0
- package/stacks/_shared/skills/observability/SKILL.md +351 -0
- package/stacks/_shared/skills/performance-patterns/SKILL.md +5 -0
- package/stacks/_shared/skills/playwright-automation/SKILL.md +5 -0
- package/stacks/_shared/skills/quality-gate/SKILL.md +5 -0
- package/stacks/_shared/skills/research-cache/SKILL.md +5 -0
- package/stacks/_shared/skills/secrets-management/SKILL.md +245 -0
- package/stacks/_shared/skills/security-baseline/SKILL.md +202 -0
- package/stacks/_shared/skills/test-coverage/SKILL.md +5 -0
- package/stacks/_shared/skills/ui-ux-audit/SKILL.md +5 -0
- package/stacks/frontend/react/skills/preline-ui/SKILL.md +5 -0
- package/stacks/frontend/react/skills/react-patterns/SKILL.md +5 -0
- package/stacks/frontend/react/skills/react-standards/SKILL.md +5 -0
- package/stacks/frontend/react/skills/react-ui-patterns/SKILL.md +5 -0
- package/stacks/frontend/react/skills/shadcn-ui/SKILL.md +5 -0
- package/stacks/frontend/react/skills/tailwind-patterns/SKILL.md +5 -0
- package/stacks/frontend/react/skills/zod-validation/SKILL.md +5 -0
- package/stacks/frontend/react-inertia/skills/inertia-react/SKILL.md +5 -0
- package/stacks/frontend/react-inertia/skills/react-standards/SKILL.md +5 -0
- package/stacks/nodejs/skills/api-security-node/SKILL.md +275 -0
- package/stacks/nodejs/skills/bun-runtime/SKILL.md +5 -0
- package/stacks/nodejs/skills/mongoose-patterns/SKILL.md +5 -0
- package/stacks/nodejs/skills/nextjs-app-router/SKILL.md +5 -0
- package/stacks/nodejs/skills/trpc-api/SKILL.md +5 -0
- package/stacks/nodejs/skills/typescript-strict/SKILL.md +5 -0
- package/stacks/nodejs/stack.json +2 -1
- package/stacks/nodejs/workflows/ci.yml +90 -0
- package/stacks/nodejs/workflows/security.yml +45 -0
- package/stacks/php/skills/api-design/SKILL.md +5 -0
- package/stacks/php/skills/api-security/SKILL.md +5 -0
- package/stacks/php/skills/composer-workflow/SKILL.md +5 -0
- package/stacks/php/skills/external-api-patterns/SKILL.md +5 -0
- package/stacks/php/skills/inertia-react/SKILL.md +5 -0
- package/stacks/php/skills/laravel-inertia-i18n/SKILL.md +5 -0
- package/stacks/php/skills/laravel-octane/SKILL.md +5 -0
- package/stacks/php/skills/laravel-patterns/SKILL.md +5 -0
- package/stacks/php/skills/mariadb-octane/SKILL.md +5 -0
- package/stacks/php/skills/php-patterns/SKILL.md +5 -0
- package/stacks/php/skills/phpstan-analysis/SKILL.md +5 -0
- package/stacks/php/skills/phpunit-testing/SKILL.md +5 -0
- package/stacks/php/skills/security-scan-php/SKILL.md +5 -0
- package/stacks/php/workflows/ci.yml +106 -0
- package/stacks/php/workflows/security.yml +36 -0
- package/stacks/python/skills/api-security-python/SKILL.md +312 -0
- package/stacks/python/skills/async-patterns/SKILL.md +5 -0
- package/stacks/python/skills/django-patterns/SKILL.md +5 -0
- package/stacks/python/skills/fastapi-patterns/SKILL.md +5 -0
- package/stacks/python/skills/pydantic-validation/SKILL.md +5 -0
- package/stacks/python/skills/pytest-testing/SKILL.md +5 -0
- package/stacks/python/skills/python-patterns/SKILL.md +26 -5
- package/stacks/python/skills/python-performance/SKILL.md +5 -0
- package/stacks/python/skills/scripting-automation/SKILL.md +260 -0
- package/stacks/python/stack.json +70 -35
- package/stacks/python/workflows/ci.yml +76 -0
- package/stacks/python/workflows/security.yml +56 -0
- package/templates/CLAUDE-python.md +315 -0
package/stacks/python/stack.json
CHANGED
|
@@ -2,7 +2,76 @@
|
|
|
2
2
|
"id": "python",
|
|
3
3
|
"name": "Python 3.12+",
|
|
4
4
|
"icon": "🐍",
|
|
5
|
-
"runtime": "
|
|
5
|
+
"runtime": "Python 3.12+",
|
|
6
|
+
"minVersion": "3.12.0",
|
|
7
|
+
"packageManager": "uv|pip",
|
|
8
|
+
"extensions": [".py", ".pyi"],
|
|
9
|
+
"testExtensions": ["test_*.py", "*_test.py"],
|
|
10
|
+
"detectFiles": ["pyproject.toml", "requirements.txt", "Pipfile", "setup.py", "manage.py"],
|
|
11
|
+
"commands": {
|
|
12
|
+
"test": "pytest --tb=short",
|
|
13
|
+
"lint": "ruff check .",
|
|
14
|
+
"format": "ruff format .",
|
|
15
|
+
"serve": "uvicorn app.main:app --reload",
|
|
16
|
+
"typecheck": "mypy ."
|
|
17
|
+
},
|
|
18
|
+
"qualityGates": [
|
|
19
|
+
{ "name": "mypy", "command": "mypy .", "required": true, "order": 1 },
|
|
20
|
+
{ "name": "ruff", "command": "ruff check .", "required": true, "order": 2 },
|
|
21
|
+
{ "name": "pytest", "command": "pytest --tb=short", "required": true, "order": 3 }
|
|
22
|
+
],
|
|
23
|
+
"frameworks": [
|
|
24
|
+
{
|
|
25
|
+
"id": "fastapi",
|
|
26
|
+
"name": "FastAPI + Uvicorn",
|
|
27
|
+
"icon": "⚡",
|
|
28
|
+
"detectFiles": ["app/main.py"],
|
|
29
|
+
"default": true,
|
|
30
|
+
"skills": ["fastapi-patterns", "async-patterns"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "django",
|
|
34
|
+
"name": "Django 5+",
|
|
35
|
+
"icon": "🎸",
|
|
36
|
+
"detectFiles": ["manage.py"],
|
|
37
|
+
"skills": ["django-patterns"]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "flask",
|
|
41
|
+
"name": "Flask",
|
|
42
|
+
"icon": "🧪",
|
|
43
|
+
"detectFiles": ["app.py", "wsgi.py"],
|
|
44
|
+
"skills": []
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "scripts",
|
|
48
|
+
"name": "Local Scripts / Automation",
|
|
49
|
+
"icon": "🤖",
|
|
50
|
+
"skills": ["scripting-automation"]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"databases": [
|
|
54
|
+
{ "id": "mysql", "name": "MySQL / MariaDB", "icon": "🐬", "default": true },
|
|
55
|
+
{ "id": "postgresql", "name": "PostgreSQL", "icon": "🐘" },
|
|
56
|
+
{ "id": "sqlite", "name": "SQLite (local)", "icon": "📦" },
|
|
57
|
+
{ "id": "mongodb", "name": "MongoDB", "icon": "🍃" },
|
|
58
|
+
{ "id": "none", "name": "No database", "icon": "⬜" }
|
|
59
|
+
],
|
|
60
|
+
"frontendOptions": [
|
|
61
|
+
{ "id": "react", "name": "React (SPA)", "icon": "⚛️", "frameworks": ["fastapi", "flask", "django"] },
|
|
62
|
+
{ "id": "htmx", "name": "HTMX + Jinja2", "icon": "🔄", "frameworks": ["fastapi", "flask", "django"] },
|
|
63
|
+
{ "id": "none", "name": "API only / CLI only", "icon": "🔌", "default": true }
|
|
64
|
+
],
|
|
65
|
+
"deployTargets": [
|
|
66
|
+
{ "id": "github", "name": "GitHub (git push)", "icon": "🐙" }
|
|
67
|
+
],
|
|
68
|
+
"skills": [
|
|
69
|
+
"python-patterns",
|
|
70
|
+
"pydantic-validation",
|
|
71
|
+
"pytest-testing",
|
|
72
|
+
"python-performance",
|
|
73
|
+
"api-security-python"
|
|
74
|
+
],
|
|
6
75
|
"requirements": [
|
|
7
76
|
{
|
|
8
77
|
"name": "Python",
|
|
@@ -26,39 +95,5 @@
|
|
|
26
95
|
},
|
|
27
96
|
"versionRegex": "pip\\s+(\\d+\\.\\d+\\.?\\d*)"
|
|
28
97
|
}
|
|
29
|
-
],
|
|
30
|
-
"frameworks": [
|
|
31
|
-
{ "id": "fastapi", "name": "FastAPI + Uvicorn", "icon": "⚡" },
|
|
32
|
-
{ "id": "django", "name": "Django 5+", "icon": "🎸" },
|
|
33
|
-
{ "id": "flask", "name": "Flask", "icon": "🧪" },
|
|
34
|
-
{ "id": "vanilla", "name": "Vanilla Python", "icon": "🐍" }
|
|
35
|
-
],
|
|
36
|
-
"databases": [
|
|
37
|
-
{ "id": "postgresql", "name": "PostgreSQL", "icon": "🐘" },
|
|
38
|
-
{ "id": "mysql", "name": "MySQL / MariaDB", "icon": "🐬" },
|
|
39
|
-
{ "id": "mongodb", "name": "MongoDB", "icon": "🍃" },
|
|
40
|
-
{ "id": "sqlite", "name": "SQLite", "icon": "📦" }
|
|
41
|
-
],
|
|
42
|
-
"frontendOptions": [
|
|
43
|
-
{ "id": "react", "name": "React (SPA)", "icon": "⚛️" },
|
|
44
|
-
{ "id": "htmx", "name": "HTMX + Jinja2", "icon": "🔄" },
|
|
45
|
-
{ "id": "none", "name": "API only (no frontend)", "icon": "🔌" }
|
|
46
|
-
],
|
|
47
|
-
"deployTargets": [
|
|
48
|
-
{ "id": "github", "name": "GitHub (git push)", "icon": "🐙" }
|
|
49
|
-
],
|
|
50
|
-
"skills": [
|
|
51
|
-
"python-patterns",
|
|
52
|
-
"fastapi-patterns",
|
|
53
|
-
"django-patterns",
|
|
54
|
-
"pydantic-validation",
|
|
55
|
-
"pytest-testing",
|
|
56
|
-
"async-patterns",
|
|
57
|
-
"python-performance"
|
|
58
|
-
],
|
|
59
|
-
"qualityGates": [
|
|
60
|
-
{ "name": "mypy", "command": "mypy .", "description": "Type checking" },
|
|
61
|
-
{ "name": "ruff", "command": "ruff check .", "description": "Linting" },
|
|
62
|
-
{ "name": "pytest", "command": "pytest --tb=short", "description": "Tests" }
|
|
63
98
|
]
|
|
64
99
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
ci:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
timeout-minutes: 15
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
python: ['3.12']
|
|
22
|
+
fail-fast: false
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python }}
|
|
29
|
+
cache: pip
|
|
30
|
+
|
|
31
|
+
- name: Install uv
|
|
32
|
+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: uv sync --frozen
|
|
36
|
+
|
|
37
|
+
- name: Typecheck (mypy)
|
|
38
|
+
run: uv run mypy .
|
|
39
|
+
|
|
40
|
+
- name: Lint (ruff)
|
|
41
|
+
run: uv run ruff check .
|
|
42
|
+
|
|
43
|
+
- name: Format check (ruff)
|
|
44
|
+
run: uv run ruff format --check .
|
|
45
|
+
|
|
46
|
+
- name: Tests (pytest)
|
|
47
|
+
run: uv run pytest --tb=short --cov --cov-report=xml
|
|
48
|
+
|
|
49
|
+
- uses: codecov/codecov-action@v4
|
|
50
|
+
if: always()
|
|
51
|
+
with:
|
|
52
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
53
|
+
fail_ci_if_error: false
|
|
54
|
+
|
|
55
|
+
security:
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
timeout-minutes: 10
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@v4
|
|
60
|
+
with:
|
|
61
|
+
fetch-depth: 0
|
|
62
|
+
|
|
63
|
+
- uses: actions/setup-python@v5
|
|
64
|
+
with:
|
|
65
|
+
python-version: '3.12'
|
|
66
|
+
|
|
67
|
+
- name: Install pip-audit
|
|
68
|
+
run: pip install pip-audit
|
|
69
|
+
|
|
70
|
+
- name: Audit dependencies
|
|
71
|
+
run: pip-audit --strict --vulnerability-service osv
|
|
72
|
+
|
|
73
|
+
- name: Gitleaks (secret scan)
|
|
74
|
+
uses: gitleaks/gitleaks-action@v2
|
|
75
|
+
env:
|
|
76
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Security
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 4 * * 1'
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
security-events: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
audit:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
timeout-minutes: 10
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.12'
|
|
23
|
+
- run: pip install pip-audit
|
|
24
|
+
- run: pip-audit --strict
|
|
25
|
+
|
|
26
|
+
bandit:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
timeout-minutes: 10
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: '3.12'
|
|
34
|
+
- run: pip install bandit[toml]
|
|
35
|
+
- run: bandit -r . -ll -ii --exclude tests,test
|
|
36
|
+
|
|
37
|
+
gitleaks:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
timeout-minutes: 5
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
with:
|
|
43
|
+
fetch-depth: 0
|
|
44
|
+
- uses: gitleaks/gitleaks-action@v2
|
|
45
|
+
env:
|
|
46
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
47
|
+
|
|
48
|
+
codeql:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
timeout-minutes: 20
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
- uses: github/codeql-action/init@v3
|
|
54
|
+
with:
|
|
55
|
+
languages: python
|
|
56
|
+
- uses: github/codeql-action/analyze@v3
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
> **CHARACTER LIMIT**: Max 40,000 chars. Validate with `wc -m CLAUDE.md` before commit.
|
|
4
|
+
|
|
5
|
+
## Last Change
|
|
6
|
+
|
|
7
|
+
**Branch:** main
|
|
8
|
+
**Date:** {{DATE}}
|
|
9
|
+
**Summary:** Initial project setup with start-vibing-stacks (Python)
|
|
10
|
+
|
|
11
|
+
## 30 Seconds Overview
|
|
12
|
+
|
|
13
|
+
{{PROJECT_NAME}} is a Python 3.12+ project using {{FRAMEWORK}}.
|
|
14
|
+
|
|
15
|
+
## Stack
|
|
16
|
+
|
|
17
|
+
| Component | Technology |
|
|
18
|
+
|-----------|------------|
|
|
19
|
+
| Language | Python >= 3.12 |
|
|
20
|
+
| Framework | {{FRAMEWORK}} |
|
|
21
|
+
| Database | {{DATABASE}} |
|
|
22
|
+
| Type Checking | mypy (strict) |
|
|
23
|
+
| Linting | ruff |
|
|
24
|
+
| Testing | pytest + pytest-asyncio |
|
|
25
|
+
| Validation | Pydantic v2 |
|
|
26
|
+
| HTTP Client | httpx |
|
|
27
|
+
| Package Manager | uv / pip |
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
### FastAPI / Flask Projects
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
project/
|
|
35
|
+
├── CLAUDE.md # This file (40k char max)
|
|
36
|
+
├── pyproject.toml # Dependencies + project config
|
|
37
|
+
├── .env # Secrets (NEVER commit)
|
|
38
|
+
├── .env.example # Template without values
|
|
39
|
+
├── .claude/
|
|
40
|
+
│ ├── agents/ # 6 active subagents
|
|
41
|
+
│ ├── skills/ # Skill systems (auto-injected)
|
|
42
|
+
│ ├── hooks/ # Validation hooks
|
|
43
|
+
│ ├── config/ # Project configuration
|
|
44
|
+
│ └── commands/ # Slash commands
|
|
45
|
+
├── app/
|
|
46
|
+
│ ├── main.py # App entrypoint + startup
|
|
47
|
+
│ ├── api/v1/
|
|
48
|
+
│ │ ├── routes/ # Endpoint modules
|
|
49
|
+
│ │ └── deps.py # Dependencies (auth, db)
|
|
50
|
+
│ ├── models/ # SQLAlchemy / Beanie models
|
|
51
|
+
│ ├── schemas/ # Pydantic schemas
|
|
52
|
+
│ ├── services/ # Business logic layer
|
|
53
|
+
│ ├── core/
|
|
54
|
+
│ │ ├── config.py # Pydantic Settings (env)
|
|
55
|
+
│ │ └── security.py # Auth, hashing
|
|
56
|
+
│ └── utils/ # Helpers
|
|
57
|
+
├── scripts/ # CLI scripts / automation
|
|
58
|
+
├── tests/
|
|
59
|
+
│ ├── conftest.py # Shared fixtures
|
|
60
|
+
│ ├── unit/
|
|
61
|
+
│ └── integration/
|
|
62
|
+
└── alembic/ # DB migrations (if SQL)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Local Scripts / Automation Projects
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
project/
|
|
69
|
+
├── CLAUDE.md
|
|
70
|
+
├── pyproject.toml
|
|
71
|
+
├── .env
|
|
72
|
+
├── .env.example
|
|
73
|
+
├── .claude/
|
|
74
|
+
├── main.py # CLI entry point (argparse)
|
|
75
|
+
├── scripts/
|
|
76
|
+
│ ├── __init__.py
|
|
77
|
+
│ ├── wordpress.py # WordPress API automation
|
|
78
|
+
│ ├── ads_manager.py # Google/Facebook/TikTok Ads
|
|
79
|
+
│ └── data_sync.py # Database sync / ETL
|
|
80
|
+
├── lib/
|
|
81
|
+
│ ├── __init__.py
|
|
82
|
+
│ ├── config.py # Pydantic Settings
|
|
83
|
+
│ ├── http_client.py # Reusable httpx client
|
|
84
|
+
│ ├── logger.py # Structured logging (rich)
|
|
85
|
+
│ └── retry.py # tenacity retry logic
|
|
86
|
+
├── data/ # Input/output data files
|
|
87
|
+
├── logs/ # Log files
|
|
88
|
+
└── tests/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Django Projects
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
project/
|
|
95
|
+
├── CLAUDE.md
|
|
96
|
+
├── pyproject.toml
|
|
97
|
+
├── manage.py
|
|
98
|
+
├── config/ # Settings, URLs, ASGI
|
|
99
|
+
├── apps/
|
|
100
|
+
│ ├── users/ # Per-app: models, views, serializers, tests
|
|
101
|
+
│ └── products/
|
|
102
|
+
└── tests/
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Critical Rules
|
|
106
|
+
|
|
107
|
+
### Python 3.12+ (MANDATORY)
|
|
108
|
+
|
|
109
|
+
- **Type hints on ALL public functions** — parameters, returns, class attributes
|
|
110
|
+
- **Pydantic v2 for all data boundaries** — API schemas, config, external data
|
|
111
|
+
- **`match/case`** for complex branching (3.10+)
|
|
112
|
+
- **`type` keyword** for simple type aliases (3.12+)
|
|
113
|
+
- **f-strings** everywhere, never `%` or `.format()`
|
|
114
|
+
- **Structural pattern matching** over nested if/elif chains
|
|
115
|
+
|
|
116
|
+
### Code Organization
|
|
117
|
+
|
|
118
|
+
- **Thin routes, fat services** — business logic in `services/`, not in routes/views
|
|
119
|
+
- **Repository pattern** for database access — isolate queries from business logic
|
|
120
|
+
- **Dependency injection** — FastAPI `Depends()`, Django class-based views
|
|
121
|
+
- **One concern per module** — a file should do one thing well
|
|
122
|
+
|
|
123
|
+
### Environment Variables & Secrets (MANDATORY)
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# CORRECT: Pydantic Settings loads from .env
|
|
127
|
+
from pydantic_settings import BaseSettings
|
|
128
|
+
|
|
129
|
+
class Settings(BaseSettings):
|
|
130
|
+
DATABASE_URL: str
|
|
131
|
+
SECRET_KEY: str
|
|
132
|
+
API_TOKEN: str
|
|
133
|
+
model_config = {"env_file": ".env"}
|
|
134
|
+
|
|
135
|
+
settings = Settings()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
| Rule | Reason |
|
|
139
|
+
|------|--------|
|
|
140
|
+
| All secrets in `.env` | Never hardcode credentials |
|
|
141
|
+
| `.env` in `.gitignore` | Never commit secrets |
|
|
142
|
+
| `.env.example` always present | Document required variables |
|
|
143
|
+
| Pydantic Settings for loading | Typed, validated, auto-parsed |
|
|
144
|
+
| `--dry-run` flag for destructive scripts | Prevent accidental data loss |
|
|
145
|
+
|
|
146
|
+
### Async vs Sync
|
|
147
|
+
|
|
148
|
+
| Workload | Pattern |
|
|
149
|
+
|----------|---------|
|
|
150
|
+
| I/O-bound (HTTP, DB, files) | `async def` + `httpx` / `asyncpg` |
|
|
151
|
+
| CPU-bound (parsing, computation) | `def` + `multiprocessing` / `concurrent.futures` |
|
|
152
|
+
| Local scripts (simple) | Sync is fine unless hitting APIs in bulk |
|
|
153
|
+
| Bulk API calls | `async def` + `asyncio.gather` + semaphore |
|
|
154
|
+
|
|
155
|
+
### Database Safety
|
|
156
|
+
|
|
157
|
+
- **Parameterized queries ALWAYS** — `cursor.execute(query, params)`
|
|
158
|
+
- **Connection context managers** — auto-close on exit
|
|
159
|
+
- **Migrations** — Alembic (FastAPI) or Django `makemigrations`
|
|
160
|
+
- **Pool connections** in production — `pool_size` + `max_overflow`
|
|
161
|
+
|
|
162
|
+
## Quality Gates
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
mypy . # Type checking (MUST pass)
|
|
166
|
+
ruff check . # Linting (MUST pass)
|
|
167
|
+
ruff format . --check # Format check
|
|
168
|
+
pytest --tb=short # Tests (MUST pass)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## FORBIDDEN
|
|
172
|
+
|
|
173
|
+
### Security (CRITICAL)
|
|
174
|
+
|
|
175
|
+
| Action | Reason |
|
|
176
|
+
|--------|--------|
|
|
177
|
+
| Hardcoded API keys/passwords | Use `.env` + Pydantic Settings |
|
|
178
|
+
| Commit `.env` files | Secrets leak to repository |
|
|
179
|
+
| SQL without parameterization | SQL injection |
|
|
180
|
+
| Deserializing untrusted binary data | Remote code execution risk |
|
|
181
|
+
| `yaml.load()` without SafeLoader | Code injection |
|
|
182
|
+
| No input validation on external data | Use Pydantic models |
|
|
183
|
+
| Storing plaintext passwords | Use `passlib` / `bcrypt` |
|
|
184
|
+
|
|
185
|
+
### Code Quality
|
|
186
|
+
|
|
187
|
+
| Action | Reason |
|
|
188
|
+
|--------|--------|
|
|
189
|
+
| `import *` | Explicit imports only |
|
|
190
|
+
| `requests` library | Use `httpx` (modern, sync+async) |
|
|
191
|
+
| `print()` for logging | Use `logging` module or `rich` |
|
|
192
|
+
| No type hints on public APIs | mypy must pass |
|
|
193
|
+
| Business logic in routes/views | Use services layer |
|
|
194
|
+
| Bare `except Exception` | Catch specific exceptions |
|
|
195
|
+
| `time.sleep()` in async code | Use `await asyncio.sleep()` |
|
|
196
|
+
| Sync HTTP in async context | Blocks the event loop |
|
|
197
|
+
| Global mutable state | Use dependency injection |
|
|
198
|
+
| Files > 400 lines | Split into modules |
|
|
199
|
+
|
|
200
|
+
### Workflow
|
|
201
|
+
|
|
202
|
+
| Action | Reason |
|
|
203
|
+
|--------|--------|
|
|
204
|
+
| Skip tests | Quality gate blocks commit |
|
|
205
|
+
| Skip type checking | mypy catches runtime errors |
|
|
206
|
+
| No `.env.example` | Others can't configure project |
|
|
207
|
+
| No `--dry-run` on destructive scripts | Risk of accidental data loss |
|
|
208
|
+
| Commit directly to main | Use feature branches |
|
|
209
|
+
|
|
210
|
+
## CLAUDE.md Update Rules
|
|
211
|
+
|
|
212
|
+
### When to Update
|
|
213
|
+
|
|
214
|
+
| Change Type | What to Update |
|
|
215
|
+
|-------------|----------------|
|
|
216
|
+
| Any file change | Last Change section |
|
|
217
|
+
| New feature | 30s Overview, Architecture if needed |
|
|
218
|
+
| New pattern | Add to relevant section |
|
|
219
|
+
| Gotcha discovered | Add to FORBIDDEN or NRY |
|
|
220
|
+
| New dependency | Update Stack table |
|
|
221
|
+
|
|
222
|
+
### Last Change Format (MANDATORY)
|
|
223
|
+
|
|
224
|
+
```markdown
|
|
225
|
+
## Last Change
|
|
226
|
+
|
|
227
|
+
**Branch:** feature/example
|
|
228
|
+
**Date:** YYYY-MM-DD
|
|
229
|
+
**Summary:** 1-2 sentences describing WHAT and WHY.
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Agent System
|
|
233
|
+
|
|
234
|
+
| Agent | Purpose |
|
|
235
|
+
|-------|---------|
|
|
236
|
+
| research-web | Researches best practices (MANDATORY for new features) |
|
|
237
|
+
| documenter | Maps files to domains, tracks what exists |
|
|
238
|
+
| domain-updater | Records problems, solutions, learnings |
|
|
239
|
+
| commit-manager | Manages commits and merges |
|
|
240
|
+
| tester | Creates tests with pytest |
|
|
241
|
+
| claude-md-compactor | Compacts CLAUDE.md when over 40k chars |
|
|
242
|
+
|
|
243
|
+
### Skills
|
|
244
|
+
|
|
245
|
+
| Category | Skills |
|
|
246
|
+
|----------|--------|
|
|
247
|
+
| **Core** | python-patterns, pydantic-validation, pytest-testing, python-performance |
|
|
248
|
+
| **Framework** | fastapi-patterns, django-patterns, async-patterns, scripting-automation |
|
|
249
|
+
| **UI** | ui-ux-pro-max (auto-installed for frontend projects) |
|
|
250
|
+
|
|
251
|
+
## Domain Documentation
|
|
252
|
+
|
|
253
|
+
### Location
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
.claude/skills/codebase-knowledge/domains/
|
|
257
|
+
├── api.md
|
|
258
|
+
├── database.md
|
|
259
|
+
├── scripts.md
|
|
260
|
+
└── ...
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Documentation Agents
|
|
264
|
+
|
|
265
|
+
| Agent | Role | When |
|
|
266
|
+
|-------|------|------|
|
|
267
|
+
| **documenter** | Maps files to domains | AFTER implementation |
|
|
268
|
+
| **domain-updater** | Records problems + solutions | BEFORE commit |
|
|
269
|
+
|
|
270
|
+
## Workflow
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
1. TODO LIST → Create detailed task list
|
|
274
|
+
2. RESEARCH → Run research agent for new features
|
|
275
|
+
3. BRANCH → Create feature/ | fix/ | refactor/ | test/
|
|
276
|
+
4. IMPLEMENT → Follow skills + type everything
|
|
277
|
+
5. QUALITY → mypy → ruff → pytest (all must pass)
|
|
278
|
+
6. DOCUMENT → Update domains + CLAUDE.md
|
|
279
|
+
7. COMMIT → Conventional commit format
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Commit Format
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
[type]: [description]
|
|
286
|
+
|
|
287
|
+
- Detail 1
|
|
288
|
+
- Detail 2
|
|
289
|
+
|
|
290
|
+
Generated with Claude Code
|
|
291
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`
|
|
295
|
+
|
|
296
|
+
## NRY (Never Repeat Yourself)
|
|
297
|
+
|
|
298
|
+
- Always check `.claude/skills/` before implementing patterns from scratch
|
|
299
|
+
- Use `tenacity` for retry logic, not hand-rolled loops
|
|
300
|
+
- Use `pydantic_settings` for env config, not `os.getenv()` manually
|
|
301
|
+
- Use `httpx` for HTTP, never `urllib` or `requests`
|
|
302
|
+
- Use `rich` for CLI output, not bare `print()`
|
|
303
|
+
|
|
304
|
+
## Configuration
|
|
305
|
+
|
|
306
|
+
Project-specific settings in `.claude/config/`:
|
|
307
|
+
|
|
308
|
+
- `active-project.json` — Stack, framework, database, skills
|
|
309
|
+
- `security-rules.json` — Security audit rules
|
|
310
|
+
- `standards-review.json` — Imported project standards (if adapted)
|
|
311
|
+
|
|
312
|
+
## Setup by start-vibing
|
|
313
|
+
|
|
314
|
+
This project was set up with `npx start-vibing-stacks`.
|
|
315
|
+
For updates: `npx start-vibing-stacks --force`
|