vibes-plug 1.0.0 → 2.11.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.
Files changed (183) hide show
  1. package/.claude/rules/vibes-plug-core.md +32 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +51 -0
  3. package/.cursorrules +42 -0
  4. package/AGENTS.md +96 -0
  5. package/BLUEPRINT.md +309 -125
  6. package/CHANGELOG.md +183 -1
  7. package/CLAUDE.md +70 -0
  8. package/LICENSE +1 -1
  9. package/README.md +641 -263
  10. package/index.js +19 -0
  11. package/package.json +61 -25
  12. package/plugin.json +24 -7
  13. package/scripts/generate_swarm_gif.py +295 -0
  14. package/scripts/install.js +201 -0
  15. package/skills/accessibility-testing-expert/SKILL.md +116 -0
  16. package/skills/ai-cost-token-optimizer/SKILL.md +82 -0
  17. package/skills/ai-evals-benchmark-expert/SKILL.md +188 -0
  18. package/skills/ai-llm-integration-expert/SKILL.md +147 -122
  19. package/skills/ai-media-generation-expert/SKILL.md +172 -0
  20. package/skills/ai-prompt-engineering-expert/SKILL.md +84 -0
  21. package/skills/angular-expert/SKILL.md +148 -0
  22. package/skills/api-design-expert/SKILL.md +316 -309
  23. package/skills/api-gateway-proxy-expert/SKILL.md +81 -0
  24. package/skills/app-analyzer-optimizer/SKILL.md +195 -188
  25. package/skills/apple-ecosystem-expert/SKILL.md +145 -0
  26. package/skills/{asisten_ramah → asisten-ramah}/SKILL.md +7 -1
  27. package/skills/astro-framework-expert/SKILL.md +200 -0
  28. package/skills/async-queue-temporal-expert/SKILL.md +240 -0
  29. package/skills/authentication-identity-expert/SKILL.md +279 -45
  30. package/skills/auto-doc-updater/SKILL.md +219 -203
  31. package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
  32. package/skills/autonomous-red-teamer/SKILL.md +203 -0
  33. package/skills/autonomous-tdd-debugger/SKILL.md +71 -0
  34. package/skills/background-jobs-queue-expert/SKILL.md +235 -0
  35. package/skills/biome-linter-formatter-expert/SKILL.md +89 -0
  36. package/skills/blockchain-web3-expert/SKILL.md +115 -0
  37. package/skills/bootstrap-to-modern/SKILL.md +93 -86
  38. package/skills/brainstorming/SKILL.md +381 -353
  39. package/skills/browser-automation-expert/SKILL.md +222 -0
  40. package/skills/bun-runtime-expert/SKILL.md +7 -1
  41. package/skills/chatbot-messaging-expert/SKILL.md +114 -0
  42. package/skills/ci-cd-devops-architect/SKILL.md +81 -45
  43. package/skills/cloud-hosting-expert/SKILL.md +249 -243
  44. package/skills/coderabbit/SKILL.md +197 -191
  45. package/skills/compliance-gdpr-privacy-expert/SKILL.md +85 -0
  46. package/skills/cron-scheduler-expert/SKILL.md +304 -0
  47. package/skills/data-pipeline-etl-expert/SKILL.md +84 -0
  48. package/skills/data-telemetry-expert/SKILL.md +218 -212
  49. package/skills/data-visualization-expert/SKILL.md +154 -0
  50. package/skills/database-migration-versioning-expert/SKILL.md +90 -0
  51. package/skills/database-orm-expert/SKILL.md +303 -293
  52. package/skills/dependency-upgrade-migrator/SKILL.md +301 -0
  53. package/skills/design-system-architect/SKILL.md +278 -242
  54. package/skills/desktop-electron-expert/SKILL.md +128 -0
  55. package/skills/documentation-site-expert/SKILL.md +59 -0
  56. package/skills/doku-mcp-server/SKILL.md +257 -0
  57. package/skills/doku-payment-gateway/SKILL.md +233 -0
  58. package/skills/domain-driven-design-expert/SKILL.md +82 -0
  59. package/skills/e2e-testing-expert/SKILL.md +320 -314
  60. package/skills/ecommerce-expert/SKILL.md +87 -0
  61. package/skills/edge-serverless-db-expert/SKILL.md +99 -0
  62. package/skills/email-notification-expert/SKILL.md +368 -0
  63. package/skills/error-resilience-expert/SKILL.md +486 -0
  64. package/skills/event-driven-architect/SKILL.md +86 -80
  65. package/skills/feature-flag-analytics-expert/SKILL.md +66 -0
  66. package/skills/file-upload-media-expert/SKILL.md +437 -0
  67. package/skills/firebase-security-expert/SKILL.md +7 -1
  68. package/skills/form-validation-expert/SKILL.md +407 -0
  69. package/skills/fullstack-expert/SKILL.md +260 -201
  70. package/skills/fullstack-expert/references/api_design_guide.md +466 -466
  71. package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
  72. package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
  73. package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
  74. package/skills/gemini-agent-booster/SKILL.md +142 -104
  75. package/skills/geospatial-maps-expert/SKILL.md +80 -0
  76. package/skills/global-a11y-i18n-expert/SKILL.md +86 -80
  77. package/skills/glsl-shader-expert/SKILL.md +107 -0
  78. package/skills/go-programming-expert/SKILL.md +300 -294
  79. package/skills/graph-rag-knowledge-expert/SKILL.md +159 -0
  80. package/skills/graphql-apollo-expert/SKILL.md +114 -0
  81. package/skills/headless-cms-expert/SKILL.md +181 -0
  82. package/skills/hig/SKILL.md +193 -187
  83. package/skills/js-backend-expert/SKILL.md +218 -191
  84. package/skills/legacy-code-translator/SKILL.md +71 -0
  85. package/skills/local-slm-edge-ai-expert/SKILL.md +167 -0
  86. package/skills/logging-error-tracking-expert/SKILL.md +344 -0
  87. package/skills/mcp-client-orchestrator/SKILL.md +76 -0
  88. package/skills/mcp-server-architect/SKILL.md +226 -126
  89. package/skills/micro-frontend-architect/SKILL.md +112 -0
  90. package/skills/mobile-expo-expert/SKILL.md +191 -185
  91. package/skills/mobile-push-notification-expert/SKILL.md +71 -0
  92. package/skills/modern-css-native-expert/SKILL.md +189 -0
  93. package/skills/monday-design-aesthetic/SKILL.md +72 -66
  94. package/skills/monorepo-architect/SKILL.md +232 -226
  95. package/skills/mpa-orchestrator/SKILL.md +120 -101
  96. package/skills/multi-agent-orchestration/SKILL.md +173 -153
  97. package/skills/multiple-entry-points/SKILL.md +91 -55
  98. package/skills/mvc-expert/SKILL.md +237 -231
  99. package/skills/n8n-automation-expert/SKILL.md +89 -0
  100. package/skills/nextjs-app-router-expert/SKILL.md +148 -0
  101. package/skills/openapi-swagger-codegen-expert/SKILL.md +67 -0
  102. package/skills/payment-gateway-expert/SKILL.md +129 -45
  103. package/skills/pdf-document-generation-expert/SKILL.md +91 -0
  104. package/skills/performance-web-vitals/SKILL.md +337 -331
  105. package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
  106. package/skills/prd-architect/SKILL.md +206 -190
  107. package/skills/proactive-background-watcher/SKILL.md +68 -0
  108. package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
  109. package/skills/production-ready-hardener/SKILL.md +461 -468
  110. package/skills/production-ready-hardener/references/production_checklist.md +161 -161
  111. package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
  112. package/skills/project-context-mapper/SKILL.md +85 -0
  113. package/skills/pwa-offline-first-expert/SKILL.md +185 -0
  114. package/skills/python-programming-expert/SKILL.md +407 -270
  115. package/skills/rate-limit-abuse-prevention/SKILL.md +377 -0
  116. package/skills/realtime-collaboration-expert/SKILL.md +99 -45
  117. package/skills/rich-text-editor-expert/SKILL.md +177 -0
  118. package/skills/rust-programming-expert/SKILL.md +240 -234
  119. package/skills/saas-billing/SKILL.md +382 -376
  120. package/skills/saas-multi-tenant/SKILL.md +256 -236
  121. package/skills/saas-mvp-launcher/SKILL.md +30 -1
  122. package/skills/saas-transformer/SKILL.md +499 -445
  123. package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
  124. package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
  125. package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
  126. package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
  127. package/skills/scalability-clean-code/SKILL.md +234 -228
  128. package/skills/search-engine-expert/SKILL.md +89 -0
  129. package/skills/secure-fuzz-testing/SKILL.md +7 -1
  130. package/skills/self-evolving-memory-graph/SKILL.md +91 -0
  131. package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
  132. package/skills/senior-frontend/SKILL.md +85 -105
  133. package/skills/seo/SKILL.md +258 -224
  134. package/skills/session-context-loader/SKILL.md +83 -0
  135. package/skills/session-handoff-resume/SKILL.md +163 -157
  136. package/skills/{skill_baru → skill-baru}/SKILL.md +177 -146
  137. package/skills/solidjs-expert/SKILL.md +80 -0
  138. package/skills/spa-orchestrator/SKILL.md +306 -287
  139. package/skills/sse-websocket-streaming-expert/SKILL.md +93 -0
  140. package/skills/state-management-expert/SKILL.md +277 -271
  141. package/skills/supabase-migration/SKILL.md +47 -1
  142. package/skills/supabase-security-expert/SKILL.md +248 -242
  143. package/skills/svelte-sveltekit-expert/SKILL.md +91 -0
  144. package/skills/svg-animation-motion-expert/SKILL.md +115 -0
  145. package/skills/tailwind-expert/SKILL.md +139 -187
  146. package/skills/tanstack-query-expert/SKILL.md +204 -198
  147. package/skills/tauri-expert/SKILL.md +7 -1
  148. package/skills/token-saver/SKILL.md +118 -110
  149. package/skills/typescript-expert/SKILL.md +329 -278
  150. package/skills/ui-components-expert/SKILL.md +166 -63
  151. package/skills/ui-ux-pro-max/SKILL.md +221 -200
  152. package/skills/vector-db-rag-expert/SKILL.md +208 -0
  153. package/skills/vibe-code-gardener/SKILL.md +180 -172
  154. package/skills/visual-qa-vision-agent/SKILL.md +71 -0
  155. package/skills/voice-ai-realtime-agent/SKILL.md +202 -0
  156. package/skills/vue-frontend-expert/SKILL.md +132 -0
  157. package/skills/wasm-edge-computing-expert/SKILL.md +97 -0
  158. package/skills/web-3d-graphics-expert/SKILL.md +137 -0
  159. package/skills/web-game-engine-expert/SKILL.md +102 -0
  160. package/skills/web-scraper/SKILL.md +98 -146
  161. package/skills/website-design-cloner/SKILL.md +180 -0
  162. package/skills/webxr-ar-vr-expert/SKILL.md +123 -0
  163. package/skills/wordpress-headless-expert/SKILL.md +144 -0
  164. package/skills/zero-to-prod-orchestrator/SKILL.md +231 -180
  165. package/skills/zero-trust-secret-vault/SKILL.md +88 -0
  166. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  167. package/CONTRIBUTING.md +0 -199
  168. package/SECURITY.md +0 -21
  169. package/banner.png +0 -0
  170. package/skills/senior-fullstack/SKILL.md +0 -167
  171. package/skills/senior-fullstack/references/architecture_patterns.md +0 -160
  172. package/skills/senior-fullstack/references/development_workflows.md +0 -222
  173. package/skills/senior-fullstack/references/tech_stack_guide.md +0 -190
  174. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +0 -114
  175. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +0 -114
  176. package/skills/senior-fullstack/scripts/project_scaffolder.py +0 -114
  177. package/skills/seo-aeo-landing-page-writer/SKILL.md +0 -97
  178. package/skills/seo-geo/SKILL.md +0 -188
  179. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  180. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  181. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  182. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  183. package/skills/ui_ux_expert/SKILL.md +0 -114
@@ -1,271 +1,408 @@
1
- ---
2
- name: python-programming-expert
3
- description: "Expert-level skill for Python programming (Python 3.12/3.13+). Covers type safety, generic syntax (PEP 695), async/await TaskGroups, FastAPI 0.115+, Pydantic v2, uv package manager, Ruff, and pytest in English and Indonesian."
1
+ ---
2
+ name: python-programming-expert
3
+ description: "Expert-level skill for Python programming (Python 3.13/3.14+). Covers type safety, generic syntax (PEP 695), async/await TaskGroups, FastAPI 0.115+, Pydantic v2, uv package manager, Ruff, and pytest in English and Indonesian."
4
4
  author: "Roedy Rustam"
5
- ---
6
-
7
- # Python Programming Expert (3.13 JIT Edition)
8
-
9
- [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
-
11
- ---
12
-
13
- <a name="english"></a>
14
- ## English
15
-
16
- ### Description
17
- Expert-level Python development guidance for **Python 3.13+** with JIT compiler, covering type safety, async patterns, modern web frameworks (FastAPI 0.115+, Django 5.x), Pydantic v2, the `uv` package manager, Ruff linting, and production-grade testing with pytest.
18
-
19
- ### Trigger Conditions
20
- - Writing Python 3.12+ / 3.13+ applications or services.
21
- - Building FastAPI 0.115+ REST APIs or Django 5.x web apps.
22
- - Managing Python projects with the `uv` package manager.
23
- - Implementing async/await patterns with `asyncio.TaskGroup`.
24
- - Writing type-safe Python with Pydantic v2 and modern generics (PEP 695).
25
- - Setting up Ruff for linting + formatting, pytest for testing.
26
-
27
- ### Python 3.13 Key Improvements
28
-
29
- #### JIT Compiler (Experimental Production-Ready)
30
- Python 3.13 ships with an **experimental JIT compiler** based on copy-and-patch. Enable it for CPU-bound workloads:
31
- ```bash
32
- python3.13 --enable-experimental-jit app.py
33
- # Or via env var:
34
- PYTHON_JIT=1 python3.13 app.py
35
- ```
36
- Expected 10-20% speedup for numeric/algorithmic code. Not yet beneficial for I/O-bound async code.
37
-
38
- #### Free-Threaded Mode (No GIL)
39
- Python 3.13 introduces an experimental **free-threaded build** (no GIL), enabling true CPU parallelism with threads:
40
- ```bash
41
- # Install free-threaded build
42
- uv python install 3.13t
43
- python3.13t -X gil=0 my_parallel_app.py
44
- ```
45
-
46
- #### Improved Error Messages
47
- Python 3.13 provides significantly better tracebacks with highlighted variable values and suggestions.
48
-
49
- ### Modern Python Toolchain (2026)
50
-
51
- #### uv — The 2026 Standard Package Manager
52
- Replace `pip`, `pip-tools`, `virtualenv`, `pyenv`, and `poetry` with **uv**:
53
- ```bash
54
- # Create project
55
- uv init my-project
56
- cd my-project
57
-
58
- # Add dependencies
59
- uv add fastapi pydantic httpx
60
-
61
- # Add dev dependencies
62
- uv add --dev pytest ruff mypy
63
-
64
- # Run scripts
65
- uv run python main.py
66
- uv run pytest
67
-
68
- # Sync environment
69
- uv sync
70
-
71
- # Lock dependencies
72
- uv lock
73
- ```
74
-
75
- #### Ruff — Linting + Formatting in One
76
- ```bash
77
- uv add --dev ruff
78
-
79
- # ruff.toml
80
- [tool.ruff]
81
- line-length = 88
82
- target-version = "py313"
83
-
84
- [tool.ruff.lint]
85
- select = ["E", "F", "I", "N", "UP", "B", "SIM", "ANN"]
86
-
87
- # Run
88
- uv run ruff check .
89
- uv run ruff format .
90
- ```
91
-
92
- ### Type Safety Modern Patterns (Python 3.12+)
93
-
94
- #### PEP 695 — New Generic Syntax
95
- ```python
96
- # Old (Python < 3.12)
97
- from typing import TypeVar
98
- T = TypeVar('T')
99
- def first[T](lst: list[T]) -> T: ...
100
-
101
- # New (Python 3.12+) — cleaner, no TypeVar boilerplate
102
- def first[T](lst: list[T]) -> T:
103
- return lst[0]
104
-
105
- type Vector = list[float] # Type alias with 'type' statement
106
- ```
107
-
108
- #### Pydantic v2 Data Validation
109
- ```python
110
- from pydantic import BaseModel, Field, field_validator
111
- from pydantic import EmailStr
112
-
113
- class UserCreate(BaseModel):
114
- name: str = Field(min_length=2, max_length=50)
115
- email: EmailStr
116
- age: int = Field(ge=0, le=150)
117
-
118
- @field_validator('name')
119
- @classmethod
120
- def name_must_not_contain_space(cls, v: str) -> str:
121
- if ' ' in v:
122
- raise ValueError('Name must not have double spaces')
123
- return v.strip()
124
-
125
- # Usage
126
- user = UserCreate(name="Alice", email="alice@example.com", age=30)
127
- user.model_dump() # {'name': 'Alice', 'email': 'alice@example.com', 'age': 30}
128
- ```
129
-
130
- ### FastAPI 0.115+ Best Practices
131
-
132
- #### Lifespan (Replace @app.on_event)
133
- ```python
134
- from contextlib import asynccontextmanager
135
- from fastapi import FastAPI
136
-
137
- @asynccontextmanager
138
- async def lifespan(app: FastAPI):
139
- # Startup: connect DB, warm caches
140
- await db.connect()
141
- yield
142
- # Shutdown: clean up resources
143
- await db.disconnect()
144
-
145
- app = FastAPI(lifespan=lifespan)
146
- ```
147
-
148
- #### Dependency Injection Pattern
149
- ```python
150
- from fastapi import Depends, HTTPException
151
- from sqlalchemy.ext.asyncio import AsyncSession
152
-
153
- async def get_db() -> AsyncSession:
154
- async with async_session_factory() as session:
155
- yield session
156
-
157
- @app.get("/users/{user_id}")
158
- async def get_user(user_id: str, db: AsyncSession = Depends(get_db)):
159
- user = await db.get(User, user_id)
160
- if not user:
161
- raise HTTPException(status_code=404, detail="User not found")
162
- return user
163
- ```
164
-
165
- #### Structured Error Responses
166
- ```python
167
- from fastapi import Request
168
- from fastapi.responses import JSONResponse
169
-
170
- class AppError(Exception):
171
- def __init__(self, message: str, code: str, status: int = 400):
172
- self.message = message
173
- self.code = code
174
- self.status = status
175
-
176
- @app.exception_handler(AppError)
177
- async def app_error_handler(request: Request, exc: AppError):
178
- return JSONResponse(
179
- status_code=exc.status,
180
- content={"error": exc.code, "message": exc.message}
181
- )
182
- ```
183
-
184
- ### Async Patterns asyncio.TaskGroup (Python 3.11+)
185
- ```python
186
- import asyncio
187
-
188
- async def main():
189
- async with asyncio.TaskGroup() as tg:
190
- task_a = tg.create_task(fetch_data("A"))
191
- task_b = tg.create_task(fetch_data("B"))
192
- # Both tasks complete or any exception is raised
193
- results = [task_a.result(), task_b.result()]
194
- ```
195
-
196
- ### Testing with pytest
197
- ```python
198
- import pytest
199
- import pytest_asyncio
200
- from httpx import AsyncClient, ASGITransport
201
-
202
- @pytest_asyncio.fixture
203
- async def client():
204
- async with AsyncClient(
205
- transport=ASGITransport(app=app), base_url="http://test"
206
- ) as ac:
207
- yield ac
208
-
209
- @pytest.mark.asyncio
210
- async def test_get_user(client: AsyncClient):
211
- response = await client.get("/users/123")
212
- assert response.status_code == 200
213
- assert response.json()["id"] == "123"
214
- ```
215
-
216
- ---
217
-
218
- <a name="bahasa-indonesia"></a>
219
- ## Bahasa Indonesia
220
-
221
- ### Deskripsi
222
- Panduan pengembangan Python tingkat ahli untuk **Python 3.13+** dengan JIT compiler, mencakup keamanan tipe, pola async, framework web modern (FastAPI 0.115+, Django 5.x), Pydantic v2, manajer paket `uv`, Ruff, dan pengujian produksi dengan pytest.
223
-
224
- ### Kondisi Pemicu
225
- - Menulis aplikasi atau layanan Python 3.12+/3.13+.
226
- - Membangun REST API FastAPI 0.115+ atau aplikasi web Django 5.x.
227
- - Mengelola proyek Python dengan manajer paket `uv`.
228
- - Mengimplementasikan pola async/await dengan `asyncio.TaskGroup`.
229
- - Menulis Python type-safe dengan Pydantic v2 dan generik modern (PEP 695).
230
- - Menyiapkan Ruff untuk linting + formatting, pytest untuk pengujian.
231
-
232
- ### Python 3.13 — Peningkatan Utama
233
-
234
- #### JIT Compiler
235
- Python 3.13 hadir dengan **JIT compiler eksperimental** berbasis copy-and-patch. Aktifkan dengan `--enable-experimental-jit` atau variabel lingkungan `PYTHON_JIT=1`. Perkiraan peningkatan kecepatan 10-20% untuk kode CPU-bound.
236
-
237
- #### Free-Threaded Mode (Tanpa GIL)
238
- Python 3.13 memperkenalkan **build free-threaded eksperimental** (tanpa GIL), memungkinkan paralelisme CPU sejati dengan thread.
239
-
240
- ### Toolchain Modern (2026)
241
-
242
- #### uv — Manajer Paket Standar 2026
243
- Gantikan `pip`, `pip-tools`, `virtualenv`, `pyenv`, dan `poetry` dengan **uv** — jauh lebih cepat dan terintegrasi dalam satu alat. Gunakan `uv init`, `uv add`, `uv run`, dan `uv sync` untuk semua operasi proyek.
244
-
245
- #### Ruff Linting + Formatting Dalam Satu Alat
246
- Ruff menggantikan Flake8, isort, Black, dan pyupgrade sekaligus — jauh lebih cepat karena ditulis dalam Rust.
247
-
248
- ### Keamanan Tipe — Pola Modern
249
-
250
- #### PEP 695 — Sintaksis Generic Baru
251
- Python 3.12+ memperkenalkan sintaksis generic yang lebih bersih tanpa boilerplate `TypeVar`. Gunakan pernyataan `type` untuk alias tipe.
252
-
253
- #### Pydantic v2
254
- Gunakan `BaseModel`, `Field`, dan `@field_validator` untuk validasi data yang ketat. `model_dump()` dan `model_validate()` menggantikan metode lama.
255
-
256
- ### FastAPI 0.115+ Best Practices
257
-
258
- #### Lifespan (Gantikan @app.on_event)
259
- Gunakan `@asynccontextmanager` dengan parameter `lifespan` di `FastAPI()` untuk startup/shutdown yang bersih.
260
-
261
- #### Dependency Injection
262
- Gunakan `Depends()` untuk injeksi sesi database, autentikasi, dan dependensi lainnya ke route handler.
263
-
264
- #### Error Terstruktur
265
- Buat kelas `Exception` kustom dan daftarkan `exception_handler` global untuk respons error yang konsisten.
266
-
267
- ### Pola Async — asyncio.TaskGroup
268
- Gunakan `asyncio.TaskGroup` (Python 3.11+) sebagai pengganti `asyncio.gather()` yang lebih aman — secara otomatis membatalkan semua task lain jika salah satu gagal.
269
-
270
- ### Pengujian dengan pytest
271
- Gunakan `pytest-asyncio` dan `AsyncClient` dari `httpx` untuk pengujian endpoint async FastAPI yang bersih dan terisolasi.
5
+ ---
6
+
7
+ # Python Programming Expert (3.14 Edition)
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Orchestration & Integration
17
+ Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `project-context-mapper` to ensure cohesive execution.
18
+
19
+ ### Description
20
+ Expert-level Python development guidance for **Python 3.13 / 3.14+** covering JIT compilation, free-threaded (no-GIL) mode, modern type safety patterns, async architecture, and the full production stack: **FastAPI 0.115+**, **Pydantic v2**, **SQLAlchemy 2.x / SQLModel**, **uv**, **Ruff**, and **pytest-asyncio**.
21
+
22
+ ### Trigger Conditions
23
+ - Writing Python 3.13+ / 3.14+ applications or services.
24
+ - Building **FastAPI 0.115+** REST APIs, **Django 5.x**, or **Litestar** web services.
25
+ - Managing Python projects with the **`uv`** package manager.
26
+ - Implementing async/await patterns with `asyncio.TaskGroup` or structured concurrency.
27
+ - Writing type-safe Python with **Pydantic v2** and modern generics (PEP 695/696).
28
+ - Setting up **Ruff** for linting + formatting; **pytest** with `pytest-asyncio` for testing.
29
+ - Building AI backends integrating with LLM APIs (OpenAI, Anthropic, Google GenAI).
30
+
31
+ ---
32
+
33
+ ### Python Version Matrix (2026)
34
+
35
+ | Version | Status | Key Feature |
36
+ |---|---|---|
37
+ | **Python 3.14** | Latest (Oct 2025) | PEP 696 defaults, improved JIT, `@` on types |
38
+ | **Python 3.13** | Stable LTS | JIT compiler, free-threaded mode (no GIL) |
39
+ | **Python 3.12** | Supported | PEP 695 generics, `type` alias statement |
40
+ | **Python 3.11** | Security only | `asyncio.TaskGroup`, `ExceptionGroup` |
41
+
42
+ ---
43
+
44
+ ### Modern Python Toolchain (2026)
45
+
46
+ #### uv The Standard Package Manager
47
+ Replace `pip`, `pip-tools`, `virtualenv`, `pyenv`, and `poetry` entirely with **uv** (written in Rust — 10-100x faster):
48
+ ```bash
49
+ # Create project
50
+ uv init my-api
51
+ cd my-api
52
+
53
+ # Add runtime dependencies
54
+ uv add fastapi pydantic httpx sqlalchemy[asyncio]
55
+
56
+ # Add dev dependencies
57
+ uv add --dev pytest pytest-asyncio ruff mypy httpx
58
+
59
+ # Run scripts (no activation needed)
60
+ uv run python main.py
61
+ uv run pytest
62
+ uv run fastapi dev main.py # Hot reload dev server
63
+
64
+ # Pin exact Python version
65
+ uv python pin 3.13
66
+
67
+ # Sync all environments
68
+ uv sync
69
+ ```
70
+
71
+ #### `pyproject.toml` — Single Config File
72
+ ```toml
73
+ [project]
74
+ name = "my-api"
75
+ version = "0.1.0"
76
+ requires-python = ">=3.13"
77
+ dependencies = [
78
+ "fastapi>=0.115",
79
+ "pydantic>=2.9",
80
+ "sqlalchemy[asyncio]>=2.0",
81
+ "asyncpg>=0.30",
82
+ ]
83
+
84
+ [tool.ruff]
85
+ line-length = 88
86
+ target-version = "py313"
87
+
88
+ [tool.ruff.lint]
89
+ select = ["E", "F", "I", "N", "UP", "B", "SIM", "ANN", "ASYNC"]
90
+
91
+ [tool.ruff.lint.per-file-ignores]
92
+ "tests/**/*.py" = ["ANN"] # No type annotations required in tests
93
+
94
+ [tool.pytest.ini_options]
95
+ asyncio_mode = "auto" # pytest-asyncio auto mode
96
+ ```
97
+
98
+ ---
99
+
100
+ ### Type Safety — Modern Patterns
101
+
102
+ #### PEP 695 — Generic Syntax (Python 3.12+)
103
+ ```python
104
+ # Old way (verbose)
105
+ from typing import TypeVar, Generic
106
+ T = TypeVar('T')
107
+ class Stack(Generic[T]):
108
+ def push(self, item: T) -> None: ...
109
+
110
+ # New way (Python 3.12+) — clean, no boilerplate
111
+ class Stack[T]:
112
+ def __init__(self) -> None:
113
+ self._items: list[T] = []
114
+
115
+ def push(self, item: T) -> None:
116
+ self._items.append(item)
117
+
118
+ def pop(self) -> T:
119
+ return self._items.pop()
120
+
121
+ # Generic functions
122
+ def first[T](lst: list[T]) -> T:
123
+ return lst[0]
124
+
125
+ # Type aliases (PEP 695)
126
+ type Vector = list[float]
127
+ type Matrix[T] = list[list[T]]
128
+ ```
129
+
130
+ #### PEP 696 — TypeVar Defaults (Python 3.14+)
131
+ ```python
132
+ # Default generic types — reduces boilerplate in libraries
133
+ class Response[T = dict]: # T defaults to dict if not specified
134
+ def __init__(self, data: T) -> None:
135
+ self.data = data
136
+
137
+ response = Response({"key": "value"}) # T inferred as dict
138
+ ```
139
+
140
+ #### Pydantic v2 — Production Data Validation
141
+ ```python
142
+ from pydantic import BaseModel, Field, field_validator, model_validator
143
+ from pydantic import EmailStr, SecretStr
144
+ from typing import Annotated
145
+
146
+ # Annotated types for reusability
147
+ PositiveInt = Annotated[int, Field(gt=0)]
148
+ TrimmedStr = Annotated[str, Field(min_length=1, strip_whitespace=True)]
149
+
150
+ class UserCreate(BaseModel):
151
+ model_config = {"str_strip_whitespace": True}
152
+
153
+ name: TrimmedStr = Field(max_length=50)
154
+ email: EmailStr
155
+ age: PositiveInt
156
+ password: SecretStr = Field(min_length=8)
157
+
158
+ @field_validator('name')
159
+ @classmethod
160
+ def validate_name(cls, v: str) -> str:
161
+ if not v.replace(' ', '').isalpha():
162
+ raise ValueError('Name must contain only letters')
163
+ return v.title()
164
+
165
+ @model_validator(mode='after')
166
+ def check_adult_email(self) -> 'UserCreate':
167
+ if self.age < 18 and 'kids' not in self.email:
168
+ raise ValueError('Minors must use a kids account email')
169
+ return self
170
+
171
+ # Usage
172
+ user = UserCreate(name="alice smith", email="alice@example.com", age=25, password="securepassword")
173
+ user.model_dump() # {'name': 'Alice Smith', 'email': 'alice@example.com', 'age': 25}
174
+ user.model_dump(mode='json') # JSON-serializable dict
175
+ ```
176
+
177
+ ---
178
+
179
+ ### FastAPI 0.115+ — Production Patterns
180
+
181
+ #### Application Structure
182
+ ```
183
+ my_api/
184
+ ├── main.py # FastAPI app + lifespan
185
+ ├── routers/
186
+ │ ├── users.py # APIRouter for /users
187
+ │ └── posts.py # APIRouter for /posts
188
+ ├── models/
189
+ │ ├── user.py # Pydantic request/response models
190
+ │ └── post.py
191
+ ├── db/
192
+ │ ├── database.py # SQLAlchemy engine + session
193
+ │ └── models.py # ORM models
194
+ ├── services/
195
+ │ └── user_service.py # Business logic layer
196
+ └── core/
197
+ ├── config.py # Settings with Pydantic BaseSettings
198
+ └── security.py # JWT, hashing
199
+ ```
200
+
201
+ #### Lifespan — Startup & Shutdown
202
+ ```python
203
+ from contextlib import asynccontextmanager
204
+ from fastapi import FastAPI
205
+ from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
206
+
207
+ engine = create_async_engine(settings.DATABASE_URL, echo=False, pool_size=10)
208
+ AsyncSessionLocal = async_sessionmaker(engine, expire_on_commit=False)
209
+
210
+ @asynccontextmanager
211
+ async def lifespan(app: FastAPI):
212
+ # Startup
213
+ async with engine.begin() as conn:
214
+ await conn.run_sync(Base.metadata.create_all)
215
+ print("✅ Database connected")
216
+ yield
217
+ # Shutdown
218
+ await engine.dispose()
219
+ print("✅ Database disconnected")
220
+
221
+ app = FastAPI(title="My API", version="1.0.0", lifespan=lifespan)
222
+ ```
223
+
224
+ #### Dependency Injection Pattern
225
+ ```python
226
+ from typing import Annotated
227
+ from fastapi import Depends, HTTPException, status
228
+ from sqlalchemy.ext.asyncio import AsyncSession
229
+
230
+ async def get_db() -> AsyncSession:
231
+ async with AsyncSessionLocal() as session:
232
+ yield session
233
+
234
+ DbDep = Annotated[AsyncSession, Depends(get_db)]
235
+
236
+ # In routes
237
+ @router.get("/users/{user_id}", response_model=UserResponse)
238
+ async def get_user(user_id: str, db: DbDep):
239
+ user = await db.get(User, user_id)
240
+ if not user:
241
+ raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
242
+ return user
243
+ ```
244
+
245
+ #### Settings with Pydantic BaseSettings
246
+ ```python
247
+ from pydantic_settings import BaseSettings, SettingsConfigDict
248
+
249
+ class Settings(BaseSettings):
250
+ model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
251
+
252
+ DATABASE_URL: str
253
+ SECRET_KEY: str
254
+ ALGORITHM: str = "HS256"
255
+ ACCESS_TOKEN_EXPIRE_MINUTES: int = 15
256
+ ENVIRONMENT: str = "development"
257
+
258
+ @property
259
+ def is_production(self) -> bool:
260
+ return self.ENVIRONMENT == "production"
261
+
262
+ settings = Settings()
263
+ ```
264
+
265
+ #### Structured Error Handling (RFC 9457)
266
+ ```python
267
+ from fastapi import Request
268
+ from fastapi.responses import JSONResponse
269
+
270
+ class AppException(Exception):
271
+ def __init__(self, *, type: str, title: str, status: int, detail: str):
272
+ self.type = type
273
+ self.title = title
274
+ self.status = status
275
+ self.detail = detail
276
+
277
+ @app.exception_handler(AppException)
278
+ async def app_exception_handler(request: Request, exc: AppException) -> JSONResponse:
279
+ return JSONResponse(
280
+ status_code=exc.status,
281
+ content={
282
+ "type": exc.type,
283
+ "title": exc.title,
284
+ "status": exc.status,
285
+ "detail": exc.detail,
286
+ }
287
+ )
288
+
289
+ # Usage in routes
290
+ raise AppException(
291
+ type="https://myapi.com/errors/user-not-found",
292
+ title="User Not Found",
293
+ status=404,
294
+ detail=f"User with id '{user_id}' does not exist",
295
+ )
296
+ ```
297
+
298
+ ---
299
+
300
+ ### Async Patterns
301
+
302
+ #### asyncio.TaskGroup (Python 3.11+)
303
+ ```python
304
+ import asyncio
305
+
306
+ async def main():
307
+ # Better than asyncio.gather — propagates exceptions immediately
308
+ async with asyncio.TaskGroup() as tg:
309
+ task_users = tg.create_task(fetch_users())
310
+ task_posts = tg.create_task(fetch_posts())
311
+ task_stats = tg.create_task(fetch_stats())
312
+ # All tasks complete here — exception in any task cancels all others
313
+ return task_users.result(), task_posts.result(), task_stats.result()
314
+ ```
315
+
316
+ #### Python 3.13 — JIT & Free-Threaded Mode
317
+ ```bash
318
+ # JIT compiler — 10-20% speedup on CPU-bound code
319
+ PYTHON_JIT=1 python3.13 compute_heavy.py
320
+
321
+ # Free-threaded build (no GIL) — true CPU parallelism
322
+ uv python install 3.13t # install free-threaded build
323
+ python3.13t -X gil=0 parallel_app.py
324
+ ```
325
+
326
+ ---
327
+
328
+ ### Testing with pytest + pytest-asyncio
329
+ ```python
330
+ # conftest.py
331
+ import pytest
332
+ from httpx import AsyncClient, ASGITransport
333
+ from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
334
+
335
+ TEST_DATABASE_URL = "sqlite+aiosqlite:///:memory:"
336
+
337
+ @pytest.fixture
338
+ async def db_session():
339
+ engine = create_async_engine(TEST_DATABASE_URL)
340
+ async with engine.begin() as conn:
341
+ await conn.run_sync(Base.metadata.create_all)
342
+ async with async_sessionmaker(engine)() as session:
343
+ yield session
344
+ await engine.dispose()
345
+
346
+ @pytest.fixture
347
+ async def client(db_session):
348
+ app.dependency_overrides[get_db] = lambda: db_session
349
+ async with AsyncClient(
350
+ transport=ASGITransport(app=app), base_url="http://test"
351
+ ) as ac:
352
+ yield ac
353
+
354
+ # test_users.py
355
+ async def test_create_user(client: AsyncClient):
356
+ response = await client.post("/users", json={"name": "Alice", "email": "alice@test.com", "age": 25, "password": "password123"})
357
+ assert response.status_code == 201
358
+ data = response.json()
359
+ assert data["email"] == "alice@test.com"
360
+ ```
361
+
362
+ ---
363
+
364
+ <a name="bahasa-indonesia"></a>
365
+ ## Bahasa Indonesia
366
+
367
+ ### Integrasi Orkestrasi
368
+ Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `project-context-mapper` untuk memastikan eksekusi yang kohesif.
369
+
370
+ ### Deskripsi
371
+ Panduan pengembangan Python tingkat ahli untuk **Python 3.13/3.14+** mencakup JIT compilation, mode free-threaded (tanpa GIL), pola keamanan tipe modern, arsitektur async, dan stack produksi lengkap: **FastAPI 0.115+**, **Pydantic v2**, **SQLAlchemy 2.x**, **uv**, **Ruff**, dan **pytest-asyncio**.
372
+
373
+ ### Kondisi Pemicu
374
+ - Menulis aplikasi atau layanan Python 3.13+/3.14+.
375
+ - Membangun REST API FastAPI 0.115+, Django 5.x, atau Litestar.
376
+ - Mengelola proyek Python dengan manajer paket `uv`.
377
+ - Mengimplementasikan pola async/await dengan `asyncio.TaskGroup`.
378
+ - Menulis Python type-safe dengan Pydantic v2 dan generik modern (PEP 695/696).
379
+ - Menyiapkan Ruff untuk linting + formatting; pytest-asyncio untuk pengujian.
380
+
381
+ ### Toolchain Modern (2026)
382
+
383
+ **`uv`** menggantikan `pip`, `pip-tools`, `virtualenv`, `pyenv`, dan `poetry` — ditulis dalam Rust, 10-100x lebih cepat. Gunakan satu file `pyproject.toml` untuk semua konfigurasi.
384
+
385
+ ### Keamanan Tipe — Pola Modern
386
+
387
+ **PEP 695** (Python 3.12+): Sintaksis generic baru yang bersih tanpa boilerplate `TypeVar`. Gunakan `type` statement untuk alias tipe.
388
+
389
+ **PEP 696** (Python 3.14+): Default untuk TypeVar — mengurangi boilerplate lebih lanjut pada library dan class generic.
390
+
391
+ **Pydantic v2**: Gunakan `BaseModel`, `Field`, `@field_validator`, dan `@model_validator` untuk validasi data yang ketat. `model_dump()` dan `model_validate()` menggantikan metode v1.
392
+
393
+ ### FastAPI 0.115+ — Pola Produksi
394
+
395
+ - **Lifespan**: Gunakan `@asynccontextmanager` dengan `lifespan=` di `FastAPI()` untuk startup/shutdown yang bersih.
396
+ - **Dependency Injection**: Gunakan `Depends()` dengan `Annotated` untuk sesi database, autentikasi, dll.
397
+ - **BaseSettings**: Gunakan `pydantic-settings` untuk konfigurasi dari environment variables dengan validasi tipe.
398
+ - **Error RFC 9457**: Format error yang konsisten dengan `type`, `title`, `status`, `detail`.
399
+
400
+ ### Pola Async
401
+
402
+ Gunakan `asyncio.TaskGroup` (Python 3.11+) sebagai pengganti `asyncio.gather()` — lebih aman karena propagasi exception langsung dan membatalkan semua task lain saat ada yang gagal.
403
+
404
+ Python 3.13 JIT: Aktifkan dengan `PYTHON_JIT=1` untuk kode CPU-bound. Free-threaded mode (`python3.13t -X gil=0`) untuk paralelisme CPU sejati.
405
+
406
+ ### Pengujian
407
+
408
+ Gunakan `pytest-asyncio` dengan `asyncio_mode = "auto"` di `pyproject.toml`. Gunakan `AsyncClient` dari `httpx` dengan `ASGITransport` untuk pengujian endpoint async yang bersih dan terisolasi tanpa perlu menjalankan server.