claude-code-templates 1.1.0 → 1.1.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/bin/create-claude-config.js +3 -4
- package/package.json +7 -2
- package/scripts/sync-templates.js +182 -0
- package/src/file-operations.js +56 -13
- package/src/index.js +3 -6
- package/src/prompts.js +164 -30
- package/src/templates.js +12 -20
- package/templates/go/README.md +25 -0
- package/templates/javascript-typescript/.claude/commands/api-endpoint.md +51 -1
- package/templates/javascript-typescript/.claude/commands/debug.md +52 -1
- package/templates/javascript-typescript/.claude/commands/lint.md +48 -1
- package/templates/javascript-typescript/.claude/commands/npm-scripts.md +48 -1
- package/templates/javascript-typescript/.claude/commands/refactor.md +55 -1
- package/templates/javascript-typescript/.claude/commands/test.md +61 -1
- package/templates/javascript-typescript/.claude/commands/typescript-migrate.md +51 -1
- package/templates/javascript-typescript/.claude/settings.json +41 -2
- package/templates/javascript-typescript/.mcp.json +13 -0
- package/templates/javascript-typescript/README.md +213 -187
- package/templates/javascript-typescript/examples/angular-app/.claude/commands/components.md +63 -0
- package/templates/javascript-typescript/examples/angular-app/.claude/commands/services.md +62 -0
- package/templates/javascript-typescript/examples/node-api/.claude/commands/api-endpoint.md +46 -0
- package/templates/javascript-typescript/examples/node-api/.claude/commands/database.md +56 -0
- package/templates/javascript-typescript/examples/node-api/.claude/commands/middleware.md +61 -1
- package/templates/javascript-typescript/examples/node-api/.claude/commands/route.md +57 -1
- package/templates/javascript-typescript/examples/node-api/CLAUDE.md +102 -1
- package/templates/javascript-typescript/examples/react-app/.claude/commands/component.md +29 -1
- package/templates/javascript-typescript/examples/react-app/.claude/commands/hooks.md +44 -1
- package/templates/javascript-typescript/examples/react-app/.claude/commands/state-management.md +45 -0
- package/templates/javascript-typescript/examples/react-app/CLAUDE.md +81 -1
- package/templates/javascript-typescript/examples/vue-app/.claude/commands/components.md +46 -0
- package/templates/javascript-typescript/examples/vue-app/.claude/commands/composables.md +51 -0
- package/templates/rust/README.md +26 -0
- package/templates/javascript-typescript/.claude/commands/react-component.md +0 -1
- package/templates/javascript-typescript/.claude/commands/route.md +0 -193
- package/templates/javascript-typescript/.claude/hooks/format-on-save.json +0 -1
- package/templates/javascript-typescript/.claude/hooks/lint-on-save.json +0 -1
- package/templates/javascript-typescript/.claude/hooks/typescript-check.json +0 -1
|
@@ -1,233 +1,259 @@
|
|
|
1
|
-
# JavaScript/TypeScript
|
|
1
|
+
# JavaScript/TypeScript Templates
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Claude Code configuration template optimized for modern JavaScript and TypeScript development**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This folder contains a comprehensive Claude Code template specifically designed for JavaScript and TypeScript projects, supporting popular frameworks like React, Vue.js, Angular, and Node.js.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Copy the template files to your JavaScript/TypeScript project:
|
|
7
|
+
## 📁 What's in This Folder
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
# Copy all template files
|
|
12
|
-
cp -r claude-code-templates/javascript-typescript/* your-project/
|
|
9
|
+
This template provides the foundation for JavaScript/TypeScript development with Claude Code:
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
11
|
+
### 📄 Files Included
|
|
12
|
+
- **`CLAUDE.md`** - Complete JavaScript/TypeScript development guidance for Claude Code
|
|
13
|
+
- **`README.md`** - This documentation file
|
|
18
14
|
|
|
19
|
-
###
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
cd your-project
|
|
24
|
-
claude
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Use the included custom commands:
|
|
28
|
-
```bash
|
|
29
|
-
# Run tests
|
|
30
|
-
/test
|
|
31
|
-
|
|
32
|
-
# Run linting
|
|
33
|
-
/lint
|
|
34
|
-
|
|
35
|
-
# Create React component
|
|
36
|
-
/react-component
|
|
15
|
+
### 🎯 Template Features
|
|
16
|
+
When you use this template with the installer, it automatically creates:
|
|
17
|
+
- **`.claude/settings.json`** - Optimized settings for JS/TS projects
|
|
18
|
+
- **`.claude/commands/`** - Ready-to-use commands for common tasks
|
|
37
19
|
|
|
38
|
-
|
|
39
|
-
/debug
|
|
40
|
-
```
|
|
20
|
+
## 🚀 How to Use This Template
|
|
41
21
|
|
|
42
|
-
|
|
22
|
+
### Option 1: Automated Installation (Recommended)
|
|
23
|
+
Use the CLI installer to automatically set up this template in your project:
|
|
43
24
|
|
|
44
|
-
### Core Configuration
|
|
45
|
-
- **`CLAUDE.md`** - Comprehensive guidance for JavaScript/TypeScript development
|
|
46
|
-
- **`.claude/settings.json`** - Optimized settings for JS/TS projects
|
|
47
|
-
- **Custom Commands** - Pre-configured commands for common development tasks
|
|
48
|
-
|
|
49
|
-
### Development Hooks
|
|
50
|
-
- **`format-on-save.json`** - Automatically format code with Prettier
|
|
51
|
-
- **`lint-on-save.json`** - Run ESLint on file changes
|
|
52
|
-
- **`typescript-check.json`** - Verify TypeScript types on save
|
|
53
|
-
|
|
54
|
-
### Custom Commands
|
|
55
|
-
- **`test.md`** - Execute tests with Jest, Vitest, or other frameworks
|
|
56
|
-
- **`lint.md`** - Run ESLint with customizable rules
|
|
57
|
-
- **`debug.md`** - Debug Node.js applications and browser code
|
|
58
|
-
- **`refactor.md`** - Refactor code with AI assistance
|
|
59
|
-
- **`typescript-migrate.md`** - Migrate JavaScript files to TypeScript
|
|
60
|
-
- **`npm-scripts.md`** - Manage and execute npm scripts
|
|
61
|
-
- **`react-component.md`** - Generate React components with best practices
|
|
62
|
-
- **`api-endpoint.md`** - Create API endpoints for Node.js applications
|
|
63
|
-
|
|
64
|
-
### Project Examples
|
|
65
|
-
- **React App** - Configuration for React applications
|
|
66
|
-
- **Node.js API** - Configuration for backend API development
|
|
67
|
-
|
|
68
|
-
## Framework-Specific Setup
|
|
69
|
-
|
|
70
|
-
### React Projects
|
|
71
25
|
```bash
|
|
72
|
-
|
|
73
|
-
|
|
26
|
+
cd your-javascript-project
|
|
27
|
+
npx claude-code-templates --language javascript-typescript
|
|
74
28
|
```
|
|
75
29
|
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
# Copy Node.js-specific configuration
|
|
83
|
-
cp -r claude-code-templates/javascript-typescript/examples/node-api/.claude/ your-api-project/
|
|
84
|
-
```
|
|
30
|
+
The installer will:
|
|
31
|
+
- Copy the `CLAUDE.md` file to your project
|
|
32
|
+
- Auto-detect your framework (React, Vue, Node.js, etc.)
|
|
33
|
+
- Create appropriate `.claude/` configuration files
|
|
34
|
+
- Set up framework-specific commands
|
|
35
|
+
- Configure development workflows
|
|
85
36
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- `/middleware` - Generate middleware functions
|
|
37
|
+
### Option 2: Manual Installation
|
|
38
|
+
Copy the template manually for more control:
|
|
89
39
|
|
|
90
|
-
|
|
40
|
+
```bash
|
|
41
|
+
# Clone the repository
|
|
42
|
+
git clone https://github.com/danipower/claude-code-templates.git
|
|
91
43
|
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
- **yarn** - Fast, reliable package manager
|
|
95
|
-
- **pnpm** - Efficient package manager
|
|
44
|
+
# Copy the JavaScript/TypeScript template
|
|
45
|
+
cp claude-code-templates/javascript-typescript/CLAUDE.md your-project/
|
|
96
46
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
- **esbuild** - Extremely fast JavaScript bundler
|
|
47
|
+
# Then use the CLI to complete the setup
|
|
48
|
+
cd your-project
|
|
49
|
+
npx claude-code-templates --language javascript-typescript
|
|
50
|
+
```
|
|
102
51
|
|
|
103
|
-
|
|
104
|
-
- **Jest** - JavaScript testing framework
|
|
105
|
-
- **Vitest** - Fast unit test framework
|
|
106
|
-
- **Testing Library** - Testing utilities
|
|
107
|
-
- **Cypress** - End-to-end testing
|
|
108
|
-
- **Playwright** - Cross-browser testing
|
|
52
|
+
## 🎨 Framework Support
|
|
109
53
|
|
|
110
|
-
|
|
111
|
-
- **ESLint** - JavaScript/TypeScript linter
|
|
112
|
-
- **Prettier** - Code formatter
|
|
113
|
-
- **TypeScript** - Static type checking
|
|
114
|
-
- **Husky** - Git hooks
|
|
54
|
+
This template automatically configures Claude Code for:
|
|
115
55
|
|
|
116
56
|
### Frontend Frameworks
|
|
117
|
-
- **React** -
|
|
118
|
-
- **Vue.js** -
|
|
119
|
-
- **Angular** -
|
|
120
|
-
- **Svelte** - Compile-time
|
|
57
|
+
- **React** - Components, hooks, JSX, testing with React Testing Library
|
|
58
|
+
- **Vue.js** - Composition API, single-file components, state management
|
|
59
|
+
- **Angular** - TypeScript-first development, RxJS patterns, CLI integration
|
|
60
|
+
- **Svelte** - Compile-time optimizations, modern JavaScript patterns
|
|
121
61
|
|
|
122
62
|
### Backend Frameworks
|
|
123
|
-
- **Express.js** -
|
|
124
|
-
- **Fastify** -
|
|
125
|
-
- **
|
|
126
|
-
- **
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
63
|
+
- **Express.js** - RESTful APIs, middleware, error handling
|
|
64
|
+
- **Fastify** - High-performance Node.js applications
|
|
65
|
+
- **NestJS** - Enterprise-grade TypeScript framework
|
|
66
|
+
- **Next.js** - Full-stack React applications with SSR/SSG
|
|
67
|
+
|
|
68
|
+
### Build Tools & Testing
|
|
69
|
+
- **Vite, Webpack, esbuild** - Modern build tool configurations
|
|
70
|
+
- **Jest, Vitest, Cypress** - Testing framework optimization
|
|
71
|
+
- **ESLint, Prettier, TypeScript** - Code quality and formatting
|
|
72
|
+
|
|
73
|
+
## 🛠️ Commands Created by the Template
|
|
74
|
+
|
|
75
|
+
When installed, this template provides commands for:
|
|
76
|
+
|
|
77
|
+
### 🧪 Testing & Quality
|
|
78
|
+
- **`/test`** - Run tests with Jest, Vitest, or other frameworks
|
|
79
|
+
- **`/lint`** - ESLint with auto-fix capabilities
|
|
80
|
+
- **`/typescript-migrate`** - Convert JavaScript files to TypeScript
|
|
81
|
+
|
|
82
|
+
### 🔧 Development Tools
|
|
83
|
+
- **`/debug`** - Debug Node.js applications and browser code
|
|
84
|
+
- **`/refactor`** - AI-assisted code refactoring
|
|
85
|
+
- **`/npm-scripts`** - Manage and execute npm/yarn scripts
|
|
86
|
+
|
|
87
|
+
### ⚡ Framework-Specific Commands
|
|
88
|
+
- **`/react-component`** - Generate React components (React projects)
|
|
89
|
+
- **`/api-endpoint`** - Create Express.js endpoints (Node.js projects)
|
|
90
|
+
- **`/route`** - Create API routes (Node.js projects)
|
|
91
|
+
- **`/component`** - Create components (React/Vue projects)
|
|
92
|
+
|
|
93
|
+
## 🎯 What Happens When You Install
|
|
94
|
+
|
|
95
|
+
### Step 1: Framework Detection
|
|
96
|
+
The installer analyzes your project to detect:
|
|
97
|
+
- Package.json dependencies
|
|
98
|
+
- Project structure
|
|
99
|
+
- Framework type (React, Vue, Angular, Node.js)
|
|
100
|
+
|
|
101
|
+
### Step 2: Template Configuration
|
|
102
|
+
Based on detection, it creates:
|
|
103
|
+
```
|
|
104
|
+
your-project/
|
|
105
|
+
├── CLAUDE.md # Copied from this template
|
|
106
|
+
├── .claude/
|
|
107
|
+
│ ├── settings.json # Framework-specific settings
|
|
108
|
+
│ └── commands/ # Commands for your framework
|
|
109
|
+
│ ├── test.md
|
|
110
|
+
│ ├── lint.md
|
|
111
|
+
│ ├── debug.md
|
|
112
|
+
│ └── [framework-specific commands]
|
|
113
|
+
```
|
|
155
114
|
|
|
115
|
+
### Step 3: Framework Customization
|
|
116
|
+
For specific frameworks, additional commands are added:
|
|
117
|
+
|
|
118
|
+
**React Projects:**
|
|
119
|
+
- Component generation with TypeScript support
|
|
120
|
+
- React hooks creation and management
|
|
121
|
+
- Testing with React Testing Library patterns
|
|
122
|
+
|
|
123
|
+
**Node.js Projects:**
|
|
124
|
+
- RESTful API endpoint creation
|
|
125
|
+
- Middleware development patterns
|
|
126
|
+
- Database integration helpers
|
|
127
|
+
|
|
128
|
+
**Vue.js Projects:**
|
|
129
|
+
- Single-file component templates
|
|
130
|
+
- Composition API patterns
|
|
131
|
+
- Vue 3 best practices
|
|
132
|
+
|
|
133
|
+
## 📚 What's in the CLAUDE.md File
|
|
134
|
+
|
|
135
|
+
The `CLAUDE.md` file in this folder contains comprehensive guidance for:
|
|
136
|
+
|
|
137
|
+
### Development Commands
|
|
138
|
+
- Package management (npm, yarn, pnpm)
|
|
139
|
+
- Build commands (dev, build, preview)
|
|
140
|
+
- Testing commands (unit, integration, e2e)
|
|
141
|
+
- Code quality commands (lint, format, typecheck)
|
|
142
|
+
|
|
143
|
+
### Technology Stack Guidelines
|
|
144
|
+
- JavaScript/TypeScript best practices
|
|
145
|
+
- Framework-specific patterns (React, Vue, Angular, Node.js)
|
|
146
|
+
- Build tools configuration (Vite, Webpack, esbuild)
|
|
147
|
+
- Testing frameworks (Jest, Vitest, Cypress, Playwright)
|
|
148
|
+
|
|
149
|
+
### Project Structure Recommendations
|
|
150
|
+
- File organization patterns
|
|
151
|
+
- Naming conventions
|
|
152
|
+
- TypeScript configuration
|
|
153
|
+
- Code quality standards
|
|
154
|
+
|
|
155
|
+
### Performance & Security
|
|
156
|
+
- Bundle optimization strategies
|
|
157
|
+
- Runtime performance tips
|
|
158
|
+
- Security best practices
|
|
159
|
+
- Dependency management
|
|
160
|
+
|
|
161
|
+
## 🚀 Getting Started
|
|
162
|
+
|
|
163
|
+
1. **Navigate to your JavaScript/TypeScript project:**
|
|
164
|
+
```bash
|
|
165
|
+
cd your-project
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
2. **Run the installer:**
|
|
169
|
+
```bash
|
|
170
|
+
npx claude-code-templates --language javascript-typescript
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
3. **Start Claude Code:**
|
|
174
|
+
```bash
|
|
175
|
+
claude
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
4. **Try the commands:**
|
|
179
|
+
```bash
|
|
180
|
+
/test # Run your tests
|
|
181
|
+
/lint # Check code quality
|
|
182
|
+
/component # Create components (React/Vue)
|
|
183
|
+
/route # Create API routes (Node.js)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## 🔧 Customization
|
|
187
|
+
|
|
188
|
+
After installation, you can customize the setup:
|
|
189
|
+
|
|
190
|
+
### Modify Commands
|
|
191
|
+
Edit files in `.claude/commands/` to match your workflow:
|
|
156
192
|
```bash
|
|
157
|
-
# Edit test command
|
|
193
|
+
# Edit the test command
|
|
158
194
|
vim .claude/commands/test.md
|
|
159
195
|
|
|
160
|
-
# Add
|
|
161
|
-
echo "#
|
|
196
|
+
# Add a custom command
|
|
197
|
+
echo "# Deploy Command" > .claude/commands/deploy.md
|
|
162
198
|
```
|
|
163
199
|
|
|
164
|
-
###
|
|
165
|
-
|
|
166
|
-
|
|
200
|
+
### Adjust Settings
|
|
201
|
+
Update `.claude/settings.json` for your project:
|
|
167
202
|
```json
|
|
168
203
|
{
|
|
169
|
-
"language": "typescript",
|
|
170
204
|
"framework": "react",
|
|
171
|
-
"testFramework": "jest",
|
|
172
|
-
"packageManager": "npm"
|
|
205
|
+
"testFramework": "jest",
|
|
206
|
+
"packageManager": "npm",
|
|
207
|
+
"buildTool": "vite"
|
|
173
208
|
}
|
|
174
209
|
```
|
|
175
210
|
|
|
176
|
-
###
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```json
|
|
180
|
-
{
|
|
181
|
-
"trigger": "on_file_save",
|
|
182
|
-
"pattern": "*.ts,*.tsx",
|
|
183
|
-
"command": "npm run typecheck"
|
|
184
|
-
}
|
|
185
|
-
```
|
|
211
|
+
### Add Framework Features
|
|
212
|
+
The template adapts to your specific framework needs automatically.
|
|
186
213
|
|
|
187
|
-
##
|
|
214
|
+
## 📖 Learn More
|
|
188
215
|
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
- Keep configuration files in project root
|
|
216
|
+
- **Main Project**: [Claude Code Templates](../README.md)
|
|
217
|
+
- **Common Templates**: [Universal patterns](../common/README.md)
|
|
218
|
+
- **Python Templates**: [Python development](../python/README.md)
|
|
219
|
+
- **CLI Tool**: [Automated installer](../cli-tool/README.md)
|
|
194
220
|
|
|
195
|
-
|
|
196
|
-
- Enable TypeScript strict mode
|
|
197
|
-
- Use ESLint with recommended rules
|
|
198
|
-
- Format code consistently with Prettier
|
|
199
|
-
- Write comprehensive tests
|
|
221
|
+
## 💡 Why Use This Template?
|
|
200
222
|
|
|
201
|
-
###
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
223
|
+
### Before (Manual Setup)
|
|
224
|
+
```bash
|
|
225
|
+
# Create CLAUDE.md from scratch
|
|
226
|
+
# Research JS/TS best practices
|
|
227
|
+
# Configure commands manually
|
|
228
|
+
# Set up linting and testing
|
|
229
|
+
# Configure TypeScript
|
|
230
|
+
# ... hours of setup
|
|
231
|
+
```
|
|
206
232
|
|
|
207
|
-
|
|
233
|
+
### After (With This Template)
|
|
234
|
+
```bash
|
|
235
|
+
npx claude-code-templates --language javascript-typescript
|
|
236
|
+
# ✅ Everything configured in 30 seconds!
|
|
237
|
+
```
|
|
208
238
|
|
|
209
|
-
###
|
|
210
|
-
- **
|
|
211
|
-
- **
|
|
212
|
-
- **
|
|
213
|
-
- **
|
|
239
|
+
### Benefits
|
|
240
|
+
- **Instant Setup** - Get started immediately with proven configurations
|
|
241
|
+
- **Framework-Aware** - Automatically adapts to React, Vue, Node.js, etc.
|
|
242
|
+
- **Best Practices** - Uses industry-standard patterns and tools
|
|
243
|
+
- **TypeScript Ready** - Full TypeScript support out of the box
|
|
244
|
+
- **Testing Included** - Pre-configured for Jest, Vitest, and more
|
|
214
245
|
|
|
215
|
-
|
|
216
|
-
- Check the main repository documentation
|
|
217
|
-
- Review framework-specific guides
|
|
218
|
-
- Use Claude Code's built-in help: `/help`
|
|
219
|
-
- Consult community resources and documentation
|
|
246
|
+
## 🤝 Contributing
|
|
220
247
|
|
|
221
|
-
|
|
248
|
+
Help improve this JavaScript/TypeScript template:
|
|
222
249
|
|
|
223
|
-
|
|
250
|
+
1. Test the template with different JS/TS projects
|
|
251
|
+
2. Report issues or suggest improvements
|
|
252
|
+
3. Add support for new frameworks or tools
|
|
253
|
+
4. Share your customizations and best practices
|
|
224
254
|
|
|
225
|
-
|
|
226
|
-
2. Create a feature branch
|
|
227
|
-
3. Add your improvements
|
|
228
|
-
4. Test with real projects
|
|
229
|
-
5. Submit a pull request
|
|
255
|
+
Your contributions make this template better for the entire JavaScript/TypeScript community!
|
|
230
256
|
|
|
231
|
-
|
|
257
|
+
---
|
|
232
258
|
|
|
233
|
-
|
|
259
|
+
**Ready to supercharge your JavaScript/TypeScript development?** Run `npx claude-code-templates --language javascript-typescript` in your project now!
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Angular Components
|
|
2
|
+
|
|
3
|
+
Create Angular components for $ARGUMENTS following project conventions.
|
|
4
|
+
|
|
5
|
+
## Task
|
|
6
|
+
|
|
7
|
+
Create or optimize Angular components based on the requirements:
|
|
8
|
+
|
|
9
|
+
1. **Analyze existing components**: Check current component patterns, naming conventions, and folder organization
|
|
10
|
+
2. **Examine Angular setup**: Review project structure, module organization, and TypeScript configuration
|
|
11
|
+
3. **Identify component type**: Determine the component category:
|
|
12
|
+
- Presentation components (dumb/pure components)
|
|
13
|
+
- Container components (smart components with state)
|
|
14
|
+
- Feature components (business logic components)
|
|
15
|
+
- Shared/UI components (reusable across features)
|
|
16
|
+
- Layout components (structural components)
|
|
17
|
+
4. **Check dependencies**: Review existing components and shared modules to avoid duplication
|
|
18
|
+
5. **Implement component**: Create component with proper TypeScript types and lifecycle hooks
|
|
19
|
+
6. **Add inputs/outputs**: Define @Input and @Output properties with proper typing
|
|
20
|
+
7. **Create template**: Build HTML template with proper Angular directives and bindings
|
|
21
|
+
8. **Add styles**: Implement component styles following project's styling approach
|
|
22
|
+
9. **Create tests**: Write comprehensive unit tests with TestBed and proper mocking
|
|
23
|
+
10. **Update module**: Register component in appropriate Angular module
|
|
24
|
+
|
|
25
|
+
## Implementation Requirements
|
|
26
|
+
|
|
27
|
+
- Follow project's Angular architecture and naming conventions
|
|
28
|
+
- Use proper component lifecycle hooks (OnInit, OnDestroy, etc.)
|
|
29
|
+
- Include comprehensive TypeScript interfaces for inputs and outputs
|
|
30
|
+
- Implement proper change detection strategy (OnPush when possible)
|
|
31
|
+
- Add proper subscription management with takeUntil or async pipe
|
|
32
|
+
- Follow Angular style guide and project coding standards
|
|
33
|
+
- Consider component performance and memory management
|
|
34
|
+
|
|
35
|
+
## Component Patterns to Consider
|
|
36
|
+
|
|
37
|
+
Based on the request:
|
|
38
|
+
- **Smart Components**: Container components that manage state and services
|
|
39
|
+
- **Dumb Components**: Presentation components that only receive inputs
|
|
40
|
+
- **Feature Components**: Components specific to business features
|
|
41
|
+
- **Shared Components**: Reusable UI components across the application
|
|
42
|
+
- **Form Components**: Reactive forms with validation and custom controls
|
|
43
|
+
- **Data Display**: Components for tables, lists, cards with proper data binding
|
|
44
|
+
|
|
45
|
+
## Angular-Specific Implementation
|
|
46
|
+
|
|
47
|
+
- **Template Syntax**: Proper use of Angular directives (*ngFor, *ngIf, etc.)
|
|
48
|
+
- **Data Binding**: Property binding, event binding, two-way binding
|
|
49
|
+
- **Change Detection**: OnPush strategy for performance optimization
|
|
50
|
+
- **Lifecycle Management**: Proper use of lifecycle hooks
|
|
51
|
+
- **Dependency Injection**: Service injection in component constructors
|
|
52
|
+
- **Testing**: TestBed configuration with proper mocking and spies
|
|
53
|
+
|
|
54
|
+
## Important Notes
|
|
55
|
+
|
|
56
|
+
- ALWAYS examine existing components first to understand project patterns
|
|
57
|
+
- Use the same styling approach and class naming as existing components
|
|
58
|
+
- Follow project's folder structure for components (usually feature-based)
|
|
59
|
+
- Don't install new dependencies without asking
|
|
60
|
+
- Consider component reusability and single responsibility principle
|
|
61
|
+
- Add proper TypeScript types for all component properties and methods
|
|
62
|
+
- Use trackBy functions for performance in *ngFor loops
|
|
63
|
+
- Implement proper unsubscription patterns to prevent memory leaks
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Angular Services
|
|
2
|
+
|
|
3
|
+
Create Angular services for $ARGUMENTS following project conventions.
|
|
4
|
+
|
|
5
|
+
## Task
|
|
6
|
+
|
|
7
|
+
Create or optimize Angular services based on the requirements:
|
|
8
|
+
|
|
9
|
+
1. **Analyze existing services**: Check current service patterns, naming conventions, and folder organization
|
|
10
|
+
2. **Examine Angular setup**: Review project structure, dependency injection patterns, and TypeScript configuration
|
|
11
|
+
3. **Identify service type**: Determine the service category:
|
|
12
|
+
- Data services (HTTP API calls, state management)
|
|
13
|
+
- Utility services (validation, formatting, helpers)
|
|
14
|
+
- Business logic services (calculations, workflows)
|
|
15
|
+
- Infrastructure services (logging, authentication, error handling)
|
|
16
|
+
- Feature services (component-specific logic)
|
|
17
|
+
4. **Check dependencies**: Review existing services and shared modules to avoid duplication
|
|
18
|
+
5. **Implement service**: Create service with proper dependency injection and TypeScript types
|
|
19
|
+
6. **Add error handling**: Include comprehensive error handling with RxJS operators
|
|
20
|
+
7. **Create tests**: Write unit tests with proper mocking following project patterns
|
|
21
|
+
8. **Update module registration**: Register service in appropriate Angular modules
|
|
22
|
+
|
|
23
|
+
## Implementation Requirements
|
|
24
|
+
|
|
25
|
+
- Follow project's Angular architecture and naming conventions (usually .service.ts)
|
|
26
|
+
- Use proper dependency injection with @Injectable decorator
|
|
27
|
+
- Include comprehensive TypeScript interfaces and types
|
|
28
|
+
- Implement proper RxJS patterns (observables, operators, error handling)
|
|
29
|
+
- Add proper error handling and logging integration
|
|
30
|
+
- Follow single responsibility principle for service design
|
|
31
|
+
- Consider service lifecycle and singleton patterns
|
|
32
|
+
|
|
33
|
+
## Service Patterns to Consider
|
|
34
|
+
|
|
35
|
+
Based on the request:
|
|
36
|
+
- **HTTP Data Services**: API calls with proper error handling and caching
|
|
37
|
+
- **State Management**: Services for sharing data between components
|
|
38
|
+
- **Authentication**: User authentication, token management, guards
|
|
39
|
+
- **Business Logic**: Complex calculations, workflows, validations
|
|
40
|
+
- **Utility Services**: Reusable functions, formatters, validators
|
|
41
|
+
- **Feature Services**: Component-specific logic extraction
|
|
42
|
+
- **Infrastructure**: Logging, monitoring, configuration services
|
|
43
|
+
|
|
44
|
+
## Angular-Specific Implementation
|
|
45
|
+
|
|
46
|
+
- **Dependency Injection**: Proper use of @Injectable and providedIn
|
|
47
|
+
- **RxJS Integration**: Observables, subjects, operators for reactive programming
|
|
48
|
+
- **HTTP Client**: Angular HttpClient for API communication
|
|
49
|
+
- **Error Handling**: Global error handling and user-friendly error messages
|
|
50
|
+
- **Testing**: TestBed, jasmine, karma for comprehensive unit testing
|
|
51
|
+
- **Module Organization**: Feature modules, shared modules, core modules
|
|
52
|
+
|
|
53
|
+
## Important Notes
|
|
54
|
+
|
|
55
|
+
- ALWAYS examine existing services first to understand project patterns
|
|
56
|
+
- Use the same error handling and response patterns as existing services
|
|
57
|
+
- Follow project's folder structure for services (usually /services or /core)
|
|
58
|
+
- Don't install new dependencies without asking
|
|
59
|
+
- Consider service performance and memory management
|
|
60
|
+
- Add proper RxJS subscription management to prevent memory leaks
|
|
61
|
+
- Use Angular's built-in services (HttpClient, Router) rather than external libraries
|
|
62
|
+
- Include proper TypeScript types for all service methods and properties
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# API Endpoint Generator
|
|
2
|
+
|
|
3
|
+
Generate a complete API endpoint for $ARGUMENTS following project conventions.
|
|
4
|
+
|
|
5
|
+
## Task
|
|
6
|
+
|
|
7
|
+
Create a new API endpoint with all necessary components:
|
|
8
|
+
|
|
9
|
+
1. **Analyze project architecture**: Examine existing API structure, patterns, and conventions
|
|
10
|
+
2. **Identify framework**: Determine if using Express, Fastify, NestJS, Next.js API routes, or other framework
|
|
11
|
+
3. **Check authentication**: Review existing auth patterns and middleware usage
|
|
12
|
+
4. **Examine data layer**: Identify database/ORM patterns (Prisma, TypeORM, Mongoose, etc.)
|
|
13
|
+
5. **Create endpoint structure**: Generate route, controller, validation, and service layers
|
|
14
|
+
6. **Implement business logic**: Add core functionality with proper error handling
|
|
15
|
+
7. **Add validation**: Include input validation using project's validation library
|
|
16
|
+
8. **Create tests**: Write unit and integration tests following project patterns
|
|
17
|
+
9. **Update documentation**: Add endpoint documentation (OpenAPI/Swagger if used)
|
|
18
|
+
|
|
19
|
+
## Implementation Requirements
|
|
20
|
+
|
|
21
|
+
- Follow project's TypeScript conventions and interfaces
|
|
22
|
+
- Use existing middleware patterns for auth, validation, logging
|
|
23
|
+
- Include proper HTTP status codes and error responses
|
|
24
|
+
- Add comprehensive input validation and sanitization
|
|
25
|
+
- Implement proper logging and monitoring
|
|
26
|
+
- Consider rate limiting and security headers
|
|
27
|
+
- Follow project's database transaction patterns
|
|
28
|
+
|
|
29
|
+
## Framework-Specific Patterns
|
|
30
|
+
|
|
31
|
+
I'll adapt to your project's framework:
|
|
32
|
+
- **Express**: Routes, controllers, middleware
|
|
33
|
+
- **Fastify**: Routes, handlers, schemas, plugins
|
|
34
|
+
- **NestJS**: Controllers, services, DTOs, guards
|
|
35
|
+
- **Next.js**: API routes with proper HTTP methods
|
|
36
|
+
- **tRPC**: Procedures with input/output validation
|
|
37
|
+
- **GraphQL**: Resolvers with proper type definitions
|
|
38
|
+
|
|
39
|
+
## Important Notes
|
|
40
|
+
|
|
41
|
+
- ALWAYS examine existing endpoints first to understand project patterns
|
|
42
|
+
- Use the same error handling and response format as existing endpoints
|
|
43
|
+
- Follow project's folder structure and naming conventions
|
|
44
|
+
- Don't install new dependencies without asking
|
|
45
|
+
- Consider backward compatibility if modifying existing endpoints
|
|
46
|
+
- Add proper database migrations if schema changes are needed
|