Integrate Component
Properly integrate a React component into a production application - NOT demo pages.
Usage
code
/integrate-component <component-name> in <project-path>
Example:
code
/integrate-component ScratchpadTeacher in /Users/gaganarora/clawd/aitutor-homework
What This Skill Does
- •Finds the component in the project
- •Identifies integration points - existing pages where the component belongs
- •Adds the component to real production routes (NOT /demo/*)
- •Updates imports and exports
- •Runs build to verify no errors
- •Runs tests if they exist
Rules
NEVER DO:
- •Create
/demo/*routes - •Create standalone demo pages
- •Add new routes just for testing a component
- •Create
*Demo.tsxfiles
ALWAYS DO:
- •Find existing pages where the component fits
- •Add component to real user flows
- •Use existing UI library (Shadcn, MUI, etc.)
- •Respect existing patterns in the codebase
- •Run
pnpm buildornpm run buildto verify
Integration Checklist
Before saying "done", verify:
- • Component is imported in at least one production page
- • Component is visible in real user flow (not /demo)
- •
pnpm tsc --noEmitpasses - •
pnpm buildpasses - • Component uses existing design system components
- • Props are properly typed
Example: ScratchpadTeacher in aitutor-homework
BAD (what NOT to do):
tsx
// src/index.tsx - WRONG
<Route path="/app/demo/scratchpad-teacher" component={ScratchpadTeacherDemo} />
GOOD (proper integration):
tsx
// src/components/QuestionDisplay.tsx - RIGHT
import { ScratchpadTeacher } from "@/components/scratchpad";
export function QuestionDisplay({ question, showSolution }) {
return (
<div>
{/* Existing question content */}
<QuestionContent question={question} />
{/* ScratchpadTeacher integrated into real flow */}
{showSolution && (
<ScratchpadTeacher
strokes={question.solutionStrokes}
title="Step-by-step solution"
autoPlay={true}
/>
)}
</div>
);
}
Finding Integration Points
Ask these questions:
- •What user action triggers this component?
- •What existing page handles that action?
- •What state/context does the component need?
- •Which existing components should contain it?
For ScratchpadTeacher:
- •Triggered by: User wants to see step-by-step solution
- •Existing page: LessonPage, QuestionDisplay
- •State needed: Solution strokes data
- •Container: QuestionDisplay or a new "ShowSolution" section in LessonPage
Verification Commands
bash
# TypeScript check cd frontend && pnpm tsc --noEmit # Full build (catches everything) cd frontend && pnpm build # Run tests cd frontend && pnpm test --run # Dev server to visually verify cd frontend && pnpm dev # Then navigate to the REAL page where component is integrated