vibes-plug 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/BLUEPRINT.md +125 -0
- package/CHANGELOG.md +195 -0
- package/CONTRIBUTING.md +199 -0
- package/LICENSE +21 -0
- package/README.md +263 -0
- package/SECURITY.md +21 -0
- package/banner.png +0 -0
- package/package.json +25 -0
- package/plugin.json +8 -0
- package/scripts/update_skills.js +75 -0
- package/skills/ai-llm-integration-expert/SKILL.md +162 -0
- package/skills/api-design-expert/SKILL.md +310 -0
- package/skills/app-analyzer-optimizer/SKILL.md +189 -0
- package/skills/asisten_ramah/SKILL.md +41 -0
- package/skills/authentication-identity-expert/SKILL.md +45 -0
- package/skills/auto-doc-updater/SKILL.md +204 -0
- package/skills/bootstrap-to-modern/SKILL.md +87 -0
- package/skills/brainstorming/SKILL.md +353 -0
- package/skills/bun-runtime-expert/SKILL.md +211 -0
- package/skills/ci-cd-devops-architect/SKILL.md +45 -0
- package/skills/cloud-hosting-expert/SKILL.md +244 -0
- package/skills/coderabbit/SKILL.md +192 -0
- package/skills/data-telemetry-expert/SKILL.md +213 -0
- package/skills/database-orm-expert/SKILL.md +294 -0
- package/skills/design-system-architect/SKILL.md +243 -0
- package/skills/e2e-testing-expert/SKILL.md +315 -0
- package/skills/event-driven-architect/SKILL.md +81 -0
- package/skills/firebase-security-expert/SKILL.md +195 -0
- package/skills/fullstack-expert/SKILL.md +202 -0
- package/skills/fullstack-expert/references/api_design_guide.md +466 -0
- package/skills/fullstack-expert/references/devops_infrastructure.md +477 -0
- package/skills/fullstack-expert/references/multi_language_backend.md +528 -0
- package/skills/fullstack-expert/references/system_design_patterns.md +358 -0
- package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -0
- package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -0
- package/skills/gemini-agent-booster/SKILL.md +135 -0
- package/skills/global-a11y-i18n-expert/SKILL.md +81 -0
- package/skills/go-programming-expert/SKILL.md +295 -0
- package/skills/hig/SKILL.md +188 -0
- package/skills/js-backend-expert/SKILL.md +192 -0
- package/skills/mcp-server-architect/SKILL.md +194 -0
- package/skills/mobile-expo-expert/SKILL.md +186 -0
- package/skills/monday-design-aesthetic/SKILL.md +67 -0
- package/skills/monorepo-architect/SKILL.md +227 -0
- package/skills/mpa-orchestrator/SKILL.md +101 -0
- package/skills/multi-agent-orchestration/SKILL.md +234 -0
- package/skills/multiple-entry-points/SKILL.md +55 -0
- package/skills/mvc-expert/SKILL.md +231 -0
- package/skills/payment-gateway-expert/SKILL.md +45 -0
- package/skills/performance-web-vitals/SKILL.md +332 -0
- package/skills/prd-architect/SKILL.md +191 -0
- package/skills/production-ready-hardener/SKILL.md +469 -0
- package/skills/production-ready-hardener/references/performance_optimization.md +441 -0
- package/skills/production-ready-hardener/references/production_checklist.md +161 -0
- package/skills/production-ready-hardener/references/security_hardening_guide.md +379 -0
- package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +875 -0
- package/skills/python-programming-expert/SKILL.md +271 -0
- package/skills/realtime-collaboration-expert/SKILL.md +45 -0
- package/skills/rust-programming-expert/SKILL.md +235 -0
- package/skills/saas-billing/SKILL.md +377 -0
- package/skills/saas-multi-tenant/SKILL.md +237 -0
- package/skills/saas-mvp-launcher/SKILL.md +231 -0
- package/skills/saas-transformer/SKILL.md +446 -0
- package/skills/saas-transformer/references/billing_integration_guide.md +401 -0
- package/skills/saas-transformer/references/feature_gating_patterns.md +137 -0
- package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -0
- package/skills/saas-transformer/scripts/saas_transformation_scanner.py +254 -0
- package/skills/scalability-clean-code/SKILL.md +229 -0
- package/skills/secure-fuzz-testing/SKILL.md +201 -0
- package/skills/senior-frontend/SKILL.md +161 -0
- package/skills/senior-frontend/references/frontend_best_practices.md +806 -0
- package/skills/senior-frontend/references/nextjs_optimization_guide.md +724 -0
- package/skills/senior-frontend/references/react_patterns.md +746 -0
- package/skills/senior-frontend/scripts/bundle_analyzer.py +407 -0
- package/skills/senior-frontend/scripts/component_generator.py +329 -0
- package/skills/senior-frontend/scripts/frontend_scaffolder.py +1005 -0
- package/skills/senior-fullstack/SKILL.md +167 -0
- package/skills/senior-fullstack/references/architecture_patterns.md +160 -0
- package/skills/senior-fullstack/references/development_workflows.md +222 -0
- package/skills/senior-fullstack/references/tech_stack_guide.md +190 -0
- package/skills/senior-fullstack/scripts/code_quality_analyzer.py +114 -0
- package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +114 -0
- package/skills/senior-fullstack/scripts/project_scaffolder.py +114 -0
- package/skills/seo/SKILL.md +225 -0
- package/skills/seo/references/cwv-thresholds.md +108 -0
- package/skills/seo/references/eeat-framework.md +214 -0
- package/skills/seo/references/quality-gates.md +155 -0
- package/skills/seo/references/schema-types.md +118 -0
- package/skills/seo-aeo-landing-page-writer/SKILL.md +97 -0
- package/skills/seo-geo/SKILL.md +188 -0
- package/skills/session-handoff-resume/SKILL.md +158 -0
- package/skills/skill_baru/SKILL.md +147 -0
- package/skills/spa-orchestrator/SKILL.md +288 -0
- package/skills/state-management-expert/SKILL.md +272 -0
- package/skills/supabase-migration/SKILL.md +45 -0
- package/skills/supabase-security-expert/SKILL.md +243 -0
- package/skills/tailwind-expert/SKILL.md +188 -0
- package/skills/tanstack-query-expert/SKILL.md +199 -0
- package/skills/tauri-expert/SKILL.md +97 -0
- package/skills/token-saver/SKILL.md +111 -0
- package/skills/typescript-expert/SKILL.md +279 -0
- package/skills/ui-components-expert/SKILL.md +63 -0
- package/skills/ui-ux-pro-max/SKILL.md +201 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/core.py +257 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +493 -0
- package/skills/ui-ux-pro-max/scripts/search.py +81 -0
- package/skills/ui_ux_expert/SKILL.md +114 -0
- package/skills/vibe-code-gardener/SKILL.md +173 -0
- package/skills/web-scraper/SKILL.md +205 -0
- package/skills/web-scraper/references/data-transforms.md +397 -0
- package/skills/web-scraper/references/extraction-patterns.md +475 -0
- package/skills/web-scraper/references/output-templates.md +481 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +180 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwind-expert
|
|
3
|
+
description: "Deep guide for Tailwind CSS v4, CSS-first configuration, theme customization, and responsive design / Panduan mendalam untuk Tailwind CSS v4, CSS-first configuration, theme kustomisasi, dan responsive design."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tailwind CSS Expert (v4 Edition)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
Deep expert guide for **Tailwind CSS v4** — covering the new CSS-first configuration model, `@theme` directive for design tokens, `@plugin` for plugins, 3D transforms, gradient improvements, and migration from v3.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
- Setting up or configuring a new Tailwind CSS v4 project.
|
|
21
|
+
- Defining design tokens via `@theme` directive in CSS.
|
|
22
|
+
- Migrating from Tailwind CSS v3 to v4.
|
|
23
|
+
- Using new v4 utilities: 3D transforms, `field-sizing`, color mix functions.
|
|
24
|
+
- Registering custom plugins with `@plugin` directive.
|
|
25
|
+
|
|
26
|
+
### Tailwind v4 — The CSS-First Paradigm Shift
|
|
27
|
+
|
|
28
|
+
Tailwind v4 eliminates `tailwind.config.js` entirely. All configuration happens in CSS:
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
/* app/globals.css */
|
|
32
|
+
@import "tailwindcss";
|
|
33
|
+
|
|
34
|
+
/* Design tokens — replaces tailwind.config.js theme */
|
|
35
|
+
@theme {
|
|
36
|
+
/* Colors using OKLCH for wide-gamut displays */
|
|
37
|
+
--color-brand-50: oklch(97% 0.02 250);
|
|
38
|
+
--color-brand-500: oklch(55% 0.2 250);
|
|
39
|
+
--color-brand-900: oklch(20% 0.1 250);
|
|
40
|
+
|
|
41
|
+
/* Typography */
|
|
42
|
+
--font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
43
|
+
--font-mono: "JetBrains Mono", "Fira Code", ui-monospace;
|
|
44
|
+
|
|
45
|
+
/* Spacing & Sizing */
|
|
46
|
+
--spacing-18: 4.5rem;
|
|
47
|
+
--spacing-112: 28rem;
|
|
48
|
+
|
|
49
|
+
/* Custom animations */
|
|
50
|
+
--animate-slide-in: slide-in 0.3s ease-out;
|
|
51
|
+
--animate-fade-up: fade-up 0.4s ease-out;
|
|
52
|
+
|
|
53
|
+
/* Breakpoints */
|
|
54
|
+
--breakpoint-3xl: 112rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Register plugins via @plugin directive */
|
|
58
|
+
@plugin "@tailwindcss/typography";
|
|
59
|
+
@plugin "@tailwindcss/forms";
|
|
60
|
+
@plugin "./plugins/animations.js";
|
|
61
|
+
|
|
62
|
+
/* Custom keyframes */
|
|
63
|
+
@keyframes slide-in {
|
|
64
|
+
from { transform: translateX(-100%); opacity: 0; }
|
|
65
|
+
to { transform: translateX(0); opacity: 1; }
|
|
66
|
+
}
|
|
67
|
+
@keyframes fade-up {
|
|
68
|
+
from { transform: translateY(16px); opacity: 0; }
|
|
69
|
+
to { transform: translateY(0); opacity: 1; }
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### New Utilities in Tailwind v4
|
|
74
|
+
|
|
75
|
+
#### 3D Transforms
|
|
76
|
+
```html
|
|
77
|
+
<!-- 3D perspective and rotation -->
|
|
78
|
+
<div class="perspective-1000">
|
|
79
|
+
<div class="rotate-x-12 rotate-y-6 transform-3d hover:rotate-y-0 transition-transform duration-500">
|
|
80
|
+
Card content
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<!-- perspective-{value}: sets perspective on parent -->
|
|
85
|
+
<!-- rotate-x-{deg}, rotate-y-{deg}: 3D rotation -->
|
|
86
|
+
<!-- transform-3d: enables 3D transform context -->
|
|
87
|
+
<!-- backface-visible, backface-hidden: card flip effects -->
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Color Mix & Relative Colors
|
|
91
|
+
```html
|
|
92
|
+
<!-- Mix colors at the utility level -->
|
|
93
|
+
<div class="bg-brand-500/50"> <!-- 50% opacity -->
|
|
94
|
+
<div class="text-[color-mix(in_oklch,blue_70%,white)]"> <!-- CSS color-mix -->
|
|
95
|
+
<div class="border-brand-500 hover:border-brand-700">
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Container Queries
|
|
99
|
+
```html
|
|
100
|
+
<!-- Responsive to parent container size, not viewport -->
|
|
101
|
+
<div class="@container">
|
|
102
|
+
<div class="@sm:grid-cols-2 @lg:grid-cols-3 grid grid-cols-1">
|
|
103
|
+
<!-- Adapts to container width, not screen width -->
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### `field-sizing` for Auto-Resizing Textareas
|
|
109
|
+
```html
|
|
110
|
+
<textarea class="field-sizing-content resize-none min-h-20 max-h-64">
|
|
111
|
+
Auto-resizes to fit content — no JavaScript needed!
|
|
112
|
+
</textarea>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Migration from v3 to v4
|
|
116
|
+
|
|
117
|
+
#### Automated Migration Tool
|
|
118
|
+
```bash
|
|
119
|
+
npx @tailwindcss/upgrade
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Key Breaking Changes
|
|
123
|
+
| v3 | v4 Equivalent |
|
|
124
|
+
|---|---|
|
|
125
|
+
| `tailwind.config.js` | `@theme {}` in CSS |
|
|
126
|
+
| `theme.extend.colors` | `--color-*` CSS vars in `@theme` |
|
|
127
|
+
| `plugins: [require('@tailwindcss/typography')]` | `@plugin "@tailwindcss/typography"` |
|
|
128
|
+
| `darkMode: 'class'` | `@variant dark (&:where(.dark, .dark *))` |
|
|
129
|
+
| `screens` in config | `--breakpoint-*` in `@theme` |
|
|
130
|
+
| `content` array | Auto-detected (no config needed) |
|
|
131
|
+
|
|
132
|
+
#### Custom Variants in v4
|
|
133
|
+
```css
|
|
134
|
+
/* Custom variants — replaces addVariant() in plugins */
|
|
135
|
+
@variant hocus (&:hover, &:focus);
|
|
136
|
+
@variant dark (&:where(.dark, .dark *));
|
|
137
|
+
@variant reduced-motion (@media (prefers-reduced-motion: reduce));
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Performance Tips
|
|
141
|
+
- Tailwind v4 uses **Lightning CSS** for transforms — 4x faster builds than v3 with PostCSS.
|
|
142
|
+
- CSS bundle is now fully tree-shaken — only styles used in your HTML/JSX are generated.
|
|
143
|
+
- Use `@layer utilities` for custom utilities that need Tailwind's specificity.
|
|
144
|
+
- Avoid `@apply` in performance-critical loops — prefer utility classes directly in HTML.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
<a name="bahasa-indonesia"></a>
|
|
149
|
+
## Bahasa Indonesia
|
|
150
|
+
|
|
151
|
+
### Deskripsi
|
|
152
|
+
Panduan mendalam untuk **Tailwind CSS v4** — mencakup model konfigurasi CSS-first baru, direktif `@theme` untuk design token, `@plugin` untuk plugin, 3D transform, peningkatan gradient, dan migrasi dari v3.
|
|
153
|
+
|
|
154
|
+
### Kondisi Pemicu
|
|
155
|
+
- Menyiapkan atau mengonfigurasi proyek Tailwind CSS v4 baru.
|
|
156
|
+
- Mendefinisikan design token via direktif `@theme` di CSS.
|
|
157
|
+
- Migrasi dari Tailwind CSS v3 ke v4.
|
|
158
|
+
- Menggunakan utilitas v4 baru: 3D transform, `field-sizing`, fungsi color mix.
|
|
159
|
+
- Mendaftarkan plugin kustom dengan direktif `@plugin`.
|
|
160
|
+
|
|
161
|
+
### Tailwind v4 — Pergeseran Paradigma CSS-First
|
|
162
|
+
|
|
163
|
+
Tailwind v4 menghilangkan `tailwind.config.js` sepenuhnya. Semua konfigurasi dilakukan di CSS menggunakan direktif `@theme`. Plugin didaftarkan dengan `@plugin`. Breakpoint, warna, spacing, animasi — semuanya didefinisikan sebagai variabel CSS `--*` di dalam blok `@theme`.
|
|
164
|
+
|
|
165
|
+
### Utilitas Baru di Tailwind v4
|
|
166
|
+
|
|
167
|
+
#### 3D Transform
|
|
168
|
+
Tailwind v4 menambahkan utilitas untuk 3D transform: `perspective-{nilai}`, `rotate-x-{derajat}`, `rotate-y-{derajat}`, `transform-3d`, `backface-visible`, `backface-hidden` — ideal untuk efek flip kartu dan galeri 3D.
|
|
169
|
+
|
|
170
|
+
#### Container Queries
|
|
171
|
+
Gunakan `@container` dan utilitas `@sm:`, `@lg:` untuk membuat komponen yang responsif terhadap ukuran container induknya, bukan ukuran viewport.
|
|
172
|
+
|
|
173
|
+
#### `field-sizing` untuk Textarea Auto-Resize
|
|
174
|
+
Kelas `field-sizing-content` membuat textarea otomatis menyesuaikan ukurannya dengan konten — tanpa JavaScript.
|
|
175
|
+
|
|
176
|
+
### Migrasi dari v3 ke v4
|
|
177
|
+
|
|
178
|
+
Gunakan alat migrasi otomatis `npx @tailwindcss/upgrade` untuk konversi dasar. Perubahan kunci:
|
|
179
|
+
- `tailwind.config.js` → `@theme {}` di CSS
|
|
180
|
+
- `plugins: [require('...')]` → `@plugin "..."`
|
|
181
|
+
- `darkMode: 'class'` → `@variant dark`
|
|
182
|
+
- Array `content` → Deteksi otomatis (tidak perlu konfigurasi)
|
|
183
|
+
|
|
184
|
+
### Tip Performa
|
|
185
|
+
- Tailwind v4 menggunakan **Lightning CSS** — build 4x lebih cepat dari v3 dengan PostCSS.
|
|
186
|
+
- Bundle CSS sepenuhnya di-tree-shake — hanya style yang digunakan yang dihasilkan.
|
|
187
|
+
- Gunakan `@layer utilities` untuk utilitas kustom yang membutuhkan spesifisitas Tailwind.
|
|
188
|
+
- Hindari `@apply` di loop kritis performa — gunakan kelas utilitas langsung di HTML.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tanstack-query-expert
|
|
3
|
+
description: "Advanced TanStack Query (v5) expert. Covers useSuspenseQuery, infinite scrolling, optimistic mutations, SSR/React Server Components hydration, and advanced cache invalidation / Pakar manajemen state asinkron menggunakan TanStack Query (React Query) v5 dan Next.js App Router (SSR)."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TanStack Query Expert (v5 + TanStack Router/Start Edition)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
Production-grade TanStack Query (v5) mastery for modern React (v18/19) and Next.js (App Router) applications. Covers declarative data fetching, advanced cache invalidation, optimistic UI updates, Suspense boundaries, SSR hydration, and the new **TanStack Router** + **TanStack Start** ecosystem for full-stack type-safe applications.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
- Refactoring data fetching logic (replacing `useEffect` + `useState` patterns).
|
|
21
|
+
- Designing query key factories (Array-based, strictly typed).
|
|
22
|
+
- Writing `useMutation` hooks with immediate Optimistic Updates.
|
|
23
|
+
- Implementing Infinite Scrolling (`useInfiniteQuery`).
|
|
24
|
+
- Using React Suspense with `useSuspenseQuery`.
|
|
25
|
+
- Integrating TanStack Query with Next.js App Router (Server Components prefetching + Client Boundary hydration).
|
|
26
|
+
- Building type-safe SPAs with **TanStack Router** (typed routes, route-level loaders).
|
|
27
|
+
- Building full-stack apps with **TanStack Start** (server functions, RSC-like patterns).
|
|
28
|
+
|
|
29
|
+
### Core Concepts & Rules of Thumb
|
|
30
|
+
- **Never** use `useEffect` to fetch data if TanStack Query is available.
|
|
31
|
+
- **Never** sync query data into local React state (e.g., `useEffect(() => setLocalState(data), [data])`). Derive state during render instead.
|
|
32
|
+
- **Stale != Garbage Collected**: `staleTime` dictates when background refetch triggers. `gcTime` dictates how long inactive data stays in memory.
|
|
33
|
+
- **Always** use `queryOptions()` helper to co-locate query definition and reuse it across components and loaders.
|
|
34
|
+
|
|
35
|
+
### Advanced Query Patterns
|
|
36
|
+
|
|
37
|
+
#### 1. `queryOptions()` Helper — The 2026 Best Practice
|
|
38
|
+
Co-locate your query definition using `queryOptions()` to share it between components and route loaders:
|
|
39
|
+
```typescript
|
|
40
|
+
import { queryOptions } from '@tanstack/react-query';
|
|
41
|
+
|
|
42
|
+
export const userQueryOptions = (userId: string) =>
|
|
43
|
+
queryOptions({
|
|
44
|
+
queryKey: ['users', userId],
|
|
45
|
+
queryFn: () => fetchUser(userId),
|
|
46
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// In component:
|
|
50
|
+
const { data } = useQuery(userQueryOptions(userId));
|
|
51
|
+
|
|
52
|
+
// In TanStack Router loader:
|
|
53
|
+
export const Route = createFileRoute('/users/$userId')({
|
|
54
|
+
loader: ({ context: { queryClient }, params }) =>
|
|
55
|
+
queryClient.ensureQueryData(userQueryOptions(params.userId)),
|
|
56
|
+
component: UserPage,
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### 2. Custom Hook & Suspense Pattern
|
|
61
|
+
Abstract `useQuery` into custom hooks. Use `useSuspenseQuery` for modern React architectures:
|
|
62
|
+
```typescript
|
|
63
|
+
export function useUser(userId: string) {
|
|
64
|
+
return useSuspenseQuery(userQueryOptions(userId));
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### 3. Query Key Factories (Mandatory for Scale)
|
|
69
|
+
Use factories to prevent typos and ensure invalidation targets the correct subsets:
|
|
70
|
+
```typescript
|
|
71
|
+
export const userKeys = {
|
|
72
|
+
all: ['users'] as const,
|
|
73
|
+
lists: () => [...userKeys.all, 'list'] as const,
|
|
74
|
+
list: (filters: string) => [...userKeys.lists(), { filters }] as const,
|
|
75
|
+
details: () => [...userKeys.all, 'detail'] as const,
|
|
76
|
+
detail: (id: string) => [...userKeys.details(), id] as const,
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### 4. Optimistic Updates (v5 Best Practice)
|
|
81
|
+
Give users instant feedback by updating the cache before the server responds:
|
|
82
|
+
```typescript
|
|
83
|
+
const mutation = useMutation({
|
|
84
|
+
mutationFn: updateTodo,
|
|
85
|
+
onMutate: async (newTodo) => {
|
|
86
|
+
await queryClient.cancelQueries({ queryKey: todoKeys.lists() });
|
|
87
|
+
const previous = queryClient.getQueryData(todoKeys.lists());
|
|
88
|
+
queryClient.setQueryData(todoKeys.lists(), (old) =>
|
|
89
|
+
old?.map(t => t.id === newTodo.id ? newTodo : t)
|
|
90
|
+
);
|
|
91
|
+
return { previous };
|
|
92
|
+
},
|
|
93
|
+
onError: (err, _, context) => {
|
|
94
|
+
queryClient.setQueryData(todoKeys.lists(), context?.previous);
|
|
95
|
+
},
|
|
96
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: todoKeys.lists() }),
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### 5. TanStack Router — Type-Safe Client-Side Routing
|
|
101
|
+
TanStack Router is the recommended router for SPAs in 2026 — fully type-safe routes, search params, and loaders:
|
|
102
|
+
```typescript
|
|
103
|
+
import { createRootRoute, createRoute, createRouter } from '@tanstack/react-router';
|
|
104
|
+
|
|
105
|
+
const rootRoute = createRootRoute({ component: RootLayout });
|
|
106
|
+
|
|
107
|
+
const usersRoute = createRoute({
|
|
108
|
+
getParentRoute: () => rootRoute,
|
|
109
|
+
path: '/users',
|
|
110
|
+
loader: ({ context: { queryClient } }) =>
|
|
111
|
+
queryClient.ensureQueryData(usersQueryOptions()),
|
|
112
|
+
component: UsersPage,
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### 6. TanStack Start — Full-Stack Framework
|
|
117
|
+
TanStack Start brings server functions and SSR to TanStack Router apps — a Vite-powered alternative to Next.js for SPAs that need SSR:
|
|
118
|
+
```typescript
|
|
119
|
+
import { createServerFn } from '@tanstack/start';
|
|
120
|
+
|
|
121
|
+
// Type-safe server function (runs on server)
|
|
122
|
+
const getUser = createServerFn({ method: 'GET' })
|
|
123
|
+
.validator(z.object({ userId: z.string() }))
|
|
124
|
+
.handler(async ({ data }) => {
|
|
125
|
+
return db.user.findUnique({ where: { id: data.userId } });
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### 7. Next.js App Router SSR Hydration
|
|
130
|
+
Prefetch on the server and hydrate on the client seamlessly:
|
|
131
|
+
```typescript
|
|
132
|
+
// Server Component (app/users/page.tsx)
|
|
133
|
+
export default async function UsersPage() {
|
|
134
|
+
const queryClient = new QueryClient();
|
|
135
|
+
await queryClient.prefetchQuery(usersQueryOptions());
|
|
136
|
+
return (
|
|
137
|
+
<HydrationBoundary state={dehydrate(queryClient)}>
|
|
138
|
+
<UsersList />
|
|
139
|
+
</HydrationBoundary>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Troubleshooting
|
|
145
|
+
- **Infinite Fetching Loops**: Check your `queryFn`. Unhandled exceptions trigger 3 auto-retries. Ensure stable query keys (no object literals in render).
|
|
146
|
+
- **`staleTime` vs `gcTime`**: If `gcTime` < `staleTime`, data is deleted from memory before it becomes stale — this defeats the cache. Always set `gcTime >= staleTime`.
|
|
147
|
+
- **Hydration Mismatch**: Ensure server and client produce identical initial query data — check for timezone or locale differences.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
<a name="bahasa-indonesia"></a>
|
|
152
|
+
## Bahasa Indonesia
|
|
153
|
+
|
|
154
|
+
### Deskripsi
|
|
155
|
+
Penguasaan TanStack Query (v5) tingkat produksi untuk aplikasi React modern (v18/19) dan Next.js (App Router). Mencakup data fetching deklaratif, invalidasi cache lanjutan, optimistic UI, Suspense boundaries, hidrasi SSR, serta ekosistem **TanStack Router** + **TanStack Start** untuk aplikasi full-stack yang type-safe.
|
|
156
|
+
|
|
157
|
+
### Kondisi Pemicu
|
|
158
|
+
- Refactoring logika data fetching (menggantikan `useEffect` + `useState`).
|
|
159
|
+
- Merancang query key factories berbasis Array yang type-safe.
|
|
160
|
+
- Menulis hook `useMutation` dengan Optimistic Updates instan.
|
|
161
|
+
- Mengimplementasikan Infinite Scrolling (`useInfiniteQuery`).
|
|
162
|
+
- Memanfaatkan React Suspense dengan `useSuspenseQuery`.
|
|
163
|
+
- Mengintegrasikan TanStack Query dengan Next.js App Router (prefetching RSC + hidrasi client boundary).
|
|
164
|
+
- Membangun SPA type-safe dengan **TanStack Router** (rute bertipe, route-level loaders).
|
|
165
|
+
- Membangun aplikasi full-stack dengan **TanStack Start** (server functions, pola mirip RSC).
|
|
166
|
+
|
|
167
|
+
### Aturan Utama & Prinsip
|
|
168
|
+
- **Jangan pernah** gunakan `useEffect` untuk fetch data jika TanStack Query tersedia.
|
|
169
|
+
- **Jangan pernah** sinkronkan data query ke state lokal React.
|
|
170
|
+
- `staleTime`: kapan refetch latar belakang dipicu. `gcTime`: berapa lama data tidak aktif di memori.
|
|
171
|
+
- **Selalu** gunakan helper `queryOptions()` untuk mendefinisikan dan berbagi query definition.
|
|
172
|
+
|
|
173
|
+
### Pola Tingkat Lanjut
|
|
174
|
+
|
|
175
|
+
#### 1. Helper `queryOptions()` — Best Practice 2026
|
|
176
|
+
Co-locate definisi query menggunakan `queryOptions()` untuk berbagi antara komponen dan route loader. Lihat contoh kode di bagian English.
|
|
177
|
+
|
|
178
|
+
#### 2. Custom Hook & Suspense Pattern
|
|
179
|
+
Abstraksikan `useQuery` ke dalam custom hook. Gunakan `useSuspenseQuery` untuk loading state yang ditangani oleh `<Suspense>`.
|
|
180
|
+
|
|
181
|
+
#### 3. Query Key Factories
|
|
182
|
+
Gunakan factory untuk mencegah typo dan memastikan invalidation menargetkan subset data yang tepat.
|
|
183
|
+
|
|
184
|
+
#### 4. Optimistic Updates
|
|
185
|
+
Perbarui cache sebelum server merespons untuk umpan balik instan kepada pengguna.
|
|
186
|
+
|
|
187
|
+
#### 5. TanStack Router
|
|
188
|
+
Router client-side yang fully type-safe untuk SPA — rute, search params, dan loader semuanya bertipe. Direkomendasikan untuk proyek SPA baru di 2026 (menggantikan React Router).
|
|
189
|
+
|
|
190
|
+
#### 6. TanStack Start
|
|
191
|
+
Framework full-stack berbasis Vite dengan server functions type-safe — alternatif Next.js untuk SPA yang membutuhkan SSR.
|
|
192
|
+
|
|
193
|
+
#### 7. Hidrasi SSR Next.js App Router
|
|
194
|
+
Prefetch di Server Component, lalu wrap dengan `<HydrationBoundary>` agar data langsung tersedia di Client Component tanpa request tambahan.
|
|
195
|
+
|
|
196
|
+
### Pemecahan Masalah
|
|
197
|
+
- **Loop Fetching**: Query key tidak stabil atau `queryFn` yang melempar error tak tertangani.
|
|
198
|
+
- **`staleTime` vs `gcTime`**: Jangan set `gcTime` lebih kecil dari `staleTime`.
|
|
199
|
+
- **Hydration Mismatch**: Pastikan server dan client menghasilkan data awal yang identik.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tauri-expert
|
|
3
|
+
description: "Expert skill for Tauri (v2) development, Rust backend, IPC, and security / Panduan ahli untuk pengembangan Tauri v2, Rust backend, IPC, dan keamanan."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tauri Expert
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
This skill provides best practice guidance for building cross-platform desktop and mobile applications using Tauri (specifically Tauri v2). It covers frontend integration with the Rust backend, Inter-Process Communication (IPC), state management, and security.
|
|
18
|
+
|
|
19
|
+
### Instructions & Best Practices
|
|
20
|
+
|
|
21
|
+
#### 1. Architecture & IPC (Inter-Process Communication)
|
|
22
|
+
- Use `tauri::command` to define Rust functions callable from the frontend.
|
|
23
|
+
- Invoke Rust functions from the frontend using `@tauri-apps/api/core` (`invoke`).
|
|
24
|
+
- Utilize Tauri's event system (`emit` from Rust, `listen` on frontend) for real-time or async updates.
|
|
25
|
+
- Keep heavy processing and filesystem access in Rust (backend), while the frontend focuses purely on UI.
|
|
26
|
+
|
|
27
|
+
#### 2. State Management (Rust Backend)
|
|
28
|
+
- Use `tauri::State` to store and manage global state in the Rust backend.
|
|
29
|
+
- Use `std::sync::Mutex` or `tokio::sync::Mutex` (if async) for mutable state.
|
|
30
|
+
- Initialize managed state during application setup: `tauri::Builder::default().manage(MyState::default())`.
|
|
31
|
+
|
|
32
|
+
#### 3. Security & Capabilities
|
|
33
|
+
- Enforce strict context isolation.
|
|
34
|
+
- In Tauri v2, use the **Capabilities** system to restrict API access per window or plugin.
|
|
35
|
+
- Never expose dangerous filesystem, shell, or network APIs globally. Only grant allowlist access to specific, required paths or commands.
|
|
36
|
+
|
|
37
|
+
#### 4. Performance & Concurrency
|
|
38
|
+
- Use `async fn` for `tauri::command` when handling heavy I/O to avoid blocking the main thread.
|
|
39
|
+
- Use `serde` (`Serialize`, `Deserialize`) efficiently for data structures sent between Rust and the frontend.
|
|
40
|
+
|
|
41
|
+
#### 5. Plugin Management (Tauri v2)
|
|
42
|
+
- Use official Tauri plugins (e.g., `tauri-plugin-fs`, `tauri-plugin-store`, `tauri-plugin-dialog`) instead of writing custom I/O modules when available.
|
|
43
|
+
- Initialize plugins in `main.rs` or `lib.rs`: `app.plugin(tauri_plugin_dialog::init())`.
|
|
44
|
+
|
|
45
|
+
#### 6. Cross-Platform & Build
|
|
46
|
+
- Avoid hardcoded paths. Use the `app_handle.path()` resolver for AppData, Cache, and other system directories.
|
|
47
|
+
- Ensure dependencies in `Cargo.toml` support cross-compilation (Windows, macOS, Linux, iOS, Android).
|
|
48
|
+
|
|
49
|
+
### Trigger Conditions
|
|
50
|
+
Active when:
|
|
51
|
+
- Building, debugging, or refactoring Tauri applications.
|
|
52
|
+
- Writing IPC systems between the frontend (React/Svelte/Vue) and the Rust backend.
|
|
53
|
+
- Configuring security (`tauri.conf.json`, capabilities, permissions).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<a name="bahasa-indonesia"></a>
|
|
58
|
+
## Bahasa Indonesia
|
|
59
|
+
|
|
60
|
+
### Deskripsi
|
|
61
|
+
Skill ini memberikan panduan praktik terbaik (best practices) untuk membangun aplikasi desktop dan mobile lintas platform menggunakan Tauri (terutama Tauri v2). Skill ini mencakup integrasi frontend dengan backend Rust, Inter-Process Communication (IPC), manajemen state, serta keamanan.
|
|
62
|
+
|
|
63
|
+
### Instruksi & Praktik Terbaik
|
|
64
|
+
|
|
65
|
+
#### 1. Arsitektur & IPC (Inter-Process Communication)
|
|
66
|
+
- Gunakan `tauri::command` untuk mendefinisikan fungsi Rust yang bisa dipanggil dari frontend.
|
|
67
|
+
- Panggil fungsi Rust dari frontend menggunakan `@tauri-apps/api/core` (`invoke`).
|
|
68
|
+
- Manfaatkan sistem *event* Tauri (`emit` dari Rust, `listen` di frontend) untuk pembaruan *real-time* atau asinkron dari backend.
|
|
69
|
+
- Lakukan operasi berat di sisi Rust (backend), sedangkan frontend hanya fokus pada UI.
|
|
70
|
+
|
|
71
|
+
#### 2. Manajemen State (Rust Backend)
|
|
72
|
+
- Gunakan `tauri::State` untuk menyimpan dan mengelola state global di backend Rust.
|
|
73
|
+
- Gunakan `std::sync::Mutex` or `tokio::sync::Mutex` (jika asinkron) untuk state yang bisa berubah (mutable state).
|
|
74
|
+
- Lakukan inisialisasi state saat setup aplikasi: `tauri::Builder::default().manage(MyState::default())`.
|
|
75
|
+
|
|
76
|
+
#### 3. Keamanan (Security & Capabilities)
|
|
77
|
+
- Terapkan isolasi konteks secara ketat.
|
|
78
|
+
- Di Tauri v2, gunakan sistem **Capabilities** untuk membatasi akses API per jendela/plugin.
|
|
79
|
+
- Jangan mengekspos API filesystem, shell, atau jaringan yang berbahaya secara global. Hanya beri akses (`allowlist`) ke path atau perintah (commands) yang spesifik dan dibutuhkan.
|
|
80
|
+
|
|
81
|
+
#### 4. Kinerja & Asinkronisitas
|
|
82
|
+
- Gunakan `async fn` pada `tauri::command` untuk I/O yang berat agar tidak memblokir *main thread*.
|
|
83
|
+
- Gunakan `serde` (`Serialize`, `Deserialize`) secara efisien untuk mengirim struktur data kompleks antara Rust dan frontend.
|
|
84
|
+
|
|
85
|
+
#### 5. Pengelolaan Plugin (Tauri v2)
|
|
86
|
+
- Gunakan ekosistem plugin Tauri (seperti `tauri-plugin-fs`, `tauri-plugin-store`, `tauri-plugin-dialog`) alih-alih membuat modul I/O sendiri jika sudah tersedia.
|
|
87
|
+
- Inisialisasi plugin di file `main.rs` atau `lib.rs`: `app.plugin(tauri_plugin_dialog::init())`.
|
|
88
|
+
|
|
89
|
+
#### 6. Lintas Platform (Cross-Platform) & Build
|
|
90
|
+
- Hindari *hardcode* path sistem operasi. Gunakan `app_handle.path()` resolver untuk direktori AppData, Cache, dsb.
|
|
91
|
+
- Pastikan dependencies di `Cargo.toml` mendukung *cross-compilation* (Windows, macOS, Linux, iOS, Android).
|
|
92
|
+
|
|
93
|
+
### Kondisi Pemicu
|
|
94
|
+
Aktif saat:
|
|
95
|
+
- Membangun, men-debug, atau melakukan *refactoring* pada aplikasi Tauri.
|
|
96
|
+
- Menulis sistem IPC antara frontend (React/Svelte/Vue) dan backend Rust.
|
|
97
|
+
- Mengonfigurasi keamanan (`tauri.conf.json`, capabilities, permission).
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: token-saver
|
|
3
|
+
description: "Skill to implement token saving scheme, concise, and focused on essential changes / Skill untuk menerapkan skema penghematan token, ringkas, dan fokus pada perubahan esensial tanpa basa-basi."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Token Saver Protocol (2026 Edition)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
Implements token-efficient communication protocols for long-context AI coding sessions. Activates concise mode — minimizing response verbosity while maintaining precision and completeness of technical output.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
- User asks for token-saving mode, concise responses, or minimal output.
|
|
21
|
+
- Session is running long and context window is being consumed rapidly.
|
|
22
|
+
- User explicitly says "be concise", "save tokens", or "minimal".
|
|
23
|
+
|
|
24
|
+
### Token Budget Strategies for Long Context
|
|
25
|
+
|
|
26
|
+
#### 1. Response Compression Rules (Active When Triggered)
|
|
27
|
+
- **No preamble**: Skip "Of course! I'll help you with that...".
|
|
28
|
+
- **No restatement**: Never repeat back what the user just said.
|
|
29
|
+
- **No trailing summaries**: Don't summarize what you just did at the end.
|
|
30
|
+
- **Code-first**: Show the code change immediately, explain briefly after.
|
|
31
|
+
- **Diff format**: For small changes, show only the changed lines (not the full file).
|
|
32
|
+
- **Bullet > prose**: Use bullet lists instead of paragraphs for explanations.
|
|
33
|
+
|
|
34
|
+
#### 2. Tool Call Efficiency
|
|
35
|
+
- **Batch parallel reads**: Read multiple files in a single turn (not sequentially).
|
|
36
|
+
- **Targeted grep over full reads**: Use `grep_search` to find specific content before reading the whole file.
|
|
37
|
+
- **Write once**: Produce correct output on first try — avoid edit-then-edit-again cycles.
|
|
38
|
+
- **Skip confirmation requests**: Don't ask "Shall I proceed?" — just proceed.
|
|
39
|
+
|
|
40
|
+
#### 3. Context Window Budget Awareness
|
|
41
|
+
When working on a long session:
|
|
42
|
+
```
|
|
43
|
+
Token budget allocation (for 200K context):
|
|
44
|
+
├── System prompt + skills: ~15K
|
|
45
|
+
├── Conversation history: ~50K (truncates older turns)
|
|
46
|
+
├── File contents read: ~100K (most expensive)
|
|
47
|
+
└── Response generation: ~35K
|
|
48
|
+
```
|
|
49
|
+
- Prefer `grep_search` over reading full large files.
|
|
50
|
+
- Summarize large files mentally; only `view_file` the specific section needed.
|
|
51
|
+
- When context is nearly full, create a checkpoint with `session-handoff-resume` skill.
|
|
52
|
+
|
|
53
|
+
#### 4. Output Size Minimization
|
|
54
|
+
For file edits:
|
|
55
|
+
```diff
|
|
56
|
+
# Preferred: diff format showing only changes
|
|
57
|
+
- const OLD_VALUE = 'old';
|
|
58
|
+
+ const NEW_VALUE = 'new';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For explanations:
|
|
62
|
+
```
|
|
63
|
+
# Preferred: 1-sentence rationale
|
|
64
|
+
Changed X to Y because Z.
|
|
65
|
+
|
|
66
|
+
# Avoid: multi-paragraph explanation of an obvious change
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### 5. Code Generation — First Draft Quality
|
|
70
|
+
Generate correct, production-ready code on the first attempt:
|
|
71
|
+
- Apply all relevant best practices from skills without being asked.
|
|
72
|
+
- Include error handling, types, and edge cases inline.
|
|
73
|
+
- Avoid TODOs, placeholder values, or "implement this later" comments.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
<a name="bahasa-indonesia"></a>
|
|
78
|
+
## Bahasa Indonesia
|
|
79
|
+
|
|
80
|
+
### Deskripsi
|
|
81
|
+
Mengimplementasikan protokol komunikasi hemat token untuk sesi coding AI yang panjang. Mengaktifkan mode ringkas — meminimalkan verbositas respons sambil mempertahankan presisi dan kelengkapan output teknis.
|
|
82
|
+
|
|
83
|
+
### Kondisi Pemicu
|
|
84
|
+
- Pengguna meminta mode hemat token, respons ringkas, atau output minimal.
|
|
85
|
+
- Sesi sudah panjang dan context window sedang dikonsumsi dengan cepat.
|
|
86
|
+
- Pengguna secara eksplisit berkata "ringkas", "hemat token", atau "minimal".
|
|
87
|
+
|
|
88
|
+
### Strategi Token Budget untuk Konteks Panjang
|
|
89
|
+
|
|
90
|
+
#### 1. Aturan Kompresi Respons (Aktif Saat Dipicu)
|
|
91
|
+
- Tanpa pembuka: Lewati "Tentu saja! Saya akan membantu Anda dengan...".
|
|
92
|
+
- Tanpa pengulangan: Jangan pernah mengulangi apa yang baru saja dikatakan pengguna.
|
|
93
|
+
- Tanpa ringkasan di akhir: Jangan rangkum apa yang baru saja dilakukan.
|
|
94
|
+
- Code-first: Tunjukkan perubahan kode segera, jelaskan singkat setelahnya.
|
|
95
|
+
- Format diff: Untuk perubahan kecil, tunjukkan hanya baris yang berubah.
|
|
96
|
+
- Poin > prosa: Gunakan daftar poin daripada paragraf.
|
|
97
|
+
|
|
98
|
+
#### 2. Efisiensi Pemanggilan Tool
|
|
99
|
+
- Baca beberapa file secara paralel dalam satu giliran.
|
|
100
|
+
- Gunakan `grep_search` untuk menemukan konten spesifik sebelum membaca file lengkap.
|
|
101
|
+
- Hasilkan output yang benar pada percobaan pertama.
|
|
102
|
+
- Jangan tanyakan "Apakah saya harus melanjutkan?" — langsung lanjutkan.
|
|
103
|
+
|
|
104
|
+
#### 3. Kesadaran Budget Context Window
|
|
105
|
+
Alokasikan token secara bijak: batasi baca file besar, gunakan `grep_search` daripada membaca file penuh, dan buat checkpoint dengan skill `session-handoff-resume` saat konteks hampir penuh.
|
|
106
|
+
|
|
107
|
+
#### 4. Minimalisasi Ukuran Output
|
|
108
|
+
Gunakan format diff untuk edit file. Berikan penjelasan 1 kalimat untuk perubahan yang jelas.
|
|
109
|
+
|
|
110
|
+
#### 5. Kualitas Draft Kode Pertama
|
|
111
|
+
Hasilkan kode yang benar dan siap produksi pada percobaan pertama — termasuk error handling, tipe, dan edge case secara inline. Hindari TODO, nilai placeholder, atau komentar "implementasikan ini nanti".
|