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