@el-j/magic-helix-plugins 4.0.0-beta.2 → 4.0.0-beta.3
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/dist/architecture/codeowners.md +123 -0
- package/dist/architecture/monorepo.md +146 -0
- package/dist/architecture/nx.md +122 -0
- package/dist/architecture/turborepo.md +114 -0
- package/dist/ci/github-actions.md +268 -0
- package/dist/ci/gitlab-ci.md +330 -0
- package/dist/containers/docker-multistage.md +120 -0
- package/dist/containers/kubernetes-deploy.md +210 -0
- package/dist/cpp/index.cjs +79 -0
- package/dist/cpp/index.mjs +209 -0
- package/dist/csharp/index.cjs +2 -2
- package/dist/csharp/{index.js → index.mjs} +17 -11
- package/dist/csharp/templates/framework-aspnetcore.md +205 -0
- package/dist/csharp/templates/framework-blazor.md +271 -0
- package/dist/csharp/templates/lang-csharp.md +162 -0
- package/dist/devops/docker-compose.md +111 -0
- package/dist/devops/docker-dockerfile.md +94 -0
- package/dist/devops/github-actions.md +160 -0
- package/dist/devops/gitlab-ci.md +210 -0
- package/dist/generic/lang-typescript.md +57 -0
- package/dist/generic/state-redux.md +21 -0
- package/dist/generic/state-rxjs.md +6 -0
- package/dist/generic/style-mui.md +23 -0
- package/dist/generic/style-tailwind.md +76 -0
- package/dist/generic/test-cypress.md +21 -0
- package/dist/generic/test-jest.md +20 -0
- package/dist/generic/test-playwright.md +21 -0
- package/dist/generic/test-vitest.md +131 -0
- package/dist/go/index.cjs +3 -3
- package/dist/go/{index.js → index.mjs} +18 -15
- package/dist/go/templates/lang-go.md +571 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +24 -0
- package/dist/java/index.cjs +2 -2
- package/dist/java/{index.js → index.mjs} +25 -19
- package/dist/java/templates/build-gradle.md +102 -0
- package/dist/java/templates/build-maven.md +86 -0
- package/dist/java/templates/framework-spring-boot.md +179 -0
- package/dist/java/templates/lang-java.md +78 -0
- package/dist/java/templates/lang-kotlin.md +88 -0
- package/dist/meta/magic-helix-meta.md +213 -0
- package/dist/meta/meta-debug.md +459 -0
- package/dist/meta/meta-implement.md +450 -0
- package/dist/meta/meta-roadmap.md +265 -0
- package/dist/nodejs/templates/angular-core.md +19 -0
- package/dist/nodejs/templates/lang-typescript.md +57 -0
- package/dist/nodejs/templates/nestjs-core.md +7 -0
- package/dist/nodejs/templates/react-core.md +677 -0
- package/dist/nodejs/templates/react-zustand.md +7 -0
- package/dist/nodejs/templates/state-redux.md +21 -0
- package/dist/nodejs/templates/state-rxjs.md +6 -0
- package/dist/nodejs/templates/style-primevue.md +6 -0
- package/dist/nodejs/templates/style-quasar.md +22 -0
- package/dist/nodejs/templates/style-tailwind.md +76 -0
- package/dist/nodejs/templates/test-cypress.md +21 -0
- package/dist/nodejs/templates/test-jest.md +20 -0
- package/dist/nodejs/templates/test-playwright.md +21 -0
- package/dist/nodejs/templates/test-vitest.md +131 -0
- package/dist/nodejs/templates/vue-core.md +108 -0
- package/dist/nodejs/templates/vue-pinia.md +5 -0
- package/dist/patterns/architecture/clean-architecture.md +469 -0
- package/dist/patterns/architecture/dependency-injection.md +517 -0
- package/dist/patterns/architecture/domain-driven-design.md +621 -0
- package/dist/patterns/architecture/layered-architecture.md +382 -0
- package/dist/patterns/architecture/repository-pattern.md +408 -0
- package/dist/patterns/domain-expertise/nextjs-rules.md +115 -0
- package/dist/patterns/domain-expertise/react-patterns.md +181 -0
- package/dist/patterns/domain-expertise/server-components.md +212 -0
- package/dist/patterns/domain-expertise/shadcn-ui.md +52 -0
- package/dist/patterns/domain-expertise/tailwind-patterns.md +52 -0
- package/dist/patterns/environment/container-awareness.md +17 -0
- package/dist/patterns/environment/ide-features.md +17 -0
- package/dist/patterns/environment/os-commands.md +17 -0
- package/dist/patterns/organization/heading-hierarchy.md +103 -0
- package/dist/patterns/organization/sequential-workflows.md +102 -0
- package/dist/patterns/organization/xml-rule-groups.md +64 -0
- package/dist/patterns/reasoning/agent-loop.md +151 -0
- package/dist/patterns/reasoning/confirmation-gates.md +141 -0
- package/dist/patterns/reasoning/dependency-analysis.md +132 -0
- package/dist/patterns/reasoning/one-tool-per-iteration.md +152 -0
- package/dist/patterns/reasoning/preview-before-action.md +194 -0
- package/dist/patterns/reasoning/reflection-checkpoints.md +166 -0
- package/dist/patterns/reasoning/result-verification.md +157 -0
- package/dist/patterns/reasoning/subtask-breakdown.md +131 -0
- package/dist/patterns/reasoning/thinking-tags.md +100 -0
- package/dist/patterns/role-definition/capability-declarations.md +72 -0
- package/dist/patterns/role-definition/expert-identity.md +45 -0
- package/dist/patterns/role-definition/scope-boundaries.md +61 -0
- package/dist/patterns/safety/code-safety-rules.md +17 -0
- package/dist/patterns/safety/credential-handling.md +17 -0
- package/dist/patterns/safety/destructive-warnings.md +17 -0
- package/dist/patterns/safety/refusal-messages.md +17 -0
- package/dist/patterns/tone/adaptive-tone.md +17 -0
- package/dist/patterns/tone/concise-communication.md +17 -0
- package/dist/patterns/tone/forbidden-phrases.md +17 -0
- package/dist/patterns/tool-guidelines/function-schemas.md +143 -0
- package/dist/patterns/tool-guidelines/parameter-examples.md +137 -0
- package/dist/patterns/tool-guidelines/usage-policies.md +105 -0
- package/dist/php/index.cjs +2 -2
- package/dist/php/{index.js → index.mjs} +12 -6
- package/dist/php/templates/framework-laravel.md +112 -0
- package/dist/php/templates/lang-php.md +94 -0
- package/dist/python/index.cjs +4 -4
- package/dist/python/{index.js → index.mjs} +10 -7
- package/dist/python/templates/lang-python.md +508 -0
- package/dist/ruby/index.cjs +2 -2
- package/dist/ruby/{index.js → index.mjs} +16 -10
- package/dist/ruby/templates/framework-rails.md +309 -0
- package/dist/ruby/templates/framework-sinatra.md +227 -0
- package/dist/ruby/templates/lang-ruby.md +216 -0
- package/dist/rust/index.cjs +3 -3
- package/dist/rust/{index.js → index.mjs} +24 -18
- package/dist/rust/templates/lang-rust.md +89 -0
- package/dist/swift/index.cjs +32 -0
- package/dist/swift/index.mjs +112 -0
- package/dist/swift/templates/framework-vapor.md +352 -0
- package/dist/swift/templates/lang-swift.md +291 -0
- package/package.json +31 -21
- package/dist/index.js +0 -20
- /package/dist/nodejs/{index.js → index.mjs} +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Server Components Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Guide usage of React Server Components (RSC) in Next.js. From **v0** pattern.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
## React Server Components (RSC)
|
|
10
|
+
|
|
11
|
+
### When to Use Server Components
|
|
12
|
+
- {SCENARIO_1_FOR_SERVER}
|
|
13
|
+
- {SCENARIO_2_FOR_SERVER}
|
|
14
|
+
- {SCENARIO_3_FOR_SERVER}
|
|
15
|
+
|
|
16
|
+
### When to Use Client Components
|
|
17
|
+
- {SCENARIO_1_FOR_CLIENT}
|
|
18
|
+
- {SCENARIO_2_FOR_CLIENT}
|
|
19
|
+
- {SCENARIO_3_FOR_CLIENT}
|
|
20
|
+
|
|
21
|
+
### Composition Patterns
|
|
22
|
+
- {HOW_TO_MIX_SERVER_AND_CLIENT}
|
|
23
|
+
- {PASSING_PROPS_BETWEEN_TYPES}
|
|
24
|
+
- {HANDLING_SERIALIZATION}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### v0 (Next.js App Router RSC Guidelines)
|
|
30
|
+
```markdown
|
|
31
|
+
## React Server Components (RSC) in Next.js
|
|
32
|
+
|
|
33
|
+
### When to Use Server Components (Default)
|
|
34
|
+
- **Data Fetching**: When you need to fetch data from APIs or databases
|
|
35
|
+
```typescript
|
|
36
|
+
// ✅ Server Component - fetch directly
|
|
37
|
+
export default async function BlogPost({ params }: { params: { id: string } }) {
|
|
38
|
+
const post = await fetch(`https://api.example.com/posts/${params.id}`)
|
|
39
|
+
.then(r => r.json());
|
|
40
|
+
return <article>{post.content}</article>;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Static Content**: Components that don't need interactivity
|
|
45
|
+
```typescript
|
|
46
|
+
// ✅ Server Component - no hooks or events
|
|
47
|
+
export function Footer() {
|
|
48
|
+
return (
|
|
49
|
+
<footer>
|
|
50
|
+
<p>© 2024 Company Name</p>
|
|
51
|
+
<nav>
|
|
52
|
+
<a href="/about">About</a>
|
|
53
|
+
<a href="/contact">Contact</a>
|
|
54
|
+
</nav>
|
|
55
|
+
</footer>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- **Sensitive Operations**: Backend logic that shouldn't be exposed to client
|
|
61
|
+
```typescript
|
|
62
|
+
// ✅ Server Component - API key stays on server
|
|
63
|
+
async function fetchData() {
|
|
64
|
+
return await fetch('https://api.example.com/data', {
|
|
65
|
+
headers: { 'Authorization': `Bearer ${process.env.API_KEY}` }
|
|
66
|
+
}).then(r => r.json());
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### When to Use Client Components ('use client')
|
|
71
|
+
- **Interactivity**: Components with event handlers or React hooks
|
|
72
|
+
```typescript
|
|
73
|
+
'use client';
|
|
74
|
+
import { useState } from 'react';
|
|
75
|
+
|
|
76
|
+
export function Counter() {
|
|
77
|
+
const [count, setCount] = useState(0);
|
|
78
|
+
return <button onClick={() => setCount(count + 1)}>Count: {count}</button>;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **Browser APIs**: Components using window, document, localStorage, etc.
|
|
83
|
+
```typescript
|
|
84
|
+
'use client';
|
|
85
|
+
import { useEffect } from 'react';
|
|
86
|
+
|
|
87
|
+
export function Tracker() {
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
console.log('Page viewed:', window.location.href);
|
|
90
|
+
}, []);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **Third-Party Libraries**: Components using client-only libraries
|
|
96
|
+
```typescript
|
|
97
|
+
'use client';
|
|
98
|
+
import { useFormik } from 'formik'; // Client-side form library
|
|
99
|
+
|
|
100
|
+
export function SignupForm() {
|
|
101
|
+
const formik = useFormik({ /* ... */ });
|
|
102
|
+
return <form onSubmit={formik.handleSubmit}>...</form>;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Composition Patterns
|
|
107
|
+
- **Server Component as Parent**: Client components can be children
|
|
108
|
+
```typescript
|
|
109
|
+
// ✅ Server Component
|
|
110
|
+
export default async function Page() {
|
|
111
|
+
const data = await fetchData();
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div>
|
|
115
|
+
<h1>{data.title}</h1>
|
|
116
|
+
<InteractiveWidget data={data} /> {/* Client Component */}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- **Pass Serializable Props**: Only JSON-serializable data between boundaries
|
|
123
|
+
```typescript
|
|
124
|
+
// ✅ Serializable props (string, number, plain object)
|
|
125
|
+
<ClientComponent title="Hello" count={5} data={{ id: 1 }} />
|
|
126
|
+
|
|
127
|
+
// ❌ Non-serializable props (functions, class instances)
|
|
128
|
+
<ClientComponent onClick={() => {}} instance={new Date()} />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- **Workaround for Non-Serializable**: Use Server Actions or move logic to client
|
|
132
|
+
```typescript
|
|
133
|
+
// ✅ Server Action (async function from server)
|
|
134
|
+
async function updateData(formData: FormData) {
|
|
135
|
+
'use server';
|
|
136
|
+
// Server-side logic
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Pass action to client component
|
|
140
|
+
<ClientForm action={updateData} />
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- **Client Component as Wrapper**: Server components can be passed as children
|
|
144
|
+
```typescript
|
|
145
|
+
// ✅ Client Component wrapper
|
|
146
|
+
'use client';
|
|
147
|
+
export function AnimatedContainer({ children }: { children: React.ReactNode }) {
|
|
148
|
+
return <motion.div>{children}</motion.div>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Usage: Server Component as child
|
|
152
|
+
<AnimatedContainer>
|
|
153
|
+
<ServerRenderedContent /> {/* Still a Server Component */}
|
|
154
|
+
</AnimatedContainer>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Performance Considerations
|
|
158
|
+
- **Minimize Client Bundles**: Keep 'use client' boundary as low as possible
|
|
159
|
+
```typescript
|
|
160
|
+
// ❌ Entire page is client component (large bundle)
|
|
161
|
+
'use client';
|
|
162
|
+
export default function Page() {
|
|
163
|
+
const [state, setState] = useState();
|
|
164
|
+
return <div>...</div>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ✅ Only interactive part is client component
|
|
168
|
+
export default function Page() {
|
|
169
|
+
return (
|
|
170
|
+
<div>
|
|
171
|
+
<StaticHeader /> {/* Server Component */}
|
|
172
|
+
<InteractiveWidget /> {/* Client Component - small bundle */}
|
|
173
|
+
<StaticFooter /> {/* Server Component */}
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
- **Data Fetching Location**: Fetch in Server Component, not Client Component
|
|
180
|
+
```typescript
|
|
181
|
+
// ✅ Fetch in Server Component (faster, no loading state)
|
|
182
|
+
export default async function Page() {
|
|
183
|
+
const data = await fetchData();
|
|
184
|
+
return <ClientDisplay data={data} />;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ❌ Fetch in Client Component (slower, needs loading state)
|
|
188
|
+
'use client';
|
|
189
|
+
export default function Page() {
|
|
190
|
+
const [data, setData] = useState(null);
|
|
191
|
+
useEffect(() => { fetchData().then(setData); }, []);
|
|
192
|
+
if (!data) return <Spinner />;
|
|
193
|
+
return <div>{data}</div>;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Variables
|
|
199
|
+
- `{SCENARIO_X_FOR_SERVER}`: When to use Server Component
|
|
200
|
+
- `{SCENARIO_X_FOR_CLIENT}`: When to use Client Component
|
|
201
|
+
- `{HOW_TO_MIX_SERVER_AND_CLIENT}`: Composition strategies
|
|
202
|
+
- `{PASSING_PROPS_BETWEEN_TYPES}`: Serialization rules
|
|
203
|
+
- `{HANDLING_SERIALIZATION}`: Workarounds for non-serializable data
|
|
204
|
+
|
|
205
|
+
## Best Practices
|
|
206
|
+
1. Default to Server Components (add 'use client' only when needed)
|
|
207
|
+
2. Explain serialization boundaries (common source of bugs)
|
|
208
|
+
3. Show composition patterns (client wrapping server, server wrapping client)
|
|
209
|
+
4. Highlight performance benefits (smaller bundles, faster data fetching)
|
|
210
|
+
5. Provide migration guide (Pages Router → App Router)
|
|
211
|
+
6. Address common mistakes ('use client' on entire page)
|
|
212
|
+
7. Benefits: Optimal performance, secure API calls, smaller JS bundles
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# shadcn/ui Component Library Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Guide usage of shadcn/ui components in Next.js/React projects. From **same.new**.
|
|
5
|
+
|
|
6
|
+
## Installation Pattern
|
|
7
|
+
```bash
|
|
8
|
+
npx shadcn-ui@latest add button
|
|
9
|
+
npx shadcn-ui@latest add card dialog input
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Component Usage
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button } from "@/components/ui/button"
|
|
15
|
+
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"
|
|
16
|
+
|
|
17
|
+
export function ProductCard({ product }: Props) {
|
|
18
|
+
return (
|
|
19
|
+
<Card>
|
|
20
|
+
<CardHeader>
|
|
21
|
+
<CardTitle>{product.name}</CardTitle>
|
|
22
|
+
</CardHeader>
|
|
23
|
+
<CardContent>
|
|
24
|
+
<p>{product.description}</p>
|
|
25
|
+
<Button>Add to Cart</Button>
|
|
26
|
+
</CardContent>
|
|
27
|
+
</Card>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Customization
|
|
33
|
+
```tsx
|
|
34
|
+
// ✅ Extend with custom variants using cva
|
|
35
|
+
import { cva } from "class-variance-authority"
|
|
36
|
+
|
|
37
|
+
const buttonVariants = cva("base-classes", {
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
default: "bg-primary",
|
|
41
|
+
outline: "border border-input",
|
|
42
|
+
custom: "bg-gradient-to-r from-purple-500 to-pink-500"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Best Practices
|
|
49
|
+
- Components are copied to your repo (not npm dependencies)
|
|
50
|
+
- Customize in `components/ui/` as needed
|
|
51
|
+
- Use Radix UI primitives for accessibility
|
|
52
|
+
- Combine with Tailwind for styling
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Tailwind CSS Patterns
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Enforce Tailwind CSS best practices and utility patterns. From **same.new** and **Loveable**.
|
|
5
|
+
|
|
6
|
+
## Key Patterns
|
|
7
|
+
|
|
8
|
+
### Utility-First Approach
|
|
9
|
+
```tsx
|
|
10
|
+
// ✅ Use utility classes
|
|
11
|
+
<button className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
|
|
12
|
+
Click me
|
|
13
|
+
</button>
|
|
14
|
+
|
|
15
|
+
// ❌ Avoid custom CSS
|
|
16
|
+
<button className="custom-button">Click me</button>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Responsive Design
|
|
20
|
+
```tsx
|
|
21
|
+
// ✅ Mobile-first responsive utilities
|
|
22
|
+
<div className="w-full md:w-1/2 lg:w-1/3 xl:w-1/4">
|
|
23
|
+
Responsive width
|
|
24
|
+
</div>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Dark Mode
|
|
28
|
+
```tsx
|
|
29
|
+
// ✅ Dark mode variants
|
|
30
|
+
<div className="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
|
|
31
|
+
Content
|
|
32
|
+
</div>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Component Extraction
|
|
36
|
+
```tsx
|
|
37
|
+
// When utilities get too long (>5 classes), extract to component
|
|
38
|
+
// ✅ Extract reusable pattern
|
|
39
|
+
function Card({ children }: { children: React.ReactNode }) {
|
|
40
|
+
return (
|
|
41
|
+
<div className="rounded-lg shadow-md p-6 bg-white dark:bg-gray-800">
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Best Practices
|
|
49
|
+
- Use arbitrary values sparingly: `w-[137px]` (prefer standard scale)
|
|
50
|
+
- Group related utilities: layout, spacing, typography, colors
|
|
51
|
+
- Use @apply only for component styles (avoid in utility classes)
|
|
52
|
+
- Configure theme in tailwind.config.js for brand colors
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# $(basename "$file" .md | tr '-' ' ' | sed 's/\b\(.\)/\u\1/g') Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
[Pattern description from integration document]
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
```markdown
|
|
8
|
+
[Key structure and variables]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
[Concrete examples from v0, Claude, ChatGPT, Cline, etc.]
|
|
13
|
+
|
|
14
|
+
## Best Practices
|
|
15
|
+
1. [Guideline 1]
|
|
16
|
+
2. [Guideline 2]
|
|
17
|
+
3. Benefits: [Key advantages]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# $(basename "$file" .md | tr '-' ' ' | sed 's/\b\(.\)/\u\1/g') Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
[Pattern description from integration document]
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
```markdown
|
|
8
|
+
[Key structure and variables]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
[Concrete examples from v0, Claude, ChatGPT, Cline, etc.]
|
|
13
|
+
|
|
14
|
+
## Best Practices
|
|
15
|
+
1. [Guideline 1]
|
|
16
|
+
2. [Guideline 2]
|
|
17
|
+
3. Benefits: [Key advantages]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# $(basename "$file" .md | tr '-' ' ' | sed 's/\b\(.\)/\u\1/g') Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
[Pattern description from integration document]
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
```markdown
|
|
8
|
+
[Key structure and variables]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
[Concrete examples from v0, Claude, ChatGPT, Cline, etc.]
|
|
13
|
+
|
|
14
|
+
## Best Practices
|
|
15
|
+
1. [Guideline 1]
|
|
16
|
+
2. [Guideline 2]
|
|
17
|
+
3. Benefits: [Key advantages]
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Heading Hierarchy Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Use Markdown headings to create scannable, nested instruction sections. From **v0**, **Claude**, and **Cline** patterns.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
# {TOP_LEVEL_ROLE}
|
|
10
|
+
|
|
11
|
+
## {SECTION_1}
|
|
12
|
+
{Content}
|
|
13
|
+
|
|
14
|
+
### {SUBSECTION_1_1}
|
|
15
|
+
{Content}
|
|
16
|
+
|
|
17
|
+
### {SUBSECTION_1_2}
|
|
18
|
+
{Content}
|
|
19
|
+
|
|
20
|
+
## {SECTION_2}
|
|
21
|
+
{Content}
|
|
22
|
+
|
|
23
|
+
### {SUBSECTION_2_1}
|
|
24
|
+
{Content}
|
|
25
|
+
|
|
26
|
+
## {SECTION_3}
|
|
27
|
+
{Content}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### v0 (Code Generation Instructions)
|
|
33
|
+
```markdown
|
|
34
|
+
# v0 Code Generation Instructions
|
|
35
|
+
|
|
36
|
+
## Code Style
|
|
37
|
+
Write modern, idiomatic TypeScript with proper typing.
|
|
38
|
+
|
|
39
|
+
### React Patterns
|
|
40
|
+
- Use functional components with hooks
|
|
41
|
+
- Prefer composition over inheritance
|
|
42
|
+
- Extract reusable logic into custom hooks
|
|
43
|
+
|
|
44
|
+
### Naming Conventions
|
|
45
|
+
- Components: PascalCase (e.g., UserProfile)
|
|
46
|
+
- Files: kebab-case (e.g., user-profile.tsx)
|
|
47
|
+
- Functions: camelCase (e.g., handleSubmit)
|
|
48
|
+
|
|
49
|
+
## Framework Requirements
|
|
50
|
+
|
|
51
|
+
### Next.js App Router
|
|
52
|
+
- Use Server Components by default
|
|
53
|
+
- Add 'use client' only when necessary
|
|
54
|
+
- Leverage React Server Components for data fetching
|
|
55
|
+
|
|
56
|
+
### Routing
|
|
57
|
+
- File-based routing in app/ directory
|
|
58
|
+
- Use route groups (folders) for organization
|
|
59
|
+
- Dynamic routes with [param] syntax
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Cline (Tool Usage Guidelines)
|
|
63
|
+
```markdown
|
|
64
|
+
# Cline Tool Usage Guidelines
|
|
65
|
+
|
|
66
|
+
## File Operations
|
|
67
|
+
|
|
68
|
+
### Reading Files
|
|
69
|
+
- Use read_file for examining code
|
|
70
|
+
- Read large sections to minimize API calls
|
|
71
|
+
- Parallelize reads when possible
|
|
72
|
+
|
|
73
|
+
### Writing Files
|
|
74
|
+
- Show preview before making changes
|
|
75
|
+
- Use replace_string_in_file for edits
|
|
76
|
+
- Include 3-5 lines of context for accuracy
|
|
77
|
+
|
|
78
|
+
## Terminal Commands
|
|
79
|
+
|
|
80
|
+
### Command Execution
|
|
81
|
+
- Run one command at a time (no parallel terminal calls)
|
|
82
|
+
- Explain purpose of non-trivial commands
|
|
83
|
+
- Use absolute paths to avoid navigation issues
|
|
84
|
+
|
|
85
|
+
### Output Management
|
|
86
|
+
- Filter output with grep/awk for large results
|
|
87
|
+
- Use --no-pager for git commands
|
|
88
|
+
- Disable paging to avoid truncation
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Variables
|
|
92
|
+
- `{TOP_LEVEL_ROLE}`: Main purpose (H1 - appears once)
|
|
93
|
+
- `{SECTION_X}`: Major category (H2 - primary divisions)
|
|
94
|
+
- `{SUBSECTION_X_Y}`: Sub-category (H3 - detailed breakdowns)
|
|
95
|
+
|
|
96
|
+
## Best Practices
|
|
97
|
+
1. Use only one H1 (main title)
|
|
98
|
+
2. H2 for major sections (5-10 max)
|
|
99
|
+
3. H3 for subsections within H2
|
|
100
|
+
4. Avoid going deeper than H3 (use lists instead)
|
|
101
|
+
5. Keep headings concise (3-7 words)
|
|
102
|
+
6. Use parallel structure (all H2s follow same pattern)
|
|
103
|
+
7. Benefits: Easy to navigate, works in Markdown viewers, hierarchical structure
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Sequential Workflows Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Define step-by-step processes with clear ordering. From **Manus** agent loop pattern.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
## {WORKFLOW_NAME}
|
|
10
|
+
|
|
11
|
+
Follow these steps in order:
|
|
12
|
+
|
|
13
|
+
1. **{STEP_1_NAME}**: {STEP_1_DESCRIPTION}
|
|
14
|
+
- {SUBSTEP_1_1}
|
|
15
|
+
- {SUBSTEP_1_2}
|
|
16
|
+
|
|
17
|
+
2. **{STEP_2_NAME}**: {STEP_2_DESCRIPTION}
|
|
18
|
+
- {SUBSTEP_2_1}
|
|
19
|
+
- {SUBSTEP_2_2}
|
|
20
|
+
|
|
21
|
+
3. **{STEP_3_NAME}**: {STEP_3_DESCRIPTION}
|
|
22
|
+
- {SUBSTEP_3_1}
|
|
23
|
+
- {SUBSTEP_3_2}
|
|
24
|
+
|
|
25
|
+
Repeat until {COMPLETION_CONDITION}.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Manus (Agent Execution Loop)
|
|
31
|
+
```markdown
|
|
32
|
+
## Agent Execution Loop
|
|
33
|
+
|
|
34
|
+
Follow these steps in order:
|
|
35
|
+
|
|
36
|
+
1. **Analyze Request**: Understand user intent and break down into subtasks
|
|
37
|
+
- Read the user's message carefully
|
|
38
|
+
- Identify required information and tools
|
|
39
|
+
- Determine if clarification is needed
|
|
40
|
+
|
|
41
|
+
2. **Plan Actions**: Decide which tool(s) to use
|
|
42
|
+
- Select one tool per iteration (no parallel tool calls)
|
|
43
|
+
- Gather necessary parameters
|
|
44
|
+
- Anticipate potential errors
|
|
45
|
+
|
|
46
|
+
3. **Execute Tool**: Call the selected tool and process results
|
|
47
|
+
- Invoke tool with validated parameters
|
|
48
|
+
- Parse output for relevant information
|
|
49
|
+
- Update internal state with findings
|
|
50
|
+
|
|
51
|
+
4. **Reflect**: Evaluate progress and decide next action
|
|
52
|
+
- Compare current state to goal
|
|
53
|
+
- Identify remaining subtasks
|
|
54
|
+
- Determine if another iteration is needed
|
|
55
|
+
|
|
56
|
+
Repeat until all subtasks are completed or user goal is achieved.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### v0 (Code Generation Workflow)
|
|
60
|
+
```markdown
|
|
61
|
+
## Code Generation Workflow
|
|
62
|
+
|
|
63
|
+
Follow these steps in order:
|
|
64
|
+
|
|
65
|
+
1. **Understand Requirements**: Parse user request for technical specs
|
|
66
|
+
- Identify framework (React, Vue, etc.)
|
|
67
|
+
- Determine styling approach (Tailwind, CSS modules)
|
|
68
|
+
- Note any specific libraries requested
|
|
69
|
+
|
|
70
|
+
2. **Plan Structure**: Design component hierarchy
|
|
71
|
+
- Break UI into logical components
|
|
72
|
+
- Identify shared vs unique elements
|
|
73
|
+
- Map out data flow
|
|
74
|
+
|
|
75
|
+
3. **Generate Code**: Write implementation
|
|
76
|
+
- Start with outer container/layout
|
|
77
|
+
- Add child components progressively
|
|
78
|
+
- Include proper TypeScript types
|
|
79
|
+
|
|
80
|
+
4. **Verify Quality**: Check for common issues
|
|
81
|
+
- Ensure accessibility (ARIA labels, semantic HTML)
|
|
82
|
+
- Validate responsive design breakpoints
|
|
83
|
+
- Confirm proper error handling
|
|
84
|
+
|
|
85
|
+
Repeat for each component in the hierarchy.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Variables
|
|
89
|
+
- `{WORKFLOW_NAME}`: Process title (e.g., "Request Processing", "Error Recovery")
|
|
90
|
+
- `{STEP_X_NAME}`: Phase name (e.g., "Analyze", "Execute", "Verify")
|
|
91
|
+
- `{STEP_X_DESCRIPTION}`: What happens in this phase
|
|
92
|
+
- `{SUBSTEP_X_Y}`: Granular actions within phase
|
|
93
|
+
- `{COMPLETION_CONDITION}`: When to stop iterating
|
|
94
|
+
|
|
95
|
+
## Best Practices
|
|
96
|
+
1. Number steps explicitly (1, 2, 3...) for clarity
|
|
97
|
+
2. Use bold for step names to make them scannable
|
|
98
|
+
3. Limit to 5-7 main steps (sub-steps for detail)
|
|
99
|
+
4. Include decision points ("If X, then Y")
|
|
100
|
+
5. State iteration/termination conditions clearly
|
|
101
|
+
6. Use present tense imperative ("Analyze", not "You should analyze")
|
|
102
|
+
7. Benefits: Reproducible process, clear sequencing, easy to debug
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# XML Rule Groups Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Structure instructions using XML-like tags for hierarchical organization. From **same.new** pattern.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```xml
|
|
9
|
+
<rules>
|
|
10
|
+
<category name="{CATEGORY_NAME}">
|
|
11
|
+
<rule>{RULE_1}</rule>
|
|
12
|
+
<rule>{RULE_2}</rule>
|
|
13
|
+
<rule>{RULE_3}</rule>
|
|
14
|
+
</category>
|
|
15
|
+
|
|
16
|
+
<category name="{CATEGORY_NAME_2}">
|
|
17
|
+
<rule>{RULE_4}</rule>
|
|
18
|
+
<rule>{RULE_5}</rule>
|
|
19
|
+
</category>
|
|
20
|
+
</rules>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### same.new (Code Generation Rules)
|
|
26
|
+
```xml
|
|
27
|
+
<rules>
|
|
28
|
+
<category name="Code Style">
|
|
29
|
+
<rule>Use functional components with hooks, not class components</rule>
|
|
30
|
+
<rule>Prefer const over let, never use var</rule>
|
|
31
|
+
<rule>Use descriptive variable names (e.g., userData not ud)</rule>
|
|
32
|
+
</category>
|
|
33
|
+
|
|
34
|
+
<category name="File Operations">
|
|
35
|
+
<rule>Always show a preview before writing files</rule>
|
|
36
|
+
<rule>Ask for confirmation before deleting or overwriting</rule>
|
|
37
|
+
<rule>Use relative paths for imports within the project</rule>
|
|
38
|
+
</category>
|
|
39
|
+
|
|
40
|
+
<category name="Error Handling">
|
|
41
|
+
<rule>Wrap async operations in try-catch blocks</rule>
|
|
42
|
+
<rule>Return user-friendly error messages, not stack traces</rule>
|
|
43
|
+
<rule>Log errors for debugging but don't expose internals</rule>
|
|
44
|
+
</category>
|
|
45
|
+
</rules>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Variables
|
|
49
|
+
- `{CATEGORY_NAME}`: Logical grouping (e.g., "Code Style", "Security", "Performance")
|
|
50
|
+
- `{RULE_X}`: Specific instruction within category
|
|
51
|
+
|
|
52
|
+
## Best Practices
|
|
53
|
+
1. Keep categories focused (5-10 rules max per category)
|
|
54
|
+
2. Use parallel structure for rules within a category
|
|
55
|
+
3. Order categories by importance (most critical first)
|
|
56
|
+
4. Use nested tags for sub-categories if needed:
|
|
57
|
+
```xml
|
|
58
|
+
<category name="React">
|
|
59
|
+
<subcategory name="Hooks">
|
|
60
|
+
<rule>Always declare hooks at top level</rule>
|
|
61
|
+
</subcategory>
|
|
62
|
+
</category>
|
|
63
|
+
```
|
|
64
|
+
5. Benefits: Easy to scan, clear hierarchy, simple to add/remove sections
|