@ruyfranca/myskills 1.0.28 → 1.0.30
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/.agent/rules/AGENTS.md +273 -0
- package/.agent/skills/cqrs-implementation/SKILL.md +107 -0
- package/.agent/skills/ddd-strategic-design/SKILL.md +70 -0
- package/.agent/skills/ddd-tactical-patterns/SKILL.md +70 -0
- package/.agent/skills/elixir-pro/SKILL.md +89 -0
- package/.agent/skills/event-sourcing-architect/SKILL.md +66 -0
- package/.agent/skills/golang-pro/SKILL.md +121 -0
- package/.agent/skills/kotlin-coroutines-expert/SKILL.md +99 -0
- package/.agent/skills/modern-javascript-patterns/SKILL.md +131 -0
- package/.agent/skills/monorepo-architect/SKILL.md +91 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +94 -247
- package/.agent/skills/react-patterns/SKILL.md +200 -0
- package/.agent/skills/react-state-management/SKILL.md +147 -0
- package/.agent/skills/ruby-pro/SKILL.md +105 -0
- package/.agent/skills/zod-validation-expert/SKILL.md +132 -0
- package/AGENTS.md +273 -0
- package/index.js +42 -9
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-state-management
|
|
3
|
+
description: "Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization."
|
|
4
|
+
risk: unknown
|
|
5
|
+
source: community
|
|
6
|
+
date_added: "2026-02-27"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# React State Management
|
|
10
|
+
|
|
11
|
+
Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization.
|
|
12
|
+
|
|
13
|
+
## Use this skill when
|
|
14
|
+
|
|
15
|
+
- Choosing the right state management solution
|
|
16
|
+
- Implementing Zustand, Redux Toolkit, Jotai, or React Query
|
|
17
|
+
- Migrating from legacy Redux to modern patterns
|
|
18
|
+
- Combining client and server state
|
|
19
|
+
|
|
20
|
+
## Do not use this skill when
|
|
21
|
+
|
|
22
|
+
- The task is unrelated to React state
|
|
23
|
+
- Simple useState is clearly sufficient
|
|
24
|
+
|
|
25
|
+
## Core Concepts
|
|
26
|
+
|
|
27
|
+
### 1. State Categories
|
|
28
|
+
|
|
29
|
+
| Category | Examples | Best Solution |
|
|
30
|
+
|----------|----------|---------------|
|
|
31
|
+
| **Local UI** | modal open, input focus | useState |
|
|
32
|
+
| **Form** | values, errors, submission | React Hook Form + Zod |
|
|
33
|
+
| **Server** | fetched data, cache | React Query / SWR |
|
|
34
|
+
| **Global Client** | auth, theme, cart | Zustand |
|
|
35
|
+
| **Atomic** | fine-grained subscriptions | Jotai |
|
|
36
|
+
|
|
37
|
+
### 2. Selection Criteria
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Do you need this state in >2 components?
|
|
41
|
+
→ No → useState / useReducer
|
|
42
|
+
→ Yes → Is it server data?
|
|
43
|
+
→ Yes → React Query / SWR
|
|
44
|
+
→ No → Zustand / Jotai
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Patterns
|
|
48
|
+
|
|
49
|
+
### Zustand (Simplest Global Store)
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { create } from 'zustand';
|
|
53
|
+
import { persist } from 'zustand/middleware';
|
|
54
|
+
|
|
55
|
+
interface CartStore {
|
|
56
|
+
items: CartItem[];
|
|
57
|
+
addItem: (item: CartItem) => void;
|
|
58
|
+
removeItem: (id: string) => void;
|
|
59
|
+
total: () => number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const useCartStore = create<CartStore>()(
|
|
63
|
+
persist(
|
|
64
|
+
(set, get) => ({
|
|
65
|
+
items: [],
|
|
66
|
+
addItem: (item) => set(state => ({ items: [...state.items, item] })),
|
|
67
|
+
removeItem: (id) => set(state => ({ items: state.items.filter(i => i.id !== id) })),
|
|
68
|
+
total: () => get().items.reduce((sum, item) => sum + item.price, 0),
|
|
69
|
+
}),
|
|
70
|
+
{ name: 'cart-storage' }
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// Usage — subscribe to only what you need (performance!)
|
|
75
|
+
const items = useCartStore(state => state.items);
|
|
76
|
+
const addItem = useCartStore(state => state.addItem);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Redux Toolkit (Complex Domain Logic)
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const orderSlice = createSlice({
|
|
83
|
+
name: 'orders',
|
|
84
|
+
initialState: { items: [], status: 'idle' } as OrdersState,
|
|
85
|
+
reducers: {
|
|
86
|
+
orderAdded: (state, action: PayloadAction<Order>) => {
|
|
87
|
+
state.items.push(action.payload);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
extraReducers: builder => {
|
|
91
|
+
builder
|
|
92
|
+
.addCase(fetchOrders.pending, state => { state.status = 'loading'; })
|
|
93
|
+
.addCase(fetchOrders.fulfilled, (state, action) => {
|
|
94
|
+
state.status = 'idle';
|
|
95
|
+
state.items = action.payload;
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### React Query (Server State)
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// Fetching
|
|
105
|
+
const { data: users, isLoading } = useQuery({
|
|
106
|
+
queryKey: ['users', filters],
|
|
107
|
+
queryFn: () => api.getUsers(filters),
|
|
108
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Mutations with optimistic updates
|
|
112
|
+
const updateUser = useMutation({
|
|
113
|
+
mutationFn: api.updateUser,
|
|
114
|
+
onMutate: async (updated) => {
|
|
115
|
+
await queryClient.cancelQueries({ queryKey: ['users'] });
|
|
116
|
+
const previous = queryClient.getQueryData(['users']);
|
|
117
|
+
queryClient.setQueryData(['users'], old =>
|
|
118
|
+
old.map(u => u.id === updated.id ? { ...u, ...updated } : u)
|
|
119
|
+
);
|
|
120
|
+
return { previous }; // rollback context
|
|
121
|
+
},
|
|
122
|
+
onError: (err, _, context) => {
|
|
123
|
+
queryClient.setQueryData(['users'], context?.previous);
|
|
124
|
+
},
|
|
125
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: ['users'] }),
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Jotai (Atomic State)
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
const themeAtom = atom<'light' | 'dark'>('light');
|
|
133
|
+
const derivedAtom = atom(get => get(themeAtom) === 'dark' ? '#000' : '#fff');
|
|
134
|
+
|
|
135
|
+
function ThemeToggle() {
|
|
136
|
+
const [theme, setTheme] = useAtom(themeAtom);
|
|
137
|
+
const bgColor = useAtomValue(derivedAtom);
|
|
138
|
+
return <button onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')}>Toggle</button>;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Best Practices
|
|
143
|
+
|
|
144
|
+
- **Don't** put server data in global stores — use React Query
|
|
145
|
+
- **Do** keep Zustand stores focused (one concern per store)
|
|
146
|
+
- **Don't** select the entire store object (`state => state`) — causes re-renders
|
|
147
|
+
- **Do** derive computed values outside the component when possible
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ruby-pro
|
|
3
|
+
description: Write idiomatic Ruby code with metaprogramming, Rails patterns, and performance optimization. Specializes in Ruby on Rails, gem development, and testing frameworks.
|
|
4
|
+
risk: unknown
|
|
5
|
+
source: community
|
|
6
|
+
date_added: "2026-02-27"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Ruby Pro
|
|
10
|
+
|
|
11
|
+
You are a Ruby expert specializing in clean, maintainable, and performant Ruby code.
|
|
12
|
+
|
|
13
|
+
## Use this skill when
|
|
14
|
+
|
|
15
|
+
- Building Ruby on Rails applications
|
|
16
|
+
- Working with Ruby metaprogramming, modules, and DSLs
|
|
17
|
+
- Developing gems and managing dependencies
|
|
18
|
+
- Optimizing Ruby performance and profiling
|
|
19
|
+
|
|
20
|
+
## Do not use this skill when
|
|
21
|
+
|
|
22
|
+
- The task is unrelated to Ruby/Rails
|
|
23
|
+
- You need a different language or runtime
|
|
24
|
+
|
|
25
|
+
## Focus Areas
|
|
26
|
+
|
|
27
|
+
- Ruby metaprogramming (modules, mixins, DSLs)
|
|
28
|
+
- Rails patterns (ActiveRecord, controllers, views)
|
|
29
|
+
- Gem development and dependency management
|
|
30
|
+
- Performance optimization and profiling
|
|
31
|
+
- Testing with RSpec and Minitest
|
|
32
|
+
- Code quality with RuboCop and static analysis
|
|
33
|
+
|
|
34
|
+
## Core Patterns
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
# Concerns as mixins
|
|
38
|
+
module Timestampable
|
|
39
|
+
extend ActiveSupport::Concern
|
|
40
|
+
|
|
41
|
+
included do
|
|
42
|
+
before_create :set_timestamps
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def set_timestamps
|
|
46
|
+
self.created_at = Time.current
|
|
47
|
+
self.updated_at = Time.current
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Service objects
|
|
52
|
+
class ProcessOrderService
|
|
53
|
+
def initialize(order, payment_gateway)
|
|
54
|
+
@order = order
|
|
55
|
+
@gateway = payment_gateway
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def call
|
|
59
|
+
ActiveRecord::Base.transaction do
|
|
60
|
+
charge_customer
|
|
61
|
+
update_inventory
|
|
62
|
+
send_confirmation
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def charge_customer
|
|
69
|
+
@gateway.charge(@order.total)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Enumerables
|
|
74
|
+
users
|
|
75
|
+
.select(&:active?)
|
|
76
|
+
.map { |u| { id: u.id, name: u.full_name } }
|
|
77
|
+
.sort_by { |u| u[:name] }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Approach
|
|
81
|
+
|
|
82
|
+
1. Embrace Ruby's expressiveness and metaprogramming features
|
|
83
|
+
2. Follow Ruby and Rails conventions and idioms
|
|
84
|
+
3. Use blocks and enumerables effectively
|
|
85
|
+
4. Handle exceptions with proper rescue/ensure patterns
|
|
86
|
+
5. Optimize for readability first, performance second
|
|
87
|
+
|
|
88
|
+
## Testing
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
# RSpec example
|
|
92
|
+
RSpec.describe ProcessOrderService do
|
|
93
|
+
subject(:service) { described_class.new(order, gateway) }
|
|
94
|
+
|
|
95
|
+
describe '#call' do
|
|
96
|
+
context 'when payment succeeds' do
|
|
97
|
+
it 'updates order status to paid' do
|
|
98
|
+
expect { service.call }.to change(order, :status).to('paid')
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Favor Ruby's expressiveness. Include Gemfile and .rubocop.yml when relevant.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zod-validation-expert
|
|
3
|
+
description: "Expert in Zod schema validation, type inference, and integration with React Hook Form, Next.js Server Actions, and tRPC."
|
|
4
|
+
risk: safe
|
|
5
|
+
source: community
|
|
6
|
+
date_added: "2026-02-27"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Zod Validation Expert
|
|
10
|
+
|
|
11
|
+
You are a production-grade Zod expert. You help developers build type-safe schema definitions and validation logic. You master Zod fundamentals, type inference, complex validations, transformations, and integrations across the modern TypeScript ecosystem.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Defining schemas for forms, APIs, environment variables
|
|
16
|
+
- Integrating Zod with React Hook Form
|
|
17
|
+
- Validating in Next.js Server Actions or API routes
|
|
18
|
+
- Building type-safe tRPC routers
|
|
19
|
+
- Parsing and transforming external data
|
|
20
|
+
|
|
21
|
+
## Core Concepts
|
|
22
|
+
|
|
23
|
+
### Why Zod?
|
|
24
|
+
|
|
25
|
+
- Runtime type-safety (TypeScript types disappear at runtime)
|
|
26
|
+
- Single source of truth for schema + types
|
|
27
|
+
- Composable and tree-shakeable
|
|
28
|
+
|
|
29
|
+
### Schema Definition & Inference
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { z } from 'zod';
|
|
33
|
+
|
|
34
|
+
// Define schema
|
|
35
|
+
const UserSchema = z.object({
|
|
36
|
+
id: z.string().uuid(),
|
|
37
|
+
name: z.string().min(2).max(50),
|
|
38
|
+
email: z.string().email(),
|
|
39
|
+
age: z.number().int().min(0).max(120).optional(),
|
|
40
|
+
role: z.enum(['admin', 'user', 'editor']).default('user'),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Infer TypeScript type — single source of truth
|
|
44
|
+
type User = z.infer<typeof UserSchema>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Parsing & Validation
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// parse — throws ZodError
|
|
51
|
+
const user = UserSchema.parse(rawData); // always typed
|
|
52
|
+
|
|
53
|
+
// safeParse — never throws
|
|
54
|
+
const result = UserSchema.safeparse(rawData);
|
|
55
|
+
if (result.success) {
|
|
56
|
+
console.log(result.data); // typed
|
|
57
|
+
} else {
|
|
58
|
+
console.error(result.error.flatten());
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Custom Validation (Refinements)
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const PasswordSchema = z.object({
|
|
66
|
+
password: z.string().min(8),
|
|
67
|
+
confirm: z.string(),
|
|
68
|
+
}).refine(data => data.password === data.confirm, {
|
|
69
|
+
message: "Passwords don't match",
|
|
70
|
+
path: ['confirm'],
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Transformations
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
const DateSchema = z.string()
|
|
78
|
+
.datetime()
|
|
79
|
+
.transform(val => new Date(val)); // string → Date after parse
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Integration Patterns
|
|
83
|
+
|
|
84
|
+
### React Hook Form
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { useForm } from 'react-hook-form';
|
|
88
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
89
|
+
|
|
90
|
+
const form = useForm<User>({
|
|
91
|
+
resolver: zodResolver(UserSchema),
|
|
92
|
+
defaultValues: { role: 'user' },
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Next.js Server Actions
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
async function createUser(formData: FormData) {
|
|
100
|
+
'use server';
|
|
101
|
+
|
|
102
|
+
const result = UserSchema.safeParse({
|
|
103
|
+
name: formData.get('name'),
|
|
104
|
+
email: formData.get('email'),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
if (!result.success) {
|
|
108
|
+
return { error: result.error.flatten().fieldErrors };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
await db.user.create({ data: result.data });
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Environment Variables
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const EnvSchema = z.object({
|
|
119
|
+
DATABASE_URL: z.string().url(),
|
|
120
|
+
API_KEY: z.string().min(32),
|
|
121
|
+
PORT: z.coerce.number().default(3000),
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export const env = EnvSchema.parse(process.env);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Best Practices
|
|
128
|
+
|
|
129
|
+
- Always use `z.infer<typeof Schema>` — never duplicate types
|
|
130
|
+
- Use `safeParse` at system boundaries (API, form submit)
|
|
131
|
+
- Compose schemas with `.extend()`, `.merge()`, `.pick()`
|
|
132
|
+
- Add `.describe()` for OpenAPI documentation generation
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# AGENTS.md - Antigravity Kit
|
|
6
|
+
|
|
7
|
+
> This file defines how the AI behaves in this workspace.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## CRITICAL: AGENT & SKILL PROTOCOL (START HERE)
|
|
12
|
+
|
|
13
|
+
> **MANDATORY:** You MUST read the appropriate agent file and its skills BEFORE performing any implementation. This is the highest priority rule.
|
|
14
|
+
|
|
15
|
+
### 1. Modular Skill Loading Protocol
|
|
16
|
+
|
|
17
|
+
Agent activated → Check frontmatter "skills:" → Read SKILL.md (INDEX) → Read specific sections.
|
|
18
|
+
|
|
19
|
+
- **Selective Reading:** DO NOT read ALL files in a skill folder. Read `SKILL.md` first, then only read sections matching the user's request.
|
|
20
|
+
- **Rule Priority:** P0 (AGENTS.md / GEMINI.md) > P1 (Agent .md) > P2 (SKILL.md). All rules are binding.
|
|
21
|
+
|
|
22
|
+
### 2. Enforcement Protocol
|
|
23
|
+
|
|
24
|
+
1. **When agent is activated:**
|
|
25
|
+
- ✅ Activate: Read Rules → Check Frontmatter → Load SKILL.md → Apply All.
|
|
26
|
+
2. **Forbidden:** Never skip reading agent rules or skill instructions. "Read → Understand → Apply" is mandatory.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📥 REQUEST CLASSIFIER (STEP 1)
|
|
31
|
+
|
|
32
|
+
**Before ANY action, classify the request:**
|
|
33
|
+
|
|
34
|
+
| Request Type | Trigger Keywords | Active Tiers | Result |
|
|
35
|
+
| ---------------- | ------------------------------------------ | ------------------------------ | --------------------------- |
|
|
36
|
+
| **QUESTION** | "what is", "how does", "explain" | TIER 0 only | Text Response |
|
|
37
|
+
| **SURVEY/INTEL** | "analyze", "list files", "overview" | TIER 0 + Explorer | Session Intel (No File) |
|
|
38
|
+
| **SIMPLE CODE** | "fix", "add", "change" (single file) | TIER 0 + TIER 1 (lite) | Inline Edit |
|
|
39
|
+
| **COMPLEX CODE** | "build", "create", "implement", "refactor" | TIER 0 + TIER 1 (full) + Agent | **{task-slug}.md Required** |
|
|
40
|
+
| **DESIGN/UI** | "design", "UI", "page", "dashboard" | TIER 0 + TIER 1 + Agent | **{task-slug}.md Required** |
|
|
41
|
+
| **SLASH CMD** | /create, /orchestrate, /debug | Command-specific flow | Variable |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🤖 INTELLIGENT AGENT ROUTING (STEP 2 - AUTO)
|
|
46
|
+
|
|
47
|
+
**ALWAYS ACTIVE: Before responding to ANY request, automatically analyze and select the best agent(s).**
|
|
48
|
+
|
|
49
|
+
> 🔴 **MANDATORY:** You MUST follow the protocol defined in `@[skills/intelligent-routing]`.
|
|
50
|
+
|
|
51
|
+
### Auto-Selection Protocol
|
|
52
|
+
|
|
53
|
+
1. **Analyze (Silent)**: Detect domains (Frontend, Backend, Security, etc.) from user request.
|
|
54
|
+
2. **Select Agent(s)**: Choose the most appropriate specialist(s).
|
|
55
|
+
3. **Inform User**: Concisely state which expertise is being applied.
|
|
56
|
+
4. **Apply**: Generate response using the selected agent's persona and rules.
|
|
57
|
+
|
|
58
|
+
### Response Format (MANDATORY)
|
|
59
|
+
|
|
60
|
+
When auto-applying an agent, inform the user:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
🤖 **Applying knowledge of `@[agent-name]`...**
|
|
64
|
+
|
|
65
|
+
[Continue with specialized response]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Rules:**
|
|
69
|
+
|
|
70
|
+
1. **Silent Analysis**: No verbose meta-commentary ("I am analyzing...").
|
|
71
|
+
2. **Respect Overrides**: If user mentions `@agent`, use it.
|
|
72
|
+
3. **Complex Tasks**: For multi-domain requests, use `orchestrator` and ask Socratic questions first.
|
|
73
|
+
|
|
74
|
+
### ⚠️ AGENT ROUTING CHECKLIST (MANDATORY BEFORE EVERY CODE/DESIGN RESPONSE)
|
|
75
|
+
|
|
76
|
+
**Before ANY code or design work, you MUST complete this mental checklist:**
|
|
77
|
+
|
|
78
|
+
| Step | Check | If Unchecked |
|
|
79
|
+
|------|-------|--------------|
|
|
80
|
+
| 1 | Did I identify the correct agent for this domain? | → STOP. Analyze request domain first. |
|
|
81
|
+
| 2 | Did I READ the agent's `.md` file (or recall its rules)? | → STOP. Open `.agent/agents/{agent}.md` |
|
|
82
|
+
| 3 | Did I announce `🤖 Applying knowledge of @[agent]...`? | → STOP. Add announcement before response. |
|
|
83
|
+
| 4 | Did I load required skills from agent's frontmatter? | → STOP. Check `skills:` field and read them. |
|
|
84
|
+
|
|
85
|
+
**Failure Conditions:**
|
|
86
|
+
|
|
87
|
+
- ❌ Writing code without identifying an agent = **PROTOCOL VIOLATION**
|
|
88
|
+
- ❌ Skipping the announcement = **USER CANNOT VERIFY AGENT WAS USED**
|
|
89
|
+
- ❌ Ignoring agent-specific rules (e.g., Purple Ban) = **QUALITY FAILURE**
|
|
90
|
+
|
|
91
|
+
> 🔴 **Self-Check Trigger:** Every time you are about to write code or create UI, ask yourself:
|
|
92
|
+
> "Have I completed the Agent Routing Checklist?" If NO → Complete it first.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## TIER 0: UNIVERSAL RULES (Always Active)
|
|
97
|
+
|
|
98
|
+
### 🌐 Language Handling
|
|
99
|
+
|
|
100
|
+
When user's prompt is NOT in English:
|
|
101
|
+
|
|
102
|
+
1. **Internally translate** for better comprehension
|
|
103
|
+
2. **Respond in user's language** - match their communication
|
|
104
|
+
3. **Code comments/variables** remain in English
|
|
105
|
+
|
|
106
|
+
### 🧹 Clean Code (Global Mandatory)
|
|
107
|
+
|
|
108
|
+
**ALL code MUST follow `@[skills/clean-code]` rules. No exceptions.**
|
|
109
|
+
|
|
110
|
+
- **Code**: Concise, direct, no over-engineering. Self-documenting.
|
|
111
|
+
- **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
|
|
112
|
+
- **Performance**: Measure first. Adhere to 2025 standards (Core Web Vitals).
|
|
113
|
+
- **Infra/Safety**: 5-Phase Deployment. Verify secrets security.
|
|
114
|
+
|
|
115
|
+
### 📁 File Dependency Awareness
|
|
116
|
+
|
|
117
|
+
**Before modifying ANY file:**
|
|
118
|
+
|
|
119
|
+
1. Check `CODEBASE.md` → File Dependencies
|
|
120
|
+
2. Identify dependent files
|
|
121
|
+
3. Update ALL affected files together
|
|
122
|
+
|
|
123
|
+
### 🗺️ System Map Read
|
|
124
|
+
|
|
125
|
+
> 🔴 **MANDATORY:** Read `ARCHITECTURE.md` at session start to understand Agents, Skills, and Scripts.
|
|
126
|
+
|
|
127
|
+
**Path Awareness:**
|
|
128
|
+
|
|
129
|
+
- Agents: `.agent/` (Project)
|
|
130
|
+
- Skills: `.agent/skills/` (Project)
|
|
131
|
+
- Runtime Scripts: `.agent/skills/<skill>/scripts/`
|
|
132
|
+
|
|
133
|
+
### 🧠 Read → Understand → Apply
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
❌ WRONG: Read agent file → Start coding
|
|
137
|
+
✅ CORRECT: Read → Understand WHY → Apply PRINCIPLES → Code
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Before coding, answer:**
|
|
141
|
+
|
|
142
|
+
1. What is the GOAL of this agent/skill?
|
|
143
|
+
2. What PRINCIPLES must I apply?
|
|
144
|
+
3. How does this DIFFER from generic output?
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## TIER 1: CODE RULES (When Writing Code)
|
|
149
|
+
|
|
150
|
+
### 📱 Project Type Routing
|
|
151
|
+
|
|
152
|
+
| Project Type | Primary Agent | Skills |
|
|
153
|
+
| -------------------------------------- | --------------------- | ----------------------------- |
|
|
154
|
+
| **MOBILE** (iOS, Android, RN, Flutter) | `mobile-developer` | mobile-design |
|
|
155
|
+
| **WEB** (Next.js, React web) | `frontend-specialist` | frontend-design |
|
|
156
|
+
| **BACKEND** (API, server, DB) | `backend-specialist` | api-patterns, database-design |
|
|
157
|
+
|
|
158
|
+
> 🔴 **Mobile + frontend-specialist = WRONG.** Mobile = mobile-developer ONLY.
|
|
159
|
+
|
|
160
|
+
### 🛑 Socratic Gate
|
|
161
|
+
|
|
162
|
+
**For complex requests, STOP and ASK first:**
|
|
163
|
+
|
|
164
|
+
### 🛑 GLOBAL SOCRATIC GATE (TIER 0)
|
|
165
|
+
|
|
166
|
+
**MANDATORY: Every user request must pass through the Socratic Gate before ANY tool use or implementation.**
|
|
167
|
+
|
|
168
|
+
| Request Type | Strategy | Required Action |
|
|
169
|
+
| ----------------------- | -------------- | ----------------------------------------------------------------- |
|
|
170
|
+
| **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
|
|
171
|
+
| **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
|
|
172
|
+
| **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
|
|
173
|
+
| **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
|
|
174
|
+
| **Direct "Proceed"** | Validation | **STOP** → Even if answers are given, ask 2 "Edge Case" questions |
|
|
175
|
+
|
|
176
|
+
**Protocol:**
|
|
177
|
+
|
|
178
|
+
1. **Never Assume:** If even 1% is unclear, ASK.
|
|
179
|
+
2. **Handle Spec-heavy Requests:** When user gives a list (Answers 1, 2, 3...), do NOT skip the gate. Instead, ask about **Trade-offs** or **Edge Cases** (e.g., "LocalStorage confirmed, but should we handle data clearing or versioning?") before starting.
|
|
180
|
+
3. **Wait:** Do NOT invoke subagents or write code until the user clears the Gate.
|
|
181
|
+
4. **Reference:** Full protocol in `@[skills/brainstorming]`.
|
|
182
|
+
|
|
183
|
+
### 🏁 Final Checklist Protocol
|
|
184
|
+
|
|
185
|
+
**Trigger:** When the user says "son kontrolleri yap", "final checks", "çalıştır tüm testleri", or similar phrases.
|
|
186
|
+
|
|
187
|
+
| Task Stage | Command | Purpose |
|
|
188
|
+
| ---------------- | -------------------------------------------------- | ------------------------------ |
|
|
189
|
+
| **Manual Audit** | `python .agent/scripts/checklist.py .` | Priority-based project audit |
|
|
190
|
+
| **Pre-Deploy** | `python .agent/scripts/checklist.py . --url <URL>` | Full Suite + Performance + E2E |
|
|
191
|
+
|
|
192
|
+
**Priority Execution Order:**
|
|
193
|
+
|
|
194
|
+
1. **Security** → 2. **Lint** → 3. **Schema** → 4. **Tests** → 5. **UX** → 6. **Seo** → 7. **Lighthouse/E2E**
|
|
195
|
+
|
|
196
|
+
**Rules:**
|
|
197
|
+
|
|
198
|
+
- **Completion:** A task is NOT finished until `checklist.py` returns success.
|
|
199
|
+
- **Reporting:** If it fails, fix the **Critical** blockers first (Security/Lint).
|
|
200
|
+
|
|
201
|
+
**Available Scripts (12 total):**
|
|
202
|
+
|
|
203
|
+
| Script | Skill | When to Use |
|
|
204
|
+
| -------------------------- | --------------------- | ------------------- |
|
|
205
|
+
| `security_scan.py` | vulnerability-scanner | Always on deploy |
|
|
206
|
+
| `dependency_analyzer.py` | vulnerability-scanner | Weekly / Deploy |
|
|
207
|
+
| `lint_runner.py` | lint-and-validate | Every code change |
|
|
208
|
+
| `test_runner.py` | testing-patterns | After logic change |
|
|
209
|
+
| `schema_validator.py` | database-design | After DB change |
|
|
210
|
+
| `ux_audit.py` | frontend-design | After UI change |
|
|
211
|
+
| `accessibility_checker.py` | frontend-design | After UI change |
|
|
212
|
+
| `seo_checker.py` | seo-fundamentals | After page change |
|
|
213
|
+
| `bundle_analyzer.py` | performance-profiling | Before deploy |
|
|
214
|
+
| `mobile_audit.py` | mobile-design | After mobile change |
|
|
215
|
+
| `lighthouse_audit.py` | performance-profiling | Before deploy |
|
|
216
|
+
| `playwright_runner.py` | webapp-testing | Before deploy |
|
|
217
|
+
|
|
218
|
+
> 🔴 **Agents & Skills can invoke ANY script** via `python .agent/skills/<skill>/scripts/<script>.py`
|
|
219
|
+
|
|
220
|
+
### 🎭 Gemini Mode Mapping
|
|
221
|
+
|
|
222
|
+
| Mode | Agent | Behavior |
|
|
223
|
+
| -------- | ----------------- | -------------------------------------------- |
|
|
224
|
+
| **plan** | `project-planner` | 4-phase methodology. NO CODE before Phase 4. |
|
|
225
|
+
| **ask** | - | Focus on understanding. Ask questions. |
|
|
226
|
+
| **edit** | `orchestrator` | Execute. Check `{task-slug}.md` first. |
|
|
227
|
+
|
|
228
|
+
**Plan Mode (4-Phase):**
|
|
229
|
+
|
|
230
|
+
1. ANALYSIS → Research, questions
|
|
231
|
+
2. PLANNING → `{task-slug}.md`, task breakdown
|
|
232
|
+
3. SOLUTIONING → Architecture, design (NO CODE!)
|
|
233
|
+
4. IMPLEMENTATION → Code + tests
|
|
234
|
+
|
|
235
|
+
> 🔴 **Edit mode:** If multi-file or structural change → Offer to create `{task-slug}.md`. For single-file fixes → Proceed directly.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## TIER 2: DESIGN RULES (Reference)
|
|
240
|
+
|
|
241
|
+
> **Design rules are in the specialist agents, NOT here.**
|
|
242
|
+
|
|
243
|
+
| Task | Read |
|
|
244
|
+
| ------------ | ------------------------------- |
|
|
245
|
+
| Web UI/UX | `.agent/frontend-specialist.md` |
|
|
246
|
+
| Mobile UI/UX | `.agent/mobile-developer.md` |
|
|
247
|
+
|
|
248
|
+
**These agents contain:**
|
|
249
|
+
|
|
250
|
+
- Purple Ban (no violet/purple colors)
|
|
251
|
+
- Template Ban (no standard layouts)
|
|
252
|
+
- Anti-cliché rules
|
|
253
|
+
- Deep Design Thinking protocol
|
|
254
|
+
|
|
255
|
+
> 🔴 **For design work:** Open and READ the agent file. Rules are there.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 📁 QUICK REFERENCE
|
|
260
|
+
|
|
261
|
+
### Agents & Skills
|
|
262
|
+
|
|
263
|
+
- **Masters**: `orchestrator`, `project-planner`, `security-auditor` (Cyber/Audit), `backend-specialist` (API/DB), `frontend-specialist` (UI/UX), `mobile-developer`, `debugger`, `game-developer`
|
|
264
|
+
- **Key Skills**: `clean-code`, `brainstorming`, `app-builder`, `frontend-design`, `mobile-design`, `plan-writing`, `behavioral-modes`
|
|
265
|
+
|
|
266
|
+
### Key Scripts
|
|
267
|
+
|
|
268
|
+
- **Verify**: `.agent/scripts/verify_all.py`, `.agent/scripts/checklist.py`
|
|
269
|
+
- **Scanners**: `security_scan.py`, `dependency_analyzer.py`
|
|
270
|
+
- **Audits**: `ux_audit.py`, `mobile_audit.py`, `lighthouse_audit.py`, `seo_checker.py`
|
|
271
|
+
- **Test**: `playwright_runner.py`, `test_runner.py`
|
|
272
|
+
|
|
273
|
+
---
|