|
1 | 1 | # GitHub Copilot Custom Coding Agent Instructions |
2 | 2 |
|
| 3 | +## AI Model Selection |
| 4 | + |
| 5 | +**IMPORTANT**: When using GitHub Copilot, always select the most powerful AI model available (e.g., GPT-4, Claude 3.5 Sonnet, or the latest advanced model) for code generation, review, and assistance tasks. More powerful models provide better code quality, deeper understanding of context, and more accurate suggestions aligned with project standards. |
| 6 | + |
3 | 7 | ## Project Overview |
4 | 8 |
|
5 | 9 | The Layer5 website is a Gatsby.js-based static site that serves as the primary interface for the Layer5 community, hosted at https://github.com/layer5io/layer5 and live at https://layer5.io. It showcases projects like Meshery, Kanvas, and Cloud Native Patterns, and provides resources for contributors, users, and cloud native enthusiasts. The site emphasizes clean design, fast performance, and accessibility, serving the cloud native infrastructure management ecosystem. |
@@ -29,13 +33,17 @@ The Layer5 website is a Gatsby.js-based static site that serves as the primary i |
29 | 33 | - Ensure all code passes `npm run lint` without errors |
30 | 34 | - Maintain accessibility standards (WCAG 2.1) |
31 | 35 | - Write clean, readable, self-documenting code with minimal comments unless necessary for complex logic |
| 36 | +- **Performance-first**: Every code change must consider Core Web Vitals impact |
| 37 | +- **SEO-aware**: Ensure proper semantic HTML, meta tags, and structured data |
32 | 38 |
|
33 | 39 | ### 3. Testing and Validation |
34 | 40 | - Always validate changes work before considering them complete |
35 | 41 | - Build the site and verify rendered content: wait for `npm start` to complete, then curl pages to verify |
36 | 42 | - The website takes significant time to build - be patient and don't interrupt builds |
37 | 43 | - Run linting frequently: `npm run lint` |
38 | 44 | - Test changes incrementally and iteratively |
| 45 | +- **Lighthouse CI**: Monitor Core Web Vitals scores (check GitHub Actions workflows) |
| 46 | +- **Performance testing**: Test on throttled connections (Fast 3G) to ensure good performance for all users |
39 | 47 |
|
40 | 48 | ## Project Structure |
41 | 49 |
|
@@ -127,10 +135,24 @@ description: "Short description for SEO (150-160 chars)" |
127 | 135 | ``` |
128 | 136 |
|
129 | 137 | ### SEO Optimization |
130 | | -- Include meta descriptions in frontmatter |
131 | | -- Use relevant keywords: "cloud native", "Meshery", "service mesh", "Kanvas", "Layer5" |
132 | | -- Maintain proper heading hierarchy (H1 → H2 → H3) |
133 | | -- Use descriptive, semantic HTML elements |
| 138 | + |
| 139 | +**Critical Requirements**: |
| 140 | +- **Meta descriptions**: Include in frontmatter (150-160 characters, compelling and keyword-rich) |
| 141 | +- **Title tags**: Clear, descriptive, under 60 characters |
| 142 | +- **Keywords**: Naturally incorporate "cloud native", "Meshery", "service mesh", "Kanvas", "Layer5", "Kubernetes", "microservices" |
| 143 | +- **Heading hierarchy**: Maintain proper structure (single H1, logical H2 → H3 → H4 progression) |
| 144 | +- **Semantic HTML**: Use appropriate HTML5 elements (`<article>`, `<section>`, `<nav>`, `<header>`, `<footer>`) |
| 145 | +- **URL structure**: Use clean, descriptive, keyword-rich URLs (slug: kebab-case) |
| 146 | +- **Image optimization**: |
| 147 | + - Always include descriptive alt text for accessibility and SEO |
| 148 | + - Use gatsby-plugin-image for automatic optimization |
| 149 | + - Implement proper image dimensions and compression |
| 150 | +- **Internal linking**: Create relevant internal links to improve site structure and navigation |
| 151 | +- **Schema markup**: Add structured data where appropriate (articles, events, FAQs) |
| 152 | +- **Open Graph tags**: Include OG tags for social media sharing |
| 153 | +- **Canonical URLs**: Ensure canonical tags are properly set to avoid duplicate content |
| 154 | +- **Mobile optimization**: Ensure responsive design for mobile-first indexing |
| 155 | +- **Page speed**: Optimize for fast loading times (target < 3 seconds) |
134 | 156 |
|
135 | 157 | ### Content Restrictions |
136 | 158 | - **No external images**: Use local assets in `src/assets` or `static` directories only |
@@ -305,27 +327,119 @@ Use descriptive, kebab-case names: |
305 | 327 |
|
306 | 328 | ## Performance Considerations |
307 | 329 |
|
| 330 | +### Core Web Vitals Optimization |
| 331 | + |
| 332 | +**CRITICAL**: All changes must maintain or improve Core Web Vitals scores. Monitor and optimize for: |
| 333 | + |
| 334 | +#### 1. Largest Contentful Paint (LCP) - Target: < 2.5s |
| 335 | +- **Images**: Use `gatsby-plugin-image` for automatic optimization, lazy loading, and responsive images |
| 336 | +- **Preload critical resources**: Preload above-the-fold images, fonts, and critical CSS |
| 337 | +- **Reduce server response time**: Optimize GraphQL queries, minimize API calls |
| 338 | +- **Remove render-blocking resources**: Defer non-critical JavaScript and CSS |
| 339 | +- **Font optimization**: Use `font-display: swap` or `optional`, preload critical fonts from `fonts.css` |
| 340 | + |
| 341 | +#### 2. First Input Delay (FID) / Interaction to Next Paint (INP) - Target: < 100ms / < 200ms |
| 342 | +- **Minimize JavaScript execution**: |
| 343 | + - Use code splitting and lazy loading via `@loadable/component` |
| 344 | + - Avoid large third-party scripts |
| 345 | + - Break up long tasks into smaller chunks |
| 346 | +- **Optimize event handlers**: Debounce/throttle scroll, resize, and input events |
| 347 | +- **Web Workers**: Offload heavy computations to Web Workers when possible |
| 348 | +- **Reduce main thread work**: Minimize DOM manipulation, avoid forced reflows |
| 349 | + |
| 350 | +#### 3. Cumulative Layout Shift (CLS) - Target: < 0.1 |
| 351 | +- **Reserve space**: Set explicit width and height for images, videos, and embeds |
| 352 | +- **Avoid dynamic content**: Don't insert content above existing content without user interaction |
| 353 | +- **Font loading**: Use `font-display: optional` to prevent layout shifts from font swaps |
| 354 | +- **Avoid animations**: Don't animate properties that trigger layout (width, height, top, left) |
| 355 | +- **Skeleton screens**: Use placeholders for dynamic content loading |
| 356 | + |
308 | 357 | ### Gatsby Build Optimization |
309 | | -- **Images**: Use `gatsby-plugin-image` for optimized images |
310 | | -- **Code splitting**: Leverage Gatsby's automatic code splitting |
311 | | -- **Lazy loading**: Use `@loadable/component` for heavy components |
312 | | -- **Bundle size**: Monitor with webpack bundle analyzer |
313 | | -- **Font loading**: Preload critical fonts defined in `fonts.css` |
| 358 | +- **Images**: Use `gatsby-plugin-image` for optimized images with automatic format conversion (WebP, AVIF) |
| 359 | +- **Code splitting**: Leverage Gatsby's automatic code splitting per route |
| 360 | +- **Lazy loading**: Use `@loadable/component` for heavy components below the fold |
| 361 | +- **Bundle size**: Monitor with webpack bundle analyzer, keep bundles < 200KB |
| 362 | +- **Font loading**: Preload critical fonts defined in `fonts.css`, use subset fonts |
| 363 | +- **Static generation**: Prefer static generation over client-side rendering when possible |
| 364 | +- **Caching**: Leverage Gatsby's aggressive caching strategy |
314 | 365 |
|
315 | 366 | ### Best Practices |
| 367 | + |
| 368 | +#### Image Optimization (Critical for LCP) |
316 | 369 | ```jsx |
317 | | -// ✓ Use gatsby-plugin-image |
| 370 | +// ✓ Use gatsby-plugin-image with proper sizing and alt text |
318 | 371 | import { GatsbyImage, getImage } from 'gatsby-plugin-image'; |
319 | 372 |
|
320 | 373 | const MyComponent = ({ imageData }) => { |
321 | 374 | const image = getImage(imageData); |
322 | | - return <GatsbyImage image={image} alt="Description" />; |
| 375 | + return ( |
| 376 | + <GatsbyImage |
| 377 | + image={image} |
| 378 | + alt="Descriptive alt text for accessibility and SEO" |
| 379 | + loading="eager" // For above-the-fold images |
| 380 | + // loading="lazy" // For below-the-fold images (default) |
| 381 | + /> |
| 382 | + ); |
323 | 383 | }; |
324 | 384 |
|
325 | | -// ✓ Use lazy loading for heavy components |
| 385 | +// ✓ Set explicit dimensions to prevent CLS |
| 386 | +const StyledImage = styled(GatsbyImage)` |
| 387 | + width: 100%; |
| 388 | + height: auto; |
| 389 | + aspect-ratio: 16 / 9; // Prevents layout shift |
| 390 | +`; |
| 391 | +``` |
| 392 | + |
| 393 | +#### Code Splitting & Lazy Loading (Critical for FID/INP) |
| 394 | +```jsx |
| 395 | +// ✓ Use lazy loading for heavy components below the fold |
326 | 396 | import loadable from '@loadable/component'; |
327 | 397 |
|
328 | | -const HeavyComponent = loadable(() => import('./HeavyComponent')); |
| 398 | +const HeavyComponent = loadable(() => import('./HeavyComponent'), { |
| 399 | + fallback: <div>Loading...</div>, // Prevents CLS |
| 400 | +}); |
| 401 | + |
| 402 | +// ✓ Use React.lazy for route-based code splitting |
| 403 | +const DynamicPage = React.lazy(() => import('./pages/DynamicPage')); |
| 404 | + |
| 405 | +// Wrap with Suspense |
| 406 | +<Suspense fallback={<LoadingSpinner />}> |
| 407 | + <DynamicPage /> |
| 408 | +</Suspense> |
| 409 | +``` |
| 410 | + |
| 411 | +#### Font Loading (Critical for CLS and LCP) |
| 412 | +```jsx |
| 413 | +// ✓ In gatsby-browser.js or component |
| 414 | +const fontStyles = ` |
| 415 | + @font-face { |
| 416 | + font-family: 'CustomFont'; |
| 417 | + src: url('/fonts/customfont.woff2') format('woff2'); |
| 418 | + font-display: optional; /* Prevents CLS from font swaps */ |
| 419 | + font-weight: 400; |
| 420 | + font-style: normal; |
| 421 | + } |
| 422 | +`; |
| 423 | +``` |
| 424 | + |
| 425 | +#### Event Handler Optimization (Critical for FID/INP) |
| 426 | +```jsx |
| 427 | +// ✓ Debounce expensive operations |
| 428 | +import { debounce } from 'lodash'; |
| 429 | + |
| 430 | +const handleSearch = debounce((query) => { |
| 431 | + // Expensive search operation |
| 432 | +}, 300); |
| 433 | + |
| 434 | +// ✓ Use passive event listeners for scroll/touch |
| 435 | +useEffect(() => { |
| 436 | + const handleScroll = () => { |
| 437 | + // Scroll handling |
| 438 | + }; |
| 439 | + |
| 440 | + window.addEventListener('scroll', handleScroll, { passive: true }); |
| 441 | + return () => window.removeEventListener('scroll', handleScroll); |
| 442 | +}, []); |
329 | 443 | ``` |
330 | 444 |
|
331 | 445 | ## Common Tasks |
@@ -444,52 +558,88 @@ Report violations via: |
444 | 558 |
|
445 | 559 | Before submitting a PR, verify: |
446 | 560 |
|
| 561 | +### Code Quality |
447 | 562 | - [ ] Code follows ESLint rules (`npm run lint` passes) |
448 | 563 | - [ ] All new components are functional, not class-based |
449 | 564 | - [ ] Styling uses styled-components or existing patterns |
450 | | -- [ ] Accessibility requirements are met (WCAG 2.1 AA) |
451 | | -- [ ] Images have descriptive alt text |
452 | | -- [ ] No external dependencies on images or resources |
453 | | -- [ ] Content uses American English |
454 | | -- [ ] Terminology is correct (Meshery, Kanvas, etc.) |
455 | 565 | - [ ] Commit messages follow Conventional Commits format |
456 | | -- [ ] Build completes successfully (`make build`) |
457 | 566 | - [ ] Changes are minimal and surgical |
458 | 567 | - [ ] No placeholder content or sensitive data |
| 568 | +- [ ] No console errors or warnings introduced |
| 569 | + |
| 570 | +### Accessibility & Semantics |
| 571 | +- [ ] Accessibility requirements are met (WCAG 2.1 AA) |
| 572 | +- [ ] Images have descriptive alt text for both accessibility and SEO |
| 573 | +- [ ] Proper semantic HTML elements used (`<article>`, `<nav>`, etc.) |
| 574 | +- [ ] Keyboard navigation works correctly |
| 575 | +- [ ] Color contrast ratios meet WCAG standards (4.5:1 for text) |
| 576 | + |
| 577 | +### SEO Requirements |
| 578 | +- [ ] Meta descriptions included in frontmatter (150-160 characters) |
| 579 | +- [ ] Title tags are descriptive and under 60 characters |
| 580 | +- [ ] Proper heading hierarchy (single H1, logical H2-H6) |
| 581 | +- [ ] URLs are clean and keyword-rich (kebab-case slugs) |
| 582 | +- [ ] Relevant keywords naturally incorporated |
| 583 | +- [ ] Open Graph tags included for social sharing |
| 584 | +- [ ] Images optimized with gatsby-plugin-image |
| 585 | +- [ ] Internal linking implemented where appropriate |
| 586 | + |
| 587 | +### Core Web Vitals Performance |
| 588 | +- [ ] **LCP < 2.5s**: Images optimized, critical resources preloaded |
| 589 | +- [ ] **FID/INP < 100ms/200ms**: JavaScript minimized, code splitting used |
| 590 | +- [ ] **CLS < 0.1**: Explicit dimensions set for media, no layout shifts |
| 591 | +- [ ] Lazy loading implemented for below-the-fold content |
| 592 | +- [ ] Font loading optimized (font-display: optional) |
| 593 | +- [ ] Bundle size kept under 200KB per route |
| 594 | +- [ ] Lighthouse CI checks pass (if applicable) |
| 595 | + |
| 596 | +### Testing & Validation |
| 597 | +- [ ] Build completes successfully (`make build`) |
459 | 598 | - [ ] Changes work correctly in development (`make site`) |
460 | 599 | - [ ] Responsive design is maintained across devices |
461 | | -- [ ] No console errors or warnings introduced |
| 600 | +- [ ] Tested on throttled connection (Fast 3G) |
| 601 | +- [ ] No external dependencies on images or resources |
| 602 | +- [ ] Content uses American English |
| 603 | +- [ ] Terminology is correct (Meshery, Kanvas, etc.) |
462 | 604 |
|
463 | 605 | ## Example Contribution |
464 | 606 |
|
465 | 607 | ### Complete Blog Post Example |
466 | 608 |
|
467 | 609 | ```markdown |
468 | 610 | --- |
469 | | -title: "Exploring Meshery's New Features in 2025" |
| 611 | +title: "Exploring Meshery's New Features in 2025 | Layer5" |
470 | 612 | path: "/blog/meshery-new-features-2025" |
471 | 613 | date: "2025-09-23" |
472 | 614 | author: "Layer5 Team" |
473 | | -description: "Discover the latest updates to Meshery, the cloud native management platform that simplifies infrastructure operations." |
| 615 | +description: "Discover the latest Meshery features for cloud native management: enhanced pattern management, Kanvas integration, and Kubernetes optimization tools for service mesh operations." |
474 | 616 | thumbnail: "/images/blog/meshery-2025-features.png" |
475 | 617 | tags: |
476 | 618 | - Meshery |
477 | 619 | - Cloud Native |
478 | 620 | - Features |
| 621 | + - Kubernetes |
| 622 | + - Service Mesh |
479 | 623 | category: "Product Updates" |
| 624 | +# SEO and Open Graph metadata |
| 625 | +keywords: ["meshery", "cloud native", "kubernetes", "service mesh", "kanvas", "microservices"] |
| 626 | +ogTitle: "Exploring Meshery's New Features in 2025" |
| 627 | +ogDescription: "Latest Meshery updates for cloud native infrastructure management" |
| 628 | +ogImage: "/images/blog/meshery-2025-features-og.png" |
| 629 | +twitterCard: "summary_large_image" |
480 | 630 | --- |
481 | 631 |
|
482 | 632 | # Exploring Meshery's New Features in 2025 |
483 | 633 |
|
484 | | -Meshery continues to evolve as the leading platform for cloud native infrastructure management. In this post, we'll explore the exciting new features released in 2025. |
| 634 | +Meshery continues to evolve as the leading platform for cloud native infrastructure management. In this post, we'll explore the exciting new features released in 2025 that enhance Kubernetes operations, service mesh management, and cloud native application deployment. |
485 | 635 |
|
486 | 636 | ## Enhanced Pattern Management |
487 | 637 |
|
488 | | -The new pattern management system allows you to... |
| 638 | +The new pattern management system allows you to define, share, and deploy cloud native infrastructure patterns with improved validation, versioning, and collaboration features. Learn how to streamline your Kubernetes deployments... |
489 | 639 |
|
490 | 640 | ## Improved Kanvas Integration |
491 | 641 |
|
492 | | -Kanvas now integrates seamlessly with Meshery to provide... |
| 642 | +Kanvas now integrates seamlessly with Meshery to provide visual topology mapping, real-time infrastructure visualization, and drag-and-drop service mesh configuration. This integration enables DevOps teams to... |
493 | 643 |
|
494 | 644 | ## Getting Started |
495 | 645 |
|
|
0 commit comments