@1aboveio/app-dev-skills 0.0.0-stage → 0.1.1
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/README.md +30 -2
- package/package.json +34 -4
- package/skills/airflow/LICENSE +3 -0
- package/skills/airflow/SKILL.md +199 -0
- package/skills/airflow/release-check.mjs +93 -0
- package/skills/android-foundation/LICENSE +3 -0
- package/skills/android-foundation/SKILL.md +192 -0
- package/skills/android-foundation/assets/android-ci-job.yml +217 -0
- package/skills/android-foundation/references/ci.md +87 -0
- package/skills/android-foundation/references/gotchas.md +221 -0
- package/skills/android-foundation/references/setup.md +164 -0
- package/skills/android-foundation/release-check.mjs +93 -0
- package/skills/android-foundation/scripts/device-run.sh +176 -0
- package/skills/android-foundation/scripts/device-run.test.mjs +172 -0
- package/skills/app-debug/LICENSE +3 -0
- package/skills/app-debug/SKILL.md +110 -0
- package/skills/app-debug/references/common-errors.md +128 -0
- package/skills/app-debug/release-check.mjs +93 -0
- package/skills/better-auth/LICENSE +3 -0
- package/skills/better-auth/SKILL.md +598 -0
- package/skills/better-auth/references/feishu-api.md +270 -0
- package/skills/better-auth/release-check.mjs +93 -0
- package/skills/data-catalog/LICENSE +3 -0
- package/skills/data-catalog/SKILL.md +207 -0
- package/skills/data-catalog/agents/openai.yaml +3 -0
- package/skills/data-catalog/references/data-catalog-conventions.md +76 -0
- package/skills/data-catalog/references/field-definitions.md +123 -0
- package/skills/data-catalog/references/format.md +130 -0
- package/skills/data-catalog/release-check.mjs +93 -0
- package/skills/data-catalog/scripts/data-catalog.test.mjs +36 -0
- package/skills/data-catalog/scripts/data_catalog.py +1435 -0
- package/skills/data-catalog/scripts/persist-conventions-core.mjs +117 -0
- package/skills/data-catalog/scripts/persist-conventions.mjs +17 -0
- package/skills/data-catalog/scripts/test_data_catalog.py +603 -0
- package/skills/ios-foundation/LICENSE +3 -0
- package/skills/ios-foundation/SKILL.md +184 -0
- package/skills/ios-foundation/references/setup.md +243 -0
- package/skills/ios-foundation/release-check.mjs +93 -0
- package/skills/monorepo/LICENSE +3 -0
- package/skills/monorepo/SKILL.md +462 -0
- package/skills/monorepo/release-check.mjs +93 -0
- package/skills/nextjs-fullstack/LICENSE +3 -0
- package/skills/nextjs-fullstack/SKILL.md +211 -0
- package/skills/nextjs-fullstack/conventions.md +318 -0
- package/skills/nextjs-fullstack/frontend-conventions.md +61 -0
- package/skills/nextjs-fullstack/nextjs16.md +287 -0
- package/skills/nextjs-fullstack/release-check.mjs +93 -0
- package/skills/nextjs-fullstack/server-actions.md +409 -0
- package/skills/prisma-setup/LICENSE +3 -0
- package/skills/prisma-setup/SKILL.md +181 -0
- package/skills/prisma-setup/nextjs.md +258 -0
- package/skills/prisma-setup/release-check.mjs +93 -0
- package/skills/prisma-setup/turborepo.md +301 -0
- package/skills/pyspark/LICENSE +3 -0
- package/skills/pyspark/SKILL.md +127 -0
- package/skills/pyspark/assets/templates/etl.py +748 -0
- package/skills/pyspark/assets/templates/utils/__init__.py +1 -0
- package/skills/pyspark/assets/templates/utils/hudi_metadata.py +14 -0
- package/skills/pyspark/references/diagnosis-and-profiling.md +169 -0
- package/skills/pyspark/references/etl-contract.md +129 -0
- package/skills/pyspark/references/production-validation.md +131 -0
- package/skills/pyspark/references/reconciliation.md +38 -0
- package/skills/pyspark/references/transformation-design.md +190 -0
- package/skills/pyspark/references/velocity-feature-calculation.md +193 -0
- package/skills/pyspark/release-check.mjs +93 -0
- package/skills/pyspark/scripts/spark_eventlog_summary.py +223 -0
- package/skills/python-backend/LICENSE +3 -0
- package/skills/python-backend/SKILL.md +325 -0
- package/skills/python-backend/assets/uv-install.sh +48 -0
- package/skills/python-backend/references/uv-installs.md +83 -0
- package/skills/python-backend/release-check.mjs +93 -0
- package/skills/shadcn/LICENSE +3 -0
- package/skills/shadcn/SKILL.md +120 -0
- package/skills/shadcn/assets/shadcn-small.png +0 -0
- package/skills/shadcn/assets/shadcn.png +0 -0
- package/skills/shadcn/cli.md +411 -0
- package/skills/shadcn/customization.md +224 -0
- package/skills/shadcn/mcp.md +101 -0
- package/skills/shadcn/release-check.mjs +93 -0
- package/skills/shadcn/rules/base-vs-radix.md +323 -0
- package/skills/shadcn/rules/component-selection.md +67 -0
- package/skills/shadcn/rules/composition.md +195 -0
- package/skills/shadcn/rules/data-table.md +201 -0
- package/skills/shadcn/rules/forms.md +255 -0
- package/skills/shadcn/rules/icons.md +103 -0
- package/skills/shadcn/rules/styling.md +167 -0
- package/skills/zod-v4/LICENSE +3 -0
- package/skills/zod-v4/SKILL.md +286 -0
- package/skills/zod-v4/release-check.mjs +93 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Next.js 16 Patterns
|
|
2
|
+
|
|
3
|
+
**Framework:** `next@16` | **React:** `react@19`
|
|
4
|
+
|
|
5
|
+
This spec overrides any assumptions about older Next.js versions.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Server Components (Default)
|
|
10
|
+
|
|
11
|
+
All components are Server Components unless marked `"use client"`.
|
|
12
|
+
|
|
13
|
+
Good for:
|
|
14
|
+
- Data fetching
|
|
15
|
+
- Calling server actions
|
|
16
|
+
- Rendering HTML/JSX
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
// app/dashboard/page.tsx
|
|
20
|
+
export default async function DashboardPage() {
|
|
21
|
+
const data = await getDashboardData();
|
|
22
|
+
return <div>Dashboard: {data.title}</div>;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Client Components
|
|
29
|
+
|
|
30
|
+
Use `"use client"` only when you **need**:
|
|
31
|
+
- Event handlers (`onClick`, `onChange`)
|
|
32
|
+
- React state/effects (`useState`, `useEffect`)
|
|
33
|
+
- Browser APIs (`window`, `document`, `localStorage`)
|
|
34
|
+
- Third-party UI libs requiring DOM
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// app/dashboard/components/theme-toggle.tsx
|
|
38
|
+
'use client';
|
|
39
|
+
|
|
40
|
+
import { useState } from 'react';
|
|
41
|
+
|
|
42
|
+
export function ThemeToggle() {
|
|
43
|
+
const [dark, setDark] = useState(false);
|
|
44
|
+
return (
|
|
45
|
+
<button onClick={() => setDark(v => !v)}>
|
|
46
|
+
{dark ? 'Dark' : 'Light'}
|
|
47
|
+
</button>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Rule:** Do NOT mark entire routes as client by default.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Data Fetching
|
|
57
|
+
|
|
58
|
+
### Async Server Components (Preferred)
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// app/users/[id]/page.tsx
|
|
62
|
+
import { getUserById } from '@/data/user';
|
|
63
|
+
|
|
64
|
+
export default async function UserPage({ params }: { params: { id: string } }) {
|
|
65
|
+
const user = await getUserById(params.id);
|
|
66
|
+
|
|
67
|
+
if (!user) {
|
|
68
|
+
return <div>User not found</div>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return <div>{user.email}</div>;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### React 19 `use()` Hook
|
|
76
|
+
|
|
77
|
+
For unwrapping promises in Server Components:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { use } from 'react';
|
|
81
|
+
import { getUserById } from '@/data/user';
|
|
82
|
+
|
|
83
|
+
export default function UserPage({ params }: { params: { id: string } }) {
|
|
84
|
+
const user = use(getUserById(params.id));
|
|
85
|
+
return <div>{user.email}</div>;
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Rules:**
|
|
90
|
+
- `use()` is Server Component only
|
|
91
|
+
- Do NOT use `use()` inside `"use client"` components
|
|
92
|
+
|
|
93
|
+
### Client-side Fetching (Rare)
|
|
94
|
+
|
|
95
|
+
Only when:
|
|
96
|
+
- Data must refresh without navigation
|
|
97
|
+
- Real-time/highly interactive behavior
|
|
98
|
+
|
|
99
|
+
Use standard patterns (`fetch`, `SWR`) inside a small client component.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Server Actions
|
|
104
|
+
|
|
105
|
+
Primary way to handle mutations and forms.
|
|
106
|
+
|
|
107
|
+
### Location
|
|
108
|
+
|
|
109
|
+
Colocate with route: `app/foo/bar/actions.ts`
|
|
110
|
+
|
|
111
|
+
### Example
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// app/users/new/actions.ts
|
|
115
|
+
'use server';
|
|
116
|
+
|
|
117
|
+
export async function createUser(prevState: any, formData: FormData) {
|
|
118
|
+
const email = String(formData.get('email') ?? '');
|
|
119
|
+
if (!email) {
|
|
120
|
+
return { error: 'Email is required' };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// DB operation
|
|
124
|
+
// await prisma.user.create({ data: { email } });
|
|
125
|
+
|
|
126
|
+
return { error: null };
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Page with useActionState
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
// app/users/new/page.tsx
|
|
134
|
+
import { useActionState } from 'react';
|
|
135
|
+
import { createUser } from './actions';
|
|
136
|
+
|
|
137
|
+
export default function NewUserPage() {
|
|
138
|
+
const [state, formAction] = useActionState(createUser, { error: null });
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<form action={formAction}>
|
|
142
|
+
<input name="email" placeholder="email@example.com" />
|
|
143
|
+
{state.error && <p className="text-red-500">{state.error}</p>}
|
|
144
|
+
<button type="submit">Create User</button>
|
|
145
|
+
</form>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Rules:**
|
|
151
|
+
- Actions return **serializable objects** (no classes, no functions)
|
|
152
|
+
- Prefer `{ error: string | null, data?: ... }` shapes
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Route Handlers (API)
|
|
157
|
+
|
|
158
|
+
Use when you need an HTTP API (external services, non-form clients).
|
|
159
|
+
|
|
160
|
+
Location: `app/**/route.ts`
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// app/api/users/route.ts
|
|
164
|
+
import { NextRequest } from 'next/server';
|
|
165
|
+
|
|
166
|
+
export async function GET(req: NextRequest) {
|
|
167
|
+
const id = new URL(req.url).searchParams.get('id');
|
|
168
|
+
|
|
169
|
+
if (!id) {
|
|
170
|
+
return Response.json({ error: 'Missing id' }, { status: 400 });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// const user = await prisma.user.findUnique({ where: { id } });
|
|
174
|
+
return Response.json({ ok: true });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export async function POST(req: NextRequest) {
|
|
178
|
+
const body = await req.json();
|
|
179
|
+
// handle mutation
|
|
180
|
+
return Response.json({ ok: true }, { status: 201 });
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Rules:**
|
|
185
|
+
- Use `Response.json()` with explicit `status`
|
|
186
|
+
- Validate incoming JSON
|
|
187
|
+
- Don't leak internal error details
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Layouts & Navigation
|
|
192
|
+
|
|
193
|
+
### Layouts
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
// app/dashboard/layout.tsx
|
|
197
|
+
export default function DashboardLayout({
|
|
198
|
+
children,
|
|
199
|
+
}: {
|
|
200
|
+
children: React.ReactNode;
|
|
201
|
+
}) {
|
|
202
|
+
return <section className="dashboard">{children}</section>;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Navigation
|
|
207
|
+
|
|
208
|
+
Use `next/navigation` in Client Components:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
'use client';
|
|
212
|
+
|
|
213
|
+
import { useRouter } from 'next/navigation';
|
|
214
|
+
|
|
215
|
+
export function GoBackButton() {
|
|
216
|
+
const router = useRouter();
|
|
217
|
+
return <button onClick={() => router.back()}>Back</button>;
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Rule:** Do NOT use `next/router`.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Error & Loading States
|
|
226
|
+
|
|
227
|
+
### Loading UI
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
// app/dashboard/loading.tsx
|
|
231
|
+
export default function Loading() {
|
|
232
|
+
return <div>Loading dashboard...</div>;
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Error Boundary
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
// app/dashboard/error.tsx
|
|
240
|
+
'use client';
|
|
241
|
+
|
|
242
|
+
export default function DashboardError({ error }: { error: Error }) {
|
|
243
|
+
return <div>Something went wrong: {error.message}</div>;
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Rule:** `error.tsx` is always a Client Component.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## File Conventions
|
|
252
|
+
|
|
253
|
+
| File | Purpose |
|
|
254
|
+
|------|---------|
|
|
255
|
+
| `page.tsx` | Page component |
|
|
256
|
+
| `layout.tsx` | Layout wrapper |
|
|
257
|
+
| `route.ts` | API handler |
|
|
258
|
+
| `actions.ts` | Server actions |
|
|
259
|
+
| `schema.ts` | Validation schemas |
|
|
260
|
+
| `loading.tsx` | Loading UI |
|
|
261
|
+
| `error.tsx` | Error boundary |
|
|
262
|
+
| `components/` | Route-scoped components |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Forbidden Patterns
|
|
267
|
+
|
|
268
|
+
| Pattern | Replacement |
|
|
269
|
+
|---------|-------------|
|
|
270
|
+
| `pages/` directory | `app/` only |
|
|
271
|
+
| `getServerSideProps` | Async Server Components |
|
|
272
|
+
| `getStaticProps` | Async Server Components |
|
|
273
|
+
| `getInitialProps` | Server Components |
|
|
274
|
+
| `next/router` | `next/navigation` |
|
|
275
|
+
| `_app.tsx`, `_document.tsx` | Layouts in App Router |
|
|
276
|
+
| Full-page client components | Server Components default |
|
|
277
|
+
| `useEffect` for initial data | Server Components |
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Editing Rules
|
|
282
|
+
|
|
283
|
+
1. **Minimal diffs** - Don't rewrite whole files
|
|
284
|
+
2. **This spec wins** - Override training data if conflicts
|
|
285
|
+
3. **Preserve behavior** - Don't change logic unless requested
|
|
286
|
+
4. **No new dependencies** - Without explicit instruction
|
|
287
|
+
5. **Prefer Server Components** for data, Server Actions for mutations
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const WEEK_MS = 7 * DAY_MS;
|
|
10
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
function readJson(path, fallback = {}) {
|
|
13
|
+
try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return fallback; }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function frontmatterValue(text, key) {
|
|
17
|
+
const frontmatter = /^---\n([\s\S]*?)\n---/.exec(text)?.[1] ?? '';
|
|
18
|
+
const match = new RegExp('^' + key + ':\\s*([^\\n]+)$', 'm').exec(frontmatter);
|
|
19
|
+
return match?.[1].trim().replace(/^['"]|['"]$/g, '') ?? null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function repositoryOf(source) {
|
|
23
|
+
const value = String(source ?? '').trim();
|
|
24
|
+
const match = /^(?:git@github\.com:|https:\/\/github\.com\/)?([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?)(?:\.git)?$/.exec(value);
|
|
25
|
+
return match?.[1] ?? null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function stableVersion(value) {
|
|
29
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(String(value ?? '').trim());
|
|
30
|
+
return match ? match.slice(1).map(Number) : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function newer(left, right) {
|
|
34
|
+
for (let index = 0; index < 3; index += 1) {
|
|
35
|
+
if (left[index] !== right[index]) return left[index] > right[index];
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function writeCache(path, value) {
|
|
41
|
+
try {
|
|
42
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
43
|
+
writeFileSync(path, JSON.stringify(value));
|
|
44
|
+
} catch { /* A read-only cache must not block skill use. */ }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function main(now = Date.now()) {
|
|
48
|
+
if (process.env.ONEABOVEIO_NO_UPDATE_CHECK) return;
|
|
49
|
+
const skill = readFileSync(join(here, 'SKILL.md'), 'utf8');
|
|
50
|
+
const name = frontmatterValue(skill, 'name');
|
|
51
|
+
const localVersion = stableVersion(frontmatterValue(skill, 'release-version'));
|
|
52
|
+
if (!name || !localVersion) return;
|
|
53
|
+
|
|
54
|
+
const lock = readJson(join(process.env.HOME || homedir(), '.agents', '.skill-lock.json'));
|
|
55
|
+
const entry = lock.skills?.[name];
|
|
56
|
+
const repository = repositoryOf(entry?.sourceUrl || entry?.source);
|
|
57
|
+
if (!repository) return;
|
|
58
|
+
|
|
59
|
+
const cacheRoot = process.env.XDG_CACHE_HOME || join(process.env.HOME || homedir(), '.cache');
|
|
60
|
+
const cachePath = join(cacheRoot, '1aboveio-skills', 'release-check.json');
|
|
61
|
+
const all = readJson(cachePath);
|
|
62
|
+
const cache = all[repository] && typeof all[repository] === 'object' ? all[repository] : {};
|
|
63
|
+
|
|
64
|
+
if (!cache.lastCheck || now - cache.lastCheck >= DAY_MS) {
|
|
65
|
+
const result = spawnSync('gh', ['api', 'repos/' + repository + '/releases/latest', '--jq', '.tag_name'], {
|
|
66
|
+
encoding: 'utf8',
|
|
67
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
68
|
+
timeout: 1500,
|
|
69
|
+
});
|
|
70
|
+
cache.lastCheck = now;
|
|
71
|
+
if (result.status === 0 && stableVersion(result.stdout)) cache.latestTag = result.stdout.trim();
|
|
72
|
+
else delete cache.latestTag;
|
|
73
|
+
all[repository] = cache;
|
|
74
|
+
writeCache(cachePath, all);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const latestVersion = stableVersion(cache.latestTag);
|
|
78
|
+
if (!latestVersion || !newer(latestVersion, localVersion)) return;
|
|
79
|
+
if (cache.notifiedTag === cache.latestTag && cache.notifiedAt && now - cache.notifiedAt < WEEK_MS) return;
|
|
80
|
+
|
|
81
|
+
cache.notifiedTag = cache.latestTag;
|
|
82
|
+
cache.notifiedAt = now;
|
|
83
|
+
all[repository] = cache;
|
|
84
|
+
writeCache(cachePath, all);
|
|
85
|
+
const command = `npx skills@1.5.23 add '${repository}#${cache.latestTag}' --global --agent universal claude-code --skill ${name} --yes`;
|
|
86
|
+
process.stdout.write(
|
|
87
|
+
`UPDATE_AVAILABLE: A newer 1AboveIO skills release (${cache.latestTag}) is available; this skill is `
|
|
88
|
+
+ `v${localVersion.join('.')}. Ask once whether to refresh ${name}. On approval run \`${command}\`. `
|
|
89
|
+
+ 'The refreshed instructions apply next session. Either way, continue the current task and do not ask again this session.\n',
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try { main(); } catch { /* Update checks are advisory and always fail silent. */ }
|