claude-code-templates 1.14.13 → 1.14.14
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/package.json +1 -2
- package/templates/common/.claude/commands/git-workflow.md +0 -239
- package/templates/common/.claude/commands/project-setup.md +0 -316
- package/templates/common/.mcp.json +0 -41
- package/templates/common/CLAUDE.md +0 -109
- package/templates/common/README.md +0 -96
- package/templates/go/.mcp.json +0 -78
- package/templates/go/README.md +0 -25
- package/templates/javascript-typescript/.claude/commands/api-endpoint.md +0 -51
- package/templates/javascript-typescript/.claude/commands/debug.md +0 -52
- package/templates/javascript-typescript/.claude/commands/lint.md +0 -48
- package/templates/javascript-typescript/.claude/commands/npm-scripts.md +0 -48
- package/templates/javascript-typescript/.claude/commands/refactor.md +0 -55
- package/templates/javascript-typescript/.claude/commands/test.md +0 -61
- package/templates/javascript-typescript/.claude/commands/typescript-migrate.md +0 -51
- package/templates/javascript-typescript/.claude/settings.json +0 -142
- package/templates/javascript-typescript/.mcp.json +0 -80
- package/templates/javascript-typescript/CLAUDE.md +0 -185
- package/templates/javascript-typescript/README.md +0 -259
- package/templates/javascript-typescript/examples/angular-app/.claude/commands/components.md +0 -63
- package/templates/javascript-typescript/examples/angular-app/.claude/commands/services.md +0 -62
- package/templates/javascript-typescript/examples/node-api/.claude/commands/api-endpoint.md +0 -46
- package/templates/javascript-typescript/examples/node-api/.claude/commands/database.md +0 -56
- package/templates/javascript-typescript/examples/node-api/.claude/commands/middleware.md +0 -61
- package/templates/javascript-typescript/examples/node-api/.claude/commands/route.md +0 -57
- package/templates/javascript-typescript/examples/node-api/CLAUDE.md +0 -102
- package/templates/javascript-typescript/examples/react-app/.claude/commands/component.md +0 -29
- package/templates/javascript-typescript/examples/react-app/.claude/commands/hooks.md +0 -44
- package/templates/javascript-typescript/examples/react-app/.claude/commands/state-management.md +0 -45
- package/templates/javascript-typescript/examples/react-app/CLAUDE.md +0 -81
- package/templates/javascript-typescript/examples/react-app/agents/react-performance-optimization.md +0 -530
- package/templates/javascript-typescript/examples/react-app/agents/react-state-management.md +0 -295
- package/templates/javascript-typescript/examples/vue-app/.claude/commands/components.md +0 -46
- package/templates/javascript-typescript/examples/vue-app/.claude/commands/composables.md +0 -51
- package/templates/python/.claude/commands/lint.md +0 -111
- package/templates/python/.claude/commands/test.md +0 -73
- package/templates/python/.claude/settings.json +0 -153
- package/templates/python/.mcp.json +0 -78
- package/templates/python/CLAUDE.md +0 -276
- package/templates/python/examples/django-app/.claude/commands/admin.md +0 -264
- package/templates/python/examples/django-app/.claude/commands/django-model.md +0 -124
- package/templates/python/examples/django-app/.claude/commands/views.md +0 -222
- package/templates/python/examples/django-app/CLAUDE.md +0 -313
- package/templates/python/examples/fastapi-app/.claude/commands/api-endpoints.md +0 -513
- package/templates/python/examples/fastapi-app/.claude/commands/auth.md +0 -775
- package/templates/python/examples/fastapi-app/.claude/commands/database.md +0 -657
- package/templates/python/examples/fastapi-app/.claude/commands/deployment.md +0 -160
- package/templates/python/examples/fastapi-app/.claude/commands/testing.md +0 -927
- package/templates/python/examples/fastapi-app/CLAUDE.md +0 -229
- package/templates/python/examples/flask-app/.claude/commands/app-factory.md +0 -384
- package/templates/python/examples/flask-app/.claude/commands/blueprint.md +0 -243
- package/templates/python/examples/flask-app/.claude/commands/database.md +0 -410
- package/templates/python/examples/flask-app/.claude/commands/deployment.md +0 -620
- package/templates/python/examples/flask-app/.claude/commands/flask-route.md +0 -217
- package/templates/python/examples/flask-app/.claude/commands/testing.md +0 -559
- package/templates/python/examples/flask-app/CLAUDE.md +0 -391
- package/templates/ruby/.claude/commands/model.md +0 -360
- package/templates/ruby/.claude/commands/test.md +0 -480
- package/templates/ruby/.claude/settings.json +0 -146
- package/templates/ruby/.mcp.json +0 -83
- package/templates/ruby/CLAUDE.md +0 -284
- package/templates/ruby/examples/rails-app/.claude/commands/authentication.md +0 -490
- package/templates/ruby/examples/rails-app/CLAUDE.md +0 -376
- package/templates/rust/.mcp.json +0 -78
- package/templates/rust/README.md +0 -26
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
# Flask Route Generator
|
|
2
|
-
|
|
3
|
-
Create Flask routes with proper structure and error handling.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
This command helps you quickly create Flask routes with validation, error handling, and best practices.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
/flask-route
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## What this command does
|
|
16
|
-
|
|
17
|
-
1. **Creates route functions** with proper decorators
|
|
18
|
-
2. **Adds request validation** and error handling
|
|
19
|
-
3. **Includes JSON responses** and status codes
|
|
20
|
-
4. **Implements authentication** if needed
|
|
21
|
-
5. **Follows Flask conventions** and best practices
|
|
22
|
-
|
|
23
|
-
## Example Output
|
|
24
|
-
|
|
25
|
-
```python
|
|
26
|
-
# routes.py or app.py
|
|
27
|
-
from flask import Flask, request, jsonify, abort
|
|
28
|
-
from flask_sqlalchemy import SQLAlchemy
|
|
29
|
-
from werkzeug.exceptions import BadRequest
|
|
30
|
-
|
|
31
|
-
app = Flask(__name__)
|
|
32
|
-
|
|
33
|
-
@app.route('/users', methods=['GET'])
|
|
34
|
-
def get_users():
|
|
35
|
-
"""Get all users with optional pagination."""
|
|
36
|
-
try:
|
|
37
|
-
page = request.args.get('page', 1, type=int)
|
|
38
|
-
per_page = request.args.get('per_page', 10, type=int)
|
|
39
|
-
|
|
40
|
-
users = User.query.paginate(
|
|
41
|
-
page=page,
|
|
42
|
-
per_page=per_page,
|
|
43
|
-
error_out=False
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
return jsonify({
|
|
47
|
-
'users': [user.to_dict() for user in users.items],
|
|
48
|
-
'total': users.total,
|
|
49
|
-
'pages': users.pages,
|
|
50
|
-
'current_page': page
|
|
51
|
-
}), 200
|
|
52
|
-
|
|
53
|
-
except Exception as e:
|
|
54
|
-
return jsonify({'error': 'Failed to fetch users'}), 500
|
|
55
|
-
|
|
56
|
-
@app.route('/users/<int:user_id>', methods=['GET'])
|
|
57
|
-
def get_user(user_id):
|
|
58
|
-
"""Get a specific user by ID."""
|
|
59
|
-
try:
|
|
60
|
-
user = User.query.get_or_404(user_id)
|
|
61
|
-
return jsonify(user.to_dict()), 200
|
|
62
|
-
|
|
63
|
-
except Exception as e:
|
|
64
|
-
return jsonify({'error': 'User not found'}), 404
|
|
65
|
-
|
|
66
|
-
@app.route('/users', methods=['POST'])
|
|
67
|
-
def create_user():
|
|
68
|
-
"""Create a new user."""
|
|
69
|
-
try:
|
|
70
|
-
data = request.get_json()
|
|
71
|
-
|
|
72
|
-
if not data:
|
|
73
|
-
return jsonify({'error': 'No data provided'}), 400
|
|
74
|
-
|
|
75
|
-
# Validate required fields
|
|
76
|
-
required_fields = ['name', 'email']
|
|
77
|
-
for field in required_fields:
|
|
78
|
-
if field not in data:
|
|
79
|
-
return jsonify({'error': f'{field} is required'}), 400
|
|
80
|
-
|
|
81
|
-
# Check if email already exists
|
|
82
|
-
if User.query.filter_by(email=data['email']).first():
|
|
83
|
-
return jsonify({'error': 'Email already exists'}), 409
|
|
84
|
-
|
|
85
|
-
# Create new user
|
|
86
|
-
user = User(
|
|
87
|
-
name=data['name'],
|
|
88
|
-
email=data['email'],
|
|
89
|
-
phone=data.get('phone'),
|
|
90
|
-
address=data.get('address')
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
db.session.add(user)
|
|
94
|
-
db.session.commit()
|
|
95
|
-
|
|
96
|
-
return jsonify(user.to_dict()), 201
|
|
97
|
-
|
|
98
|
-
except BadRequest:
|
|
99
|
-
return jsonify({'error': 'Invalid JSON data'}), 400
|
|
100
|
-
except Exception as e:
|
|
101
|
-
db.session.rollback()
|
|
102
|
-
return jsonify({'error': 'Failed to create user'}), 500
|
|
103
|
-
|
|
104
|
-
@app.route('/users/<int:user_id>', methods=['PUT'])
|
|
105
|
-
def update_user(user_id):
|
|
106
|
-
"""Update an existing user."""
|
|
107
|
-
try:
|
|
108
|
-
user = User.query.get_or_404(user_id)
|
|
109
|
-
data = request.get_json()
|
|
110
|
-
|
|
111
|
-
if not data:
|
|
112
|
-
return jsonify({'error': 'No data provided'}), 400
|
|
113
|
-
|
|
114
|
-
# Update fields
|
|
115
|
-
if 'name' in data:
|
|
116
|
-
user.name = data['name']
|
|
117
|
-
if 'email' in data:
|
|
118
|
-
# Check if new email already exists
|
|
119
|
-
existing_user = User.query.filter_by(email=data['email']).first()
|
|
120
|
-
if existing_user and existing_user.id != user_id:
|
|
121
|
-
return jsonify({'error': 'Email already exists'}), 409
|
|
122
|
-
user.email = data['email']
|
|
123
|
-
if 'phone' in data:
|
|
124
|
-
user.phone = data['phone']
|
|
125
|
-
if 'address' in data:
|
|
126
|
-
user.address = data['address']
|
|
127
|
-
|
|
128
|
-
db.session.commit()
|
|
129
|
-
|
|
130
|
-
return jsonify(user.to_dict()), 200
|
|
131
|
-
|
|
132
|
-
except BadRequest:
|
|
133
|
-
return jsonify({'error': 'Invalid JSON data'}), 400
|
|
134
|
-
except Exception as e:
|
|
135
|
-
db.session.rollback()
|
|
136
|
-
return jsonify({'error': 'Failed to update user'}), 500
|
|
137
|
-
|
|
138
|
-
@app.route('/users/<int:user_id>', methods=['DELETE'])
|
|
139
|
-
def delete_user(user_id):
|
|
140
|
-
"""Delete a user."""
|
|
141
|
-
try:
|
|
142
|
-
user = User.query.get_or_404(user_id)
|
|
143
|
-
|
|
144
|
-
db.session.delete(user)
|
|
145
|
-
db.session.commit()
|
|
146
|
-
|
|
147
|
-
return jsonify({'message': 'User deleted successfully'}), 200
|
|
148
|
-
|
|
149
|
-
except Exception as e:
|
|
150
|
-
db.session.rollback()
|
|
151
|
-
return jsonify({'error': 'Failed to delete user'}), 500
|
|
152
|
-
|
|
153
|
-
# Error handlers
|
|
154
|
-
@app.errorhandler(404)
|
|
155
|
-
def not_found(error):
|
|
156
|
-
return jsonify({'error': 'Resource not found'}), 404
|
|
157
|
-
|
|
158
|
-
@app.errorhandler(400)
|
|
159
|
-
def bad_request(error):
|
|
160
|
-
return jsonify({'error': 'Bad request'}), 400
|
|
161
|
-
|
|
162
|
-
@app.errorhandler(500)
|
|
163
|
-
def internal_error(error):
|
|
164
|
-
return jsonify({'error': 'Internal server error'}), 500
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Route Patterns Supported
|
|
168
|
-
|
|
169
|
-
### Basic Routes
|
|
170
|
-
```python
|
|
171
|
-
@app.route('/')
|
|
172
|
-
@app.route('/users')
|
|
173
|
-
@app.route('/users/<int:user_id>')
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### HTTP Methods
|
|
177
|
-
```python
|
|
178
|
-
@app.route('/users', methods=['GET', 'POST'])
|
|
179
|
-
@app.route('/users/<int:id>', methods=['GET', 'PUT', 'DELETE'])
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### URL Parameters
|
|
183
|
-
```python
|
|
184
|
-
@app.route('/users/<int:user_id>')
|
|
185
|
-
@app.route('/posts/<string:slug>')
|
|
186
|
-
@app.route('/files/<path:filename>')
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Best Practices Included
|
|
190
|
-
|
|
191
|
-
- **Input validation** for all user data
|
|
192
|
-
- **Proper HTTP status codes** (200, 201, 400, 404, 500)
|
|
193
|
-
- **JSON responses** with consistent structure
|
|
194
|
-
- **Error handling** with try/catch blocks
|
|
195
|
-
- **Database rollback** on errors
|
|
196
|
-
- **RESTful conventions** for URL design
|
|
197
|
-
- **Documentation strings** for each route
|
|
198
|
-
- **Request data validation** before processing
|
|
199
|
-
|
|
200
|
-
## Common Response Patterns
|
|
201
|
-
|
|
202
|
-
```python
|
|
203
|
-
# Success with data
|
|
204
|
-
return jsonify({'data': result}), 200
|
|
205
|
-
|
|
206
|
-
# Created resource
|
|
207
|
-
return jsonify({'data': new_resource, 'id': new_id}), 201
|
|
208
|
-
|
|
209
|
-
# Validation error
|
|
210
|
-
return jsonify({'error': 'Field is required'}), 400
|
|
211
|
-
|
|
212
|
-
# Not found
|
|
213
|
-
return jsonify({'error': 'Resource not found'}), 404
|
|
214
|
-
|
|
215
|
-
# Server error
|
|
216
|
-
return jsonify({'error': 'Internal server error'}), 500
|
|
217
|
-
```
|