agents-config 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/AGENTS.md +490 -0
  2. package/LICENSE +21 -0
  3. package/README.md +254 -0
  4. package/adapters/claude.template.md +77 -0
  5. package/adapters/codex.template.md +72 -0
  6. package/adapters/copilot.template.md +68 -0
  7. package/adapters/cursor.template.md +69 -0
  8. package/adapters/gemini.template.md +73 -0
  9. package/adapters/windsurf.template.md +81 -0
  10. package/bin/agents-init.js +699 -0
  11. package/bin/postinstall.js +28 -0
  12. package/instructions/development-standards.instructions.md +47 -0
  13. package/instructions/github-issue.instructions.md +324 -0
  14. package/instructions/github-release-notes.instructions.md +888 -0
  15. package/instructions/mui.instructions.md +50 -0
  16. package/instructions/storybook.instructions.md +55 -0
  17. package/instructions/web-interface-guidelines.instructions.md +331 -0
  18. package/package.json +56 -0
  19. package/prompts/create-pr.prompt.md +78 -0
  20. package/prompts/scaffold-component.prompt.md +57 -0
  21. package/rules/accessibility.md +36 -0
  22. package/rules/component-architecture.md +34 -0
  23. package/rules/gemini.md +547 -0
  24. package/rules/mui.md +491 -0
  25. package/rules/react-19-compiler.md +26 -0
  26. package/rules/spec-driven-development.md +36 -0
  27. package/rules/supabase.md +40 -0
  28. package/rules/tailwind-v4.md +29 -0
  29. package/rules/three-js-react.md +76 -0
  30. package/rules/web-performance.md +29 -0
  31. package/schemas/agents-project.schema.json +78 -0
  32. package/skills/accessibility-audit/SKILL.md +39 -0
  33. package/skills/integrate-gemini/SKILL.md +124 -0
  34. package/skills/scaffold-component/SKILL.md +77 -0
  35. package/skills/vercel-react-best-practices/AGENTS.md +2719 -0
  36. package/skills/vercel-react-best-practices/SKILL.md +125 -0
  37. package/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  38. package/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  39. package/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  40. package/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  41. package/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  42. package/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  43. package/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  44. package/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  45. package/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  46. package/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  47. package/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  48. package/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  49. package/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  50. package/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  51. package/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  52. package/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  53. package/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  54. package/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  55. package/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  56. package/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  57. package/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  58. package/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  59. package/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  60. package/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  61. package/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  62. package/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  63. package/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  64. package/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  65. package/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  66. package/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  67. package/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  68. package/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  69. package/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  70. package/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  71. package/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  72. package/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  73. package/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  74. package/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  75. package/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  76. package/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  77. package/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  78. package/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  79. package/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  80. package/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  81. package/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  82. package/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  83. package/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  84. package/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  85. package/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  86. package/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  87. package/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  88. package/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  89. package/skills/workflows/sdd-workflow.md +49 -0
  90. package/skills/workflows/setup-orchestration.md +18 -0
@@ -0,0 +1,29 @@
1
+ ---
2
+ trigger: always_on
3
+ description: Web performance and Core Web Vitals optimization guidelines.
4
+ ---
5
+
6
+ **OBJECTIVE:**
7
+ Ensuring fast load times, smooth interactions, and stable layouts for both 3D and standard web content.
8
+
9
+ **REASON:**
10
+ Large 3D assets can easily degrade performance, leading to poor Core Web Vitals scores and high bounce rates, especially on mobile devices.
11
+
12
+ **DESCRIPTION:**
13
+ Rules for asset budgeting, layout stability, and resource prioritization.
14
+
15
+ **INSTRUCTIONS:**
16
+
17
+ ### Core Web Vitals
18
+ - **Prevent Layout Shifts (CLS)**: Always set explicit `width` and `height` dimensions (or aspect ratio) on the canvas container to reserve space before the scene initializes.
19
+ - **Optimize LCP**: Identify the largest above-fold element (often a hero texture or font), and utilize the CSS property, [content visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/content-visibility) to help with more performant rendering. Use `<link rel="preload">` for these critical assets and **Inline Critical CSS** in the HTML `<head>` for a near-instant first paint.
20
+
21
+ ### Asset Budgeting
22
+ - **Texture Compression**: Use `.webp` or `.ktx2` for textures. Avoid large 4K textures unless viewed up close; 1K or 2K is usually sufficient for web.
23
+ - **Geometry Optimization**: Use Draco compression for GLTF models. Aim for a total initial bundle size (including models) under 5MB for the primary interactive state.
24
+ - **Lazy Loading**: Use dynamic imports `React.lazy()` or the `useLoader` cleanup mechanism for non-critical assets (e.g., objects in future scenes or footer elements).
25
+
26
+ ### Rendering Performance
27
+ - **Font Display**: Use `font-display: swap` for all web fonts to ensure text is visible while the custom font (and 3D scene) loads.
28
+ - **Avoid Long Tasks**: Ensure that Three.js initialization or heavy computations don't block the main thread for more than 50ms. Use `setTimeout` or `requestIdleCallback` to chunk initialization if necessary.
29
+ - **Asset Caching**: Leverage service workers or strong Cache-Control headers for 3D assets that don't change frequently.
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/ericthayer/agents-config/main/schemas/agents-project.schema.json",
4
+ "title": "Agents Project Configuration",
5
+ "description": "Configuration schema for project-specific AI agent settings",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "description": "JSON Schema reference"
11
+ },
12
+ "version": {
13
+ "type": "string",
14
+ "description": "Configuration version (semver)",
15
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
16
+ },
17
+ "project": {
18
+ "type": "object",
19
+ "description": "Project metadata",
20
+ "properties": {
21
+ "name": {
22
+ "type": "string",
23
+ "description": "Project name"
24
+ },
25
+ "framework": {
26
+ "type": "string",
27
+ "enum": ["next", "react", "remix", "astro", "vue", "svelte", "other"],
28
+ "description": "Primary framework"
29
+ },
30
+ "styling": {
31
+ "type": "string",
32
+ "enum": ["tailwind", "mui", "vanilla", "styled", "emotion", "css-modules", "other"],
33
+ "description": "Styling approach"
34
+ },
35
+ "database": {
36
+ "type": "string",
37
+ "enum": ["supabase", "firebase", "prisma", "drizzle", "none", "other"],
38
+ "description": "Database/backend"
39
+ }
40
+ },
41
+ "required": ["name"]
42
+ },
43
+ "agents": {
44
+ "type": "array",
45
+ "description": "AI agents to configure",
46
+ "items": {
47
+ "type": "string",
48
+ "enum": ["copilot", "claude", "cursor", "gemini", "codex", "windsurf"]
49
+ }
50
+ },
51
+ "rules": {
52
+ "type": "object",
53
+ "description": "Rule configuration",
54
+ "properties": {
55
+ "include": {
56
+ "type": "array",
57
+ "description": "Rules to include (by filename without extension)",
58
+ "items": {
59
+ "type": "string"
60
+ }
61
+ },
62
+ "exclude": {
63
+ "type": "array",
64
+ "description": "Rules to exclude",
65
+ "items": {
66
+ "type": "string"
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "overrides": {
72
+ "type": "object",
73
+ "description": "Project-specific rule overrides",
74
+ "additionalProperties": true
75
+ }
76
+ },
77
+ "required": ["version", "project"]
78
+ }
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: accessibility-audit
3
+ description: Verify that a component or page meets the high accessibility standards defined in AGENTS.md.
4
+ ---
5
+
6
+ # `accessibility-audit`
7
+
8
+ Use this skill before marking any feature as "Done". It helps you catch common accessibility issues that are strictly forbidden by [AGENTS.md](../../AGENTS.md).
9
+
10
+ ## Checklist
11
+
12
+ ### 1. Semantic Structure
13
+ - [ ] Are buttons used for actions (`<button>`) and links for navigation (`<a>`)?
14
+ - [ ] Do headings (`h1`-`h6`) follow a logical hierarchy? (Only one `h1` per page).
15
+ - [ ] Are lists (`ul`, `ol`) used for grouped items?
16
+
17
+ ### 2. Interactive Elements
18
+ - [ ] **Focus**: Can you tab to every interactive element?
19
+ - [ ] **Visual Focus**: Does every element have a visible focus ring? (No `outline: none` without replacement).
20
+ - [ ] **Labels**: Do all icon-only buttons have `aria-label`?
21
+ - [ ] **Forms**: Do all inputs have a linked `<label>` or `aria-label`?
22
+
23
+ ### 3. Images & Media
24
+ - [ ] Do all images have `alt` text (or `alt=""` if decorative)?
25
+ - [ ] do user-uploaded or AI-generated images have proper error states?
26
+ - [ ] Are explicit `width` and `height` attributes set to prevent layout shifts?
27
+
28
+ ### 4. Dynamic Content
29
+ - [ ] **Loading**: Are loading states announced? (e.g., `aria-busy="true"` or `role="status"`).
30
+ - [ ] **Streaming**: Is the streaming text container using `aria-live="polite"`?
31
+ - [ ] **Updates**: Do dynamic updates trigger screen reader notifications?
32
+
33
+ ### 5. Motion & Validation
34
+ - [ ] **Reduced Motion**: Is `prefers-reduced-motion` respected?
35
+ - [ ] **Validation**: Are form errors linked to inputs via `aria-describedby`?
36
+ - [ ] **Focus Management**: Is focus moved to the error summary or first error on submit failure?
37
+
38
+ ## Failure Conditions
39
+ If any of the above are "No", the feature is **NOT** ready. Stop and fix it.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: integrate-gemini
3
+ description: Implement robust Google Gemini API integration with streaming, error handling, and type safety.
4
+ ---
5
+
6
+ # `integrate-gemini`
7
+
8
+ Use this skill when the user wants to "connect to Gemini", "add AI features", or "fix API generation".
9
+
10
+ ## Requirements (from rules/gemini.md)
11
+ 1. **Safety**: NEVER hardcode API keys. Use `import.meta.env` or similar.
12
+ 2. **UX**: Always show Loading / Streaming states.
13
+ 3. **Reliability**: Handle errors gracefully (network, blocking, rate limits).
14
+ 4. **Attribution**: AI content must be labeled.
15
+
16
+ ## Usage
17
+ 1. **Check for Client Library**: Ensure `@google/generative-ai` is installed. If not, install it.
18
+ 2. **Create the Hook**: Create `hooks/useGemini.ts` (or similar).
19
+ 3. **Implement Logic**: Use the pattern below to handle the complexities of streaming.
20
+
21
+ ## Code Pattern: `useGemini` Hook
22
+
23
+ ```typescript
24
+ import { useState, useCallback } from 'react';
25
+ import { GoogleGenerativeAI, GenerativeModel } from '@google/generative-ai';
26
+
27
+ // Initialize outside component if key is static, or inside if dynamic
28
+ // const genAI = new GoogleGenerativeAI(import.meta.env.VITE_GEMINI_API_KEY);
29
+
30
+ interface UseGeminiOptions {
31
+ modelName?: string;
32
+ // Gemini 3 Thinking Config
33
+ useThinking?: boolean;
34
+ thinkingBudget?: number; // e.g., 16384
35
+ onError?: (error: Error) => void;
36
+ }
37
+
38
+ export const useGemini = ({
39
+ modelName = "gemini-3-pro-preview", // Updated default to Gemini 3
40
+ useThinking = false,
41
+ thinkingBudget = 16384,
42
+ onError
43
+ }: UseGeminiOptions = {}) => {
44
+ const [response, setResponse] = useState<string>('');
45
+ const [isLoading, setIsLoading] = useState(false);
46
+ const [isStreaming, setIsStreaming] = useState(false);
47
+ const [error, setError] = useState<Error | null>(null);
48
+
49
+ const generate = useCallback(async (prompt: string, images?: File[]) => {
50
+ setIsLoading(true);
51
+ setIsStreaming(false);
52
+ setError(null);
53
+ setResponse('');
54
+
55
+ try {
56
+ const genAI = new GoogleGenerativeAI(import.meta.env.VITE_GEMINI_API_KEY);
57
+
58
+ // Determine configuration based on Thinking
59
+ const generationConfig: any = {};
60
+ if (useThinking) {
61
+ generationConfig.thinkingConfig = { thinkingBudget };
62
+ // Must increase maxOutputTokens to accommodate thinking process
63
+ generationConfig.maxOutputTokens = thinkingBudget + 8192;
64
+ }
65
+
66
+ const model = genAI.getGenerativeModel({
67
+ model: modelName,
68
+ generationConfig
69
+ });
70
+
71
+ // Prepare contents (Text + optional Images)
72
+ let contents: any[] = [{ text: prompt }];
73
+ if (images && images.length > 0) {
74
+ // Simple example for adding images (implementation varies by input format)
75
+ // Ideally convert File -> Base64 here
76
+ // const imageParts = await Promise.all(images.map(fileToGenerativePart));
77
+ // contents = [...imageParts, { text: prompt }];
78
+ }
79
+
80
+ // Use streaming for better UX
81
+ const result = await model.generateContentStream(contents);
82
+
83
+ setIsLoading(false); // Initial wait is over, now we stream
84
+ setIsStreaming(true);
85
+
86
+ let fullText = '';
87
+ for await (const chunk of result.stream) {
88
+ const chunkText = chunk.text();
89
+ fullText += chunkText;
90
+ setResponse(prev => prev + chunkText);
91
+ }
92
+
93
+ setIsStreaming(false);
94
+ return fullText;
95
+
96
+ } catch (err: any) {
97
+ const errorObj = err instanceof Error ? err : new Error(String(err));
98
+ setError(errorObj);
99
+ setIsLoading(false);
100
+ setIsStreaming(false);
101
+ if (onError) onError(errorObj);
102
+ console.error("Gemini API Error:", err);
103
+ }
104
+ }, [modelName, useThinking, thinkingBudget, onError]);
105
+
106
+ return {
107
+ generate,
108
+ response,
109
+ isLoading,
110
+ isStreaming,
111
+ error,
112
+ attribution: "Generated by Google Gemini"
113
+ };
114
+ };
115
+ ```
116
+
117
+ ## UI Implementation Tips
118
+ - **Thinking UI**: If `useThinking` is true, the `isLoading` state might be longer. Considering adding a "Reasoning..." label.
119
+ - **Cancel Support**: Consider passing an `AbortSignal` to `generate` for long-running thinking tasks.
120
+ - **Images**: If using `gemini-3-pro-image-preview`, use standard `generateContent` (not stream) and handle base64 output.
121
+ - **Disable Submit**: `disabled={isLoading || isStreaming}`
122
+ - **Loading Spinner**: Show when `isLoading` is true.
123
+ - **Cursor/Typewriter**: Show when `isStreaming` is true.
124
+ - **Error Banner**: Display `error.message` if `error` exists.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: scaffold-component
3
+ description: Create a new React component following project constraints (Tailwind, MUI, or Vanilla).
4
+ ---
5
+
6
+ # `scaffold-component` (Global Fallback)
7
+
8
+ Use this skill when the user asks to "create a component". This skill is designed to be framework-agnostic and will adapt to the current project's stack. Adhere to the following process and development philosophy and approach.
9
+
10
+ ## Development Process
11
+
12
+ **Philosophy & Approach**
13
+
14
+ - **Spec-Driven Development (SDD)**: Always start by creating a technical specification using the [sdd-workflow](../workflows/sdd-workflow.md) template. Adhere to the `spec-driven-development.md` global rule.
15
+ - Create the spec as `[ComponentName].spec.md` within the component folder before starting implementation.
16
+ - **Living Document**: Refactor the spec for every new feature or discovery and maintain a timestamped **Changelog** at the bottom.
17
+ - **Component Architecture**: Follow the `component-architecture.md` global rule (Folder-per-Component).
18
+
19
+ ## Usage
20
+ 1. **Draft the Spec**: Follow the [sdd-workflow](../workflows/sdd-workflow.md) template and create `src/components/[ComponentName]/[ComponentName].spec.md`. Initialize the **Changelog** section.
21
+ 2. **Detect Framework & Stack**: Check `package.json` for dependencies (e.g., `@mui/material`, `tailwindcss`, `react` version). Adhere to project-specific rules like `three-js-react.md` if applicable.
22
+ 3. **Implement & Update**: Follow the spec strictly. If architecture changes during build, update the spec and the changelog **before** proceeding.
23
+
24
+ ## Framework-Specific Rules
25
+
26
+ ### If MUI is detected:
27
+ - Use MUI components (`Box`, `Typography`, `Grid`).
28
+ - Use the `sx` prop for custom styling.
29
+ - Use `Grid` (v2) if on MUI v6+.
30
+ - Follow [mui.md](../../rules/mui.md) architecture patterns.
31
+
32
+ ### If Tailwind CSS is detected:
33
+ - Use standard HTML tags (`div`, `header`, `main`).
34
+ - Use `className` with Tailwind utility classes.
35
+ - Follow mobile-first responsive patterns (e.g., `sm:`, `md:`, `lg:`).
36
+ - Follow [tailwind-v4.md](../../rules/tailwind-v4.md) patterns.
37
+
38
+ ### Default (Vanilla React/CSS):
39
+ - Use standard HTML tags.
40
+ - Use CSS Modules or standard CSS
41
+ - Use CSS Custom Properties to build a light/dark theme.
42
+
43
+ ## Base Template
44
+
45
+ ```tsx
46
+ import React from 'react';
47
+
48
+ /**
49
+ * Props for the [ComponentName] component.
50
+ */
51
+ export interface [ComponentName]Props {
52
+ /** ARIA label for accessibility */
53
+ 'aria-label'?: string;
54
+ title?: string;
55
+ children?: React.ReactNode;
56
+ }
57
+
58
+ /**
59
+ * [Brief description of the component]
60
+ */
61
+ export const [ComponentName]: React.FC<[ComponentName]Props> = ({
62
+ 'aria-label': ariaLabel,
63
+ title,
64
+ children,
65
+ ...props
66
+ }) => {
67
+ // IMPLEMENTATION: Adapt based on detected framework (MUI vs Tailwind)
68
+ return (
69
+ <div className="[component-name-kebab-case]" {...props}>
70
+ {title && <h2>{title}</h2>}
71
+ <div role="region" aria-label={ariaLabel || "[Default Label]"}>
72
+ {children || <p>New component: [ComponentName]</p>}
73
+ </div>
74
+ </div>
75
+ );
76
+ };
77
+ ```