vibes-plug 1.0.0 → 2.5.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/workflows/publish.yml +20 -0
- package/AGENTS.md +66 -0
- package/BLUEPRINT.md +152 -60
- package/CHANGELOG.md +50 -0
- package/README.md +346 -194
- package/package.json +25 -25
- package/plugin.json +1 -1
- package/skills/ai-cost-token-optimizer/SKILL.md +52 -0
- package/skills/ai-llm-integration-expert/SKILL.md +180 -162
- package/skills/api-design-expert/SKILL.md +314 -310
- package/skills/app-analyzer-optimizer/SKILL.md +193 -189
- package/skills/apple-ecosystem-expert/SKILL.md +142 -0
- package/skills/async-queue-temporal-expert/SKILL.md +54 -0
- package/skills/authentication-identity-expert/SKILL.md +251 -20
- package/skills/auto-doc-updater/SKILL.md +214 -204
- package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
- package/skills/autonomous-red-teamer/SKILL.md +59 -0
- package/skills/autonomous-swarm-director/SKILL.md +69 -0
- package/skills/autonomous-tdd-debugger/SKILL.md +65 -0
- package/skills/bootstrap-to-modern/SKILL.md +90 -86
- package/skills/brainstorming/SKILL.md +373 -353
- package/skills/browser-automation-expert/SKILL.md +46 -0
- package/skills/ci-cd-devops-architect/SKILL.md +72 -45
- package/skills/cloud-hosting-expert/SKILL.md +244 -244
- package/skills/coderabbit/SKILL.md +192 -192
- package/skills/cron-scheduler-expert/SKILL.md +298 -0
- package/skills/data-telemetry-expert/SKILL.md +213 -213
- package/skills/database-orm-expert/SKILL.md +294 -294
- package/skills/dependency-upgrade-migrator/SKILL.md +295 -0
- package/skills/design-system-architect/SKILL.md +27 -10
- package/skills/doku-mcp-server/SKILL.md +251 -0
- package/skills/doku-payment-gateway/SKILL.md +227 -0
- package/skills/e2e-testing-expert/SKILL.md +315 -315
- package/skills/edge-serverless-db-expert/SKILL.md +43 -0
- package/skills/email-notification-expert/SKILL.md +362 -0
- package/skills/error-resilience-expert/SKILL.md +480 -0
- package/skills/event-driven-architect/SKILL.md +81 -81
- package/skills/feature-flag-analytics-expert/SKILL.md +46 -0
- package/skills/file-upload-media-expert/SKILL.md +431 -0
- package/skills/form-validation-expert/SKILL.md +401 -0
- package/skills/fullstack-expert/SKILL.md +202 -202
- package/skills/fullstack-expert/references/api_design_guide.md +466 -466
- package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
- package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
- package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
- package/skills/gemini-agent-booster/SKILL.md +135 -135
- package/skills/global-a11y-i18n-expert/SKILL.md +81 -81
- package/skills/glsl-shader-expert/SKILL.md +101 -0
- package/skills/go-programming-expert/SKILL.md +295 -295
- package/skills/graphql-apollo-expert/SKILL.md +108 -0
- package/skills/hig/SKILL.md +188 -188
- package/skills/hyper-context-synthesizer/SKILL.md +55 -0
- package/skills/js-backend-expert/SKILL.md +34 -9
- package/skills/legacy-code-translator/SKILL.md +65 -0
- package/skills/llm-cost-arbitrage-router/SKILL.md +59 -0
- package/skills/logging-error-tracking-expert/SKILL.md +338 -0
- package/skills/mcp-client-orchestrator/SKILL.md +70 -0
- package/skills/mcp-server-architect/SKILL.md +194 -194
- package/skills/micro-frontend-architect/SKILL.md +106 -0
- package/skills/mobile-expo-expert/SKILL.md +186 -186
- package/skills/mobile-push-notification-expert/SKILL.md +51 -0
- package/skills/monday-design-aesthetic/SKILL.md +67 -67
- package/skills/monorepo-architect/SKILL.md +227 -227
- package/skills/mpa-orchestrator/SKILL.md +101 -101
- package/skills/multi-agent-orchestration/SKILL.md +234 -234
- package/skills/multiple-entry-points/SKILL.md +55 -55
- package/skills/mvc-expert/SKILL.md +231 -231
- package/skills/payment-gateway-expert/SKILL.md +45 -45
- package/skills/performance-web-vitals/SKILL.md +332 -332
- package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
- package/skills/prd-architect/SKILL.md +201 -191
- package/skills/proactive-background-watcher/SKILL.md +62 -0
- package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
- package/skills/production-ready-hardener/SKILL.md +173 -186
- package/skills/production-ready-hardener/references/production_checklist.md +161 -161
- package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
- package/skills/project-context-mapper/SKILL.md +79 -0
- package/skills/python-programming-expert/SKILL.md +263 -132
- package/skills/rate-limit-abuse-prevention/SKILL.md +371 -0
- package/skills/realtime-collaboration-expert/SKILL.md +45 -45
- package/skills/rust-programming-expert/SKILL.md +235 -235
- package/skills/saas-billing/SKILL.md +377 -377
- package/skills/saas-multi-tenant/SKILL.md +251 -237
- package/skills/saas-mvp-launcher/SKILL.md +10 -0
- package/skills/saas-transformer/SKILL.md +187 -144
- package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
- package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
- package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
- package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
- package/skills/scalability-clean-code/SKILL.md +229 -229
- package/skills/self-evolving-memory-graph/SKILL.md +75 -0
- package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
- package/skills/senior-frontend/SKILL.md +161 -161
- package/skills/senior-fullstack/SKILL.md +167 -167
- package/skills/seo/SKILL.md +235 -225
- package/skills/seo-geo/SKILL.md +188 -188
- package/skills/session-context-loader/SKILL.md +77 -0
- package/skills/session-handoff-resume/SKILL.md +158 -158
- package/skills/skill_baru/SKILL.md +172 -147
- package/skills/spa-orchestrator/SKILL.md +288 -288
- package/skills/state-management-expert/SKILL.md +272 -272
- package/skills/supabase-security-expert/SKILL.md +243 -243
- package/skills/tailwind-expert/SKILL.md +188 -188
- package/skills/tanstack-query-expert/SKILL.md +199 -199
- package/skills/token-saver/SKILL.md +119 -111
- package/skills/typescript-expert/SKILL.md +324 -279
- package/skills/ui-components-expert/SKILL.md +263 -46
- package/skills/ui-ux-pro-max/SKILL.md +202 -201
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
- package/skills/ui_ux_expert/SKILL.md +17 -6
- package/skills/vector-db-rag-expert/SKILL.md +52 -0
- package/skills/vibe-code-gardener/SKILL.md +181 -173
- package/skills/visual-qa-vision-agent/SKILL.md +65 -0
- package/skills/vue-frontend-expert/SKILL.md +126 -0
- package/skills/web-3d-graphics-expert/SKILL.md +131 -0
- package/skills/web-game-engine-expert/SKILL.md +96 -0
- package/skills/web-scraper/SKILL.md +207 -205
- package/skills/website-design-cloner/SKILL.md +174 -0
- package/skills/webxr-ar-vr-expert/SKILL.md +117 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +206 -180
- package/skills/zero-trust-secret-vault/SKILL.md +40 -0
- package/vibes-swarm-demo.gif +0 -0
|
@@ -1,199 +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.
|
|
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.
|
|
@@ -1,111 +1,119 @@
|
|
|
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:
|
|
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".
|
|
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: vibes-plug-swarm
|
|
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".
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Orchestration & Integration
|
|
116
|
+
- Integrates with `zero-to-prod-orchestrator`, `session-handoff-resume`, `brainstorming`, and `ai-cost-token-optimizer`.
|
|
117
|
+
|
|
118
|
+
## Integrasi Orkestrasi
|
|
119
|
+
- Terintegrasi dengan `zero-to-prod-orchestrator`, `session-handoff-resume`, `brainstorming`, dan `ai-cost-token-optimizer`.
|