cc-codeconductor 1.4.2 → 1.5.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/README.md +37 -12
- package/dist/index.js +291 -109
- package/docs/generated/cli.md +8 -0
- package/package.json +1 -1
- package/presets/agy/README.md +1 -1
- package/presets/agy/hooks.json +1 -1
- package/presets/agy/scripts/invoke-hook.cjs +20 -5
- package/presets/agy/settings.json +1 -1
- package/presets/agy/skills/api-versioning/SKILL.md +394 -0
- package/presets/agy/skills/astro/SKILL.md +318 -0
- package/presets/agy/skills/auth-token-inspector/SKILL.md +30 -0
- package/presets/agy/skills/cc-pagespeed/SKILL.md +2 -3
- package/presets/agy/skills/code-review/SKILL.md +207 -0
- package/presets/agy/skills/django-orm/SKILL.md +460 -0
- package/presets/agy/skills/django-uv/SKILL.md +405 -0
- package/presets/agy/skills/drizzle-schema-architect/SKILL.md +50 -0
- package/presets/agy/skills/fastapi-pydantic-strict/SKILL.md +43 -0
- package/presets/agy/skills/jpa-nplusone-detector/SKILL.md +45 -0
- package/presets/agy/skills/jpa-postgres/SKILL.md +623 -0
- package/presets/agy/skills/livewire-alpine-bridge/SKILL.md +35 -0
- package/presets/agy/skills/nextjs-typescript/SKILL.md +390 -0
- package/presets/agy/skills/python/SKILL.md +611 -0
- package/presets/agy/skills/seo-analytics-injector/SKILL.md +43 -0
- package/presets/agy/skills/spring-auth-auditor/SKILL.md +29 -0
- package/presets/agy/skills/spring-boot-feature/SKILL.md +563 -0
- package/presets/agy/skills/spring-boot-testing-strategy/SKILL.md +475 -0
- package/presets/agy/skills/tailwind-responsive-auditor/SKILL.md +29 -0
- package/presets/agy/skills/tdd-mutation-tester/SKILL.md +27 -0
- package/presets/agy/workflows/cc-pagespeed.md +2 -3
- package/presets/agy/workflows/cc-review.md +31 -0
- package/presets/agy/workflows/cc-security.md +1 -1
- package/presets/claude/commands/cc/review.md +33 -0
- package/presets/claude/settings.json +2 -2
- package/presets/claude/skills/android/SKILL.md +1 -1
- package/presets/claude/skills/api-versioning/SKILL.md +1 -1
- package/presets/claude/skills/astro/SKILL.md +318 -0
- package/presets/claude/skills/auth-token-inspector/SKILL.md +30 -0
- package/presets/claude/skills/code-review/SKILL.md +207 -0
- package/presets/claude/skills/django-orm/SKILL.md +1 -1
- package/presets/claude/skills/django-testing/SKILL.md +1 -1
- package/presets/claude/skills/django-uv/SKILL.md +405 -0
- package/presets/claude/skills/drizzle-schema-architect/SKILL.md +50 -0
- package/presets/claude/skills/fastapi-pydantic-strict/SKILL.md +43 -0
- package/presets/claude/skills/jpa-nplusone-detector/SKILL.md +45 -0
- package/presets/claude/skills/jpa-postgres/SKILL.md +1 -1
- package/presets/claude/skills/livewire-alpine-bridge/SKILL.md +35 -0
- package/presets/claude/skills/nextjs-typescript/SKILL.md +390 -0
- package/presets/claude/skills/pagespeed-perf/SKILL.md +1 -1
- package/presets/claude/skills/python/SKILL.md +1 -1
- package/presets/claude/skills/python-django-stack/SKILL.md +1 -1
- package/presets/claude/skills/python-fastapi-stack/SKILL.md +1 -1
- package/presets/claude/skills/security/SKILL.md +1 -1
- package/presets/claude/skills/seo-analytics-injector/SKILL.md +43 -0
- package/presets/claude/skills/spring-auth-auditor/SKILL.md +29 -0
- package/presets/claude/skills/spring-boot-feature/SKILL.md +1 -1
- package/presets/claude/skills/spring-boot-kotlin/SKILL.md +1 -1
- package/presets/claude/skills/spring-boot-testing-strategy/SKILL.md +475 -0
- package/presets/claude/skills/sqlalchemy/SKILL.md +1 -1
- package/presets/claude/skills/tailwind-responsive-auditor/SKILL.md +29 -0
- package/presets/claude/skills/tdd-mutation-tester/SKILL.md +27 -0
- package/presets/claude/skills/testing-strategy/SKILL.md +1 -1
- package/presets/codex/skills/android/SKILL.md +1 -1
- package/presets/codex/skills/api-versioning/SKILL.md +1 -1
- package/presets/codex/skills/astro/SKILL.md +318 -0
- package/presets/codex/skills/auth-token-inspector/SKILL.md +30 -0
- package/presets/codex/skills/cc-openspec/SKILL.md +1 -1
- package/presets/codex/skills/cc-pagespeed/SKILL.md +2 -3
- package/presets/codex/skills/cc-review/SKILL.md +31 -0
- package/presets/codex/skills/cc-security/SKILL.md +1 -1
- package/presets/codex/skills/code-review/SKILL.md +207 -0
- package/presets/codex/skills/django-orm/SKILL.md +1 -1
- package/presets/codex/skills/django-testing/SKILL.md +1 -1
- package/presets/codex/skills/django-uv/SKILL.md +405 -0
- package/presets/codex/skills/drizzle-schema-architect/SKILL.md +50 -0
- package/presets/codex/skills/fastapi-pydantic-strict/SKILL.md +43 -0
- package/presets/codex/skills/jpa-nplusone-detector/SKILL.md +45 -0
- package/presets/codex/skills/jpa-postgres/SKILL.md +1 -1
- package/presets/codex/skills/livewire-alpine-bridge/SKILL.md +35 -0
- package/presets/codex/skills/nextjs-typescript/SKILL.md +390 -0
- package/presets/codex/skills/pagespeed-perf/SKILL.md +1 -1
- package/presets/codex/skills/python/SKILL.md +1 -1
- package/presets/codex/skills/python-django-stack/SKILL.md +1 -1
- package/presets/codex/skills/python-fastapi-stack/SKILL.md +1 -1
- package/presets/codex/skills/security-ai-llm/SKILL.md +43 -0
- package/presets/codex/skills/security-blue-team/SKILL.md +43 -0
- package/presets/codex/skills/security-cloud/SKILL.md +43 -0
- package/presets/codex/skills/security-crypto/SKILL.md +43 -0
- package/presets/codex/skills/security-exploit-dev/SKILL.md +45 -0
- package/presets/codex/skills/security-grc/SKILL.md +43 -0
- package/presets/codex/skills/security-incident-response/SKILL.md +45 -0
- package/presets/codex/skills/security-log-analysis/SKILL.md +43 -0
- package/presets/codex/skills/security-malware-analysis/SKILL.md +44 -0
- package/presets/codex/skills/security-mobile/SKILL.md +43 -0
- package/presets/codex/skills/security-network/SKILL.md +43 -0
- package/presets/codex/skills/security-ot-ics/SKILL.md +43 -0
- package/presets/codex/skills/security-recon/SKILL.md +45 -0
- package/presets/codex/skills/security-red-team/SKILL.md +44 -0
- package/presets/codex/skills/security-reverse-engineering/SKILL.md +44 -0
- package/presets/codex/skills/security-soc-automation/SKILL.md +43 -0
- package/presets/codex/skills/security-threat-hunting/SKILL.md +43 -0
- package/presets/codex/skills/security-vuln-assessment/SKILL.md +45 -0
- package/presets/codex/skills/security-web/SKILL.md +44 -0
- package/presets/codex/skills/seo-analytics-injector/SKILL.md +43 -0
- package/presets/codex/skills/spring-auth-auditor/SKILL.md +29 -0
- package/presets/codex/skills/spring-boot-feature/SKILL.md +2 -2
- package/presets/codex/skills/spring-boot-kotlin/SKILL.md +1 -1
- package/presets/codex/skills/spring-boot-testing-strategy/SKILL.md +475 -0
- package/presets/codex/skills/sqlalchemy/SKILL.md +1 -1
- package/presets/codex/skills/tailwind-responsive-auditor/SKILL.md +29 -0
- package/presets/codex/skills/tdd-mutation-tester/SKILL.md +27 -0
- package/presets/codex/skills/testing-strategy/SKILL.md +1 -1
- package/presets/cursor/commands/cc/openspec.md +1 -1
- package/presets/cursor/commands/cc/pagespeed.md +2 -3
- package/presets/cursor/commands/cc/review.md +31 -0
- package/presets/cursor/commands/cc/security.md +1 -1
- package/presets/cursor/skills/android/SKILL.md +1 -1
- package/presets/cursor/skills/api-versioning/SKILL.md +2 -1
- package/presets/cursor/skills/astro/SKILL.md +1 -1
- package/presets/cursor/skills/auth-token-inspector/SKILL.md +1 -1
- package/presets/cursor/skills/code-review/SKILL.md +1 -1
- package/presets/cursor/skills/django-orm/SKILL.md +3 -5
- package/presets/cursor/skills/django-testing/SKILL.md +1 -1
- package/presets/cursor/skills/django-uv/SKILL.md +1 -1
- package/presets/cursor/skills/drizzle-schema-architect/SKILL.md +1 -1
- package/presets/cursor/skills/fastapi-pydantic-strict/SKILL.md +1 -1
- package/presets/cursor/skills/jpa-nplusone-detector/SKILL.md +1 -1
- package/presets/cursor/skills/jpa-postgres/SKILL.md +2 -4
- package/presets/cursor/skills/livewire-alpine-bridge/SKILL.md +1 -1
- package/presets/cursor/skills/nextjs-typescript/SKILL.md +1 -1
- package/presets/cursor/skills/pagespeed-perf/SKILL.md +1 -1
- package/presets/cursor/skills/python/SKILL.md +6 -7
- package/presets/cursor/skills/python-django-stack/SKILL.md +1 -1
- package/presets/cursor/skills/python-fastapi-stack/SKILL.md +1 -1
- package/presets/cursor/skills/security/SKILL.md +1 -1
- package/presets/cursor/skills/seo-analytics-injector/SKILL.md +1 -1
- package/presets/cursor/skills/spring-auth-auditor/SKILL.md +1 -1
- package/presets/cursor/skills/spring-boot-feature/SKILL.md +2 -4
- package/presets/cursor/skills/spring-boot-kotlin/SKILL.md +1 -1
- package/presets/cursor/skills/spring-boot-testing-strategy/SKILL.md +1 -1
- package/presets/cursor/skills/sqlalchemy/SKILL.md +1 -1
- package/presets/cursor/skills/tailwind-responsive-auditor/SKILL.md +1 -1
- package/presets/cursor/skills/tdd-mutation-tester/SKILL.md +1 -1
- package/presets/gemini/commands/cc/openspec.toml +1 -1
- package/presets/gemini/commands/cc/pagespeed.toml +2 -3
- package/presets/gemini/commands/cc/review.toml +31 -0
- package/presets/gemini/commands/cc/security.toml +1 -1
- package/presets/opencode/README.md +45 -52
- package/presets/opencode/commands/cc-pagespeed.md +2 -3
- package/presets/opencode/commands/cc-review.md +31 -0
- package/presets/opencode/commands/cc-security.md +1 -1
- package/presets/opencode/opencode.jsonc +1 -1
- package/presets/opencode/skills/android/SKILL.md +1 -1
- package/presets/opencode/skills/api-versioning/SKILL.md +2 -1
- package/presets/opencode/skills/astro/SKILL.md +1 -1
- package/presets/opencode/skills/auth-token-inspector/SKILL.md +1 -1
- package/presets/opencode/skills/code-review/SKILL.md +1 -1
- package/presets/opencode/skills/django-orm/SKILL.md +3 -3
- package/presets/opencode/skills/django-testing/SKILL.md +1 -1
- package/presets/opencode/skills/django-uv/SKILL.md +1 -1
- package/presets/opencode/skills/drizzle-schema-architect/SKILL.md +1 -1
- package/presets/opencode/skills/fastapi-pydantic-strict/SKILL.md +1 -1
- package/presets/opencode/skills/jpa-nplusone-detector/SKILL.md +1 -1
- package/presets/opencode/skills/jpa-postgres/SKILL.md +2 -1
- package/presets/opencode/skills/livewire-alpine-bridge/SKILL.md +1 -1
- package/presets/opencode/skills/nextjs-typescript/SKILL.md +1 -1
- package/presets/opencode/skills/pagespeed-perf/SKILL.md +1 -1
- package/presets/opencode/skills/python/SKILL.md +6 -5
- package/presets/opencode/skills/python-django-stack/SKILL.md +1 -1
- package/presets/opencode/skills/python-fastapi-stack/SKILL.md +1 -1
- package/presets/opencode/skills/security/SKILL.md +1 -1
- package/presets/opencode/skills/seo-analytics-injector/SKILL.md +1 -1
- package/presets/opencode/skills/spring-auth-auditor/SKILL.md +1 -1
- package/presets/opencode/skills/spring-boot-feature/SKILL.md +2 -1
- package/presets/opencode/skills/spring-boot-kotlin/SKILL.md +1 -1
- package/presets/opencode/skills/spring-boot-testing-strategy/SKILL.md +1 -1
- package/presets/opencode/skills/sqlalchemy/SKILL.md +1 -1
- package/presets/opencode/skills/tailwind-responsive-auditor/SKILL.md +1 -1
- package/presets/opencode/skills/tdd-mutation-tester/SKILL.md +1 -1
- package/presets/seo-hotel/skills/astro-seo/SKILL.md +1 -1
- package/presets/seo-hotel/skills/geo-readiness/SKILL.md +1 -1
- package/presets/seo-hotel/skills/off-page/SKILL.md +1 -1
- package/presets/seo-hotel/skills/schema-validator/SKILL.md +1 -1
- package/presets/seo-hotel/skills/seo-audit/SKILL.md +1 -1
- package/presets/shared/invoke-hook.cjs +20 -5
- package/src/presets/models/roles.yml +28 -28
- package/src/presets/shared-skills.yml +58 -22
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: nextjs-typescript
|
|
3
|
+
name: nextjs-typescript
|
|
4
|
+
description: >
|
|
5
|
+
Provides expert knowledge for building Next.js 15+ applications with the App Router, TypeScript, Server Components, Server Actions, and TanStack Query.
|
|
6
|
+
|
|
7
|
+
user-invokable: true
|
|
8
|
+
license: MIT
|
|
9
|
+
metadata:
|
|
10
|
+
author: lgzarturo
|
|
11
|
+
category: frontend
|
|
12
|
+
|
|
13
|
+
compatibility:
|
|
14
|
+
tools: [claude, codex, gemini, agy, opencode]
|
|
15
|
+
stacks:
|
|
16
|
+
languages: []
|
|
17
|
+
frameworks: []
|
|
18
|
+
|
|
19
|
+
risk:
|
|
20
|
+
level: medium
|
|
21
|
+
can_execute_shell: false
|
|
22
|
+
can_modify_files: true
|
|
23
|
+
requires_network: false
|
|
24
|
+
|
|
25
|
+
inputs: []
|
|
26
|
+
|
|
27
|
+
outputs: []
|
|
28
|
+
|
|
29
|
+
quality:
|
|
30
|
+
reviewed_by: codeconductor-core
|
|
31
|
+
version: 0.1.0
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Next.js + TypeScript
|
|
37
|
+
|
|
38
|
+
## Server vs Client Components
|
|
39
|
+
|
|
40
|
+
The App Router defaults to Server Components. Every component is a Server
|
|
41
|
+
Component unless it explicitly opts in to the client.
|
|
42
|
+
|
|
43
|
+
### Decision Rule
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
Does the component need any of the following?
|
|
47
|
+
- useState / useReducer
|
|
48
|
+
- useEffect / lifecycle methods
|
|
49
|
+
- Browser APIs (window, document, localStorage)
|
|
50
|
+
- Event listeners (onClick, onChange, onSubmit)
|
|
51
|
+
- Third-party libraries that require the DOM
|
|
52
|
+
|
|
53
|
+
YES → Client Component (`"use client"` directive)
|
|
54
|
+
NO → Server Component (default, no directive needed)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Keep the `"use client"` boundary as far down the component tree as possible.
|
|
58
|
+
Wrap only the interactive leaf node, not the entire page.
|
|
59
|
+
|
|
60
|
+
### Server Component (default)
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
// app/users/page.tsx — no directive needed
|
|
64
|
+
import { db } from '@/lib/db';
|
|
65
|
+
|
|
66
|
+
export default async function UsersPage() {
|
|
67
|
+
// Direct database access — no API round-trip needed
|
|
68
|
+
const users = await db.user.findMany({ orderBy: { createdAt: 'desc' } });
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<ul>
|
|
72
|
+
{users.map(user => (
|
|
73
|
+
<li key={user.id}>{user.email}</li>
|
|
74
|
+
))}
|
|
75
|
+
</ul>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Client Component
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
// components/ui/counter.tsx
|
|
84
|
+
'use client';
|
|
85
|
+
|
|
86
|
+
import { useState } from 'react';
|
|
87
|
+
|
|
88
|
+
interface Props {
|
|
89
|
+
initialCount?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function Counter({ initialCount = 0 }: Props) {
|
|
93
|
+
const [count, setCount] = useState(initialCount);
|
|
94
|
+
return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Composing Server and Client
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
// app/dashboard/page.tsx — Server Component
|
|
102
|
+
import { Counter } from '@/components/ui/counter'; // Client
|
|
103
|
+
import { getUser } from '@/lib/queries'; // Server-only function
|
|
104
|
+
|
|
105
|
+
export default async function DashboardPage() {
|
|
106
|
+
const user = await getUser(); // runs on the server
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div>
|
|
110
|
+
<h1>Welcome, {user.name}</h1>
|
|
111
|
+
<Counter initialCount={user.loginCount} /> {/* client island */}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Passing server data to client components as props is correct. The server
|
|
118
|
+
renders the Server Component tree first, serializes the props, and sends them
|
|
119
|
+
to the client.
|
|
120
|
+
|
|
121
|
+
## Data Fetching
|
|
122
|
+
|
|
123
|
+
### Server Component Fetching (recommended for initial data)
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
// app/posts/[id]/page.tsx
|
|
127
|
+
interface Props {
|
|
128
|
+
params: Promise<{ id: string }>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default async function PostPage({ params }: Props) {
|
|
132
|
+
const { id } = await params;
|
|
133
|
+
const post = await fetch(`https://api.example.com/posts/${id}`, {
|
|
134
|
+
next: { revalidate: 3600 }, // ISR: revalidate every hour
|
|
135
|
+
}).then(r => r.json());
|
|
136
|
+
|
|
137
|
+
if (!post) notFound();
|
|
138
|
+
|
|
139
|
+
return <article>{post.title}</article>;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Cache strategies:
|
|
144
|
+
|
|
145
|
+
| `cache` option | Behavior |
|
|
146
|
+
|----------------|----------|
|
|
147
|
+
| `force-cache` | Cache indefinitely (default for fetch in RSC) |
|
|
148
|
+
| `no-store` | Never cache — fresh on every request |
|
|
149
|
+
| `next: { revalidate: N }` | ISR — revalidate after N seconds |
|
|
150
|
+
| `next: { tags: ['posts'] }` | On-demand revalidation via tag |
|
|
151
|
+
|
|
152
|
+
### Server Actions (mutations)
|
|
153
|
+
|
|
154
|
+
Server Actions run on the server. Use them for form submissions and mutations.
|
|
155
|
+
Never use them for reads.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
// app/posts/create/actions.ts
|
|
159
|
+
'use server';
|
|
160
|
+
|
|
161
|
+
import { revalidatePath } from 'next/cache';
|
|
162
|
+
import { redirect } from 'next/navigation';
|
|
163
|
+
import { z } from 'zod';
|
|
164
|
+
import { db } from '@/lib/db';
|
|
165
|
+
|
|
166
|
+
const CreatePostSchema = z.object({
|
|
167
|
+
title: z.string().min(1).max(200),
|
|
168
|
+
content: z.string().min(1),
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
export async function createPost(formData: FormData) {
|
|
172
|
+
const parsed = CreatePostSchema.safeParse({
|
|
173
|
+
title: formData.get('title'),
|
|
174
|
+
content: formData.get('content'),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
if (!parsed.success) {
|
|
178
|
+
return { error: parsed.error.flatten().fieldErrors };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
await db.post.create({ data: parsed.data });
|
|
182
|
+
|
|
183
|
+
revalidatePath('/posts');
|
|
184
|
+
redirect('/posts');
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
// app/posts/create/page.tsx
|
|
190
|
+
import { createPost } from './actions';
|
|
191
|
+
|
|
192
|
+
export default function CreatePostPage() {
|
|
193
|
+
return (
|
|
194
|
+
<form action={createPost}>
|
|
195
|
+
<input name="title" type="text" required />
|
|
196
|
+
<textarea name="content" required />
|
|
197
|
+
<button type="submit">Create</button>
|
|
198
|
+
</form>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Rules for Server Actions:
|
|
204
|
+
|
|
205
|
+
- Always validate input with Zod — do not trust `FormData` values
|
|
206
|
+
- Return error objects for validation failures; use `redirect()` for success
|
|
207
|
+
- Call `revalidatePath()` or `revalidateTag()` after mutations that affect
|
|
208
|
+
cached data
|
|
209
|
+
- Never put secrets or auth logic in Client Components — keep it in actions
|
|
210
|
+
|
|
211
|
+
### TanStack Query (client-side data)
|
|
212
|
+
|
|
213
|
+
Use TanStack Query for data that must stay fresh on the client: real-time
|
|
214
|
+
feeds, user-specific data after mutations, optimistic updates.
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
// components/posts/post-list.tsx
|
|
218
|
+
'use client';
|
|
219
|
+
|
|
220
|
+
import { useQuery } from '@tanstack/react-query';
|
|
221
|
+
|
|
222
|
+
interface Post {
|
|
223
|
+
id: string;
|
|
224
|
+
title: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function PostList() {
|
|
228
|
+
const { data, isLoading, error } = useQuery<Post[]>({
|
|
229
|
+
queryKey: ['posts'],
|
|
230
|
+
queryFn: () => fetch('/api/posts').then(r => r.json()),
|
|
231
|
+
staleTime: 60_000, // treat data as fresh for 60 seconds
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
if (isLoading) return <p>Loading...</p>;
|
|
235
|
+
if (error) return <p>Failed to load posts.</p>;
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<ul>
|
|
239
|
+
{data?.map(post => <li key={post.id}>{post.title}</li>)}
|
|
240
|
+
</ul>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Do not use TanStack Query for data that a Server Component can fetch directly.
|
|
246
|
+
The extra client-side fetch is unnecessary when the data can be fetched at
|
|
247
|
+
render time on the server.
|
|
248
|
+
|
|
249
|
+
## Route Handlers
|
|
250
|
+
|
|
251
|
+
Use route handlers for: webhooks, third-party OAuth callbacks, or endpoints
|
|
252
|
+
consumed by non-Next.js clients.
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// app/api/posts/route.ts
|
|
256
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
257
|
+
import { z } from 'zod';
|
|
258
|
+
import { db } from '@/lib/db';
|
|
259
|
+
|
|
260
|
+
const CreatePostBody = z.object({
|
|
261
|
+
title: z.string().min(1),
|
|
262
|
+
content: z.string().min(1),
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
export async function GET() {
|
|
266
|
+
const posts = await db.post.findMany({ orderBy: { createdAt: 'desc' } });
|
|
267
|
+
return NextResponse.json(posts);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export async function POST(request: NextRequest) {
|
|
271
|
+
const body = await request.json();
|
|
272
|
+
const parsed = CreatePostBody.safeParse(body);
|
|
273
|
+
|
|
274
|
+
if (!parsed.success) {
|
|
275
|
+
return NextResponse.json(
|
|
276
|
+
{ error: parsed.error.flatten() },
|
|
277
|
+
{ status: 400 }
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const post = await db.post.create({ data: parsed.data });
|
|
282
|
+
return NextResponse.json(post, { status: 201 });
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Metadata API
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
// app/posts/[id]/page.tsx
|
|
290
|
+
import type { Metadata } from 'next';
|
|
291
|
+
|
|
292
|
+
interface Props {
|
|
293
|
+
params: Promise<{ id: string }>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
297
|
+
const { id } = await params;
|
|
298
|
+
const post = await fetch(`/api/posts/${id}`).then(r => r.json());
|
|
299
|
+
|
|
300
|
+
return {
|
|
301
|
+
title: post.title,
|
|
302
|
+
description: post.excerpt,
|
|
303
|
+
openGraph: {
|
|
304
|
+
title: post.title,
|
|
305
|
+
images: [{ url: post.coverImage }],
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Never hardcode metadata in `<head>` tags — use the Metadata API. It handles
|
|
312
|
+
deduplication, inheritance, and streaming correctly.
|
|
313
|
+
|
|
314
|
+
## Streaming with Suspense
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
// app/dashboard/page.tsx
|
|
318
|
+
import { Suspense } from 'react';
|
|
319
|
+
import { UserStats } from './user-stats'; // slow data fetch
|
|
320
|
+
import { RecentActivity } from './recent'; // fast data fetch
|
|
321
|
+
|
|
322
|
+
export default function DashboardPage() {
|
|
323
|
+
return (
|
|
324
|
+
<div>
|
|
325
|
+
<RecentActivity /> {/* renders immediately */}
|
|
326
|
+
<Suspense fallback={<p>Loading stats...</p>}>
|
|
327
|
+
<UserStats /> {/* streams in when ready */}
|
|
328
|
+
</Suspense>
|
|
329
|
+
</div>
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Wrap independently slow data sources in their own `<Suspense>` boundaries.
|
|
335
|
+
Do not wrap the entire page — that defeats streaming.
|
|
336
|
+
|
|
337
|
+
## TypeScript Conventions
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
// Use type imports for type-only imports
|
|
341
|
+
import type { User } from '@prisma/client';
|
|
342
|
+
|
|
343
|
+
// Prefer interfaces for object shapes that may be extended
|
|
344
|
+
interface UserCardProps {
|
|
345
|
+
user: Pick<User, 'id' | 'name' | 'email'>;
|
|
346
|
+
onSelect?: (id: string) => void;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Use type aliases for unions and computed types
|
|
350
|
+
type Status = 'active' | 'inactive' | 'pending';
|
|
351
|
+
type UserWithPosts = User & { posts: Post[] };
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Rules:
|
|
355
|
+
|
|
356
|
+
- Never use `any` — use `unknown` and narrow with type guards
|
|
357
|
+
- Use `satisfies` to validate objects against a type without widening
|
|
358
|
+
- Co-locate type definitions with the component or function that uses them;
|
|
359
|
+
export only what other modules need
|
|
360
|
+
- Use `next/navigation` hooks (`useRouter`, `usePathname`) not `next/router` —
|
|
361
|
+
the latter is Pages Router only
|
|
362
|
+
|
|
363
|
+
## Project Structure
|
|
364
|
+
|
|
365
|
+
```text
|
|
366
|
+
app/
|
|
367
|
+
(auth)/ — route group, no URL segment
|
|
368
|
+
login/page.tsx
|
|
369
|
+
register/page.tsx
|
|
370
|
+
(dashboard)/
|
|
371
|
+
dashboard/page.tsx
|
|
372
|
+
posts/
|
|
373
|
+
[id]/page.tsx
|
|
374
|
+
create/
|
|
375
|
+
page.tsx
|
|
376
|
+
actions.ts
|
|
377
|
+
api/
|
|
378
|
+
posts/route.ts
|
|
379
|
+
layout.tsx — root layout
|
|
380
|
+
not-found.tsx
|
|
381
|
+
|
|
382
|
+
components/
|
|
383
|
+
ui/ — generic, reusable components
|
|
384
|
+
posts/ — domain-specific components
|
|
385
|
+
|
|
386
|
+
lib/
|
|
387
|
+
db.ts — database client
|
|
388
|
+
auth.ts — auth configuration
|
|
389
|
+
queries.ts — reusable server-side query functions
|
|
390
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-ai-llm
|
|
3
|
+
description: >
|
|
4
|
+
Harden LLM and agent integrations you operate: prompt injection, tool allowlists, secret leakage, and supply-chain of models. Defensive only.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI / LLM Security
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Treat model output as untrusted; never exec it without a schema
|
|
21
|
+
- Allowlist tools and paths; contain file writes
|
|
22
|
+
- Keep secrets out of prompts and logs
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Help jailbreak third-party products or steal model weights
|
|
27
|
+
- Log raw user PII to prompt-debug stores
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-ai-llm`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Review our agent tool runner for path traversal and unbounded shell.`
|
|
37
|
+
- `Add tests that a prompt cannot make the bot dump .env.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-blue-team
|
|
3
|
+
description: >
|
|
4
|
+
Improve detections, hardening, and response for the estate you defend. Detection-as-code and control design, not offense.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Blue Team Defense
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Tune detections for true positives; document exceptions
|
|
21
|
+
- Pair every new control with a test or canary
|
|
22
|
+
- Share hunt hypotheses with IR, not with the public internet
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Disable EDR or logging to 'reduce noise' without a ticket
|
|
27
|
+
- Copy attacker malware into production 'for training'
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-blue-team`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `We missed a token-replay. Propose a detection plus a unit test for the API gateway.`
|
|
37
|
+
- `Harden CI: pin actions, require reviews on workflows that deploy.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-cloud
|
|
3
|
+
description: >
|
|
4
|
+
Harden IAM, storage, keys, and org policies in cloud accounts you administer. Focus on identity, logging, and public-exposure controls.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Cloud Security
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Prefer roles over long-lived keys; require MFA on human admins
|
|
21
|
+
- Block public buckets and overly broad IAM `*` unless justified
|
|
22
|
+
- Turn on cloud audit logs and retain them per policy
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Disable logging or GuardDuty/Security Command Center 'to save cost' without a recorded exception
|
|
27
|
+
- Share account credentials in chat or tickets
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-cloud`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Audit this AWS account's IAM: unused keys, admin wildcards, and public S3.`
|
|
37
|
+
- `Write a policy-as-code check that fails CI if a bucket ACL is public.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-crypto
|
|
3
|
+
description: >
|
|
4
|
+
Choose and review cryptographic usage in your codebase: TLS, hashing, KMS, secret storage. Prefer standard libraries and vetted constructions.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Applied Cryptography
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Use platform TLS and KMS; do not invent protocols
|
|
21
|
+
- Hash passwords with a memory-hard KDF; never roll your own
|
|
22
|
+
- Keep keys out of git; rotate on leak
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Recommend ECB, MD5 for security, or home-grown ciphers
|
|
27
|
+
- Ask models to 'break' or weaken crypto for a CTF against third parties
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-crypto`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Review how we store refresh tokens. Propose KMS envelope encryption and tests.`
|
|
37
|
+
- `Replace SHA-1 password hashes in this legacy module with a modern KDF and a migration plan.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-exploit-dev
|
|
3
|
+
description: >
|
|
4
|
+
Understand how a confirmed vulnerability in an owned system is triggered so you can patch and test it. This is not exploit development for offense. No payloads, malware, or attack procedures.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Defensive Exploit Analysis (Authorized)
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Describe the bug class (e.g. missing authz) at a design level
|
|
21
|
+
- Write a regression test that fails before the fix and passes after
|
|
22
|
+
- Prefer sanitizers, type systems, and least-privilege patches
|
|
23
|
+
- Stop and refuse if the user asks for a working exploit, PoC payload, or bypass kit
|
|
24
|
+
|
|
25
|
+
## Do not
|
|
26
|
+
|
|
27
|
+
- Write exploits, exploit PoCs, shellcode, or weaponized requests
|
|
28
|
+
- Document step-by-step attack procedures against any system
|
|
29
|
+
- Help with CTF flags, cracking, or unauthorized access
|
|
30
|
+
|
|
31
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
32
|
+
|
|
33
|
+
## How to Use
|
|
34
|
+
|
|
35
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-exploit-dev`.
|
|
36
|
+
Example prompts:
|
|
37
|
+
|
|
38
|
+
- `We confirmed IDOR on /invoices/:id in our app. Help design the authz check and a RED test — no exploit.`
|
|
39
|
+
- `Turn this crash report from our fuzzer into a defensive patch and a regression test.`
|
|
40
|
+
|
|
41
|
+
## Integration
|
|
42
|
+
|
|
43
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
44
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
45
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-grc
|
|
3
|
+
description: >
|
|
4
|
+
Map controls to SOC2, ISO 27001, PCI, or internal policy for the org you work for. Evidence and control design — not audit theater.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# GRC / Compliance Engineering
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Map each control to an owner, evidence path, and test
|
|
21
|
+
- Prefer automated evidence (CI, IaC, tickets) over screenshots
|
|
22
|
+
- Record exceptions with expiry dates
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Fabricate evidence or backdate approvals
|
|
27
|
+
- Copy another company's policies without legal review
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-grc`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Map our GitHub branch protection to SOC2 CC6.6 and list evidence.`
|
|
37
|
+
- `List gaps: secrets in git, missing MFA on GitHub org owners.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|