कॉम्पोनेंट इंस्पेक्टर अपडेटर
स्किलयह टूल, अलग-अलग कॉम्पोनेंट के डेवलपमेंट इंस्पेक्टर की जांच करता है और उसे सिंक करता है. ऐसा तब होता है, जब React कॉम्पोनेंट के प्रॉप, स्टेटस, व्यवहार या टेस्ट सुइट में बदलाव होता है. यह तीन स्टेट कैटगरी (बदलाव किया जा सकता है, प्रॉप्स, कंप्यूटेड) को रीकंसाइल करता है. साथ ही, सादी अंग्रेज़ी में टेस्ट की पुष्टि करने वाले फ़िक्सचर को रीफ़्रेश करता है, 'पिछली बार अपडेट किया गया' टाइमस्टैंप चिप को आगे बढ़ाता है, और प्रोडक्शन ट्री-शेकिंग की इंटिग्रिटी की पुष्टि करता है.
इस स्किल को ऐक्सेस करने के लिए साइन इन करें
Build It! सीरीज़ में इस्तेमाल की गई पूरी स्किल देखने और कॉपी करने के लिए, अपनी Google डेवलपर प्रोफ़ाइल से साइन इन करें.
डेवलपर प्रोफ़ाइल ज़रूरी है
आपके पास डेवलपर प्रोफ़ाइल बनाने की अनुमति नहीं है. इस सुविधा को चालू करने के लिए, अपने Workspace एडमिन को सूचना दें.
डेवलपर प्रोफ़ाइल बनाएं
Build It! की सभी स्किल, नियम, प्रॉम्प्ट, और आर्टफ़ैक्ट अनलॉक करने के लिए, बिना किसी शुल्क के Google डेवलपर प्रोफ़ाइल बनाएं.
अनलॉक करने के लिए, Builder Central में शामिल हों
Build It! की सभी स्किल, नियम, प्रॉम्प्ट, और आर्टफ़ैक्ट अनलॉक करने के लिए, एक क्लिक में बिल्डर मेंबर का बैज मुफ़्त में पाएं.
Google Antigravity को इंस्टॉल और इस्तेमाल करने का तरीका
इस स्किल को अपने Google Antigravity वर्कस्पेस में जोड़ें, ताकि जब भी कोई कॉम्पोनेंट बदले, तब मौजूदा कॉम्पोनेंट इंस्पेक्टर अलाइन रहें:
- अपने प्रोजेक्ट फ़ाइल फ़ोल्डर में
.agents/skills/component-inspector-updater/फ़ोल्डर बनाएं या फ़ाइल फ़ोल्डर में कोई स्किल जोड़ने के लिए, Google Antigravity Customizations > Skills खोलें. - नीचे दी गई पूरी Markdown परिभाषा को उस फ़ोल्डर में
SKILL.mdके तौर पर सेव करें. - किसी कॉम्पोनेंट में बदलाव करने के बाद, इसे मैन्युअल तरीके से शुरू करें. उदाहरण के लिए: "CoachChatInspector को मेरे हाल ही के बदलावों के साथ सिंक करने के लिए, component-inspector-updater स्किल का इस्तेमाल करें". इसके अलावा, Inspector Editing Mode नियम इंस्टॉल करें, ताकि Inspector Editing Mode के चालू होने पर, Google Antigravity इस वर्कफ़्लो को अपने-आप चलाए.
- क्या आपको पहले एक नया इंस्पेक्टर बनाना है? कंपैनियन Component Inspector Generator स्किल का इस्तेमाल करें.
कॉम्पोनेंट इंस्पेक्टर अपडेटर स्किल की परिभाषा
स्किल की इस पूरी परिभाषा को अपने वर्कस्पेस में SKILL.md के तौर पर कॉपी करें.
---
name: component-inspector-updater
description: >-
Audits and synchronizes an existing isolated component development inspector when the underlying
React component's props, state, behavior, or test suites change. Reconciles the three state
categories (Editable, Props, Computed), refreshes plain-English test verification fixtures,
advances the 'Last Updated' timestamp chip, and verifies production tree-shaking integrity.
---
# Component Inspector Updater Skill
Use this skill whenever an underlying React/Next.js component (e.g. `CurrentSetCard`, `WorkoutHeader`) has undergone changes (such as added, renamed, or deleted props, altered state management, or updated test suites) and its existing development inspection route (`src/dev/inspectors/[ComponentName]Inspector.tsx`) needs to be brought up to date.
---
## 1. Core Update Principles
Because component inspectors represent a manual snapshot at a fixed point in time, any change to the target component introduces potential **inspector drift**. When updating an inspector:
1. **Full Prop Reconcilation**: Every property in `interface [ComponentName]Props` must be accounted for in either the **Editable State** or **Props State**.
2. **Category Accuracy**:
- **Editable State**: Only state variables that the user/athlete directly manipulates during active usage.
- **Props State**: Parent inputs and configuration.
- **Computed State**: All values derived via `useMemo` from the other two categories.
3. **Plain-English Test Synchronization**:
- Synchronize test cards with the latest assertions from `scripts/` and `docs/architecture/client_architecture_spec.md`.
- Update test fixture handlers so `[Load Test Fixture]` accurately populates the new prop structure.
4. **Preservation of Custom Presets & Scenarios**:
- NEVER delete, reset, or overwrite custom presets, scenarios, or edge-case fixtures that were manually added to the inspector (such as weekly overhaul proposals, multi-exercise scenarios, or custom user test cards).
- Only adapt their data shape to conform to updated prop signatures if types changed; never revert the presets list back to a minimal default.
5. **Timestamp Advancement**:
- Always update `const GENERATED_AT = 'YYYY-MM-DD HH:MM [TIMEZONE]';` to the current date and time.
6. **Preserve Production Tree-Shaking**:
- Ensure the App Router stub at `src/app/dev/[slug]/page.tsx` continues to guard with `process.env.NODE_ENV === 'development'` and `notFound()` in production.
7. **Zero Viewport / Page-Scroll Disruptions**:
- Verify that prop changes, preset loaders, and fixture triggers never introduce automatic page-level scrolling (e.g. `scrollIntoView()` or viewport jumping). Internal element scrolling must always be scoped strictly to `containerRef.current.scrollTop = containerRef.current.scrollHeight` so the user's viewport on the workbench controls is preserved.
> **Skill Maintenance Policy**: Updates to this skill must reflect generic architectural standards that apply to all component inspectors across the app. Do not update this skill for one-off requests for individual components (e.g. adding a specific preset or scenario to a single component).
---
## 2. Step-by-Step Update Workflow
### Step 1: Diff and Audit the Component
1. Inspect the updated component file: `src/components/[category]/[ComponentName].tsx`.
2. Inspect the existing inspector file: `src/dev/inspectors/[ComponentName]Inspector.tsx`.
3. Identify all discrepancies:
- **Added Props**: New inputs that require state variables and inspector controls.
- **Removed / Deprecated Props**: Old inputs that should be pruned from the inspector.
- **Type Signature Changes**: Props that changed types (e.g. `number` to `string | number`, or array structure changes).
- **Callback Signature Changes**: Changes to event handlers (`onWeightChange`, `onComplete`, etc.).
### Step 2: Audit Relevant Test Suites
1. Check test files in `scripts/` (e.g., `test-active-workout-suite.ts`, `test-client-state.ts`, etc.) and the plain-English test cases in `docs/architecture/client_architecture_spec.md`.
2. Determine if any new test cases were added or existing test expectations were modified.
3. Draft plain-English titles and descriptions for any new test cases.
### Step 3: Update `src/dev/inspectors/[ComponentName]Inspector.tsx`
Perform the following edits:
1. **Advance Timestamp**:
Update the constant:
```ts
const GENERATED_AT = 'YYYY-MM-DD HH:MM [TIMEZONE]';
```
2. **Update Props & Editable State Hooks**:
- Add/remove `useState` hooks for modified props or editable fields.
- Update the dummy data presets (`loadPreset('active')`, `loadPreset('completed')`, etc.) to match new prop structures while strictly preserving all custom presets (e.g. week proposals, multi-exercise scenarios, custom fixtures).
3. **Update Computed State (`useMemo`)**:
- Recompute derived metrics if formulas or business rules changed.
- Update dependencies array in `useMemo`.
4. **Update the State Inspector Controls (Right Column)**:
- Add controls for new props in the Props or Editable cards.
- Update the Computed State grid if new derived properties were added.
5. **Update Component Canvas Invocation (Left Column)**:
- Ensure `<[ComponentName] {...props} />` passes all required new props and updated handler signatures.
6. **Update Test Cases & Fixture Buttons (Bottom Section)**:
- Update or add test fixture cards with clear, plain-English user descriptions.
- Update `[Load Test Fixture]` click handlers to set the new state/props for each test scenario.
7. **Verify Component Registry**:
- Confirm `src/dev/registry.ts` has the component correctly listed with its current name, routePath, and domain category.
### Step 4: Validate Build & Tree-Shaking Integrity
1. **Typecheck**:
```bash
npx tsc --noEmit
```
Ensure zero TypeScript compilation errors.
2. **Production Bundle Verification**:
- For routine iteration, rely on `npx tsc --noEmit`.
- Never run raw `npm run build` while a local `next dev` server is active, as it overwrites `.next/` with production bundles and wipes out dev chunk manifests.
- If full production tree-shaking verification is needed, run in an isolated directory:
```bash
NEXT_DIST_DIR=.next-build npx next build && rm -rf .next-build
```
- Confirm route `/dev/[slug]` remains minimal in size (~700 B minimal 404 stub).
---
## 3. Checklist for Inspector Verification
- [ ] All props from `[ComponentName]Props` have corresponding state and inspector controls.
- [ ] Editable and Prop state controls correctly update the live canvas.
- [ ] Computed state cards reflect all derived properties with lock badges.
- [ ] All test fixture cards have plain-English descriptions (no raw test IDs in prose).
- [ ] `[Load Test Fixture]` buttons correctly apply the fixture state.
- [ ] `const GENERATED_AT` reflects the current update timestamp.
- [ ] `data-testid="last-updated-chip"` displays the updated timestamp in the header.
- [ ] `npx tsc --noEmit` exits with 0 errors.
- [ ] `npm run build` exits with 0 errors and preserves zero production bundle impact.