specweave 0.23.16 → 0.24.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.
- package/.claude-plugin/marketplace.json +93 -38
- package/CLAUDE.md +159 -11
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +57 -0
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +3 -0
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts +89 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts.map +1 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js +213 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts +29 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js +109 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +2 -0
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/smart-filter.d.ts +83 -0
- package/dist/src/cli/helpers/smart-filter.d.ts.map +1 -0
- package/dist/src/cli/helpers/smart-filter.js +265 -0
- package/dist/src/cli/helpers/smart-filter.js.map +1 -0
- package/dist/src/core/progress/progress-tracker.d.ts +4 -1
- package/dist/src/core/progress/progress-tracker.d.ts.map +1 -1
- package/dist/src/core/progress/progress-tracker.js +33 -4
- package/dist/src/core/progress/progress-tracker.js.map +1 -1
- package/dist/src/core/qa/quality-gate-decider.d.ts +1 -1
- package/dist/src/core/qa/quality-gate-decider.js +2 -2
- package/dist/src/core/qa/quality-gate-decider.js.map +1 -1
- package/dist/src/core/qa/risk-calculator.d.ts +2 -2
- package/dist/src/core/qa/risk-calculator.js +2 -2
- package/dist/src/core/spec-content-sync.d.ts +1 -1
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/core/validators/ac-presence-validator.d.ts +56 -0
- package/dist/src/core/validators/ac-presence-validator.d.ts.map +1 -0
- package/dist/src/core/validators/ac-presence-validator.js +149 -0
- package/dist/src/core/validators/ac-presence-validator.js.map +1 -0
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.js +39 -7
- package/dist/src/integrations/ado/ado-dependency-loader.js.map +1 -1
- package/dist/src/integrations/ado/area-path-mapper.d.ts +137 -0
- package/dist/src/integrations/ado/area-path-mapper.d.ts.map +1 -0
- package/dist/src/integrations/ado/area-path-mapper.js +267 -0
- package/dist/src/integrations/ado/area-path-mapper.js.map +1 -0
- package/dist/src/integrations/jira/filter-processor.d.ts +126 -0
- package/dist/src/integrations/jira/filter-processor.d.ts.map +1 -0
- package/dist/src/integrations/jira/filter-processor.js +207 -0
- package/dist/src/integrations/jira/filter-processor.js.map +1 -0
- package/dist/src/integrations/jira/jira-client.d.ts +13 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +33 -0
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/utils/ac-embedder.d.ts +63 -0
- package/dist/src/utils/ac-embedder.d.ts.map +1 -0
- package/dist/src/utils/ac-embedder.js +217 -0
- package/dist/src/utils/ac-embedder.js.map +1 -0
- package/dist/src/utils/env-manager.d.ts +86 -0
- package/dist/src/utils/env-manager.d.ts.map +1 -0
- package/dist/src/utils/env-manager.js +188 -0
- package/dist/src/utils/env-manager.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave/agents/AGENTS-INDEX.md +1 -1
- package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +9 -9
- package/plugins/specweave/commands/specweave-do.md +37 -0
- package/plugins/specweave/commands/specweave-done.md +159 -0
- package/plugins/specweave/commands/specweave-embed-acs.md +446 -0
- package/plugins/specweave/commands/specweave-next.md +148 -3
- package/plugins/specweave/commands/specweave-qa.md +2 -2
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh +1 -1
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh.bak +245 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
- package/plugins/specweave/hooks/lib/sync-spec-content.sh.bak +149 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +34 -4
- package/plugins/specweave/hooks/lib/validate-spec-status.sh +1 -1
- package/plugins/specweave/hooks/lib/validate-spec-status.sh.bak +163 -0
- package/plugins/specweave/hooks/post-first-increment.sh +1 -1
- package/plugins/specweave/hooks/post-first-increment.sh.bak +61 -0
- package/plugins/specweave/hooks/post-spec-update.sh +1 -1
- package/plugins/specweave/hooks/post-spec-update.sh.bak +158 -0
- package/plugins/specweave/hooks/post-user-story-complete.sh +1 -1
- package/plugins/specweave/hooks/post-user-story-complete.sh.bak +179 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +1 -1
- package/plugins/specweave/hooks/pre-command-deduplication.sh.bak +83 -0
- package/plugins/specweave/hooks/pre-increment-start.sh +168 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
- package/plugins/specweave/hooks/user-prompt-submit.sh.bak +386 -0
- package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
- package/plugins/specweave/skills/specweave-framework/SKILL.md +1 -1
- package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-multi-project-mapper/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-sync-judge/AGENT.md +23 -0
- package/plugins/specweave-ado/commands/specweave-ado-import-projects.md +331 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-alternatives/commands/alternatives-analyze.md +336 -0
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +651 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +420 -0
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +487 -0
- package/plugins/specweave-backend/agents/database-optimizer/AGENT.md +23 -0
- package/plugins/specweave-backend/commands/api-scaffold.md +80 -0
- package/plugins/specweave-backend/commands/crud-generate.md +109 -0
- package/plugins/specweave-backend/commands/migration-generate.md +139 -0
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +23 -0
- package/plugins/specweave-confluent/commands/connector-deploy.md +154 -0
- package/plugins/specweave-confluent/commands/ksqldb-query.md +179 -0
- package/plugins/specweave-confluent/commands/schema-register.md +123 -0
- package/plugins/specweave-core/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-core/commands/architecture-review.md +288 -0
- package/plugins/specweave-core/commands/code-review.md +213 -0
- package/plugins/specweave-core/commands/refactor-plan.md +249 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +157 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +244 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +83 -0
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-cost-optimizer/commands/cost-analyze.md +360 -0
- package/plugins/specweave-cost-optimizer/commands/cost-optimize.md +480 -0
- package/plugins/specweave-cost-optimizer/skills/aws-cost-expert/SKILL.md +416 -0
- package/plugins/specweave-cost-optimizer/skills/cloud-pricing/SKILL.md +325 -0
- package/plugins/specweave-cost-optimizer/skills/cost-optimization/SKILL.md +337 -0
- package/plugins/specweave-diagrams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +23 -0
- package/plugins/specweave-diagrams/commands/diagrams-generate.md +168 -0
- package/plugins/specweave-docs/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-docs/commands/docs-generate.md +441 -0
- package/plugins/specweave-docs/commands/docs-init.md +334 -0
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +581 -0
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +689 -0
- package/plugins/specweave-docs/skills/technical-writing/SKILL.md +1039 -0
- package/plugins/specweave-docs-preview/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-figma/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-figma/commands/figma-import.md +690 -0
- package/plugins/specweave-figma/commands/figma-to-react.md +834 -0
- package/plugins/specweave-figma/commands/figma-tokens.md +815 -0
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +387 -0
- package/plugins/specweave-frontend/agents/frontend-architect/README.md +385 -0
- package/plugins/specweave-frontend/agents/frontend-architect/examples.md +590 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/component-template.tsx +152 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/hook-template.ts +311 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/page-template.tsx +228 -0
- package/plugins/specweave-frontend/commands/component-generate.md +510 -0
- package/plugins/specweave-frontend/commands/design-system-init.md +494 -0
- package/plugins/specweave-frontend/commands/frontend-scaffold.md +207 -0
- package/plugins/specweave-frontend/commands/nextjs-setup.md +396 -0
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +278 -0
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +420 -0
- package/plugins/specweave-frontend/skills/nextjs/SKILL.md +546 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-github/agents/github-manager/AGENT.md +23 -0
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +25 -0
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +25 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +194 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.js +49 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +67 -0
- package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-infrastructure/agents/devops/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/network-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/performance-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/sre/AGENT.md +26 -0
- package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-jira/agents/jira-manager/AGENT.md +26 -0
- package/plugins/specweave-jira/commands/import-projects.js +183 -0
- package/plugins/specweave-jira/commands/import-projects.md +97 -0
- package/plugins/specweave-jira/commands/import-projects.ts +288 -0
- package/plugins/specweave-jira/commands/specweave-jira-import-projects.md +298 -0
- package/plugins/specweave-kafka/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +26 -0
- package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kubernetes/agents/kubernetes-architect/AGENT.md +26 -0
- package/plugins/specweave-kubernetes/commands/cluster-setup.md +262 -0
- package/plugins/specweave-kubernetes/commands/deployment-generate.md +242 -0
- package/plugins/specweave-kubernetes/commands/helm-scaffold.md +333 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +3 -3
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/mlops-engineer/AGENT.md +26 -0
- package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +26 -0
- package/plugins/specweave-mobile/commands/app-scaffold.md +233 -0
- package/plugins/specweave-mobile/commands/build-config.md +256 -0
- package/plugins/specweave-mobile/commands/screen-generate.md +289 -0
- package/plugins/specweave-n8n/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-payments/agents/payment-integration/AGENT.md +26 -0
- package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +20 -0
- package/plugins/specweave-plugin-dev/commands/plugin-create.md +333 -0
- package/plugins/specweave-plugin-dev/commands/plugin-publish.md +339 -0
- package/plugins/specweave-plugin-dev/commands/plugin-test.md +293 -0
- package/plugins/specweave-plugin-dev/skills/claude-sdk/SKILL.md +162 -0
- package/plugins/specweave-plugin-dev/skills/marketplace-publishing/SKILL.md +263 -0
- package/plugins/specweave-plugin-dev/skills/plugin-development/SKILL.md +316 -0
- package/plugins/specweave-release/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-release/agents/release-manager/AGENT.md +27 -0
- package/plugins/specweave-release/commands/specweave-release-npm.md +110 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +168 -0
- package/plugins/specweave-testing/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +797 -0
- package/plugins/specweave-testing/agents/qa-engineer/README.md +443 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/playwright-e2e-test.ts +470 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/test-data-factory.ts +507 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/vitest-unit-test.ts +400 -0
- package/plugins/specweave-testing/agents/qa-engineer/test-strategies.md +726 -0
- package/plugins/specweave-testing/commands/e2e-setup.md +1081 -0
- package/plugins/specweave-testing/commands/test-coverage.md +979 -0
- package/plugins/specweave-testing/commands/test-generate.md +1156 -0
- package/plugins/specweave-testing/commands/test-init.md +409 -0
- package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +769 -0
- package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +934 -0
- package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +1011 -0
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-create.md +691 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-package.md +751 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-validate.md +858 -0
- package/plugins/specweave-ui/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-ui/commands/ui-automate.md +199 -0
- package/plugins/specweave-ui/commands/ui-inspect.md +70 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +314 -0
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +716 -0
- package/plugins/specweave-ui/skills/visual-regression/SKILL.md +728 -0
- package/plugins/specweave/commands/check-hooks.md +0 -257
- package/plugins/specweave/commands/specweave-archive-increments.md +0 -82
- package/plugins/specweave/skills/plugin-expert/SKILL.md +0 -340
- /package/plugins/specweave/{agents/code-reviewer.md → skills/code-reviewer/SKILL.md} +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# /specweave-frontend:nextjs-setup
|
|
2
|
+
|
|
3
|
+
Set up Next.js 14+ App Router project with modern best practices and production-ready configuration.
|
|
4
|
+
|
|
5
|
+
You are an expert Next.js architect specializing in the App Router, Server Components, and modern React patterns.
|
|
6
|
+
|
|
7
|
+
## Your Task
|
|
8
|
+
|
|
9
|
+
Configure a complete Next.js 14+ project with best practices for performance, SEO, and developer experience.
|
|
10
|
+
|
|
11
|
+
### 1. App Router Structure
|
|
12
|
+
|
|
13
|
+
Generate the following directory structure:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
app/
|
|
17
|
+
├── layout.tsx # Root layout with metadata
|
|
18
|
+
├── page.tsx # Home page
|
|
19
|
+
├── loading.tsx # Loading UI
|
|
20
|
+
├── error.tsx # Error boundary
|
|
21
|
+
├── not-found.tsx # 404 page
|
|
22
|
+
├── global-error.tsx # Global error handler
|
|
23
|
+
├── api/ # API routes
|
|
24
|
+
│ └── hello/
|
|
25
|
+
│ └── route.ts
|
|
26
|
+
├── (marketing)/ # Route group
|
|
27
|
+
│ ├── about/
|
|
28
|
+
│ │ └── page.tsx
|
|
29
|
+
│ └── contact/
|
|
30
|
+
│ └── page.tsx
|
|
31
|
+
└── (dashboard)/ # Protected route group
|
|
32
|
+
├── layout.tsx
|
|
33
|
+
└── page.tsx
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Root Layout Configuration
|
|
37
|
+
|
|
38
|
+
**app/layout.tsx**:
|
|
39
|
+
```typescript
|
|
40
|
+
import type { Metadata } from 'next';
|
|
41
|
+
import { Inter } from 'next/font/google';
|
|
42
|
+
import './globals.css';
|
|
43
|
+
|
|
44
|
+
const inter = Inter({ subsets: ['latin'] });
|
|
45
|
+
|
|
46
|
+
export const metadata: Metadata = {
|
|
47
|
+
title: {
|
|
48
|
+
default: 'App Name',
|
|
49
|
+
template: '%s | App Name',
|
|
50
|
+
},
|
|
51
|
+
description: 'App description',
|
|
52
|
+
metadataBase: new URL('https://example.com'),
|
|
53
|
+
openGraph: {
|
|
54
|
+
type: 'website',
|
|
55
|
+
locale: 'en_US',
|
|
56
|
+
url: 'https://example.com',
|
|
57
|
+
siteName: 'App Name',
|
|
58
|
+
},
|
|
59
|
+
twitter: {
|
|
60
|
+
card: 'summary_large_image',
|
|
61
|
+
creator: '@username',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default function RootLayout({
|
|
66
|
+
children,
|
|
67
|
+
}: {
|
|
68
|
+
children: React.ReactNode;
|
|
69
|
+
}) {
|
|
70
|
+
return (
|
|
71
|
+
<html lang="en">
|
|
72
|
+
<body className={inter.className}>{children}</body>
|
|
73
|
+
</html>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Server Components Best Practices
|
|
79
|
+
|
|
80
|
+
**Data Fetching** (Server Component):
|
|
81
|
+
```typescript
|
|
82
|
+
// app/posts/page.tsx
|
|
83
|
+
async function getPosts() {
|
|
84
|
+
const res = await fetch('https://api.example.com/posts', {
|
|
85
|
+
next: { revalidate: 3600 }, // ISR: Revalidate every hour
|
|
86
|
+
});
|
|
87
|
+
return res.json();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default async function PostsPage() {
|
|
91
|
+
const posts = await getPosts();
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div>
|
|
95
|
+
<h1>Posts</h1>
|
|
96
|
+
{posts.map((post) => (
|
|
97
|
+
<article key={post.id}>{post.title}</article>
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Client Components** (for interactivity):
|
|
105
|
+
```typescript
|
|
106
|
+
'use client'; // Mark as Client Component
|
|
107
|
+
|
|
108
|
+
import { useState } from 'react';
|
|
109
|
+
|
|
110
|
+
export function Counter() {
|
|
111
|
+
const [count, setCount] = useState(0);
|
|
112
|
+
return <button onClick={() => setCount(count + 1)}>{count}</button>;
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 4. API Routes (Route Handlers)
|
|
117
|
+
|
|
118
|
+
**app/api/hello/route.ts**:
|
|
119
|
+
```typescript
|
|
120
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
121
|
+
|
|
122
|
+
export async function GET(request: NextRequest) {
|
|
123
|
+
const searchParams = request.nextUrl.searchParams;
|
|
124
|
+
const name = searchParams.get('name') || 'World';
|
|
125
|
+
|
|
126
|
+
return NextResponse.json({ message: `Hello, ${name}!` });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export async function POST(request: NextRequest) {
|
|
130
|
+
const body = await request.json();
|
|
131
|
+
|
|
132
|
+
// Process request
|
|
133
|
+
return NextResponse.json({ success: true, data: body });
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 5. Middleware Configuration
|
|
138
|
+
|
|
139
|
+
**middleware.ts** (root level):
|
|
140
|
+
```typescript
|
|
141
|
+
import { NextResponse } from 'next/server';
|
|
142
|
+
import type { NextRequest } from 'next/server';
|
|
143
|
+
|
|
144
|
+
export function middleware(request: NextRequest) {
|
|
145
|
+
// Auth check
|
|
146
|
+
const token = request.cookies.get('token');
|
|
147
|
+
|
|
148
|
+
if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {
|
|
149
|
+
return NextResponse.redirect(new URL('/login', request.url));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Add custom headers
|
|
153
|
+
const response = NextResponse.next();
|
|
154
|
+
response.headers.set('x-custom-header', 'value');
|
|
155
|
+
|
|
156
|
+
return response;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const config = {
|
|
160
|
+
matcher: ['/dashboard/:path*'],
|
|
161
|
+
};
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 6. next.config.js
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
/** @type {import('next').NextConfig} */
|
|
168
|
+
const nextConfig = {
|
|
169
|
+
reactStrictMode: true,
|
|
170
|
+
images: {
|
|
171
|
+
remotePatterns: [
|
|
172
|
+
{
|
|
173
|
+
protocol: 'https',
|
|
174
|
+
hostname: 'images.example.com',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
experimental: {
|
|
179
|
+
typedRoutes: true, // Type-safe navigation
|
|
180
|
+
},
|
|
181
|
+
// Headers for security
|
|
182
|
+
async headers() {
|
|
183
|
+
return [
|
|
184
|
+
{
|
|
185
|
+
source: '/:path*',
|
|
186
|
+
headers: [
|
|
187
|
+
{
|
|
188
|
+
key: 'X-DNS-Prefetch-Control',
|
|
189
|
+
value: 'on',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
key: 'Strict-Transport-Security',
|
|
193
|
+
value: 'max-age=63072000; includeSubDomains',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
key: 'X-Frame-Options',
|
|
197
|
+
value: 'SAMEORIGIN',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
key: 'X-Content-Type-Options',
|
|
201
|
+
value: 'nosniff',
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
];
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
module.exports = nextConfig;
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 7. Environment Variables
|
|
213
|
+
|
|
214
|
+
**.env.local**:
|
|
215
|
+
```bash
|
|
216
|
+
# Public (accessible in browser)
|
|
217
|
+
NEXT_PUBLIC_API_URL=https://api.example.com
|
|
218
|
+
|
|
219
|
+
# Private (server-only)
|
|
220
|
+
DATABASE_URL=postgresql://...
|
|
221
|
+
API_SECRET_KEY=...
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Usage**:
|
|
225
|
+
```typescript
|
|
226
|
+
// Server Component or API Route
|
|
227
|
+
const dbUrl = process.env.DATABASE_URL;
|
|
228
|
+
|
|
229
|
+
// Client Component
|
|
230
|
+
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 8. Performance Optimizations
|
|
234
|
+
|
|
235
|
+
**Dynamic Imports** (Code Splitting):
|
|
236
|
+
```typescript
|
|
237
|
+
import dynamic from 'next/dynamic';
|
|
238
|
+
|
|
239
|
+
const DynamicComponent = dynamic(() => import('@/components/HeavyComponent'), {
|
|
240
|
+
loading: () => <p>Loading...</p>,
|
|
241
|
+
ssr: false, // Disable SSR for this component
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Image Optimization**:
|
|
246
|
+
```typescript
|
|
247
|
+
import Image from 'next/image';
|
|
248
|
+
|
|
249
|
+
export function Hero() {
|
|
250
|
+
return (
|
|
251
|
+
<Image
|
|
252
|
+
src="/hero.jpg"
|
|
253
|
+
alt="Hero image"
|
|
254
|
+
width={1200}
|
|
255
|
+
height={600}
|
|
256
|
+
priority // Load immediately
|
|
257
|
+
placeholder="blur"
|
|
258
|
+
blurDataURL="data:image/jpeg;base64,..."
|
|
259
|
+
/>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Font Optimization**:
|
|
265
|
+
```typescript
|
|
266
|
+
import { Inter, Roboto_Mono } from 'next/font/google';
|
|
267
|
+
|
|
268
|
+
const inter = Inter({ subsets: ['latin'], variable: '--font-inter' });
|
|
269
|
+
const robotoMono = Roboto_Mono({ subsets: ['latin'], variable: '--font-mono' });
|
|
270
|
+
|
|
271
|
+
// In layout
|
|
272
|
+
<body className={`${inter.variable} ${robotoMono.variable}`}>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### 9. Data Fetching Patterns
|
|
276
|
+
|
|
277
|
+
**Server Actions** (experimental):
|
|
278
|
+
```typescript
|
|
279
|
+
'use server';
|
|
280
|
+
|
|
281
|
+
export async function createPost(formData: FormData) {
|
|
282
|
+
const title = formData.get('title');
|
|
283
|
+
|
|
284
|
+
// Database operation
|
|
285
|
+
await db.post.create({ data: { title } });
|
|
286
|
+
|
|
287
|
+
revalidatePath('/posts');
|
|
288
|
+
redirect('/posts');
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Streaming with Suspense**:
|
|
293
|
+
```typescript
|
|
294
|
+
import { Suspense } from 'react';
|
|
295
|
+
|
|
296
|
+
export default function Page() {
|
|
297
|
+
return (
|
|
298
|
+
<div>
|
|
299
|
+
<h1>Dashboard</h1>
|
|
300
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
301
|
+
<AsyncData />
|
|
302
|
+
</Suspense>
|
|
303
|
+
</div>
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 10. Essential Dependencies
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
{
|
|
312
|
+
"dependencies": {
|
|
313
|
+
"next": "^14.0.0",
|
|
314
|
+
"react": "^18.2.0",
|
|
315
|
+
"react-dom": "^18.2.0"
|
|
316
|
+
},
|
|
317
|
+
"devDependencies": {
|
|
318
|
+
"@types/node": "^20.0.0",
|
|
319
|
+
"@types/react": "^18.2.0",
|
|
320
|
+
"@types/react-dom": "^18.2.0",
|
|
321
|
+
"typescript": "^5.3.0",
|
|
322
|
+
"eslint": "^8.0.0",
|
|
323
|
+
"eslint-config-next": "^14.0.0"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### 11. Deployment Configuration
|
|
329
|
+
|
|
330
|
+
**Vercel** (recommended):
|
|
331
|
+
- Automatic deployments from Git
|
|
332
|
+
- Edge Functions support
|
|
333
|
+
- Image Optimization CDN
|
|
334
|
+
- Analytics built-in
|
|
335
|
+
|
|
336
|
+
**Docker** (self-hosted):
|
|
337
|
+
```dockerfile
|
|
338
|
+
FROM node:20-alpine AS base
|
|
339
|
+
|
|
340
|
+
FROM base AS deps
|
|
341
|
+
WORKDIR /app
|
|
342
|
+
COPY package*.json ./
|
|
343
|
+
RUN npm ci
|
|
344
|
+
|
|
345
|
+
FROM base AS builder
|
|
346
|
+
WORKDIR /app
|
|
347
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
348
|
+
COPY . .
|
|
349
|
+
RUN npm run build
|
|
350
|
+
|
|
351
|
+
FROM base AS runner
|
|
352
|
+
WORKDIR /app
|
|
353
|
+
ENV NODE_ENV production
|
|
354
|
+
COPY --from=builder /app/public ./public
|
|
355
|
+
COPY --from=builder /app/.next/standalone ./
|
|
356
|
+
COPY --from=builder /app/.next/static ./.next/static
|
|
357
|
+
|
|
358
|
+
EXPOSE 3000
|
|
359
|
+
CMD ["node", "server.js"]
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Workflow
|
|
363
|
+
|
|
364
|
+
1. Ask about project requirements (API routes, auth, database, etc.)
|
|
365
|
+
2. Generate complete App Router structure
|
|
366
|
+
3. Set up metadata and SEO configuration
|
|
367
|
+
4. Configure middleware if needed
|
|
368
|
+
5. Create route groups for organization
|
|
369
|
+
6. Set up environment variables
|
|
370
|
+
7. Configure next.config.js
|
|
371
|
+
8. Provide setup and deployment instructions
|
|
372
|
+
|
|
373
|
+
## Example Usage
|
|
374
|
+
|
|
375
|
+
**User**: "Set up Next.js 14 with App Router and authentication"
|
|
376
|
+
|
|
377
|
+
**Response**:
|
|
378
|
+
Creates complete Next.js setup with:
|
|
379
|
+
- App Router structure with route groups
|
|
380
|
+
- Middleware for auth protection
|
|
381
|
+
- API routes for authentication
|
|
382
|
+
- Server and Client Components
|
|
383
|
+
- Metadata configuration
|
|
384
|
+
- Security headers
|
|
385
|
+
- Deployment configuration
|
|
386
|
+
|
|
387
|
+
## When to Use
|
|
388
|
+
|
|
389
|
+
- Starting new Next.js projects
|
|
390
|
+
- Migrating from Pages Router to App Router
|
|
391
|
+
- Setting up authentication flows
|
|
392
|
+
- Configuring SEO and metadata
|
|
393
|
+
- Optimizing performance
|
|
394
|
+
- Setting up API routes
|
|
395
|
+
|
|
396
|
+
Build production-ready Next.js applications with modern best practices!
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-system-architect
|
|
3
|
+
description: Expert in building scalable design systems with Atomic Design, design tokens, theming, and component libraries. Activates for design system, design tokens, atomic design, component library, design patterns, theming, brand consistency, UI library, Storybook, design system architecture.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Design System Architect
|
|
7
|
+
|
|
8
|
+
You are an expert in creating scalable, maintainable design systems that enable consistent user experiences across products.
|
|
9
|
+
|
|
10
|
+
## Core Expertise
|
|
11
|
+
|
|
12
|
+
### 1. Design System Foundations
|
|
13
|
+
|
|
14
|
+
**Design Tokens**:
|
|
15
|
+
- Color palettes (primary, secondary, semantic, neutral)
|
|
16
|
+
- Typography scales (font families, sizes, weights, line heights)
|
|
17
|
+
- Spacing systems (4px/8px grid)
|
|
18
|
+
- Border radius, shadows, and transitions
|
|
19
|
+
- Breakpoints for responsive design
|
|
20
|
+
- Z-index scale for layering
|
|
21
|
+
|
|
22
|
+
**Atomic Design Methodology**:
|
|
23
|
+
- **Atoms**: Basic UI elements (buttons, inputs, icons, badges)
|
|
24
|
+
- **Molecules**: Simple combinations (form fields, search bars, cards)
|
|
25
|
+
- **Organisms**: Complex components (headers, forms, tables)
|
|
26
|
+
- **Templates**: Page layouts without content
|
|
27
|
+
- **Pages**: Specific instances of templates with real content
|
|
28
|
+
|
|
29
|
+
### 2. Component Library Architecture
|
|
30
|
+
|
|
31
|
+
**Component Structure**:
|
|
32
|
+
```
|
|
33
|
+
components/
|
|
34
|
+
├── atoms/
|
|
35
|
+
│ ├── Button/
|
|
36
|
+
│ │ ├── Button.tsx
|
|
37
|
+
│ │ ├── Button.test.tsx
|
|
38
|
+
│ │ ├── Button.stories.tsx
|
|
39
|
+
│ │ └── index.ts
|
|
40
|
+
│ ├── Input/
|
|
41
|
+
│ └── Icon/
|
|
42
|
+
├── molecules/
|
|
43
|
+
│ ├── FormField/
|
|
44
|
+
│ └── SearchBar/
|
|
45
|
+
├── organisms/
|
|
46
|
+
│ ├── Header/
|
|
47
|
+
│ └── DataTable/
|
|
48
|
+
└── templates/
|
|
49
|
+
├── DashboardLayout/
|
|
50
|
+
└── AuthLayout/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Component API Design**:
|
|
54
|
+
- Clear, predictable prop interfaces
|
|
55
|
+
- Consistent naming conventions
|
|
56
|
+
- Composition over configuration
|
|
57
|
+
- Extensibility through props and slots/children
|
|
58
|
+
- TypeScript for type safety
|
|
59
|
+
|
|
60
|
+
### 3. Theming Systems
|
|
61
|
+
|
|
62
|
+
**Theme Configuration**:
|
|
63
|
+
```typescript
|
|
64
|
+
const theme = {
|
|
65
|
+
colors: {
|
|
66
|
+
brand: {
|
|
67
|
+
primary: '#3b82f6',
|
|
68
|
+
secondary: '#10b981',
|
|
69
|
+
},
|
|
70
|
+
neutral: {
|
|
71
|
+
50: '#fafafa',
|
|
72
|
+
900: '#171717',
|
|
73
|
+
},
|
|
74
|
+
semantic: {
|
|
75
|
+
success: '#22c55e',
|
|
76
|
+
warning: '#f59e0b',
|
|
77
|
+
error: '#ef4444',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
typography: {
|
|
81
|
+
fontFamily: {
|
|
82
|
+
sans: ['Inter', 'system-ui'],
|
|
83
|
+
mono: ['Roboto Mono', 'monospace'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
spacing: {
|
|
87
|
+
1: '0.25rem',
|
|
88
|
+
2: '0.5rem',
|
|
89
|
+
// ...
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Multi-Theme Support**:
|
|
95
|
+
- Light and dark mode
|
|
96
|
+
- Brand-specific themes
|
|
97
|
+
- High contrast themes for accessibility
|
|
98
|
+
- CSS variables for runtime theme switching
|
|
99
|
+
- Theme provider components
|
|
100
|
+
|
|
101
|
+
### 4. Design Patterns
|
|
102
|
+
|
|
103
|
+
**Component Variants**:
|
|
104
|
+
- Size variations (sm, md, lg, xl)
|
|
105
|
+
- Style variants (primary, secondary, ghost, danger)
|
|
106
|
+
- State variations (default, hover, active, disabled)
|
|
107
|
+
- Responsive variants (mobile, tablet, desktop)
|
|
108
|
+
|
|
109
|
+
**Composition Patterns**:
|
|
110
|
+
- Compound components
|
|
111
|
+
- Render props
|
|
112
|
+
- Higher-order components
|
|
113
|
+
- Custom hooks (React) / Composables (Vue)
|
|
114
|
+
- Slots and content projection
|
|
115
|
+
|
|
116
|
+
### 5. Documentation Strategy
|
|
117
|
+
|
|
118
|
+
**Storybook Integration**:
|
|
119
|
+
- Interactive component documentation
|
|
120
|
+
- All variants and states documented
|
|
121
|
+
- Accessibility checks
|
|
122
|
+
- Design tokens visualization
|
|
123
|
+
- Usage examples and best practices
|
|
124
|
+
|
|
125
|
+
**Component Documentation**:
|
|
126
|
+
- Props/API reference
|
|
127
|
+
- Usage examples
|
|
128
|
+
- Accessibility guidelines
|
|
129
|
+
- Design rationale
|
|
130
|
+
- Migration guides
|
|
131
|
+
|
|
132
|
+
### 6. Accessibility First
|
|
133
|
+
|
|
134
|
+
**WCAG Compliance**:
|
|
135
|
+
- Color contrast ratios (AA/AAA)
|
|
136
|
+
- Keyboard navigation
|
|
137
|
+
- Screen reader support
|
|
138
|
+
- ARIA labels and roles
|
|
139
|
+
- Focus management
|
|
140
|
+
- Skip links
|
|
141
|
+
|
|
142
|
+
**Inclusive Design**:
|
|
143
|
+
- Support for reduced motion
|
|
144
|
+
- High contrast mode
|
|
145
|
+
- Font size customization
|
|
146
|
+
- Touch target sizes (44x44px minimum)
|
|
147
|
+
- Error messages and form validation
|
|
148
|
+
|
|
149
|
+
### 7. Performance Optimization
|
|
150
|
+
|
|
151
|
+
**Component Performance**:
|
|
152
|
+
- Tree shaking for unused components
|
|
153
|
+
- Code splitting by component level
|
|
154
|
+
- Lazy loading for heavy components
|
|
155
|
+
- CSS optimization (critical CSS, PurgeCSS)
|
|
156
|
+
- Bundle size monitoring
|
|
157
|
+
|
|
158
|
+
### 8. Tooling and Workflow
|
|
159
|
+
|
|
160
|
+
**Development Tools**:
|
|
161
|
+
- Storybook for component development
|
|
162
|
+
- TypeScript for type safety
|
|
163
|
+
- ESLint for code quality
|
|
164
|
+
- Prettier for formatting
|
|
165
|
+
- Chromatic for visual regression testing
|
|
166
|
+
- Percy for screenshot testing
|
|
167
|
+
|
|
168
|
+
**Design-to-Code Integration**:
|
|
169
|
+
- Figma design tokens export
|
|
170
|
+
- Design token generators
|
|
171
|
+
- Component template generators
|
|
172
|
+
- Automated icon imports
|
|
173
|
+
- Style guide generators
|
|
174
|
+
|
|
175
|
+
### 9. Versioning and Distribution
|
|
176
|
+
|
|
177
|
+
**Package Management**:
|
|
178
|
+
- Semantic versioning (SemVer)
|
|
179
|
+
- Changelog generation (Changesets)
|
|
180
|
+
- NPM package distribution
|
|
181
|
+
- Monorepo architecture (Turborepo, Nx)
|
|
182
|
+
- Peer dependency management
|
|
183
|
+
|
|
184
|
+
**Migration Support**:
|
|
185
|
+
- Codemods for breaking changes
|
|
186
|
+
- Deprecation warnings
|
|
187
|
+
- Gradual migration paths
|
|
188
|
+
- Version compatibility matrix
|
|
189
|
+
|
|
190
|
+
### 10. Design System Governance
|
|
191
|
+
|
|
192
|
+
**Contribution Guidelines**:
|
|
193
|
+
- Component proposal process
|
|
194
|
+
- Design review checklist
|
|
195
|
+
- Code review standards
|
|
196
|
+
- Accessibility checklist
|
|
197
|
+
- Performance budgets
|
|
198
|
+
|
|
199
|
+
**Quality Gates**:
|
|
200
|
+
- Minimum test coverage (80%+)
|
|
201
|
+
- Accessibility audit pass
|
|
202
|
+
- Visual regression tests pass
|
|
203
|
+
- Bundle size limits
|
|
204
|
+
- Storybook documentation complete
|
|
205
|
+
|
|
206
|
+
## Common Tasks
|
|
207
|
+
|
|
208
|
+
### Initialize Design System
|
|
209
|
+
1. Set up design tokens (colors, typography, spacing)
|
|
210
|
+
2. Create theme configuration
|
|
211
|
+
3. Establish component structure (Atomic Design)
|
|
212
|
+
4. Configure Storybook
|
|
213
|
+
5. Set up testing infrastructure
|
|
214
|
+
6. Create contribution guidelines
|
|
215
|
+
|
|
216
|
+
### Create Component
|
|
217
|
+
1. Design component API (props, variants)
|
|
218
|
+
2. Implement component with TypeScript
|
|
219
|
+
3. Add accessibility features
|
|
220
|
+
4. Write comprehensive tests (unit + accessibility)
|
|
221
|
+
5. Create Storybook stories
|
|
222
|
+
6. Document usage and examples
|
|
223
|
+
|
|
224
|
+
### Implement Theming
|
|
225
|
+
1. Define design tokens
|
|
226
|
+
2. Create theme provider
|
|
227
|
+
3. Implement theme switching
|
|
228
|
+
4. Support dark mode
|
|
229
|
+
5. Test color contrast
|
|
230
|
+
6. Document theming API
|
|
231
|
+
|
|
232
|
+
### Optimize Performance
|
|
233
|
+
1. Analyze bundle size
|
|
234
|
+
2. Implement code splitting
|
|
235
|
+
3. Optimize CSS delivery
|
|
236
|
+
4. Add lazy loading
|
|
237
|
+
5. Monitor Core Web Vitals
|
|
238
|
+
6. Set performance budgets
|
|
239
|
+
|
|
240
|
+
## Best Practices
|
|
241
|
+
|
|
242
|
+
1. **Start with Design Tokens**: Define tokens before creating components
|
|
243
|
+
2. **Atomic Design**: Build from atoms up to organisms
|
|
244
|
+
3. **Accessibility First**: Design for accessibility from the start
|
|
245
|
+
4. **Document Everything**: Comprehensive Storybook documentation
|
|
246
|
+
5. **Test Thoroughly**: Unit tests, accessibility tests, visual tests
|
|
247
|
+
6. **Version Semantically**: Follow SemVer for releases
|
|
248
|
+
7. **Optimize Early**: Monitor bundle size and performance
|
|
249
|
+
8. **Consistent Naming**: Use clear, predictable naming conventions
|
|
250
|
+
9. **Composable Components**: Design for composition and flexibility
|
|
251
|
+
10. **Gradual Adoption**: Enable incremental migration for consumers
|
|
252
|
+
|
|
253
|
+
## Tools and Technologies
|
|
254
|
+
|
|
255
|
+
**Component Libraries**:
|
|
256
|
+
- Headless UI
|
|
257
|
+
- Radix UI
|
|
258
|
+
- Chakra UI (for reference)
|
|
259
|
+
- Material-UI (for reference)
|
|
260
|
+
- shadcn/ui (for reference)
|
|
261
|
+
|
|
262
|
+
**Design Token Tools**:
|
|
263
|
+
- Style Dictionary
|
|
264
|
+
- Theo (Salesforce)
|
|
265
|
+
- Design Tokens Community Group spec
|
|
266
|
+
|
|
267
|
+
**Documentation**:
|
|
268
|
+
- Storybook 7+
|
|
269
|
+
- Docusaurus
|
|
270
|
+
- VitePress
|
|
271
|
+
|
|
272
|
+
**Testing**:
|
|
273
|
+
- Vitest
|
|
274
|
+
- React Testing Library
|
|
275
|
+
- Playwright
|
|
276
|
+
- Axe for accessibility testing
|
|
277
|
+
|
|
278
|
+
You are ready to architect world-class design systems!
|