@silverassist/agents-toolkit 2.0.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/LICENSE +135 -0
- package/README.md +388 -0
- package/bin/cli.js +940 -0
- package/package.json +52 -0
- package/src/index.js +58 -0
- package/templates/agents/AGENTS.codex.md +195 -0
- package/templates/agents/AGENTS.md +195 -0
- package/templates/agents/CLAUDE.md +213 -0
- package/templates/agents/copilot-instructions.md +83 -0
- package/templates/shared/instructions/css-styling.instructions.md +142 -0
- package/templates/shared/instructions/documentation-language.instructions.md +216 -0
- package/templates/shared/instructions/github-workflow.instructions.md +245 -0
- package/templates/shared/instructions/php-standards.instructions.md +293 -0
- package/templates/shared/instructions/react-components.instructions.md +196 -0
- package/templates/shared/instructions/server-actions.instructions.md +429 -0
- package/templates/shared/instructions/testing-standards.instructions.md +264 -0
- package/templates/shared/instructions/tests.instructions.md +103 -0
- package/templates/shared/instructions/typescript.instructions.md +106 -0
- package/templates/shared/instructions/wordpress-plugin-architecture.instructions.md +238 -0
- package/templates/shared/prompts/README.md +129 -0
- package/templates/shared/prompts/_partials/README.md +57 -0
- package/templates/shared/prompts/_partials/documentation.md +203 -0
- package/templates/shared/prompts/_partials/git-operations.md +171 -0
- package/templates/shared/prompts/_partials/github-integration.md +100 -0
- package/templates/shared/prompts/_partials/jira-integration.md +155 -0
- package/templates/shared/prompts/_partials/pr-template.md +216 -0
- package/templates/shared/prompts/_partials/validations.md +87 -0
- package/templates/shared/prompts/add-tests.prompt.md +151 -0
- package/templates/shared/prompts/analyze-github-issue.prompt.md +73 -0
- package/templates/shared/prompts/analyze-ticket.prompt.md +63 -0
- package/templates/shared/prompts/create-plan.prompt.md +118 -0
- package/templates/shared/prompts/create-pr.prompt.md +139 -0
- package/templates/shared/prompts/finalize-pr.prompt.md +150 -0
- package/templates/shared/prompts/fix-issues.prompt.md +92 -0
- package/templates/shared/prompts/new-wp-component.prompt.md +51 -0
- package/templates/shared/prompts/new-wp-plugin.prompt.md +46 -0
- package/templates/shared/prompts/prepare-pr.prompt.md +123 -0
- package/templates/shared/prompts/prepare-release.prompt.md +74 -0
- package/templates/shared/prompts/quality-check.prompt.md +45 -0
- package/templates/shared/prompts/review-code.prompt.md +81 -0
- package/templates/shared/prompts/work-github-issue.prompt.md +96 -0
- package/templates/shared/prompts/work-ticket.prompt.md +98 -0
- package/templates/shared/skills/README.md +53 -0
- package/templates/shared/skills/component-architecture/SKILL.md +321 -0
- package/templates/shared/skills/create-component/SKILL.md +714 -0
- package/templates/shared/skills/domain-driven-design/SKILL.md +277 -0
- package/templates/shared/skills/plugin-creation/SKILL.md +1094 -0
- package/templates/shared/skills/quality-checks/SKILL.md +493 -0
- package/templates/shared/skills/release-management/SKILL.md +649 -0
- package/templates/shared/skills/testing/SKILL.md +682 -0
- package/templates/shared/skills/testing-patterns/SKILL.md +243 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-driven-design
|
|
3
|
+
description: Guide for organizing code using Domain-Driven Design principles. Use this when creating new features, restructuring folders, or ensuring consistent project organization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Domain-Driven Design (DDD) Skill
|
|
7
|
+
|
|
8
|
+
This skill provides guidelines for organizing code following Domain-Driven Design principles.
|
|
9
|
+
|
|
10
|
+
## Core Principles
|
|
11
|
+
|
|
12
|
+
1. **Group by Domain, Not by Type** - Organize files by business domain rather than technical type
|
|
13
|
+
2. **Clear Boundaries** - Each domain has well-defined responsibilities
|
|
14
|
+
3. **Self-Documenting Structure** - Folder names clearly communicate what the code does
|
|
15
|
+
4. **Colocation** - Related code (components, utils, tests) lives together
|
|
16
|
+
|
|
17
|
+
## Domain Organization Rules
|
|
18
|
+
|
|
19
|
+
### ✅ DO
|
|
20
|
+
|
|
21
|
+
- Create domain folders that match business concepts
|
|
22
|
+
- Keep domain-specific utilities inside domain folders
|
|
23
|
+
- Place tests in `__tests__/` subfolders within each domain
|
|
24
|
+
- Use clear, descriptive folder names
|
|
25
|
+
|
|
26
|
+
### ❌ DON'T
|
|
27
|
+
|
|
28
|
+
- Create generic folders like "helpers", "services", "utils" at root level
|
|
29
|
+
- Mix different domain concerns in the same folder
|
|
30
|
+
- Create deeply nested folder structures (max 3 levels)
|
|
31
|
+
- Use abbreviations in folder names
|
|
32
|
+
|
|
33
|
+
## Project Structure
|
|
34
|
+
|
|
35
|
+
### Components Domain
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
src/components/
|
|
39
|
+
├── auth/ # Authentication components
|
|
40
|
+
│ ├── login-form/
|
|
41
|
+
│ ├── register-form/
|
|
42
|
+
│ └── password-reset/
|
|
43
|
+
├── dashboard/ # Dashboard components
|
|
44
|
+
│ ├── stats-card/
|
|
45
|
+
│ ├── activity-feed/
|
|
46
|
+
│ └── charts/
|
|
47
|
+
├── checkout/ # Checkout flow components
|
|
48
|
+
│ ├── cart-summary/
|
|
49
|
+
│ ├── payment-form/
|
|
50
|
+
│ └── order-confirmation/
|
|
51
|
+
├── forms/ # Reusable form components
|
|
52
|
+
│ ├── contact-form/
|
|
53
|
+
│ └── newsletter-form/
|
|
54
|
+
├── layout/ # Layout components
|
|
55
|
+
│ ├── header/
|
|
56
|
+
│ ├── footer/
|
|
57
|
+
│ └── sidebar/
|
|
58
|
+
├── shared/ # Cross-domain reusable components
|
|
59
|
+
│ ├── loading-spinner/
|
|
60
|
+
│ ├── error-boundary/
|
|
61
|
+
│ └── empty-state/
|
|
62
|
+
└── ui/ # Primitive UI components
|
|
63
|
+
├── button/
|
|
64
|
+
├── input/
|
|
65
|
+
└── modal/
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Library Domain
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
src/lib/
|
|
72
|
+
├── api/ # API client utilities
|
|
73
|
+
│ ├── client.ts
|
|
74
|
+
│ ├── endpoints.ts
|
|
75
|
+
│ └── types.ts
|
|
76
|
+
├── auth/ # Authentication utilities
|
|
77
|
+
│ ├── session.ts
|
|
78
|
+
│ ├── tokens.ts
|
|
79
|
+
│ └── permissions.ts
|
|
80
|
+
├── email/ # Email automation
|
|
81
|
+
│ ├── templates.ts
|
|
82
|
+
│ ├── sender.ts
|
|
83
|
+
│ └── types.ts
|
|
84
|
+
├── payment/ # Payment processing
|
|
85
|
+
│ ├── stripe.ts
|
|
86
|
+
│ ├── checkout.ts
|
|
87
|
+
│ └── types.ts
|
|
88
|
+
└── utils/ # Generic utilities (keep minimal)
|
|
89
|
+
├── formatting.ts
|
|
90
|
+
└── validation.ts
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Actions Domain (Next.js Server Actions)
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
src/actions/
|
|
97
|
+
├── auth/ # Auth-related actions
|
|
98
|
+
│ ├── index.ts # Barrel export
|
|
99
|
+
│ ├── login.ts
|
|
100
|
+
│ ├── logout.ts
|
|
101
|
+
│ └── register.ts
|
|
102
|
+
├── checkout/ # Checkout actions
|
|
103
|
+
│ ├── index.ts # Barrel export
|
|
104
|
+
│ ├── create-order.ts
|
|
105
|
+
│ ├── process-payment.ts
|
|
106
|
+
│ └── add-to-cart.ts
|
|
107
|
+
├── contact/ # Contact form actions
|
|
108
|
+
│ ├── index.ts
|
|
109
|
+
│ └── submit-form.ts
|
|
110
|
+
└── user/ # User management actions
|
|
111
|
+
├── index.ts
|
|
112
|
+
├── update-profile.ts
|
|
113
|
+
└── change-password.ts
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Data Access Layer (DAL)
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
src/data/ # Data Access Layer - server-only
|
|
120
|
+
├── index.ts # Barrel export
|
|
121
|
+
├── user.ts # User data operations
|
|
122
|
+
├── product.ts # Product data operations
|
|
123
|
+
├── order.ts # Order data operations
|
|
124
|
+
└── auth.ts # Auth/session utilities
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
> **CRITICAL**: All files in `src/data/` must start with `import "server-only"` to prevent
|
|
128
|
+
> accidental client-side imports. See `server-actions.instructions.md` for security details.
|
|
129
|
+
|
|
130
|
+
## Barrel Export Pattern
|
|
131
|
+
|
|
132
|
+
Use **barrel exports** (`index.ts`) for folders with multiple internal files.
|
|
133
|
+
|
|
134
|
+
### Export Strategy by File Type
|
|
135
|
+
|
|
136
|
+
| File Type | Export Type | Reason |
|
|
137
|
+
|-----------|-------------|--------|
|
|
138
|
+
| Components | `export default` | Tree-shaking optimization (Next.js recommendation) |
|
|
139
|
+
| Helpers/Utils | `export { name }` | Multiple functions per file |
|
|
140
|
+
| Types | `export type { }` | Type-only exports |
|
|
141
|
+
| Actions | `export { name }` | Named functions for clarity |
|
|
142
|
+
| Hooks | `export { name }` | Named functions for clarity |
|
|
143
|
+
|
|
144
|
+
### When to Create Barrel Exports
|
|
145
|
+
|
|
146
|
+
- ✅ Domain folders with 3+ files
|
|
147
|
+
- ✅ Component folders with multiple related components
|
|
148
|
+
- ✅ When you want to hide internal file structure
|
|
149
|
+
- ❌ Single-file folders (unnecessary)
|
|
150
|
+
|
|
151
|
+
### Component Barrel Export
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
// src/components/auth/index.ts
|
|
155
|
+
// Components use "export default" in their files,
|
|
156
|
+
// barrel re-exports with names for convenient imports
|
|
157
|
+
export { default as LoginForm } from "./login-form";
|
|
158
|
+
export { default as RegisterForm } from "./register-form";
|
|
159
|
+
export { default as PasswordReset } from "./password-reset";
|
|
160
|
+
|
|
161
|
+
// Usage - Clean named imports
|
|
162
|
+
import { LoginForm, RegisterForm } from "@/components/auth";
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Library Barrel Export
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
// src/lib/payment/index.ts
|
|
169
|
+
// Libraries use named exports throughout
|
|
170
|
+
export { createCheckout, validateCart } from "./checkout";
|
|
171
|
+
export { processPayment, refundPayment } from "./stripe";
|
|
172
|
+
export type { PaymentIntent, CheckoutSession } from "./types";
|
|
173
|
+
|
|
174
|
+
// Usage
|
|
175
|
+
import {
|
|
176
|
+
createCheckout,
|
|
177
|
+
processPayment,
|
|
178
|
+
type PaymentIntent,
|
|
179
|
+
} from "@/lib/payment";
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Actions Barrel Export
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
// src/actions/checkout/index.ts
|
|
186
|
+
export { createOrder } from "./create-order";
|
|
187
|
+
export { processPayment } from "./process-payment";
|
|
188
|
+
export { addToCart } from "./add-to-cart";
|
|
189
|
+
|
|
190
|
+
// Usage
|
|
191
|
+
import { createOrder, addToCart } from "@/actions/checkout";
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Import Rules
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
// ✅ CORRECT: Import from domain barrel
|
|
198
|
+
import { LoginForm } from "@/components/auth";
|
|
199
|
+
import { createCheckout } from "@/lib/payment";
|
|
200
|
+
import { createOrder } from "@/actions/checkout";
|
|
201
|
+
|
|
202
|
+
// ❌ INCORRECT: Deep imports when barrel exists
|
|
203
|
+
import LoginForm from "@/components/auth/login-form";
|
|
204
|
+
import { createCheckout } from "@/lib/payment/checkout";
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Domain Boundaries
|
|
208
|
+
|
|
209
|
+
### Identifying Domains
|
|
210
|
+
|
|
211
|
+
Ask these questions to identify domains:
|
|
212
|
+
|
|
213
|
+
1. **What business concept does this code represent?**
|
|
214
|
+
2. **Who is the primary user of this functionality?**
|
|
215
|
+
3. **What would change together?**
|
|
216
|
+
|
|
217
|
+
### Example Domain Identification
|
|
218
|
+
|
|
219
|
+
| Feature | Domain | Reason |
|
|
220
|
+
|---------|--------|--------|
|
|
221
|
+
| Login form | `auth` | Authentication concern |
|
|
222
|
+
| Product card | `products` or `catalog` | Product display concern |
|
|
223
|
+
| Shopping cart | `checkout` | Purchase flow concern |
|
|
224
|
+
| User settings | `user` or `settings` | User management concern |
|
|
225
|
+
|
|
226
|
+
## Avoiding Common Mistakes
|
|
227
|
+
|
|
228
|
+
### ❌ Generic Folder Anti-Patterns
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
# ❌ BAD: Generic folders
|
|
232
|
+
src/
|
|
233
|
+
├── components/
|
|
234
|
+
├── helpers/ # What kind of helpers?
|
|
235
|
+
├── services/ # Too vague
|
|
236
|
+
├── utils/ # Catch-all folder
|
|
237
|
+
└── types/ # Types should live with their domain
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### ✅ Domain-Oriented Structure
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
# ✅ GOOD: Domain-oriented
|
|
244
|
+
src/
|
|
245
|
+
├── components/
|
|
246
|
+
│ ├── auth/
|
|
247
|
+
│ ├── checkout/
|
|
248
|
+
│ └── shared/
|
|
249
|
+
├── lib/
|
|
250
|
+
│ ├── auth/
|
|
251
|
+
│ ├── payment/
|
|
252
|
+
│ └── api/
|
|
253
|
+
└── actions/
|
|
254
|
+
├── auth/
|
|
255
|
+
└── checkout/
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Migration Strategy
|
|
259
|
+
|
|
260
|
+
When refactoring to DDD:
|
|
261
|
+
|
|
262
|
+
1. **Identify current pain points** - What's hard to find?
|
|
263
|
+
2. **Map business domains** - List all business concepts
|
|
264
|
+
3. **Plan folder structure** - Design new organization
|
|
265
|
+
4. **Migrate incrementally** - Move one domain at a time
|
|
266
|
+
5. **Update imports** - Use find-and-replace for import paths
|
|
267
|
+
6. **Add barrel exports** - Create index.ts files as you go
|
|
268
|
+
|
|
269
|
+
## Checklist
|
|
270
|
+
|
|
271
|
+
Before creating new code, verify:
|
|
272
|
+
|
|
273
|
+
- [ ] Code belongs to an identifiable business domain
|
|
274
|
+
- [ ] Domain folder already exists or should be created
|
|
275
|
+
- [ ] Related tests will live in `__tests__/` within the domain
|
|
276
|
+
- [ ] Imports use domain paths (not deep internal paths)
|
|
277
|
+
- [ ] No generic "utils" or "helpers" at root level
|