Skip to content

Commit f136540

Browse files
authored
Update audit prompts (#566)
Update `audit-doc` prompts based on feedback externally received.
1 parent 9bf4d71 commit f136540

File tree

16 files changed

+883
-394
lines changed

16 files changed

+883
-394
lines changed

.github/copilot-instructions.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# Alexander Sullivan's Portfolio - AI Coding Agent Instructions
2+
3+
## Architecture Overview
4+
5+
This is a **Next.js portfolio website** using the **App Router** (not Pages Router), React, TypeScript, and Material-UI with Emotion. The project follows a modular structure with path aliases, comprehensive testing, and Progressive Web App (PWA) capabilities.
6+
7+
### Key Technologies & Integrations
8+
9+
- **Framework**: Next.js App Router with React Server Components
10+
- **Styling**: Material-UI (MUI) + Emotion (use `sx` prop, not CSS modules)
11+
- **Testing**: Jest (unit tests), Cypress (E2E tests with accessibility via cypress-axe)
12+
- **Monitoring**: Sentry error tracking, Firebase Analytics/Performance, Vercel Speed Insights
13+
- **PWA**: Service Worker in `public/sw.js`, manifest via `src/app/manifest.ts`
14+
15+
## Critical Workflows
16+
17+
### Development Commands
18+
19+
```bash
20+
npm run dev # Start dev server at localhost:3000
21+
npm run validate # Full CI check: prettier → eslint → tsc → jest → cypress → build → markdown
22+
npm run test:jest # Unit tests only
23+
npm run test:cypress:e2e # E2E tests headless
24+
npm run build # Production build
25+
```
26+
27+
**Always run `npm run validate` before committing.** This is the comprehensive quality gate used in CI/CD.
28+
29+
### Testing Requirements
30+
31+
- **Unit tests**: Every component requires a `.test.tsx` file (see `src/components/banner/Banner.test.tsx`)
32+
- **Test setup**: Uses `jest/setup.ts` with jsdom environment
33+
- **E2E tests**: Located in `cypress/e2e/`, include accessibility tests (cypress-axe)
34+
- **Coverage**: Run `npm run test:jest:coverage` for coverage reports
35+
36+
## Project-Specific Conventions
37+
38+
### Path Aliases (Critical!)
39+
40+
Always use TypeScript path aliases defined in `tsconfig.json`:
41+
42+
```typescript
43+
import Avatar from '@components/banner/Avatar';
44+
// NOT '../components/banner/Avatar'
45+
import { DELAYS } from '@constants/index';
46+
// NOT '../../constants'
47+
import { isNetworkFast } from '@util/isNetworkFast';
48+
```
49+
50+
### Component Patterns
51+
52+
#### Material-UI Styling
53+
54+
Use `sx` prop for styling, never inline styles or CSS modules:
55+
56+
```typescript
57+
<Box
58+
component='div'
59+
sx={{
60+
display: 'flex',
61+
margin: '3rem auto',
62+
fontSize: 'clamp(1.5rem, 2.5rem, 2.5rem)',
63+
}}
64+
>
65+
```
66+
67+
#### SVG Icons Pattern
68+
69+
SVGs are imported as React components via `@svgr/webpack`. See `src/images/icons.tsx`:
70+
71+
```typescript
72+
import Icon from './icons/example.svg';
73+
export const ExampleIcon = (props: SvgIconProps) =>
74+
<SvgIcon component={Icon} inheritViewBox {...props} />;
75+
```
76+
77+
### Data Management
78+
79+
Static data lives in `src/data/`:
80+
81+
- `projects.ts`: Project portfolio with typed interface
82+
- `publications.ts`: Academic publications
83+
- `socials.ts`: Social media links
84+
- `keywords.ts`: SEO keywords array
85+
86+
### Constants Pattern
87+
88+
Centralized constants in `src/constants/index.ts` with `as const` for type safety:
89+
90+
```typescript
91+
DELAYS.PROJECT_HOVER_VIDEO; // 1000ms before video plays on hover
92+
THRESHOLDS.SNEEZE_TRIGGER_INTERVAL; // Easter egg triggers
93+
NETWORK.SLOW_DOWNLINK_THRESHOLD; // Network performance checks
94+
```
95+
96+
## Code Style & Quality
97+
98+
### Linting & Formatting
99+
100+
- **Indentation**: Tabs (not spaces) - enforced by ESLint
101+
- **Line length**: No hard limit, use Prettier
102+
- **Import sorting**: Handled by `@trivago/prettier-plugin-sort-imports`
103+
- **Unused vars**: Prefix with `_` to ignore (e.g., `_unusedParam`)
104+
105+
### ESLint Rules (see `eslint.config.js`)
106+
107+
- Tabs for indentation (indent: ['error', 'tab'])
108+
- Console logs allowed (`no-console: off`)
109+
- Unused vars with `_` prefix ignored
110+
- React hooks exhaustive deps enforced
111+
112+
### TypeScript
113+
114+
- **Strict mode**: Enabled in `tsconfig.json`
115+
- **No implicit any**: All types must be explicit
116+
- **React 19**: Uses new `react-jsx` transform
117+
- Run `npm run tsc` to check types (no emit)
118+
119+
## Next.js App Router Specifics
120+
121+
### Metadata & SEO
122+
123+
All metadata configured in `src/app/layout.tsx`:
124+
125+
```typescript
126+
export const metadata: Metadata = {
127+
title: { template: `%s | ${metadataValues.title}`, default: metadataValues.title },
128+
keywords: seoKeywords,
129+
openGraph: { ... },
130+
robots: { index: true, follow: true },
131+
};
132+
```
133+
134+
### Server Components vs Client Components
135+
136+
- Default: Server Components (no `'use client'`)
137+
- Client-only: Components with hooks, event handlers, browser APIs
138+
- Example client component: `src/components/ServiceWorkerRegister.tsx`
139+
140+
### Security Headers
141+
142+
CSP and security headers configured in `next.config.js` headers() function. Includes:
143+
144+
- X-Content-Type-Options: nosniff
145+
- X-Frame-Options: DENY
146+
- Strict-Transport-Security (HSTS)
147+
- Content Security Policy for service workers
148+
149+
## Special Features
150+
151+
### Network Performance Optimization
152+
153+
`src/util/isNetworkFast.ts` checks Network Information API to conditionally load heavy assets based on connection speed.
154+
155+
### Easter Eggs
156+
157+
- `src/helpers/aaaahhhh.ts`: Fun image replacement logic triggered by avatar interactions
158+
- `src/helpers/ascii.ts`: Console ASCII art
159+
160+
### Service Worker
161+
162+
- Lives in `public/sw.js` and served via `src/app/sw.js/`
163+
- Registration in `src/components/ServiceWorkerRegister.tsx`
164+
- Used for PWA offline support
165+
166+
## Firebase & Analytics
167+
168+
Initialize Firebase only client-side (see `src/configs/firebase.ts`):
169+
170+
```typescript
171+
import { init, logAnalyticsEvent } from '@configs/firebase';
172+
173+
init(); // Call once on client mount
174+
logAnalyticsEvent('event_name', { params });
175+
```
176+
177+
## Documentation
178+
179+
Architecture docs in `docs/architecture/`:
180+
181+
- `index.md`: System overview
182+
- Component-specific docs for Avatar, Projects, Publications, etc.
183+
184+
## Common Gotchas
185+
186+
1. **Don't** import from relative paths - use path aliases
187+
2. **Don't** forget to update tests when changing components
188+
3. **Always** run `npm run validate` frequently when making changes

.github/prompts/audit-docs.md

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)