diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..99e54f9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,97 @@ +# Repository guidance + +This is Rohit Choudhari's portfolio website at rohitc.tech. Keep shared +coding-agent instructions in this file; `CLAUDE.md` only imports it. + +## Setup and commands + +- Use Node.js **24 or newer** and Bun. `package.json` defines the scripts and + `bun.lock` is the dependency lockfile; do not introduce npm or Yarn lockfiles. +- Install dependencies with `bun install --frozen-lockfile`. +- `bun run dev`: start Next.js development server (port 3000 by default). +- `bun run build`: create the production build. +- `bun run start`: serve an existing production build. +- `bun run lint`: run ESLint across the repository. +- `bunx tsc --noEmit --incremental false`: check TypeScript without writing a + build-info file. This is a direct tool invocation, not a package script. +- `bunx prettier --check `: check formatting for specific files. + Use `bunx prettier --write ` to format only those files. +- `bun run format` formats the entire repository; avoid it for scoped edits. +- `bun run prepare`: initialize Husky hooks when needed. The pre-commit hook runs + lint-staged, which formats staged JS/TS/JSON/CSS/Markdown and runs ESLint fixes + on staged JS/TS. It does not run type checks or tests. + +For Amp orbs, `.agents/setup` checks the toolchain and installs locked development +dependencies. `.agents/resume` only checks the restored tools/dependencies; it +does not reinstall them. These scripts are for the orb lifecycle, not prerequisites +for every local task. + +## Project map + +- Next.js 16 App Router, React 18, strict TypeScript, and Tailwind CSS 3. + The `@/*` alias resolves to `src/*`. +- `src/app/page.tsx` and `src/app/home.module.css`: portfolio home page. +- `src/app/layout.tsx`: shared layout, SEO/Open Graph/Twitter metadata, Person + JSON-LD, Outfit and JetBrains Mono via `next/font/google`, theme provider, + navigation, Vercel Analytics, and Speed Insights. +- `src/app/blog/page.tsx` and `src/app/blog/[slug]/page.tsx`: blog index and + statically generated posts sourced from `src/data/posts.ts`. +- `src/app/uses/page.tsx`: tools and hardware page, with its content defined inline. +- `src/components/`: reusable components; navigation lives in + `src/components/layout/Navbar.tsx`, with its own CSS Module. +- `src/data/`: project, experience, education, and blog content. Prefer editing + these sources rather than duplicating content in components. +- `src/contexts/ThemeContext.tsx`: dark-by-default theme persisted under + `theme-preference` in localStorage; it does **not** select the theme from the + operating system. It separately tracks the system's reduced-motion preference. +- `src/app/globals.css` and `tailwind.config.ts`: global styles, theme tokens, + utilities, and animation settings. Component-specific styles use CSS Modules + alongside Tailwind utilities. +- `src/hooks/useScrollAnimation.ts` and `src/components/AnimateOnScroll.tsx`: + IntersectionObserver-based reveal behavior. +- `public/`: static assets, referenced by root-relative URLs. +- `src/utils/ipValidation.ts` exists but has no callers in `src/`; do not treat it + as an active security boundary or assume its validation is comprehensive. + +## Editing conventions + +- Follow nearby code and keep changes focused. Use typed props and preserve + Server Components unless browser APIs, state, or effects require `"use client"`. +- Prefer `@/` imports for shared source files and relative imports for colocated + CSS Modules. Group React/Next.js imports before components and other internal + imports. Do not create `src/lib/` or `src/styles/` just to match legacy examples. +- Follow `.prettierrc` (two spaces, double quotes, semicolons) and + `eslint.config.mjs`; unused variables and explicit `any` are lint errors. +- Reuse CSS custom properties/theme utilities. Preserve light/dark support, + reduced-motion handling, skip links, visible focus, keyboard navigation, and + meaningful ARIA labels when changing UI. +- `README.md`, `docs/knowledge.md`, and `.cursor/rules/` contain historical setup + examples (including Yarn, old fonts, and generic branch/PR conventions). For + current setup, use this file and executable configuration, not those examples. + +## Verification + +- For guidance-only edits, check changed Markdown with Prettier, verify referenced + paths/scripts against the checkout, and run `git diff --check`. +- For application changes, run lint, TypeScript checking, and a production build. + There is currently no test script or checked-in automated test suite; do not + report tests as passing without actually running applicable checks. +- For UI changes, run the site and inspect affected routes at mobile and desktop + widths, in both themes. Exercise affected navigation/menu states, keyboard + access, and reduced motion; capture and inspect screenshots for visual changes. +- Font loading uses Google Fonts during builds; report network/font-fetch failures + distinctly from source errors rather than silently changing font configuration. + +## Git and deployment + +- Inspect the worktree and staged diff before editing; preserve unrelated changes. + Follow the user's ticket, branch, commit, and PR requirements. The remote default + branch is `master`; do not assume it is `main` or commit directly to either. +- Use focused Conventional Commits (`type(scope): summary`). Do not push, deploy, + or rewrite published history without explicit authorization. +- Deployment configuration targets Vercel, not GitHub Pages despite the repository + name. `next.config.js` defines Next.js image rules and security headers; + `vercel.json` adds hosting headers and immutable caching specifically for + `/assets/*`. Frame headers differ (`SAMEORIGIN` vs `DENY`); inspect both files + before changing security policy rather than assuming they agree. +- Never commit secrets, `.env*`, dependencies, or generated build output. diff --git a/CLAUDE.md b/CLAUDE.md index d02c2e4..43c994c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,82 +1 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Development Commands - -- **Start development server**: `bun dev` (Next.js dev server on localhost:3000) -- **Build for production**: `bun run build` -- **Start production server**: `bun start` -- **Lint code**: `bun lint` (ESLint with Next.js config) -- **Format code**: `bun format` (Prettier formatting) -- **Prepare git hooks**: `bun prepare` (Husky setup) - -## Architecture Overview - -This is a personal portfolio website built with Next.js 16 using the App Router architecture. The codebase follows a modern React/Next.js structure: - -### Core Architecture - -- **Framework**: Next.js 16 with App Router (`src/app/`) -- **Styling**: Tailwind CSS with custom theme support -- **Fonts**: Google Fonts (Outfit + JetBrains Mono) with optimized loading -- **Theme**: Custom dark/light theme system with localStorage persistence and reduced motion support -- **Typography**: Optimized font loading with fallbacks and display swap - -### Key Components - -- **ThemeProvider** (`src/contexts/ThemeContext.tsx`): Global theme state management with dark mode default, system preference detection, and reduced motion support -- **Layout system**: Root layout with comprehensive SEO metadata, structured data, and accessibility features -- **Navigation**: Responsive navbar component with theme switching -- **Project showcase**: Component-based project cards with image optimization - -### Special Features - -- **Security**: Custom IP validation utilities (`src/utils/ipValidation.ts`) to replace vulnerable dependencies -- **SEO**: Comprehensive metadata, Open Graph, Twitter cards, and JSON-LD structured data -- **Performance**: Optimized font loading, image caching headers via Vercel config -- **Accessibility**: Skip links, proper ARIA labels, keyboard navigation support - -### File Organization - -- `src/app/`: Next.js App Router pages and layouts -- `src/components/`: Reusable React components -- `src/contexts/`: React context providers -- `src/data/`: Static data and configuration -- `src/hooks/`: Custom React hooks -- `src/utils/`: Utility functions and helpers - -### Development Standards - -Import order (from .cursor/rules): - -1. React imports -2. Next.js imports -3. Component imports (@/components/\*) -4. Library imports (@/lib/\*) -5. Style imports (@/styles/\*) -6. Other internal imports (@/\*) -7. Relative imports - -### Git Workflow - -- Uses Husky for pre-commit hooks with lint-staged -- Follows conventional commit format -- Branch naming: `feature/`, `fix/`, `refactor/`, `docs/`, `style/`, `perf/` -- Automated formatting and linting on commit - -### Security Headers - -Configured in `vercel.json`: - -- X-Content-Type-Options: nosniff -- X-Frame-Options: DENY -- X-XSS-Protection: 1; mode=block -- Long-term caching for static assets - -### Deployment - -- **Platform**: Vercel with automatic deployments -- **Domain**: rohitc.tech -- **Build**: Standard Next.js build process -- **Assets**: Optimized with long-term caching headers +@AGENTS.md