| name | moviemonk-ai |
| description | Full build and safety test workflow for MovieMonk UX/Component changes. Validates that UI modifications maintain type safety, component consistency, responsive behavior, and test coverage before deployment. Runs linting, unit tests, integration tests, and regression checks with automated validation of component consistency patterns. WHEN: after making UI component changes, before deploying UX improvements, validating movie/show/person display consistency, ensuring responsive behavior is preserved, testing ambiguity modal or hero metadata changes. |
| license | MIT |
| metadata | {"author":"Aravind Lal","version":"1.0.0","project":"moviemonk-ai"} |
MovieMonk UX Build & Safety Test
AUTHORITATIVE WORKFLOW ā MANDATORY FOR DEPLOYMENT
This skill ensures all UI/UX changes are production-ready by validating type safety, component consistency, test coverage, and responsive behavior. MUST be completed before merging to main branch.
Triggers
Activate this skill when you want to:
- Validate UX changes across movie/show/person display components
- Ensure component consistency patterns (metadata formatting, spacing, affordances)
- Verify TypeScript types match component implementations
- Test responsive behavior (mobile and desktop viewports)
- Validate that schema changes propagate correctly through the data pipeline (types ā services ā components)
- Run comprehensive regression testing before deployment
- Check for breaking changes to existing UI behavior
Scope: This skill orchestrates validation of UI/component changes. It does NOT create new components or features ā it validates existing changes for safety and consistency.
Prerequisites
- All target component files edited and saved
.env.local configured with the usual API keys from README when running locally
- No uncommitted changes in unrelated files (clean git state recommended)
- Node modules installed (
npm install completed)
Rules
- Sequential Validation ā Run steps in order; don't skip stages
- Test Isolation ā Run linting first, then unit tests per component, then integration tests
- Type Safety First ā Fix TypeScript errors before running tests
- 100% Pass Rate ā All tests must pass; no known failures allowed
- Responsive Coverage ā Test affects both mobile and desktop breakpoints
- Component Consistency ā Validate that related components (Movie/TV/Person display) use matching patterns
- Zero Regressions ā Integration tests must verify story flows unchanged
Steps
| # | Stage | Action | Validation |
|---|
| 1 | Type Check | npm run lint | No TypeScript errors, all imports valid |
| 2 | Unit Tests | npm test -- __tests__/components/ (affected components) | 100% pass (affected files only) |
| 3 | Integration Tests | npm test -- __tests__/integration/userJourneySmoke.test.ts | 100% pass (user stories intact) |
| 4 | Consistency Audit | Visual inspection of component pattern alignment | Component Consistency Checklist section below |
| 5 | Responsive Verify | Dev tools: test mobile and desktop viewports | Spacing, affordances, scroll behavior consistent |
| 6 | Edge Cases | Manual testing of boundary conditions | Empty states, long text, slow networks |
| 7 | Report & Approve | Summarize all validation results | All stages passed, ready for merge |
STAGE 1: Type Check
Command:
npm run lint
Expected Output:
ā No errors found
ā All files pass TypeScript checks
Common Issues & Solutions:
| Issue | Cause | Solution |
|---|
Property 'language' does not exist on type 'MovieData' | Schema mismatch between types.ts and component | Update types.ts first, then constants.ts INITIAL_PROMPT schema, then components |
Cannot find module '@/types' | Import path incorrect | Verify file exists at path and tsconfig paths are correct |
Expected value of type 'string | undefined' but got 'string' | Optional field treated as required | Add ?: to type definition or use optional chaining ?. in component |
Unused variable 'tempVar' | Dead code from refactoring | Remove variable if not needed, or prefix with _ if intentional |
Remediation: Fix all errors before proceeding to Stage 2. If errors are in unrelated files, they must be resolved first.
STAGE 2: Unit Tests (Component-Specific)
Target: Run tests for affected components only to isolate changes
Command by component type:
npm test -- __tests__/components/
npm test -- __tests__/components/ambiguousModal.test.ts
npm test -- __tests__/components/discoveryPage.test.ts
npm test -- __tests__/components/personDisplay.test.ts
Stage 2 Complete When: All targeted component suites pass.
STAGE 3: Integration Tests (Story Validation)
Command:
npm test -- __tests__/integration/userJourneySmoke.test.ts
Expected Output:
PASS __tests__/integration/userJourneySmoke.test.ts
User Journey Smoke Tests
ā discovery page loads with hero metadata (120 ms)
ā search results render and filter correctly (85 ms)
ā modal selection resolves to detail view (200 ms)
Test Suites: 1 passed, 1 total
Tests: 3 passed, 3 total
What This Validates:
- End-to-end user flows unbroken (search ā ambiguity ā detail)
- Hero metadata visible and formatted correctly
- Modal filtering and selection work
- Detail display renders all sections (overview, cast, similar, etc.)
- No console errors during flow
If Test Fails:
- Check test output for which step broke (e.g., "renders movie detail on selection")
- Verify component that changed is related to that step
- Look for console errors in test output
- May need to update test snapshot or expectations if UI intentionally changed
Stage 3 Complete When: 100% of user journey tests pass, no skipped tests
STAGE 4: Consistency Audit
Component Consistency Checklist:
Metadata Format Consistency
Field Presence Across Components
Run this search across codebase:
grep -r "formatDisplayLanguage\|LANGUAGE_NAME_BY_CODE" src/components/
Expected: MovieDisplay.tsx and TVShowDisplay.tsx both have these; PersonDisplay does not (person doesn't have language field)
Responsive Spacing Validation
Scroll Behavior Validation
No Regressions in Related Sections
Audit Complete When: All checkboxes validated via code inspection or manual testing
STAGE 5: Responsive Verification
Test on both viewports:
Desktop (sm: breakpoint, 768px+)
npm run dev
- Open http://localhost:3000 in browser
- Open DevTools (F12) ā Device Toolbar ā Select "Desktop" or iPad Pro
- Trigger search to show ambiguous modal (e.g., search "Avatar")
- Verify:
Mobile (default viewport, <640px)
- In DevTools ā Device Toolbar ā Select "iPhone 12" or "Pixel 5"
- Trigger same search flow
- Verify:
Responsive Complete When: All checks pass on both mobile and desktop
STAGE 6: Edge Cases
Manual testing scenarios:
| Scenario | Steps | Expected Outcome |
|---|
| Long title | Search for very long movie/show title | Metadata text wraps properly, doesn't break layout |
| Missing language | Search movie with no spoken_languages data in TMDB | Language field empty or shows "Unknown", doesn't crash |
| Many results | Search term with 50+ results | Scroll works smoothly, affordances update, no performance lag |
| Fast scroll to top | Scroll down 10+ items, then scroll to top immediately | "Scroll for more" hint doesn't reappear (shows once per render) |
| No results | Search for gibberish term | Error state displays cleanly, no console errors |
| Slow network | Browser DevTools ā Network ā Throttle to "Slow 3G" | Data loads incrementally, affordances responsive |
Edge Cases Complete When: No unexpected behavior or console errors observed
STAGE 7: Report & Approve
Generate validation summary:
## MovieMonk UX Build & Safety Test Report
**Date:** [YYYY-MM-DD HH:MM]
**Branch:** improvements/general-ux-polish
**Components Changed:** [list files]
### Validation Results
| Stage | Status | Evidence |
|-------|--------|----------|
| Type Check (npm run lint) | ā
PASS | 0 errors, 0 warnings |
| Unit Tests | ā
PASS | 12/12 tests passed |
| Integration Tests | ā
PASS | 3/3 user journey tests passed |
| Consistency Audit | ā
PASS | All 8 checkboxes verified |
| Responsive (Desktop) | ā
PASS | Verified on 1920x1080 viewport |
| Responsive (Mobile) | ā
PASS | Verified on 375x812 viewport |
| Edge Cases | ā
PASS | 5/5 scenarios tested |
### Summary
All validation stages passed. The following UX improvements are production-ready:
- Language field now displays in hero metadata (movie/TV)
- Metadata standardized across all detail views (Year ⢠Type ⢠Language)
- Desktop spacing enhanced (increased padding, row height, thumbnails)
- Scroll affordance cues implemented (gradients + hint)
- Modal footer removed; desktop scroll restored
### Approval
ā
**READY FOR MERGE TO MAIN**
Recommendation: Merge to main branch for production deployment.
Report Complete When: All stages documented with pass/fail evidence
Common Patterns in MovieMonk
Adding a New Field to MovieData
When adding a field (e.g., language), follow this sequence:
-
types.ts ā Add field to interface:
export interface MovieData {
language?: string;
}
-
constants.ts ā Update schema AND prompt:
export const MOVIE_DATA_SCHEMA = `{
// ... existing schema
"language": "string (e.g., 'Japanese', 'Korean')",
}`;
export const INITIAL_PROMPT = `...
Include language field extracted from...
`;
-
services/tmdbService.ts ā Extract from API:
language: details.spoken_languages[0]?.english_name || details.original_language
-
components/MovieDisplay.tsx ā Render with formatting:
const formatDisplayLanguage = (code: string) => {
const LANGUAGE_NAME_BY_CODE = { ja: 'Japanese', ko: 'Korean', ... };
return LANGUAGE_NAME_BY_CODE[code] || code;
};
-
All Related Components ā Apply same format (TVShowDisplay, PersonDisplay, etc.)
-
Run Full Validation ā Execute this skill's complete workflow
Standardizing Metadata Format Across Components
Target pattern: Year ⢠Type ⢠Language (bullets with ' \u2022 ' separator)
-
Update each detail component:
const metadataParts = [
movieData.releaseYear,
movieData.type,
formatDisplayLanguage(movieData.language)
].filter(Boolean);
const metadata = metadataParts.join(' \u2022 ');
-
Remove genre, director, or other fields from hero line (move to chips/sections below)
-
Test that metadata appears identically formatted across Movie/TV/Person detail views
-
Run Stage 2-3 to verify consistency is tested
Improving Desktop Spacing
Use Tailwind's sm: breakpoint (768px+):
<div className="px-4 py-3 sm:px-7 sm:py-5">
{}
{}
</div>
Verify with Stage 5 responsive testing.
Troubleshooting
Lint Errors After Changes
Error: Property 'X' does not exist on type 'MovieData'
Root Causes:
- Field added to component but not to types.ts interface
- Field added to types.ts but not exported
- Import path to types incorrect in component
Fix:
- Verify types.ts has the field defined
- Check component imports:
import { MovieData } from '@/types' (adjust path as needed)
- Run
npm run lint -- --fix to auto-fix fixable issues
Test Snapshots Out of Date
Error: Snapshot does not match or 1 snapshot outdated
Root Cause: Component output changed intentionally (e.g., metadata format), test snapshot needs update
Fix:
npm test -- -u
npm test -- __tests__/components/ambiguousModal.test.ts -u
ā ļø Review snapshot diff: Before committing snapshot updates, inspect the diff to ensure changes are intentional (not bugs).
Tests Pass But Console Errors Appear
Symptom: Tests pass, but chrome/browser console shows error about missing field
Root Cause: Service not extracting field, component accessing undefined path without null-check
Fix:
- Check service (e.g., tmdbService.ts) to verify field extraction logic
- Add fallback in component:
movieData.language || ''
- Update test mock to include the field with test data
- Re-run tests to verify console errors gone
Desktop Scrolling Still Broken
Symptom: Modal scrolls on mobile but not desktop
Root Causes:
- Outer dialog not locked to
overflow-hidden
- Modal height not constrained (height auto, not fixed vh)
- Results list doesn't have explicit scroll container
Fix:
- Verify modal outer div:
overflow-hidden (not overflow-y-auto)
- Verify modal container:
h-[86vh] max-h-[86vh] on sm: breakpoint
- Verify results list:
overflow-y-auto h-full to take remaining height
- Disable any scroll-on-parent logic (e.g., prevent wheel bubbling)
Re-test Stage 5 after fixes.
References
- MovieDisplay.tsx ā Movie hero + detail rendering
- TVShowDisplay.tsx ā TV series metadata + cast + similar
- PersonDisplay.tsx ā Person bio + filmography
- AmbiguousModal.tsx ā Search result shortlist + modal scroll UX
- types.ts ā MovieData interface (source of truth for shape)
- constants.ts ā INITIAL_PROMPT + MOVIE_DATA_SCHEMA (AI instruction + validation)
- services/tmdbService.ts ā TMDB API extraction + normalization
Checklist for Merge
Before opening a PR or merging to main, verify:
Ready to merge when: All checkboxes checked and no remediations pending.