@smartsoft001/pro-claude-plugins 0.2.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/.claude-plugin/marketplace.json +26 -0
- package/README.md +56 -0
- package/package.json +14 -0
- package/plugins/flow/.claude-plugin/README.md +91 -0
- package/plugins/flow/.claude-plugin/merge-permissions.js +115 -0
- package/plugins/flow/.claude-plugin/plugin.json +5 -0
- package/plugins/flow/.claude-plugin/settings.template.json +86 -0
- package/plugins/flow/agents/angular-component-scaffolder.md +176 -0
- package/plugins/flow/agents/angular-directive-builder.md +154 -0
- package/plugins/flow/agents/angular-guard-builder.md +244 -0
- package/plugins/flow/agents/angular-jest-test-writer.md +475 -0
- package/plugins/flow/agents/angular-pipe-builder.md +170 -0
- package/plugins/flow/agents/angular-resolver-builder.md +287 -0
- package/plugins/flow/agents/angular-service-builder.md +162 -0
- package/plugins/flow/agents/angular-signal-state-builder.md +340 -0
- package/plugins/flow/agents/angular-test-diagnostician.md +279 -0
- package/plugins/flow/agents/angular-testbed-configurator.md +315 -0
- package/plugins/flow/agents/arch-scaffolder.md +278 -0
- package/plugins/flow/agents/e2e-data-testid-injector.md +195 -0
- package/plugins/flow/agents/e2e-project-scaffolder.md +194 -0
- package/plugins/flow/agents/e2e-test-writer.md +357 -0
- package/plugins/flow/agents/shared-agent-evolver.md +294 -0
- package/plugins/flow/agents/shared-build-verifier.md +160 -0
- package/plugins/flow/agents/shared-config-updater.md +310 -0
- package/plugins/flow/agents/shared-coverage-enforcer.md +184 -0
- package/plugins/flow/agents/shared-error-handler.md +217 -0
- package/plugins/flow/agents/shared-file-creator.md +344 -0
- package/plugins/flow/agents/shared-impl-orchestrator.md +312 -0
- package/plugins/flow/agents/shared-impl-reporter.md +368 -0
- package/plugins/flow/agents/shared-impl-teammate.md +201 -0
- package/plugins/flow/agents/shared-linear-subtask-iterator.md +337 -0
- package/plugins/flow/agents/shared-logic-implementer.md +244 -0
- package/plugins/flow/agents/shared-maia-api.md +26 -0
- package/plugins/flow/agents/shared-parallelization-analyzer.md +343 -0
- package/plugins/flow/agents/shared-performance-validator.md +168 -0
- package/plugins/flow/agents/shared-plan-perspective.md +271 -0
- package/plugins/flow/agents/shared-project-standardizer.md +205 -0
- package/plugins/flow/agents/shared-report-synthesizer.md +188 -0
- package/plugins/flow/agents/shared-review-teammate.md +189 -0
- package/plugins/flow/agents/shared-security-scanner.md +186 -0
- package/plugins/flow/agents/shared-style-enforcer.md +230 -0
- package/plugins/flow/agents/shared-subtask-dependency-analyzer.md +189 -0
- package/plugins/flow/agents/shared-tdd-developer.md +350 -0
- package/plugins/flow/agents/shared-team-coordinator.md +192 -0
- package/plugins/flow/agents/shared-test-fixer.md +186 -0
- package/plugins/flow/agents/shared-test-runner.md +191 -0
- package/plugins/flow/agents/shared-ui-classifier.md +263 -0
- package/plugins/flow/agents/shared-verification-orchestrator.md +194 -0
- package/plugins/flow/agents/shared-verification-runner.md +140 -0
- package/plugins/flow/agents/ui-a11y-validator.md +305 -0
- package/plugins/flow/agents/ui-screenshot-reporter.md +329 -0
- package/plugins/flow/agents/ui-web-designer.md +214 -0
- package/plugins/flow/scripts/compute-session-tokens.sh +39 -0
- package/plugins/flow/skills/a11y-audit/SKILL.md +214 -0
- package/plugins/flow/skills/angular-patterns/SKILL.md +191 -0
- package/plugins/flow/skills/browser-capture/SKILL.md +238 -0
- package/plugins/flow/skills/commit/SKILL.md +259 -0
- package/plugins/flow/skills/debug-helper/SKILL.md +375 -0
- package/plugins/flow/skills/impl/SKILL.md +992 -0
- package/plugins/flow/skills/karpathy-guidelines/SKILL.md +72 -0
- package/plugins/flow/skills/linear-suggestion/SKILL.md +132 -0
- package/plugins/flow/skills/maia-files-delete/SKILL.md +59 -0
- package/plugins/flow/skills/maia-files-upload/SKILL.md +57 -0
- package/plugins/flow/skills/nx-conventions/SKILL.md +326 -0
- package/plugins/flow/skills/plan/SKILL.md +1033 -0
- package/plugins/flow/skills/push/SKILL.md +759 -0
- package/plugins/flow/skills/review/SKILL.md +443 -0
- package/plugins/flow/skills/test-e2e/SKILL.md +164 -0
- package/plugins/flow/skills/test-unit/SKILL.md +456 -0
- package/plugins/flow-external/.claude-plugin/README.md +146 -0
- package/plugins/flow-external/.claude-plugin/merge-permissions.js +94 -0
- package/plugins/flow-external/.claude-plugin/plugin.json +5 -0
- package/plugins/flow-external/.claude-plugin/settings.template.json +78 -0
- package/plugins/flow-external/agents/angular-component-scaffolder.md +271 -0
- package/plugins/flow-external/agents/angular-directive-builder.md +134 -0
- package/plugins/flow-external/agents/angular-guard-builder.md +73 -0
- package/plugins/flow-external/agents/angular-pipe-builder.md +90 -0
- package/plugins/flow-external/agents/angular-resolver-builder.md +79 -0
- package/plugins/flow-external/agents/angular-service-builder.md +168 -0
- package/plugins/flow-external/agents/angular-state-builder.md +263 -0
- package/plugins/flow-external/agents/shared-build-verifier.md +67 -0
- package/plugins/flow-external/agents/shared-impl-orchestrator.md +90 -0
- package/plugins/flow-external/agents/shared-impl-reporter.md +135 -0
- package/plugins/flow-external/agents/shared-linear-subtask-iterator.md +70 -0
- package/plugins/flow-external/agents/shared-ui-classifier.md +38 -0
- package/plugins/flow-external/agents/ui-web-designer.md +203 -0
- package/plugins/flow-external/scripts/compute-session-tokens.sh +39 -0
- package/plugins/flow-external/skills/a11y-audit/SKILL.md +97 -0
- package/plugins/flow-external/skills/angular-cli-conventions/SKILL.md +268 -0
- package/plugins/flow-external/skills/angular-patterns/SKILL.md +182 -0
- package/plugins/flow-external/skills/browser-capture/SKILL.md +74 -0
- package/plugins/flow-external/skills/commit/SKILL.md +114 -0
- package/plugins/flow-external/skills/debug-helper/SKILL.md +135 -0
- package/plugins/flow-external/skills/impl/SKILL.md +218 -0
- package/plugins/flow-external/skills/karpathy-guidelines/SKILL.md +72 -0
- package/plugins/flow-external/skills/linear-suggestion/SKILL.md +62 -0
- package/plugins/flow-external/skills/maia-files-delete/SKILL.md +34 -0
- package/plugins/flow-external/skills/maia-files-upload/SKILL.md +41 -0
- package/plugins/flow-external/skills/plan/SKILL.md +334 -0
- package/plugins/flow-external/skills/push/SKILL.md +232 -0
- package/plugins/flow-legacy/.claude-plugin/README.md +143 -0
- package/plugins/flow-legacy/.claude-plugin/merge-permissions.js +94 -0
- package/plugins/flow-legacy/.claude-plugin/plugin.json +5 -0
- package/plugins/flow-legacy/.claude-plugin/settings.template.json +79 -0
- package/plugins/flow-legacy/agents/angular-component-scaffolder.md +327 -0
- package/plugins/flow-legacy/agents/angular-directive-builder.md +253 -0
- package/plugins/flow-legacy/agents/angular-guard-builder.md +326 -0
- package/plugins/flow-legacy/agents/angular-pipe-builder.md +238 -0
- package/plugins/flow-legacy/agents/angular-resolver-builder.md +339 -0
- package/plugins/flow-legacy/agents/angular-service-builder.md +271 -0
- package/plugins/flow-legacy/agents/angular-state-builder.md +480 -0
- package/plugins/flow-legacy/agents/shared-impl-orchestrator.md +174 -0
- package/plugins/flow-legacy/agents/shared-impl-reporter.md +232 -0
- package/plugins/flow-legacy/agents/shared-linear-subtask-iterator.md +198 -0
- package/plugins/flow-legacy/agents/shared-tdd-developer.md +307 -0
- package/plugins/flow-legacy/agents/shared-test-runner.md +133 -0
- package/plugins/flow-legacy/agents/shared-ui-classifier.md +145 -0
- package/plugins/flow-legacy/scripts/compute-session-tokens.sh +39 -0
- package/plugins/flow-legacy/skills/a11y-audit/SKILL.md +214 -0
- package/plugins/flow-legacy/skills/angular-patterns/SKILL.md +346 -0
- package/plugins/flow-legacy/skills/browser-capture/SKILL.md +238 -0
- package/plugins/flow-legacy/skills/commit/SKILL.md +215 -0
- package/plugins/flow-legacy/skills/debug-helper/SKILL.md +395 -0
- package/plugins/flow-legacy/skills/impl/SKILL.md +710 -0
- package/plugins/flow-legacy/skills/karpathy-guidelines/SKILL.md +72 -0
- package/plugins/flow-legacy/skills/linear-suggestion/SKILL.md +132 -0
- package/plugins/flow-legacy/skills/maia-files-delete/SKILL.md +59 -0
- package/plugins/flow-legacy/skills/maia-files-upload/SKILL.md +57 -0
- package/plugins/flow-legacy/skills/nx-conventions/SKILL.md +368 -0
- package/plugins/flow-legacy/skills/plan/SKILL.md +742 -0
- package/plugins/flow-legacy/skills/push/SKILL.md +645 -0
- package/plugins/flow-legacy/skills/test-unit/SKILL.md +500 -0
- package/plugins/smart-pro/.claude-plugin/README.md +115 -0
- package/plugins/smart-pro/.claude-plugin/merge-permissions.js +129 -0
- package/plugins/smart-pro/.claude-plugin/plugin.json +5 -0
- package/plugins/smart-pro/.claude-plugin/settings.template.json +94 -0
- package/plugins/smart-pro/agents/angular-components/AGENT.md +214 -0
- package/plugins/smart-pro/hooks/CONFIG.md +198 -0
- package/plugins/smart-pro/hooks/README.md +139 -0
- package/plugins/smart-pro/hooks/audit_logger.py +107 -0
- package/plugins/smart-pro/hooks/auto_format.sh +11 -0
- package/plugins/smart-pro/hooks/hooks.json +79 -0
- package/plugins/smart-pro/hooks/safety_validator.py +129 -0
- package/plugins/smart-pro/hooks/sensitive_file_blocker.py +58 -0
- package/plugins/smart-pro/hooks/skill_validator.py +220 -0
- package/plugins/smart-pro/skills/angular-components-action-panel/SKILL.md +159 -0
- package/plugins/smart-pro/skills/angular-components-avatar/SKILL.md +142 -0
- package/plugins/smart-pro/skills/angular-components-badge/SKILL.md +110 -0
- package/plugins/smart-pro/skills/angular-components-breadcrumbs/SKILL.md +91 -0
- package/plugins/smart-pro/skills/angular-components-button/SKILL.md +146 -0
- package/plugins/smart-pro/skills/angular-components-button-group/SKILL.md +121 -0
- package/plugins/smart-pro/skills/angular-components-calendar/SKILL.md +78 -0
- package/plugins/smart-pro/skills/angular-components-card/SKILL.md +110 -0
- package/plugins/smart-pro/skills/angular-components-card-heading/SKILL.md +105 -0
- package/plugins/smart-pro/skills/angular-components-command-palette/SKILL.md +168 -0
- package/plugins/smart-pro/skills/angular-components-container/SKILL.md +93 -0
- package/plugins/smart-pro/skills/angular-components-description-list/SKILL.md +102 -0
- package/plugins/smart-pro/skills/angular-components-details/SKILL.md +70 -0
- package/plugins/smart-pro/skills/angular-components-divider/SKILL.md +110 -0
- package/plugins/smart-pro/skills/angular-components-drawer/SKILL.md +136 -0
- package/plugins/smart-pro/skills/angular-components-dropdown/SKILL.md +131 -0
- package/plugins/smart-pro/skills/angular-components-empty-state/SKILL.md +103 -0
- package/plugins/smart-pro/skills/angular-components-feed/SKILL.md +110 -0
- package/plugins/smart-pro/skills/angular-components-form/SKILL.md +77 -0
- package/plugins/smart-pro/skills/angular-components-grid-list/SKILL.md +91 -0
- package/plugins/smart-pro/skills/angular-components-input/SKILL.md +118 -0
- package/plugins/smart-pro/skills/angular-components-list/SKILL.md +75 -0
- package/plugins/smart-pro/skills/angular-components-list-container/SKILL.md +106 -0
- package/plugins/smart-pro/skills/angular-components-media-object/SKILL.md +133 -0
- package/plugins/smart-pro/skills/angular-components-modal/SKILL.md +159 -0
- package/plugins/smart-pro/skills/angular-components-multi-column-layout/SKILL.md +84 -0
- package/plugins/smart-pro/skills/angular-components-navbar/SKILL.md +93 -0
- package/plugins/smart-pro/skills/angular-components-notification/SKILL.md +147 -0
- package/plugins/smart-pro/skills/angular-components-page/SKILL.md +162 -0
- package/plugins/smart-pro/skills/angular-components-page-heading/SKILL.md +96 -0
- package/plugins/smart-pro/skills/angular-components-paging/SKILL.md +86 -0
- package/plugins/smart-pro/skills/angular-components-progress-bars/SKILL.md +94 -0
- package/plugins/smart-pro/skills/angular-components-searchbar/SKILL.md +113 -0
- package/plugins/smart-pro/skills/angular-components-section-heading/SKILL.md +156 -0
- package/plugins/smart-pro/skills/angular-components-select-menu/SKILL.md +101 -0
- package/plugins/smart-pro/skills/angular-components-sidebar-layout/SKILL.md +121 -0
- package/plugins/smart-pro/skills/angular-components-sidebar-navigation/SKILL.md +80 -0
- package/plugins/smart-pro/skills/angular-components-sign-in-form/SKILL.md +91 -0
- package/plugins/smart-pro/skills/angular-components-stacked-layout/SKILL.md +114 -0
- package/plugins/smart-pro/skills/angular-components-stacked-list/SKILL.md +93 -0
- package/plugins/smart-pro/skills/angular-components-stats/SKILL.md +87 -0
- package/plugins/smart-pro/skills/angular-components-table/SKILL.md +98 -0
- package/plugins/smart-pro/skills/angular-components-tabs/SKILL.md +99 -0
- package/plugins/smart-pro/skills/angular-components-textarea/SKILL.md +111 -0
- package/plugins/smart-pro/skills/angular-components-toggle/SKILL.md +109 -0
- package/plugins/smart-pro/skills/angular-components-vertical-navigation/SKILL.md +139 -0
- package/plugins/smart-pro/skills/audit-log/SKILL.md +82 -0
- package/plugins/smart-pro/skills/format-code/SKILL.md +46 -0
- package/plugins/smart-pro/skills/project-conventions/SKILL.md +90 -0
- package/plugins/smart-pro/skills/safety-check/SKILL.md +0 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +7 -0
- package/src/index.js.map +1 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-helper
|
|
3
|
+
description: Cross-stack debugging workflows for Angular 14, NestJS, and MongoDB applications
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debug Helper (Angular 14 Legacy)
|
|
7
|
+
|
|
8
|
+
This skill provides debugging workflows and techniques for Angular 14 legacy projects.
|
|
9
|
+
|
|
10
|
+
## 1. Angular 14 Debugging
|
|
11
|
+
|
|
12
|
+
### Component Not Rendering
|
|
13
|
+
|
|
14
|
+
1. **Check selector usage**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// Verify selector matches
|
|
18
|
+
@Component({ selector: 'app-my-component' })
|
|
19
|
+
// Template: <app-my-component></app-my-component>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. **Check module declarations**
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
@NgModule({
|
|
26
|
+
declarations: [MyComponent], // Is it declared?
|
|
27
|
+
exports: [MyComponent], // Is it exported (if used outside)?
|
|
28
|
+
})
|
|
29
|
+
export class FeatureModule {}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. **Check module imports**
|
|
33
|
+
```typescript
|
|
34
|
+
@NgModule({
|
|
35
|
+
imports: [FeatureModule], // Is feature module imported?
|
|
36
|
+
})
|
|
37
|
+
export class AppModule {}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### BehaviorSubject/Observable Issues
|
|
41
|
+
|
|
42
|
+
1. **BehaviorSubject not updating view**
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// Wrong: mutating array directly
|
|
46
|
+
const items = this._items.getValue();
|
|
47
|
+
items.push(newItem); // Won't trigger update
|
|
48
|
+
this._items.next(items);
|
|
49
|
+
|
|
50
|
+
// Correct: create new reference
|
|
51
|
+
const items = this._items.getValue();
|
|
52
|
+
this._items.next([...items, newItem]);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. **Subscription not receiving values**
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// Ensure subscription is active
|
|
59
|
+
ngOnInit(): void {
|
|
60
|
+
this.items$ = this.stateService.items$;
|
|
61
|
+
|
|
62
|
+
// Debug: log values
|
|
63
|
+
this.items$.pipe(
|
|
64
|
+
tap(items => console.log('Items received:', items)),
|
|
65
|
+
takeUntil(this.destroy$)
|
|
66
|
+
).subscribe();
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
3. **Memory leak from subscriptions**
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// Always unsubscribe with takeUntil pattern
|
|
74
|
+
private readonly destroy$ = new Subject<void>();
|
|
75
|
+
|
|
76
|
+
ngOnInit(): void {
|
|
77
|
+
this.service.data$
|
|
78
|
+
.pipe(takeUntil(this.destroy$))
|
|
79
|
+
.subscribe(data => this.data = data);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ngOnDestroy(): void {
|
|
83
|
+
this.destroy$.next();
|
|
84
|
+
this.destroy$.complete();
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Change Detection Issues
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Force change detection (use sparingly)
|
|
92
|
+
constructor(private cdr: ChangeDetectorRef) {}
|
|
93
|
+
|
|
94
|
+
// After async operation
|
|
95
|
+
this.cdr.detectChanges();
|
|
96
|
+
|
|
97
|
+
// Or mark for check (OnPush)
|
|
98
|
+
this.cdr.markForCheck();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### HTTP Debugging (Angular 14)
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// HTTP interceptor for logging
|
|
105
|
+
@Injectable()
|
|
106
|
+
export class LoggingInterceptor implements HttpInterceptor {
|
|
107
|
+
intercept(
|
|
108
|
+
req: HttpRequest<any>,
|
|
109
|
+
next: HttpHandler,
|
|
110
|
+
): Observable<HttpEvent<any>> {
|
|
111
|
+
console.log('Request:', req.method, req.url);
|
|
112
|
+
|
|
113
|
+
return next.handle(req).pipe(
|
|
114
|
+
tap({
|
|
115
|
+
next: (event) => {
|
|
116
|
+
if (event instanceof HttpResponse) {
|
|
117
|
+
console.log('Response:', event.status, event.body);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
error: (error) => console.error('HTTP Error:', error),
|
|
121
|
+
}),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Register in module
|
|
127
|
+
@NgModule({
|
|
128
|
+
providers: [
|
|
129
|
+
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptor, multi: true },
|
|
130
|
+
],
|
|
131
|
+
})
|
|
132
|
+
export class AppModule {}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Template Debugging
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<!-- Debug in template with json pipe -->
|
|
139
|
+
<pre>{{ data | json }}</pre>
|
|
140
|
+
|
|
141
|
+
<!-- Debug *ngIf condition -->
|
|
142
|
+
<p>isLoading: {{ isLoading }}</p>
|
|
143
|
+
<p>items.length: {{ items?.length }}</p>
|
|
144
|
+
|
|
145
|
+
<!-- Debug *ngFor -->
|
|
146
|
+
<div *ngFor="let item of items; let i = index">{{ i }}: {{ item | json }}</div>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Browser DevTools
|
|
150
|
+
|
|
151
|
+
1. **Angular DevTools** - Install Chrome extension (works with Angular 14)
|
|
152
|
+
2. **Component inspector** - Click "Components" tab
|
|
153
|
+
3. **Profiler** - Record change detection cycles
|
|
154
|
+
4. **Network tab** - Check API calls
|
|
155
|
+
|
|
156
|
+
## 2. NestJS Debugging
|
|
157
|
+
|
|
158
|
+
### Request Not Reaching Controller
|
|
159
|
+
|
|
160
|
+
1. **Check route path**
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
@Controller('features') // /features
|
|
164
|
+
@Get(':id') // /features/:id
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
2. **Check module imports**
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
@Module({
|
|
171
|
+
imports: [FeatureModule], // Is module imported?
|
|
172
|
+
})
|
|
173
|
+
export class AppModule {}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
3. **Check guards/interceptors**
|
|
177
|
+
```typescript
|
|
178
|
+
@UseGuards(AuthGuard) // Is guard blocking?
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Dependency Injection Errors
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
Error: Nest can't resolve dependencies of FeatureService
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Solutions:**
|
|
188
|
+
|
|
189
|
+
1. Check provider is in module
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
@Module({
|
|
193
|
+
providers: [FeatureService, FeatureRepository],
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
2. Check circular dependencies
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// Use forwardRef
|
|
201
|
+
@Inject(forwardRef(() => OtherService))
|
|
202
|
+
private readonly other: OtherService,
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
3. Check module exports
|
|
206
|
+
```typescript
|
|
207
|
+
@Module({
|
|
208
|
+
providers: [SharedService],
|
|
209
|
+
exports: [SharedService], // Must export if used elsewhere
|
|
210
|
+
})
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Logging
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import { Logger } from '@nestjs/common';
|
|
217
|
+
|
|
218
|
+
@Injectable()
|
|
219
|
+
export class FeatureService {
|
|
220
|
+
private readonly logger = new Logger(FeatureService.name);
|
|
221
|
+
|
|
222
|
+
async findAll() {
|
|
223
|
+
this.logger.log('Finding all features');
|
|
224
|
+
this.logger.debug('Debug info');
|
|
225
|
+
this.logger.warn('Warning');
|
|
226
|
+
this.logger.error('Error occurred', error.stack);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## 3. MongoDB/Mongoose Debugging
|
|
232
|
+
|
|
233
|
+
### Connection Issues
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
// Log connection events
|
|
237
|
+
mongoose.connection.on('connected', () => console.log('MongoDB connected'));
|
|
238
|
+
mongoose.connection.on('error', (err) => console.error('MongoDB error:', err));
|
|
239
|
+
mongoose.connection.on('disconnected', () =>
|
|
240
|
+
console.log('MongoDB disconnected'),
|
|
241
|
+
);
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Query Debugging
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
// Enable Mongoose debug mode
|
|
248
|
+
mongoose.set('debug', true);
|
|
249
|
+
|
|
250
|
+
// Or for specific query
|
|
251
|
+
const result = await this.model.find({ status: 'active' });
|
|
252
|
+
console.log('Query:', this.model.find({ status: 'active' }).getQuery());
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## 4. Common Debugging Patterns
|
|
256
|
+
|
|
257
|
+
### Console Debugging
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// Temporary debug logs (remove before commit)
|
|
261
|
+
console.log('DEBUG:', variable);
|
|
262
|
+
console.table(arrayOfObjects);
|
|
263
|
+
console.group('Group');
|
|
264
|
+
console.log('Item 1');
|
|
265
|
+
console.log('Item 2');
|
|
266
|
+
console.groupEnd();
|
|
267
|
+
console.time('Operation');
|
|
268
|
+
// ... operation
|
|
269
|
+
console.timeEnd('Operation');
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Breakpoint Debugging
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
// Add debugger statement
|
|
276
|
+
function processData(data: Data) {
|
|
277
|
+
debugger; // Execution pauses here in DevTools
|
|
278
|
+
return transform(data);
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### VS Code Launch Configuration (Angular 14 / Nx 14)
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
// .vscode/launch.json
|
|
286
|
+
{
|
|
287
|
+
"version": "0.2.0",
|
|
288
|
+
"configurations": [
|
|
289
|
+
{
|
|
290
|
+
"type": "node",
|
|
291
|
+
"request": "launch",
|
|
292
|
+
"name": "Debug NestJS",
|
|
293
|
+
"runtimeArgs": ["-r", "ts-node/register"],
|
|
294
|
+
"args": ["${workspaceFolder}/apps/api/src/main.ts"],
|
|
295
|
+
"cwd": "${workspaceFolder}"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"type": "chrome",
|
|
299
|
+
"request": "launch",
|
|
300
|
+
"name": "Debug Angular",
|
|
301
|
+
"url": "http://localhost:4200",
|
|
302
|
+
"webRoot": "${workspaceFolder}/apps/web/src"
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## 5. Error Investigation Workflow
|
|
309
|
+
|
|
310
|
+
### Step 1: Reproduce
|
|
311
|
+
|
|
312
|
+
- Get exact steps to reproduce
|
|
313
|
+
- Note environment (browser, Node version - should be Node 18)
|
|
314
|
+
|
|
315
|
+
### Step 2: Isolate
|
|
316
|
+
|
|
317
|
+
- Identify component/service causing issue
|
|
318
|
+
- Check if issue is frontend, backend, or database
|
|
319
|
+
|
|
320
|
+
### Step 3: Trace
|
|
321
|
+
|
|
322
|
+
- Add logging at key points
|
|
323
|
+
- Use debugger to step through code
|
|
324
|
+
- Check network requests/responses
|
|
325
|
+
|
|
326
|
+
### Step 4: Root Cause
|
|
327
|
+
|
|
328
|
+
- Identify the actual cause (not symptoms)
|
|
329
|
+
- Document findings
|
|
330
|
+
|
|
331
|
+
### Step 5: Fix & Verify
|
|
332
|
+
|
|
333
|
+
- Apply fix
|
|
334
|
+
- Write test that catches the bug
|
|
335
|
+
- Verify fix doesn't introduce regressions
|
|
336
|
+
|
|
337
|
+
## 6. Quick Fixes (Angular 14)
|
|
338
|
+
|
|
339
|
+
### "Cannot read property of undefined"
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
// Use optional chaining
|
|
343
|
+
const name = user?.profile?.name;
|
|
344
|
+
|
|
345
|
+
// With nullish coalescing
|
|
346
|
+
const name = user?.profile?.name ?? 'Unknown';
|
|
347
|
+
|
|
348
|
+
// In templates (Angular 14)
|
|
349
|
+
{
|
|
350
|
+
{
|
|
351
|
+
user?.profile?.name;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### "Expression has changed after it was checked"
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
// Option 1: setTimeout
|
|
360
|
+
ngAfterViewInit(): void {
|
|
361
|
+
setTimeout(() => this.value = newValue);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Option 2: ChangeDetectorRef
|
|
365
|
+
ngAfterViewInit(): void {
|
|
366
|
+
this.value = newValue;
|
|
367
|
+
this.cdr.detectChanges();
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### "Circular dependency detected"
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
// Use forwardRef
|
|
375
|
+
@Inject(forwardRef(() => ServiceB))
|
|
376
|
+
private serviceB: ServiceB
|
|
377
|
+
|
|
378
|
+
// Or refactor to remove circular dependency
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### "NullInjectorError: No provider for X"
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
// Check module providers
|
|
385
|
+
@NgModule({
|
|
386
|
+
providers: [MyService], // Add missing provider
|
|
387
|
+
})
|
|
388
|
+
export class AppModule {}
|
|
389
|
+
|
|
390
|
+
// Or check providedIn
|
|
391
|
+
@Injectable({
|
|
392
|
+
providedIn: 'root', // Or specific module
|
|
393
|
+
})
|
|
394
|
+
export class MyService {}
|
|
395
|
+
```
|