This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Install dependencies:
npm install - Start the dev server:
npm run dev - Build for production:
npm run build - Start the production server:
npm run start - Run lint:
npm run lint - Run the full test suite:
npm test - Run Jest in watch mode:
npm run test:watch - Run test coverage:
npm run test:coverage - Run Prettier check:
npm run format:check - Fix formatting:
npm run format:fix - Generate sitemap/robots manually:
npm run sitemap - Run bundle analysis build:
npm run analyze - Run TypeScript without emitting:
npx tsc --noEmit
- Run one test file:
npm test -- src/components/chat/__tests__/navigation-indicator.test.tsx - Run tests matching a name:
npm test -- -t "tool execution"
- Copy
.env.exampleto.env.localfor local development. - The AI chat API expects
LLM_API_KEY;LLM_BASE_URLis optional for OpenAI-compatible providers. - Contact form email delivery uses
NODEMAILER_USERandNODEMAILER_PASS. npm run buildautomatically triggerspostbuild, which runsnpm run sitemap.next.config.jssetseslint.ignoreDuringBuilds = true, so a successful production build does not guarantee lint is clean.BUILD_STANDALONE=trueenables Next.js standalone output.ANALYZE=trueenables the bundle analyzer.
This is a Next.js 15 Pages Router portfolio site with a strong emphasis on animation, SEO, and an AI-driven chat assistant that can trigger structured UI actions on the site.
src/pages/_app.tsxis the main composition root.- Wraps the app in
AnimationGateProvider,ChatProvider, andThemeProvider. - Configures
DefaultSeofromsrc/data/siteMetaData.mjs. - Mounts global route-transition motion and Vercel Analytics.
- Wraps the app in
src/layout/main-layout.tsxprovides the shared shell: welcome overlay, navbar, footer, skip link, and floating chat button.- Routes use the Pages Router under
src/pages/, including API routes insrc/pages/api/.
The most important non-standard architecture in this repo is the chat/tool pipeline.
src/pages/api/chat.tshandles chat requests.- Builds a typed
ToolContextfrom route/theme/user state. - Initializes the tool registry.
- Calls the LLM through the
openaiSDK usingLLM_API_KEYand optionalLLM_BASE_URL. - Executes returned tool calls and then performs a follow-up model call so the assistant can respond naturally after tool execution.
- Applies rate limiting before model execution.
- Builds a typed
src/types/tools.tsdefines the core contracts:ToolContext,ToolAction,ToolResult,ToolCall, and tool execution config/stats.src/lib/tools/contains the tool implementations and registry logic.src/lib/tools/context-aware-tool-registryis responsible for contextual tool availability and page detection.src/components/chat/contains the floating assistant UI, action indicators, feedback panels, and related chat interaction components.src/config/ai.tscontains model/system prompt configuration.src/utility/ai-chat-responses.tscontains fallback/response helpers referenced by the README and chat flow.
When extending chat behavior, preserve the typed action pipeline rather than adding ad hoc UI-side behavior.
- Theme switching is handled by
next-themeswithattribute="class". - Global styling lives in
src/styles/globals.cssand is based on Tailwind + CSS custom properties. - Tailwind configuration lives in
tailwind.config.js. - Framer Motion is the primary animation system across page transitions, reveals, overlays, and chat interactions.
- Shared animation primitives live in
src/animation/. src/contexts/animation-gate.tsxcoordinates when animations should run during route transitions and welcome-screen flow.
- Site content is largely data-driven through
src/data/rather than hard-coded in page JSX. src/data/siteMetaData.mjsis the source of truth for site URL, SEO metadata, social links, and verification tags.- Navigation structure is sourced from
src/data/navigationRoutes. - Projects, experience, skills, and similar portfolio content are organized as source data and rendered by components.
- SEO defaults are configured in
_app.tsxvianext-seoandsrc/data/siteMetaData.mjs. src/scripts/generateSitemap.mjsgeneratessitemap.xmlandrobots.txt.- SEO generation is part of the normal production build through
postbuild.
src/pages/api/chat.tspowers the AI assistant.src/pages/api/sendmail.tshandles contact-form email delivery.src/utility/rate-limiter.tsprovides the in-memory/LRU-based rate limiter used by API routes.
- Jest is configured through
jest.config.jsusingnext/jest. - Tests run in
jest-environment-jsdom. jest.setup.jsloads@testing-library/jest-dom.- The repo primarily uses Jest + React Testing Library for component and chat interaction tests.
- Tests are colocated using
__tests__directories and*.test.*/*.spec.*naming.
- Preserve the existing typed tool/action architecture when modifying the AI assistant.
- Prefer updating data in
src/data/and config files over hard-coding portfolio content in components. - Keep animation changes aligned with the existing Framer Motion + animation-gate structure instead of introducing parallel animation systems.
- If you change SEO-relevant routes or metadata, check whether sitemap generation or metadata files also need updates.
- When working on deployment or production behavior, remember that the GitHub workflow deploys to Vercel and the app is configured with Vercel-oriented assumptions.
- If you need a clean typecheck, run
npx tsc --noEmitexplicitly; the normal build path does not enforce lint cleanliness.