|
1 | | -# GitHub Copilot Instructions |
2 | | - |
3 | | -## Project Overview |
4 | | -CodeStorm Hub is a modern portfolio website showcasing open source community projects and achievements. Built with Next.js 15, TypeScript, Tailwind CSS 4, and Radix UI, following design engineering principles inspired by Vercel and modern web standards. |
5 | | - |
6 | | -## Development Guidelines |
7 | | - |
8 | | -### Technology Stack |
9 | | -- **Framework**: Next.js 15 with App Router and Turbopack |
10 | | -- **Language**: TypeScript with strict mode enabled |
11 | | -- **Styling**: Tailwind CSS 4 with utility-first approach |
12 | | -- **UI Components**: Radix UI primitives for accessibility |
13 | | -- **Icons**: Radix UI Icons for consistent iconography |
14 | | -- **Typography**: Geist Sans and Geist Mono fonts |
15 | | -- **Colors**: Radix Colors for semantic color usage |
16 | | -- **Deployment**: Vercel with automatic deployments |
17 | | - |
18 | | -### Code Quality Standards |
19 | | - |
20 | | -#### TypeScript Best Practices |
21 | | -- Use strict TypeScript configuration |
22 | | -- Define proper interfaces for all component props |
23 | | -- Avoid `any` type - use proper typing |
24 | | -- Export types alongside components when needed |
25 | | -- Use discriminated unions for complex state management |
26 | | - |
27 | | -#### Component Architecture |
28 | | -- Prefer functional components with React hooks |
29 | | -- Use Radix UI primitives as foundation for custom components |
30 | | -- Implement compound component patterns for complex UI |
31 | | -- Follow atomic design methodology (atoms → molecules → organisms) |
32 | | -- Export components as default exports with named type exports |
33 | | - |
34 | | -#### Styling Guidelines |
35 | | -- Use Tailwind CSS utility classes exclusively |
36 | | -- Follow mobile-first responsive design approach |
37 | | -- Implement dark/light mode using CSS custom properties |
38 | | -- Use Radix Colors for semantic color definitions |
39 | | -- Maintain consistent spacing using Tailwind's spacing scale |
40 | | -- Prefer composition over customization for component styling |
41 | | - |
42 | | -### Accessibility Requirements |
43 | | -- Ensure WCAG 2.1 AA compliance for all components |
44 | | -- Use semantic HTML elements appropriately |
45 | | -- Include proper ARIA attributes where needed |
46 | | -- Test keyboard navigation functionality |
47 | | -- Provide alternative text for images and icons |
48 | | -- Maintain proper color contrast ratios (4.5:1 minimum) |
49 | | -- Support screen readers with proper markup |
50 | | - |
51 | | -### Performance Optimization |
52 | | -- Optimize for Core Web Vitals (LCP < 2.5s, FID < 100ms, CLS < 0.1) |
53 | | -- Use Next.js Image component for all images |
54 | | -- Implement proper code splitting at route and component levels |
55 | | -- Leverage dynamic imports for heavy components |
56 | | -- Minimize JavaScript bundle size |
57 | | -- Use proper caching strategies for static assets |
58 | | - |
59 | | -### File Organization |
60 | | -- `src/app/` - Next.js App Router pages and layouts |
61 | | -- `src/components/` - Reusable UI components organized by type |
62 | | -- `src/lib/` - Utility functions and configurations |
63 | | -- `public/` - Static assets (images, icons, etc.) |
64 | | -- `docs/` - Project documentation |
65 | | - |
66 | | -### Naming Conventions |
67 | | -- **Files**: kebab-case (`component-name.tsx`, `utility-function.ts`) |
68 | | -- **Components**: PascalCase (`ComponentName`, `MyButton`) |
69 | | -- **Variables/Functions**: camelCase (`handleClick`, `userData`) |
70 | | -- **Constants**: UPPER_SNAKE_CASE (`API_ENDPOINT`, `MAX_RETRY_COUNT`) |
71 | | -- **CSS Classes**: Tailwind utilities (no custom CSS classes preferred) |
72 | | - |
73 | | -### Component Patterns |
74 | | - |
75 | | -#### Basic Component Structure |
76 | | -```tsx |
77 | | -interface ComponentProps { |
78 | | - title: string |
79 | | - children?: React.ReactNode |
80 | | - variant?: 'primary' | 'secondary' |
81 | | - disabled?: boolean |
82 | | -} |
83 | | - |
84 | | -export default function Component({ |
85 | | - title, |
86 | | - children, |
87 | | - variant = 'primary', |
88 | | - disabled = false |
89 | | -}: ComponentProps) { |
90 | | - return ( |
91 | | - <div className="component-classes"> |
92 | | - <h2 className="text-lg font-semibold">{title}</h2> |
93 | | - {children} |
94 | | - </div> |
95 | | - ) |
96 | | -} |
97 | | - |
98 | | -export type { ComponentProps } |
99 | | -``` |
100 | | - |
101 | | -#### Page Structure with Metadata |
102 | | -```tsx |
103 | | -import type { Metadata } from 'next' |
104 | | - |
105 | | -export const metadata: Metadata = { |
106 | | - title: 'Page Title | CodeStorm Hub', |
107 | | - description: 'Page description for SEO', |
108 | | - openGraph: { |
109 | | - title: 'Page Title', |
110 | | - description: 'Page description', |
111 | | - type: 'website', |
112 | | - }, |
113 | | -} |
114 | | - |
115 | | -export default function Page() { |
116 | | - return ( |
117 | | - <main className="container mx-auto px-4 py-8"> |
118 | | - {/* Page content */} |
119 | | - </main> |
120 | | - ) |
121 | | -} |
122 | | -``` |
123 | | - |
124 | | -### Design System Integration |
125 | | - |
126 | | -#### Color Usage |
127 | | -- Use Radix Colors semantic scale (gray, blue, red, green, yellow) |
128 | | -- Implement proper dark/light mode support |
129 | | -- Ensure accessible color combinations |
130 | | -- Use CSS custom properties for theme switching |
131 | | - |
132 | | -#### Typography |
133 | | -- Use Geist Sans for UI text and body content |
134 | | -- Use Geist Mono for code blocks and technical content |
135 | | -- Follow consistent type scale (text-sm, text-base, text-lg, etc.) |
136 | | -- Maintain proper line heights for readability |
137 | | - |
138 | | -#### Spacing and Layout |
139 | | -- Use Tailwind's spacing scale consistently (4, 8, 12, 16, 24, etc.) |
140 | | -- Implement proper grid systems using CSS Grid and Flexbox |
141 | | -- Ensure responsive design across all breakpoints |
142 | | -- Use container queries for component-level responsiveness |
143 | | - |
144 | | -### Testing Approach |
145 | | -- Write tests for complex utility functions |
146 | | -- Test component accessibility with automated tools |
147 | | -- Validate responsive design across device sizes |
148 | | -- Test dark/light mode functionality |
149 | | -- Ensure keyboard navigation works correctly |
150 | | - |
151 | | -### Common Patterns to Avoid |
152 | | -- Don't use inline styles - prefer Tailwind utilities |
153 | | -- Don't create custom CSS files - use Tailwind's utility system |
154 | | -- Don't ignore accessibility requirements |
155 | | -- Don't bypass Next.js optimizations (use Image, Link components) |
156 | | -- Don't use outdated React patterns (class components, legacy lifecycle methods) |
157 | | -- Don't forget to handle loading and error states |
158 | | -- Don't hardcode values that should be responsive or configurable |
159 | | - |
160 | | -### Development Workflow |
161 | | -1. **Setup**: Ensure `npm install` runs successfully |
162 | | -2. **Development**: Use `npm run dev` for local development |
163 | | -3. **Linting**: Run `npm run lint` before committing |
164 | | -4. **Building**: Verify `npm run build` succeeds |
165 | | -5. **Testing**: Test functionality across different screen sizes |
166 | | -6. **Accessibility**: Validate with screen readers and keyboard navigation |
167 | | - |
168 | | -### Integration with Existing Tools |
169 | | -- **Storybook**: Document components with usage examples |
170 | | -- **ESLint**: Follow configured linting rules |
171 | | -- **Prettier**: Maintain consistent code formatting |
172 | | -- **TypeScript**: Leverage strict type checking |
173 | | -- **Radix UI**: Use primitives for accessible component foundations |
174 | | - |
175 | | -### Deployment Considerations |
176 | | -- Optimize images and assets for web delivery |
177 | | -- Ensure proper meta tags for SEO |
178 | | -- Test performance on slower networks |
179 | | -- Validate accessibility across different browsers |
180 | | -- Monitor Core Web Vitals in production |
181 | | - |
182 | | -## Project-Specific Notes |
183 | | -- This is a community showcase project - code quality is paramount |
184 | | -- Components should be reusable and well-documented |
185 | | -- Performance and accessibility are not optional |
186 | | -- Follow the established design system strictly |
187 | | -- Consider mobile users as primary audience |
188 | | -- Maintain consistency with existing component patterns |
189 | | - |
190 | | -## Getting Help |
191 | | -- Refer to `.github/INSTRUCTIONS.md` for detailed repository guidelines |
192 | | -- Check `.github/DESIGN_PRINCIPLES.md` for comprehensive design system documentation |
193 | | -- Review existing components in `src/components/` for established patterns |
194 | | -- Consult Radix UI documentation for primitive component usage |
195 | | -- Follow Tailwind CSS documentation for utility class usage |
| 1 | +# GitHub Copilot Instructions (canonical) |
| 2 | + |
| 3 | +> Canonical location for Copilot / AI coding agent guidance for this repository. Keep this file short, actionable, and up-to-date. If other instruction files exist (for humans or tooling), they should point here. |
| 4 | +
|
| 5 | +## Quick Project Summary |
| 6 | +- Next.js 15 (App Router) + TypeScript (strict) |
| 7 | +- Tailwind CSS 4 for styling, Radix UI primitives for accessibility |
| 8 | +- Atomic component structure under `src/components/` and pages under `src/app/` |
| 9 | +- Focus: accessibility (WCAG 2.1 AA), Core Web Vitals performance, and DX |
| 10 | + |
| 11 | +## Essential Commands |
| 12 | +- Install: npm install |
| 13 | +- Dev: npm run dev |
| 14 | +- Lint: npm run lint |
| 15 | +- Build: npm run build |
| 16 | +- Type check: npx tsc --noEmit |
| 17 | + |
| 18 | +## Agent Guidance (do these first) |
| 19 | +1. Respect strict TypeScript and avoid `any`. Export prop types with components. |
| 20 | +2. Use Tailwind utilities; avoid introducing new global CSS files. |
| 21 | +3. Prefer Next.js primitives (Image, Link) and dynamic imports for heavy bundles. |
| 22 | +4. Use Radix UI primitives for interactive patterns (Dialog, DropdownMenu, Toast). |
| 23 | +5. Add Metadata via Next's `Metadata` API for pages (SEO/OpenGraph). |
| 24 | + |
| 25 | +## Useful Repo-Specific Pointers |
| 26 | +- Component examples: `src/components/ui/` and `src/components/` (follow existing prop patterns) |
| 27 | +- Pages: `src/app/[route]/page.tsx` and `src/app/layout.tsx` for global layout and metadata |
| 28 | +- Utilities and types: `src/lib/` |
| 29 | +- Config files: `tailwind.config.ts`, `next.config.ts`, `vercel.json`, `postcss.config.mjs` |
| 30 | +- CI and validation: `.github/workflows/copilot-validation.yml` |
| 31 | +- MCP config (extended agent context): `.github/copilot-mcp.json` |
| 32 | +- Dev environment spec: `.copilot/dev-environment.yml` (recommended tools and extensions) |
| 33 | + |
| 34 | +## VS Code / Agent Environment Recommendations |
| 35 | +- Recommended extensions: bradlc.vscode-tailwindcss, ms-vscode.vscode-typescript-next, esbenp.prettier-vscode, ms-vscode.vscode-eslint, github.copilot, github.copilot-chat |
| 36 | +- Run `npx tsc --noEmit` and `npm run lint` before suggesting large changes. |
| 37 | + |
| 38 | +## When to Update This File |
| 39 | +- If you change build/dev commands, CI workflows, or introduce new global patterns. |
| 40 | +- Keep content minimal and link to longer docs under `docs/` for deep guidance. |
| 41 | + |
| 42 | +--- |
| 43 | +For longer design-system guidance see `docs/design-principles.md`. For environment details see `.copilot/dev-environment.yml`. |
0 commit comments