@namch/agent-assistant 1.0.0 → 1.0.2
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 +114 -522
- package/agents/backend-engineer.md +0 -8
- package/agents/brainstormer.md +0 -6
- package/agents/business-analyst.md +0 -5
- package/agents/database-architect.md +0 -6
- package/agents/debugger.md +0 -6
- package/agents/designer.md +0 -5
- package/agents/devops-engineer.md +0 -7
- package/agents/docs-manager.md +0 -6
- package/agents/frontend-engineer.md +0 -7
- package/agents/game-engineer.md +0 -7
- package/agents/mobile-engineer.md +0 -7
- package/agents/performance-engineer.md +0 -7
- package/agents/planner.md +0 -6
- package/agents/project-manager.md +0 -6
- package/agents/researcher.md +0 -5
- package/agents/reviewer.md +0 -6
- package/agents/scouter.md +0 -6
- package/agents/security-engineer.md +0 -7
- package/agents/tech-lead.md +0 -7
- package/agents/tester.md +0 -5
- package/cli/README.md +19 -10
- package/documents/business/business-features.md +1 -1
- package/documents/business/business-prd.md +4 -4
- package/documents/knowledge-architecture.md +1 -1
- package/documents/knowledge-domain.md +1 -1
- package/documents/knowledge-overview.md +14 -29
- package/documents/knowledge-source-base.md +14 -14
- package/package.json +1 -1
- package/rules/QUICK-REFERENCE.md +4 -1
- package/rules/SKILL-DISCOVERY.md +37 -14
- package/skills/active-directory-attacks/SKILL.md +383 -0
- package/skills/active-directory-attacks/references/advanced-attacks.md +382 -0
- package/skills/agent-evaluation/SKILL.md +64 -0
- package/skills/agent-memory-mcp/SKILL.md +82 -0
- package/skills/agent-memory-systems/SKILL.md +67 -0
- package/skills/agent-tool-builder/SKILL.md +53 -0
- package/skills/ai-agents-architect/SKILL.md +90 -0
- package/skills/ai-product/SKILL.md +54 -0
- package/skills/ai-wrapper-product/SKILL.md +273 -0
- package/skills/api-documentation-generator/SKILL.md +484 -0
- package/skills/api-fuzzing-bug-bounty/SKILL.md +433 -0
- package/skills/api-security-best-practices/SKILL.md +907 -0
- package/skills/autonomous-agent-patterns/SKILL.md +761 -0
- package/skills/autonomous-agents/SKILL.md +68 -0
- package/skills/aws-penetration-testing/SKILL.md +405 -0
- package/skills/aws-penetration-testing/references/advanced-aws-pentesting.md +469 -0
- package/skills/azure-functions/SKILL.md +42 -0
- package/skills/backend-dev-guidelines/SKILL.md +342 -0
- package/skills/backend-dev-guidelines/resources/architecture-overview.md +451 -0
- package/skills/backend-dev-guidelines/resources/async-and-errors.md +307 -0
- package/skills/backend-dev-guidelines/resources/complete-examples.md +638 -0
- package/skills/backend-dev-guidelines/resources/configuration.md +275 -0
- package/skills/backend-dev-guidelines/resources/database-patterns.md +224 -0
- package/skills/backend-dev-guidelines/resources/middleware-guide.md +213 -0
- package/skills/backend-dev-guidelines/resources/routing-and-controllers.md +756 -0
- package/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +336 -0
- package/skills/backend-dev-guidelines/resources/services-and-repositories.md +789 -0
- package/skills/backend-dev-guidelines/resources/testing-guide.md +235 -0
- package/skills/backend-dev-guidelines/resources/validation-patterns.md +754 -0
- package/skills/broken-authentication/SKILL.md +476 -0
- package/skills/bullmq-specialist/SKILL.md +57 -0
- package/skills/bun-development/SKILL.md +691 -0
- package/skills/burp-suite-testing/SKILL.md +380 -0
- package/skills/cloud-penetration-testing/SKILL.md +501 -0
- package/skills/cloud-penetration-testing/references/advanced-cloud-scripts.md +318 -0
- package/skills/computer-use-agents/SKILL.md +315 -0
- package/skills/content-creator/SKILL.md +248 -0
- package/skills/content-creator/assets/content_calendar_template.md +99 -0
- package/skills/content-creator/references/brand_guidelines.md +199 -0
- package/skills/content-creator/references/content_frameworks.md +534 -0
- package/skills/content-creator/references/social_media_optimization.md +317 -0
- package/skills/content-creator/scripts/brand_voice_analyzer.py +185 -0
- package/skills/content-creator/scripts/seo_optimizer.py +419 -0
- package/skills/context-window-management/SKILL.md +53 -0
- package/skills/conversation-memory/SKILL.md +61 -0
- package/skills/copy-editing/SKILL.md +439 -0
- package/skills/copywriting/SKILL.md +225 -0
- package/skills/crewai/SKILL.md +243 -0
- package/skills/discord-bot-architect/SKILL.md +277 -0
- package/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/skills/email-sequence/SKILL.md +925 -0
- package/skills/email-systems/SKILL.md +54 -0
- package/skills/ethical-hacking-methodology/SKILL.md +466 -0
- package/skills/executing-plans/SKILL.md +76 -0
- package/skills/file-path-traversal/SKILL.md +486 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-dev-guidelines/SKILL.md +359 -0
- package/skills/frontend-dev-guidelines/resources/common-patterns.md +331 -0
- package/skills/frontend-dev-guidelines/resources/complete-examples.md +872 -0
- package/skills/frontend-dev-guidelines/resources/component-patterns.md +502 -0
- package/skills/frontend-dev-guidelines/resources/data-fetching.md +767 -0
- package/skills/frontend-dev-guidelines/resources/file-organization.md +502 -0
- package/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +501 -0
- package/skills/frontend-dev-guidelines/resources/performance.md +406 -0
- package/skills/frontend-dev-guidelines/resources/routing-guide.md +364 -0
- package/skills/frontend-dev-guidelines/resources/styling-guide.md +428 -0
- package/skills/frontend-dev-guidelines/resources/typescript-standards.md +418 -0
- package/skills/gcp-cloud-run/SKILL.md +288 -0
- package/skills/git-pushing/SKILL.md +33 -0
- package/skills/git-pushing/scripts/smart_commit.sh +19 -0
- package/skills/github-workflow-automation/SKILL.md +846 -0
- package/skills/html-injection-testing/SKILL.md +498 -0
- package/skills/idor-testing/SKILL.md +442 -0
- package/skills/inngest/SKILL.md +55 -0
- package/skills/javascript-mastery/SKILL.md +645 -0
- package/skills/kaizen/SKILL.md +730 -0
- package/skills/langfuse/SKILL.md +238 -0
- package/skills/langgraph/SKILL.md +287 -0
- package/skills/linux-privilege-escalation/SKILL.md +504 -0
- package/skills/llm-app-patterns/SKILL.md +760 -0
- package/skills/metasploit-framework/SKILL.md +478 -0
- package/skills/multi-agent-brainstorming/SKILL.md +256 -0
- package/skills/neon-postgres/SKILL.md +56 -0
- package/skills/nextjs-supabase-auth/SKILL.md +56 -0
- package/skills/nosql-expert/SKILL.md +111 -0
- package/skills/pentest-checklist/SKILL.md +334 -0
- package/skills/pentest-commands/SKILL.md +438 -0
- package/skills/plaid-fintech/SKILL.md +50 -0
- package/skills/planning-with-files/SKILL.md +211 -0
- package/skills/planning-with-files/examples.md +202 -0
- package/skills/planning-with-files/reference.md +218 -0
- package/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/skills/planning-with-files/templates/findings.md +95 -0
- package/skills/planning-with-files/templates/progress.md +114 -0
- package/skills/planning-with-files/templates/task_plan.md +132 -0
- package/skills/privilege-escalation-methods/SKILL.md +333 -0
- package/skills/production-code-audit/SKILL.md +540 -0
- package/skills/prompt-caching/SKILL.md +61 -0
- package/skills/prompt-engineering/SKILL.md +171 -0
- package/skills/prompt-library/SKILL.md +322 -0
- package/skills/rag-engineer/SKILL.md +90 -0
- package/skills/rag-implementation/SKILL.md +63 -0
- package/skills/react-ui-patterns/SKILL.md +289 -0
- package/skills/red-team-tools/SKILL.md +310 -0
- package/skills/scanning-tools/SKILL.md +589 -0
- package/skills/shodan-reconnaissance/SKILL.md +503 -0
- package/skills/slack-bot-builder/SKILL.md +264 -0
- package/skills/smtp-penetration-testing/SKILL.md +500 -0
- package/skills/social-content/SKILL.md +807 -0
- package/skills/software-architecture/SKILL.md +75 -0
- package/skills/sql-injection-testing/SKILL.md +448 -0
- package/skills/sqlmap-database-pentesting/SKILL.md +400 -0
- package/skills/ssh-penetration-testing/SKILL.md +488 -0
- package/skills/stripe-integration/SKILL.md +69 -0
- package/skills/subagent-driven-development/SKILL.md +240 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tavily-web/SKILL.md +36 -0
- package/skills/telegram-bot-builder/SKILL.md +254 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/test-fixing/SKILL.md +119 -0
- package/skills/top-web-vulnerabilities/SKILL.md +543 -0
- package/skills/trigger-dev/SKILL.md +67 -0
- package/skills/twilio-communications/SKILL.md +295 -0
- package/skills/upstash-qstash/SKILL.md +68 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/voice-agents/SKILL.md +68 -0
- package/skills/voice-ai-development/SKILL.md +302 -0
- package/skills/windows-privilege-escalation/SKILL.md +496 -0
- package/skills/wireshark-analysis/SKILL.md +497 -0
- package/skills/wordpress-penetration-testing/SKILL.md +485 -0
- package/skills/workflow-automation/SKILL.md +68 -0
- package/skills/xss-html-injection/SKILL.md +499 -0
- package/skills/zapier-make-patterns/SKILL.md +67 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Async Patterns and Error Handling
|
|
2
|
+
|
|
3
|
+
Complete guide to async/await patterns and custom error handling.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Async/Await Best Practices](#asyncawait-best-practices)
|
|
8
|
+
- [Promise Error Handling](#promise-error-handling)
|
|
9
|
+
- [Custom Error Types](#custom-error-types)
|
|
10
|
+
- [asyncErrorWrapper Utility](#asyncerrorwrapper-utility)
|
|
11
|
+
- [Error Propagation](#error-propagation)
|
|
12
|
+
- [Common Async Pitfalls](#common-async-pitfalls)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Async/Await Best Practices
|
|
17
|
+
|
|
18
|
+
### Always Use Try-Catch
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// ❌ NEVER: Unhandled async errors
|
|
22
|
+
async function fetchData() {
|
|
23
|
+
const data = await database.query(); // If throws, unhandled!
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ✅ ALWAYS: Wrap in try-catch
|
|
28
|
+
async function fetchData() {
|
|
29
|
+
try {
|
|
30
|
+
const data = await database.query();
|
|
31
|
+
return data;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
Sentry.captureException(error);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Avoid .then() Chains
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// ❌ AVOID: Promise chains
|
|
43
|
+
function processData() {
|
|
44
|
+
return fetchData()
|
|
45
|
+
.then(data => transform(data))
|
|
46
|
+
.then(transformed => save(transformed))
|
|
47
|
+
.catch(error => {
|
|
48
|
+
console.error(error);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ✅ PREFER: Async/await
|
|
53
|
+
async function processData() {
|
|
54
|
+
try {
|
|
55
|
+
const data = await fetchData();
|
|
56
|
+
const transformed = await transform(data);
|
|
57
|
+
return await save(transformed);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
Sentry.captureException(error);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Promise Error Handling
|
|
68
|
+
|
|
69
|
+
### Parallel Operations
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// ✅ Handle errors in Promise.all
|
|
73
|
+
try {
|
|
74
|
+
const [users, profiles, settings] = await Promise.all([
|
|
75
|
+
userService.getAll(),
|
|
76
|
+
profileService.getAll(),
|
|
77
|
+
settingsService.getAll(),
|
|
78
|
+
]);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
// One failure fails all
|
|
81
|
+
Sentry.captureException(error);
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ✅ Handle errors individually with Promise.allSettled
|
|
86
|
+
const results = await Promise.allSettled([
|
|
87
|
+
userService.getAll(),
|
|
88
|
+
profileService.getAll(),
|
|
89
|
+
settingsService.getAll(),
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
results.forEach((result, index) => {
|
|
93
|
+
if (result.status === 'rejected') {
|
|
94
|
+
Sentry.captureException(result.reason, {
|
|
95
|
+
tags: { operation: ['users', 'profiles', 'settings'][index] }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Custom Error Types
|
|
104
|
+
|
|
105
|
+
### Define Custom Errors
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Base error class
|
|
109
|
+
export class AppError extends Error {
|
|
110
|
+
constructor(
|
|
111
|
+
message: string,
|
|
112
|
+
public code: string,
|
|
113
|
+
public statusCode: number,
|
|
114
|
+
public isOperational: boolean = true
|
|
115
|
+
) {
|
|
116
|
+
super(message);
|
|
117
|
+
this.name = this.constructor.name;
|
|
118
|
+
Error.captureStackTrace(this, this.constructor);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Specific error types
|
|
123
|
+
export class ValidationError extends AppError {
|
|
124
|
+
constructor(message: string) {
|
|
125
|
+
super(message, 'VALIDATION_ERROR', 400);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export class NotFoundError extends AppError {
|
|
130
|
+
constructor(message: string) {
|
|
131
|
+
super(message, 'NOT_FOUND', 404);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export class ForbiddenError extends AppError {
|
|
136
|
+
constructor(message: string) {
|
|
137
|
+
super(message, 'FORBIDDEN', 403);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export class ConflictError extends AppError {
|
|
142
|
+
constructor(message: string) {
|
|
143
|
+
super(message, 'CONFLICT', 409);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Usage
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
// Throw specific errors
|
|
152
|
+
if (!user) {
|
|
153
|
+
throw new NotFoundError('User not found');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (user.age < 18) {
|
|
157
|
+
throw new ValidationError('User must be 18+');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Error boundary handles them
|
|
161
|
+
function errorBoundary(error, req, res, next) {
|
|
162
|
+
if (error instanceof AppError) {
|
|
163
|
+
return res.status(error.statusCode).json({
|
|
164
|
+
error: {
|
|
165
|
+
message: error.message,
|
|
166
|
+
code: error.code
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Unknown error
|
|
172
|
+
Sentry.captureException(error);
|
|
173
|
+
res.status(500).json({ error: { message: 'Internal server error' } });
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## asyncErrorWrapper Utility
|
|
180
|
+
|
|
181
|
+
### Pattern
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
export function asyncErrorWrapper(
|
|
185
|
+
handler: (req: Request, res: Response, next: NextFunction) => Promise<any>
|
|
186
|
+
) {
|
|
187
|
+
return async (req: Request, res: Response, next: NextFunction) => {
|
|
188
|
+
try {
|
|
189
|
+
await handler(req, res, next);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
next(error);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Usage
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// Without wrapper - error can be unhandled
|
|
201
|
+
router.get('/users', async (req, res) => {
|
|
202
|
+
const users = await userService.getAll(); // If throws, unhandled!
|
|
203
|
+
res.json(users);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// With wrapper - errors caught
|
|
207
|
+
router.get('/users', asyncErrorWrapper(async (req, res) => {
|
|
208
|
+
const users = await userService.getAll();
|
|
209
|
+
res.json(users);
|
|
210
|
+
}));
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Error Propagation
|
|
216
|
+
|
|
217
|
+
### Proper Error Chains
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// ✅ Propagate errors up the stack
|
|
221
|
+
async function repositoryMethod() {
|
|
222
|
+
try {
|
|
223
|
+
return await PrismaService.main.user.findMany();
|
|
224
|
+
} catch (error) {
|
|
225
|
+
Sentry.captureException(error, { tags: { layer: 'repository' } });
|
|
226
|
+
throw error; // Propagate to service
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async function serviceMethod() {
|
|
231
|
+
try {
|
|
232
|
+
return await repositoryMethod();
|
|
233
|
+
} catch (error) {
|
|
234
|
+
Sentry.captureException(error, { tags: { layer: 'service' } });
|
|
235
|
+
throw error; // Propagate to controller
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function controllerMethod(req, res) {
|
|
240
|
+
try {
|
|
241
|
+
const result = await serviceMethod();
|
|
242
|
+
res.json(result);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
this.handleError(error, res, 'controllerMethod'); // Final handler
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Common Async Pitfalls
|
|
252
|
+
|
|
253
|
+
### Fire and Forget (Bad)
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
// ❌ NEVER: Fire and forget
|
|
257
|
+
async function processRequest(req, res) {
|
|
258
|
+
sendEmail(user.email); // Fires async, errors unhandled!
|
|
259
|
+
res.json({ success: true });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ✅ ALWAYS: Await or handle
|
|
263
|
+
async function processRequest(req, res) {
|
|
264
|
+
try {
|
|
265
|
+
await sendEmail(user.email);
|
|
266
|
+
res.json({ success: true });
|
|
267
|
+
} catch (error) {
|
|
268
|
+
Sentry.captureException(error);
|
|
269
|
+
res.status(500).json({ error: 'Failed to send email' });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// ✅ OR: Intentional background task
|
|
274
|
+
async function processRequest(req, res) {
|
|
275
|
+
sendEmail(user.email).catch(error => {
|
|
276
|
+
Sentry.captureException(error);
|
|
277
|
+
});
|
|
278
|
+
res.json({ success: true });
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Unhandled Rejections
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
// ✅ Global handler for unhandled rejections
|
|
286
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
287
|
+
Sentry.captureException(reason, {
|
|
288
|
+
tags: { type: 'unhandled_rejection' }
|
|
289
|
+
});
|
|
290
|
+
console.error('Unhandled Rejection:', reason);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
process.on('uncaughtException', (error) => {
|
|
294
|
+
Sentry.captureException(error, {
|
|
295
|
+
tags: { type: 'uncaught_exception' }
|
|
296
|
+
});
|
|
297
|
+
console.error('Uncaught Exception:', error);
|
|
298
|
+
process.exit(1);
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
**Related Files:**
|
|
305
|
+
- [SKILL.md](SKILL.md)
|
|
306
|
+
- [sentry-and-monitoring.md](sentry-and-monitoring.md)
|
|
307
|
+
- [complete-examples.md](complete-examples.md)
|