@smartsoft001-mobilems/claude-plugins 2.85.0 → 2.86.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.
Files changed (132) hide show
  1. package/.claude-plugin/marketplace.json +2 -6
  2. package/package.json +2 -2
  3. package/plugins/mobilems/.claude-plugin/README.md +30 -0
  4. package/plugins/mobilems/.claude-plugin/plugin.json +5 -0
  5. package/plugins/mobilems/scripts/refresh-mobilems-api-spec.sh +372 -0
  6. package/plugins/mobilems/skills/mobilems-docs-reader/SKILL.md +116 -0
  7. package/plugins/flow/.claude-plugin/README.md +0 -91
  8. package/plugins/flow/.claude-plugin/merge-permissions.js +0 -97
  9. package/plugins/flow/.claude-plugin/plugin.json +0 -5
  10. package/plugins/flow/.claude-plugin/settings.template.json +0 -86
  11. package/plugins/flow/agents/angular-component-scaffolder.md +0 -175
  12. package/plugins/flow/agents/angular-directive-builder.md +0 -153
  13. package/plugins/flow/agents/angular-guard-builder.md +0 -243
  14. package/plugins/flow/agents/angular-jest-test-writer.md +0 -474
  15. package/plugins/flow/agents/angular-pipe-builder.md +0 -169
  16. package/plugins/flow/agents/angular-resolver-builder.md +0 -286
  17. package/plugins/flow/agents/angular-service-builder.md +0 -161
  18. package/plugins/flow/agents/angular-signal-state-builder.md +0 -339
  19. package/plugins/flow/agents/angular-test-diagnostician.md +0 -279
  20. package/plugins/flow/agents/angular-testbed-configurator.md +0 -315
  21. package/plugins/flow/agents/arch-scaffolder.md +0 -278
  22. package/plugins/flow/agents/e2e-data-testid-injector.md +0 -197
  23. package/plugins/flow/agents/e2e-project-scaffolder.md +0 -194
  24. package/plugins/flow/agents/e2e-test-writer.md +0 -350
  25. package/plugins/flow/agents/shared-agent-evolver.md +0 -294
  26. package/plugins/flow/agents/shared-build-verifier.md +0 -160
  27. package/plugins/flow/agents/shared-config-updater.md +0 -310
  28. package/plugins/flow/agents/shared-coverage-enforcer.md +0 -184
  29. package/plugins/flow/agents/shared-error-handler.md +0 -217
  30. package/plugins/flow/agents/shared-file-creator.md +0 -344
  31. package/plugins/flow/agents/shared-impl-orchestrator.md +0 -312
  32. package/plugins/flow/agents/shared-impl-reporter.md +0 -368
  33. package/plugins/flow/agents/shared-impl-teammate.md +0 -201
  34. package/plugins/flow/agents/shared-linear-subtask-iterator.md +0 -337
  35. package/plugins/flow/agents/shared-logic-implementer.md +0 -243
  36. package/plugins/flow/agents/shared-maia-api.md +0 -26
  37. package/plugins/flow/agents/shared-parallelization-analyzer.md +0 -343
  38. package/plugins/flow/agents/shared-performance-validator.md +0 -168
  39. package/plugins/flow/agents/shared-plan-perspective.md +0 -269
  40. package/plugins/flow/agents/shared-project-standardizer.md +0 -205
  41. package/plugins/flow/agents/shared-report-synthesizer.md +0 -188
  42. package/plugins/flow/agents/shared-review-teammate.md +0 -189
  43. package/plugins/flow/agents/shared-security-scanner.md +0 -186
  44. package/plugins/flow/agents/shared-style-enforcer.md +0 -230
  45. package/plugins/flow/agents/shared-subtask-dependency-analyzer.md +0 -188
  46. package/plugins/flow/agents/shared-tdd-developer.md +0 -350
  47. package/plugins/flow/agents/shared-team-coordinator.md +0 -189
  48. package/plugins/flow/agents/shared-test-fixer.md +0 -186
  49. package/plugins/flow/agents/shared-test-runner.md +0 -191
  50. package/plugins/flow/agents/shared-ui-classifier.md +0 -263
  51. package/plugins/flow/agents/shared-verification-orchestrator.md +0 -194
  52. package/plugins/flow/agents/shared-verification-runner.md +0 -140
  53. package/plugins/flow/agents/ui-a11y-validator.md +0 -305
  54. package/plugins/flow/agents/ui-screenshot-reporter.md +0 -329
  55. package/plugins/flow/agents/ui-web-designer.md +0 -214
  56. package/plugins/flow/scripts/compute-session-tokens.sh +0 -39
  57. package/plugins/flow/skills/a11y-audit/SKILL.md +0 -214
  58. package/plugins/flow/skills/angular-patterns/SKILL.md +0 -191
  59. package/plugins/flow/skills/browser-capture/SKILL.md +0 -238
  60. package/plugins/flow/skills/commit/SKILL.md +0 -259
  61. package/plugins/flow/skills/debug-helper/SKILL.md +0 -375
  62. package/plugins/flow/skills/impl/SKILL.md +0 -992
  63. package/plugins/flow/skills/linear-suggestion/SKILL.md +0 -132
  64. package/plugins/flow/skills/maia-files-delete/SKILL.md +0 -59
  65. package/plugins/flow/skills/maia-files-upload/SKILL.md +0 -57
  66. package/plugins/flow/skills/nx-conventions/SKILL.md +0 -326
  67. package/plugins/flow/skills/plan/SKILL.md +0 -1033
  68. package/plugins/flow/skills/push/SKILL.md +0 -759
  69. package/plugins/flow/skills/review/SKILL.md +0 -443
  70. package/plugins/flow/skills/test-e2e/SKILL.md +0 -161
  71. package/plugins/flow/skills/test-unit/SKILL.md +0 -456
  72. package/plugins/flow-external/.claude-plugin/README.md +0 -152
  73. package/plugins/flow-external/.claude-plugin/merge-permissions.js +0 -80
  74. package/plugins/flow-external/.claude-plugin/plugin.json +0 -5
  75. package/plugins/flow-external/.claude-plugin/settings.template.json +0 -78
  76. package/plugins/flow-external/agents/angular-component-scaffolder.md +0 -269
  77. package/plugins/flow-external/agents/angular-directive-builder.md +0 -130
  78. package/plugins/flow-external/agents/angular-guard-builder.md +0 -70
  79. package/plugins/flow-external/agents/angular-pipe-builder.md +0 -82
  80. package/plugins/flow-external/agents/angular-resolver-builder.md +0 -74
  81. package/plugins/flow-external/agents/angular-service-builder.md +0 -160
  82. package/plugins/flow-external/agents/angular-state-builder.md +0 -254
  83. package/plugins/flow-external/agents/shared-build-verifier.md +0 -67
  84. package/plugins/flow-external/agents/shared-impl-orchestrator.md +0 -88
  85. package/plugins/flow-external/agents/shared-impl-reporter.md +0 -135
  86. package/plugins/flow-external/agents/shared-linear-subtask-iterator.md +0 -70
  87. package/plugins/flow-external/agents/shared-ui-classifier.md +0 -38
  88. package/plugins/flow-external/agents/ui-web-designer.md +0 -179
  89. package/plugins/flow-external/scripts/compute-session-tokens.sh +0 -39
  90. package/plugins/flow-external/skills/a11y-audit/SKILL.md +0 -96
  91. package/plugins/flow-external/skills/angular-cli-conventions/SKILL.md +0 -267
  92. package/plugins/flow-external/skills/angular-patterns/SKILL.md +0 -170
  93. package/plugins/flow-external/skills/browser-capture/SKILL.md +0 -68
  94. package/plugins/flow-external/skills/commit/SKILL.md +0 -114
  95. package/plugins/flow-external/skills/debug-helper/SKILL.md +0 -131
  96. package/plugins/flow-external/skills/impl/SKILL.md +0 -217
  97. package/plugins/flow-external/skills/linear-suggestion/SKILL.md +0 -62
  98. package/plugins/flow-external/skills/maia-files-delete/SKILL.md +0 -34
  99. package/plugins/flow-external/skills/maia-files-upload/SKILL.md +0 -41
  100. package/plugins/flow-external/skills/plan/SKILL.md +0 -334
  101. package/plugins/flow-external/skills/push/SKILL.md +0 -232
  102. package/plugins/flow-legacy/.claude-plugin/README.md +0 -143
  103. package/plugins/flow-legacy/.claude-plugin/merge-permissions.js +0 -94
  104. package/plugins/flow-legacy/.claude-plugin/plugin.json +0 -5
  105. package/plugins/flow-legacy/.claude-plugin/settings.template.json +0 -79
  106. package/plugins/flow-legacy/agents/angular-component-scaffolder.md +0 -323
  107. package/plugins/flow-legacy/agents/angular-directive-builder.md +0 -258
  108. package/plugins/flow-legacy/agents/angular-guard-builder.md +0 -322
  109. package/plugins/flow-legacy/agents/angular-pipe-builder.md +0 -227
  110. package/plugins/flow-legacy/agents/angular-resolver-builder.md +0 -332
  111. package/plugins/flow-legacy/agents/angular-service-builder.md +0 -271
  112. package/plugins/flow-legacy/agents/angular-state-builder.md +0 -479
  113. package/plugins/flow-legacy/agents/shared-impl-orchestrator.md +0 -174
  114. package/plugins/flow-legacy/agents/shared-impl-reporter.md +0 -232
  115. package/plugins/flow-legacy/agents/shared-linear-subtask-iterator.md +0 -187
  116. package/plugins/flow-legacy/agents/shared-tdd-developer.md +0 -306
  117. package/plugins/flow-legacy/agents/shared-test-runner.md +0 -131
  118. package/plugins/flow-legacy/agents/shared-ui-classifier.md +0 -145
  119. package/plugins/flow-legacy/scripts/compute-session-tokens.sh +0 -39
  120. package/plugins/flow-legacy/skills/a11y-audit/SKILL.md +0 -214
  121. package/plugins/flow-legacy/skills/angular-patterns/SKILL.md +0 -346
  122. package/plugins/flow-legacy/skills/browser-capture/SKILL.md +0 -238
  123. package/plugins/flow-legacy/skills/commit/SKILL.md +0 -215
  124. package/plugins/flow-legacy/skills/debug-helper/SKILL.md +0 -395
  125. package/plugins/flow-legacy/skills/impl/SKILL.md +0 -710
  126. package/plugins/flow-legacy/skills/linear-suggestion/SKILL.md +0 -132
  127. package/plugins/flow-legacy/skills/maia-files-delete/SKILL.md +0 -59
  128. package/plugins/flow-legacy/skills/maia-files-upload/SKILL.md +0 -57
  129. package/plugins/flow-legacy/skills/nx-conventions/SKILL.md +0 -368
  130. package/plugins/flow-legacy/skills/plan/SKILL.md +0 -742
  131. package/plugins/flow-legacy/skills/push/SKILL.md +0 -645
  132. package/plugins/flow-legacy/skills/test-unit/SKILL.md +0 -500
@@ -1,143 +0,0 @@
1
- # Flow-Legacy Plugin for Claude Code
2
-
3
- Development flow skills for **legacy Angular 14 projects** with Linear-driven workflow.
4
-
5
- ## Target Projects
6
-
7
- This plugin is designed for older MobileMS projects using:
8
-
9
- - **Angular 14.x** (not Angular 20+)
10
- - **Nx 14.x** with `@nrwl/*` packages
11
- - **NgRx 14.x**
12
- - **Node.js 18** (not 24)
13
-
14
- ### Legacy Patterns (what this plugin supports)
15
-
16
- | Feature | Legacy (Angular 14) | Modern (Angular 20+) |
17
- |---------|---------------------|----------------------|
18
- | Control flow | `*ngIf`, `*ngFor` | `@if`, `@for` |
19
- | Dependency injection | Constructor injection | `inject()` |
20
- | Inputs/Outputs | `@Input()`, `@Output()` | `input()`, `output()` |
21
- | State management | BehaviorSubject, Observable | Signals |
22
- | Components | NgModules | Standalone |
23
- | Nx packages | `@nrwl/*` | `@nx/*` |
24
-
25
- ## Workflow Skills
26
-
27
- | Skill | Description |
28
- |-------|-------------|
29
- | `/commit` | Create conventional commit based on Linear task |
30
- | `/impl` | Implement plans from Linear task comments |
31
- | `/plan` | Create implementation plan and save to Linear |
32
- | `/push` | Push changes and update Linear status |
33
-
34
- ## Installation
35
-
36
- ### 1. Enable plugin in project's `.claude/settings.json`:
37
-
38
- ```json
39
- {
40
- "enabledPlugins": {
41
- "flow-legacy@mobilems": true
42
- }
43
- }
44
- ```
45
-
46
- ### 2. Merge permissions from template
47
-
48
- Run the merge script:
49
-
50
- ```bash
51
- node node_modules/@smartsoft001-mobilems/claude-plugins/plugins/flow-legacy/.claude-plugin/merge-permissions.js
52
- ```
53
-
54
- Or manually copy permissions from `settings.template.json` to your project's `.claude/settings.json`.
55
-
56
- ## Required MCP Servers
57
-
58
- Configure these in your `.mcp.json`:
59
-
60
- - `linear` - Linear API integration (MCP prefix `mcp__linear__`)
61
- - `playwright` - Browser automation for screenshots
62
-
63
- ## Permission Strategy
64
-
65
- ### Automatic (allow)
66
- - Git read operations (status, diff, log, show)
67
- - Nx commands (test, lint, build)
68
- - Linear API (read/write issues, comments)
69
- - Playwright (screenshots)
70
- - Utility skills
71
-
72
- ### Requires Confirmation (ask)
73
- - Workflow skills (/commit, /impl, /plan, /push)
74
- - `git commit` - creating commits
75
- - `git push` - pushing to remote
76
- - `gh pr create` - creating pull requests
77
-
78
- ## Utility Skills
79
-
80
- | Skill | Description |
81
- |-------|-------------|
82
- | `maia-files-upload` | Upload files to Maia API |
83
- | `maia-files-delete` | Delete files from Maia API |
84
- | `browser-capture` | Capture screenshots with Playwright |
85
- | `linear-suggestion` | Create Linear issues for improvements |
86
- | `test-unit` | Run unit tests with coverage |
87
- | `a11y-audit` | Accessibility audit |
88
-
89
- ## Agents
90
-
91
- See `agents/` directory for specialized agents adapted for Angular 14 patterns:
92
-
93
- ### Angular Agents (Legacy patterns)
94
- - `angular-component-scaffolder` - Components with NgModules, `*ngIf`/`*ngFor`, constructor DI
95
- - `angular-service-builder` - Services with BehaviorSubject, constructor DI
96
- - `angular-state-builder` - State management with BehaviorSubject/Observable patterns
97
- - `angular-directive-builder` - Directives with constructor DI
98
- - `angular-pipe-builder` - Pipes with legacy patterns
99
- - `angular-guard-builder` - Guards with constructor DI
100
- - `angular-resolver-builder` - Resolvers with constructor DI
101
-
102
- ### Shared Agents
103
- - `shared-tdd-developer` - TDD workflow
104
- - `shared-impl-orchestrator` - Implementation orchestration
105
- - `shared-impl-reporter` - Implementation reporting
106
- - `shared-linear-subtask-iterator` - Linear subtask iteration
107
- - `shared-verification-orchestrator` - Verification pipeline
108
- - And more...
109
-
110
- ## Differences from `flow` plugin
111
-
112
- | Aspect | `flow` (modern) | `flow-legacy` |
113
- |--------|-----------------|---------------|
114
- | Angular version | 20+ | 14 |
115
- | Node.js version | 24 | 18 |
116
- | Component syntax | Standalone, signals | NgModules, *ngIf/*ngFor |
117
- | DI pattern | `inject()` | Constructor injection |
118
- | Nx packages | `@nx/*` | `@nrwl/*` |
119
- | State | Signals | BehaviorSubject/Observable |
120
-
121
- ## Example Project Structure
122
-
123
- ```
124
- libs/
125
- shared/
126
- angular/
127
- src/
128
- lib/
129
- components/
130
- services/
131
- pipes/
132
- directives/
133
- museum-articles/
134
- shell/
135
- angular/
136
- museum-objects/
137
- shell/
138
- angular/
139
- apps/
140
- web/
141
- src/
142
- app/
143
- ```
@@ -1,94 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Merge flow-legacy plugin permissions into project's .claude/settings.json
4
- *
5
- * Usage:
6
- * npx @smartsoft001-mobilems/claude-plugins flow-legacy:merge-permissions
7
- *
8
- * Or directly:
9
- * node node_modules/@smartsoft001-mobilems/claude-plugins/plugins/flow-legacy/.claude-plugin/merge-permissions.js
10
- */
11
-
12
- const fs = require('fs');
13
- const path = require('path');
14
-
15
- const SETTINGS_PATH = path.join(process.cwd(), '.claude', 'settings.json');
16
- const TEMPLATE_PATH = path.join(__dirname, 'settings.template.json');
17
-
18
- function loadJson(filePath) {
19
- try {
20
- return JSON.parse(fs.readFileSync(filePath, 'utf8'));
21
- } catch (e) {
22
- return null;
23
- }
24
- }
25
-
26
- function mergeArrays(existing, template) {
27
- return [...new Set([...existing, ...template])];
28
- }
29
-
30
- function main() {
31
- console.log('Flow-Legacy Plugin - Merge Permissions\n');
32
-
33
- // Load template
34
- const template = loadJson(TEMPLATE_PATH);
35
- if (!template) {
36
- console.error('ERROR: Could not load template from:', TEMPLATE_PATH);
37
- process.exit(1);
38
- }
39
-
40
- // Load or create settings
41
- let settings = loadJson(SETTINGS_PATH);
42
- if (!settings) {
43
- console.log('Creating new .claude/settings.json...');
44
- fs.mkdirSync(path.dirname(SETTINGS_PATH), { recursive: true });
45
- settings = { permissions: { allow: [], deny: [], ask: [] } };
46
- }
47
-
48
- // Ensure permissions structure exists
49
- settings.permissions = settings.permissions || {
50
- allow: [],
51
- deny: [],
52
- ask: [],
53
- };
54
- settings.permissions.allow = settings.permissions.allow || [];
55
- settings.permissions.ask = settings.permissions.ask || [];
56
- settings.permissions.deny = settings.permissions.deny || [];
57
-
58
- // Count before
59
- const beforeAllow = settings.permissions.allow.length;
60
- const beforeAsk = settings.permissions.ask.length;
61
-
62
- // Merge permissions
63
- settings.permissions.allow = mergeArrays(
64
- settings.permissions.allow,
65
- template.permissions.allow,
66
- );
67
- settings.permissions.ask = mergeArrays(
68
- settings.permissions.ask,
69
- template.permissions.ask,
70
- );
71
-
72
- // Enable plugin
73
- settings.enabledPlugins = settings.enabledPlugins || {};
74
- settings.enabledPlugins['flow-legacy@mobilems'] = true;
75
-
76
- // Write back
77
- fs.writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2) + '\n');
78
-
79
- // Report
80
- const addedAllow = settings.permissions.allow.length - beforeAllow;
81
- const addedAsk = settings.permissions.ask.length - beforeAsk;
82
-
83
- console.log('Permissions merged successfully!\n');
84
- console.log(
85
- ` allow: ${beforeAllow} -> ${settings.permissions.allow.length} (+${addedAllow})`,
86
- );
87
- console.log(
88
- ` ask: ${beforeAsk} -> ${settings.permissions.ask.length} (+${addedAsk})`,
89
- );
90
- console.log(`\nPlugin enabled: flow-legacy@mobilems`);
91
- console.log(`\nFile updated: ${SETTINGS_PATH}`);
92
- }
93
-
94
- main();
@@ -1,5 +0,0 @@
1
- {
2
- "name": "flow-legacy",
3
- "description": "Development flow skills for legacy Angular 14 projects with Linear-driven workflow",
4
- "version": "2.85.0"
5
- }
@@ -1,79 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/anthropics/claude-code/main/schemas/settings.schema.json",
3
- "_description": "Template permissions for flow-legacy@mobilems plugin. Merge these into your project's .claude/settings.json",
4
- "permissions": {
5
- "allow": [
6
- "Bash(git status:*)",
7
- "Bash(git diff:*)",
8
- "Bash(git log:*)",
9
- "Bash(git show:*)",
10
- "Bash(git add:*)",
11
- "Bash(git fetch:*)",
12
- "Bash(git pull:*)",
13
- "Bash(gh run list:*)",
14
- "Bash(gh run view:*)",
15
- "Bash(gh pr list:*)",
16
- "Bash(nx:*)",
17
- "Bash(npx nx:*)",
18
- "Bash(npx tsc:*)",
19
- "Bash(npm start)",
20
- "Bash(npm run format:*)",
21
- "Bash(npm audit:*)",
22
- "Bash(npm install:*)",
23
- "Bash(source:*)",
24
- "Bash(nvm use:*)",
25
- "Bash(curl:*)",
26
- "Bash(lsof:*)",
27
- "Bash(ls:*)",
28
- "Bash(find:*)",
29
- "Bash(grep:*)",
30
- "Bash(xargs:*)",
31
- "Bash(sleep:*)",
32
- "Bash(rm:*)",
33
- "Bash(test:*)",
34
- "Bash(for:*)",
35
- "Bash(node:*)",
36
- "Bash(mkdir:*)",
37
- "mcp__linear__get_issue",
38
- "mcp__linear__list_issues",
39
- "mcp__linear__list_comments",
40
- "mcp__linear__save_comment",
41
- "mcp__linear__delete_comment",
42
- "mcp__linear__save_issue",
43
- "mcp__linear__list_issue_statuses",
44
- "mcp__linear__create_attachment",
45
- "mcp__linear__get_attachment",
46
- "mcp__linear__delete_attachment",
47
- "mcp__linear__list_issue_labels",
48
- "mcp__playwright__browser_snapshot",
49
- "mcp__playwright__browser_take_screenshot",
50
- "mcp__playwright__browser_navigate",
51
- "mcp__playwright__browser_close",
52
- "mcp__playwright__browser_wait_for",
53
- "mcp__playwright__browser_click",
54
- "mcp__playwright__browser_resize",
55
- "mcp__playwright__browser_evaluate",
56
- "mcp__playwright__browser_console_messages",
57
- "mcp__playwright__browser_press_key",
58
- "mcp__playwright__browser_network_requests",
59
- "Skill(flow-legacy:maia-files-upload)",
60
- "Skill(flow-legacy:maia-files-delete)",
61
- "Skill(flow-legacy:browser-capture)",
62
- "Skill(flow-legacy:linear-suggestion)",
63
- "Skill(flow-legacy:test-unit)",
64
- "Skill(flow-legacy:a11y-audit)"
65
- ],
66
- "ask": [
67
- "Skill(flow-legacy:commit)",
68
- "Skill(flow-legacy:impl)",
69
- "Skill(flow-legacy:plan)",
70
- "Skill(flow-legacy:push)",
71
- "Bash(git commit:*)",
72
- "Bash(git push:*)",
73
- "Bash(gh pr create:*)"
74
- ]
75
- },
76
- "enabledPlugins": {
77
- "flow-legacy@mobilems": true
78
- }
79
- }
@@ -1,323 +0,0 @@
1
- ---
2
- name: angular-component-scaffolder
3
- description: Create Angular 14 components with NgModules and legacy patterns. Use when scaffolding new components following Angular 14 best practices (*ngIf/*ngFor, constructor DI, @Input/@Output).
4
- tools: Read, Write, Glob, Grep
5
- model: sonnet
6
- color: "#DD0031"
7
- ---
8
-
9
- You are an expert at creating Angular 14 components following legacy best practices.
10
-
11
- ## Primary Responsibility
12
-
13
- Create Angular components using Angular 14 patterns including NgModules, `*ngIf`/`*ngFor`, constructor injection, and `@Input()`/`@Output()` decorators.
14
-
15
- ## When to Use
16
-
17
- - Creating new Angular components in legacy projects (Angular 14)
18
- - Scaffolding component structure with template and styles
19
- - Setting up component with proper constructor DI
20
-
21
- ## CRITICAL: Angular 14 Patterns (MANDATORY)
22
-
23
- **NEVER use modern Angular 20+ patterns. ALWAYS use these legacy patterns:**
24
-
25
- | Feature | ✅ CORRECT (Angular 14) | ❌ WRONG (Angular 20+) |
26
- |---------|------------------------|----------------------|
27
- | Control flow | `*ngIf`, `*ngFor` | `@if`, `@for` |
28
- | DI | Constructor injection | `inject()` |
29
- | Inputs | `@Input()` decorator | `input()`, `input.required()` |
30
- | Outputs | `@Output()` decorator | `output()` |
31
- | Two-way binding | `@Input()` + `@Output()` | `model()` |
32
- | State | Class properties | `signal()` |
33
- | Derived state | Getters or manual | `computed()` |
34
-
35
- ## Project-Specific Patterns
36
-
37
- This project uses:
38
-
39
- - **NgModules** - components must be declared in modules
40
- - **`*ngIf` and `*ngFor`** for control flow
41
- - **Constructor injection** for DI
42
- - **`@Input()` and `@Output()`** decorators
43
- - **No signals** - use class properties and BehaviorSubject
44
- - **Tailwind CSS** with `smart-` prefix (if applicable)
45
-
46
- ## Component Templates
47
-
48
- ### Basic Component
49
-
50
- ```typescript
51
- import { Component, OnInit, OnDestroy } from '@angular/core';
52
- import { Subject } from 'rxjs';
53
- import { takeUntil } from 'rxjs/operators';
54
-
55
- @Component({
56
- selector: 'app-feature-name',
57
- templateUrl: './feature-name.component.html',
58
- styleUrls: ['./feature-name.component.scss'],
59
- })
60
- export class FeatureNameComponent implements OnInit, OnDestroy {
61
- // Class properties for state (NOT signals)
62
- isLoading = false;
63
- data: DataType[] = [];
64
- error: string | null = null;
65
-
66
- // Destroy subject for cleanup
67
- private readonly destroy$ = new Subject<void>();
68
-
69
- // Constructor injection (NOT inject())
70
- constructor(
71
- private readonly dataService: DataService,
72
- private readonly router: Router
73
- ) {}
74
-
75
- ngOnInit(): void {
76
- this.loadData();
77
- }
78
-
79
- ngOnDestroy(): void {
80
- this.destroy$.next();
81
- this.destroy$.complete();
82
- }
83
-
84
- private loadData(): void {
85
- this.isLoading = true;
86
- this.dataService.getData()
87
- .pipe(takeUntil(this.destroy$))
88
- .subscribe({
89
- next: (data) => {
90
- this.data = data;
91
- this.isLoading = false;
92
- },
93
- error: (err) => {
94
- this.error = err.message;
95
- this.isLoading = false;
96
- },
97
- });
98
- }
99
-
100
- // Getter for derived state (NOT computed())
101
- get itemCount(): number {
102
- return this.data.length;
103
- }
104
-
105
- get hasData(): boolean {
106
- return this.data.length > 0;
107
- }
108
- }
109
- ```
110
-
111
- ### Component with Inputs/Outputs
112
-
113
- ```typescript
114
- import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
115
-
116
- @Component({
117
- selector: 'app-item-card',
118
- templateUrl: './item-card.component.html',
119
- styleUrls: ['./item-card.component.scss'],
120
- })
121
- export class ItemCardComponent implements OnChanges {
122
- // Inputs with @Input() decorator (NOT input())
123
- @Input() label!: string; // Required input
124
- @Input() item!: Item; // Required input
125
- @Input() showActions = true; // Optional with default
126
-
127
- // Outputs with @Output() decorator (NOT output())
128
- @Output() selected = new EventEmitter<Item>();
129
- @Output() closed = new EventEmitter<void>();
130
-
131
- // Internal state (NOT signals)
132
- isOpen = false;
133
-
134
- ngOnChanges(changes: SimpleChanges): void {
135
- if (changes['item']) {
136
- // React to input changes
137
- console.log('Item changed:', this.item);
138
- }
139
- }
140
-
141
- onSelect(): void {
142
- this.selected.emit(this.item);
143
- }
144
-
145
- onClose(): void {
146
- this.closed.emit();
147
- }
148
-
149
- toggleDropdown(force?: boolean): void {
150
- this.isOpen = force ?? !this.isOpen;
151
- }
152
- }
153
- ```
154
-
155
- ### Two-Way Binding Component
156
-
157
- ```typescript
158
- import { Component, Input, Output, EventEmitter } from '@angular/core';
159
-
160
- @Component({
161
- selector: 'app-search-input',
162
- templateUrl: './search-input.component.html',
163
- })
164
- export class SearchInputComponent {
165
- // Two-way binding with @Input + @Output pattern (NOT model())
166
- @Input() searchText = '';
167
- @Output() searchTextChange = new EventEmitter<string>();
168
-
169
- onSearchChange(value: string): void {
170
- this.searchText = value;
171
- this.searchTextChange.emit(value);
172
- }
173
- }
174
- ```
175
-
176
- Usage in parent:
177
- ```html
178
- <app-search-input [(searchText)]="filterText"></app-search-input>
179
- ```
180
-
181
- ## Template Patterns
182
-
183
- ### Control Flow with *ngIf and *ngFor
184
-
185
- ```html
186
- <!-- Loading state with *ngIf -->
187
- <div *ngIf="isLoading" class="loading-spinner">
188
- <app-spinner></app-spinner>
189
- </div>
190
-
191
- <!-- Error state with *ngIf -->
192
- <div *ngIf="error" class="error-message">
193
- <app-error [message]="error"></app-error>
194
- </div>
195
-
196
- <!-- Content with *ngIf and *ngFor -->
197
- <div *ngIf="!isLoading && !error" class="content">
198
- <ul *ngIf="hasData; else emptyTemplate">
199
- <li *ngFor="let item of data; trackBy: trackByFn">
200
- <app-item-card
201
- [item]="item"
202
- (selected)="onSelect($event)"
203
- ></app-item-card>
204
- </li>
205
- </ul>
206
-
207
- <ng-template #emptyTemplate>
208
- <p class="empty-message">
209
- {{ 'COMMON.noItems' | translate }}
210
- </p>
211
- </ng-template>
212
- </div>
213
- ```
214
-
215
- ### TrackBy Function
216
-
217
- ```typescript
218
- // Always provide trackBy for *ngFor
219
- trackByFn(index: number, item: Item): string {
220
- return item.id;
221
- }
222
- ```
223
-
224
- ## Module Declaration
225
-
226
- Components MUST be declared in a module:
227
-
228
- ```typescript
229
- import { NgModule } from '@angular/core';
230
- import { CommonModule } from '@angular/common';
231
- import { TranslateModule } from '@ngx-translate/core';
232
-
233
- import { FeatureNameComponent } from './feature-name.component';
234
- import { ItemCardComponent } from './item-card/item-card.component';
235
-
236
- @NgModule({
237
- declarations: [
238
- FeatureNameComponent,
239
- ItemCardComponent,
240
- ],
241
- imports: [
242
- CommonModule,
243
- TranslateModule,
244
- ],
245
- exports: [
246
- FeatureNameComponent,
247
- ItemCardComponent,
248
- ],
249
- })
250
- export class FeatureModule {}
251
- ```
252
-
253
- ## File Structure
254
-
255
- ```
256
- feature-name/
257
- feature-name.component.ts # Component class
258
- feature-name.component.html # Template
259
- feature-name.component.scss # Styles
260
- feature-name.component.spec.ts # Tests
261
- feature-name.module.ts # Module (if standalone feature)
262
- ```
263
-
264
- ## Scaffolding Checklist
265
-
266
- - [ ] Uses NgModule (NOT standalone)
267
- - [ ] Uses constructor injection (NOT `inject()`)
268
- - [ ] Uses `@Input()` / `@Output()` decorators (NOT `input()` / `output()`)
269
- - [ ] Uses `*ngIf` / `*ngFor` in template (NOT `@if` / `@for`)
270
- - [ ] Has `trackBy` function for all `*ngFor` loops
271
- - [ ] Uses class properties for state (NOT signals)
272
- - [ ] Uses getters for derived values (NOT `computed()`)
273
- - [ ] Has `OnDestroy` with Subject for cleanup
274
- - [ ] Declared in a module
275
- - [ ] Imports `TranslateModule` if using translations
276
- - [ ] Has proper TypeScript types
277
-
278
- ## Output Format
279
-
280
- ```markdown
281
- ## Component Scaffolded
282
-
283
- ### Files Created
284
-
285
- | File | Purpose |
286
- | --------------------------------- | ----------------- |
287
- | `feature-name.component.ts` | Component class |
288
- | `feature-name.component.html` | Template |
289
- | `feature-name.component.scss` | Styles |
290
- | `feature-name.component.spec.ts` | Unit tests |
291
-
292
- ### Component API
293
-
294
- **Inputs:**
295
-
296
- - `@Input() item: Item` (required)
297
- - `@Input() showActions: boolean` (default: true)
298
-
299
- **Outputs:**
300
-
301
- - `@Output() selected: EventEmitter<Item>`
302
-
303
- ### Angular 14 Patterns Used
304
-
305
- - ✅ Constructor injection
306
- - ✅ `*ngIf` / `*ngFor` control flow
307
- - ✅ `@Input()` / `@Output()` decorators
308
- - ✅ Class properties for state
309
- - ✅ Getters for derived values
310
-
311
- ### Module Registration
312
-
313
- Add to module declarations:
314
- ```typescript
315
- declarations: [FeatureNameComponent]
316
- ```
317
-
318
- ### Next Steps
319
-
320
- 1. Implement component logic
321
- 2. Add to module declarations
322
- 3. Add to routing or parent component
323
- ```