claude-code-templates 1.2.0 → 1.3.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/package.json +10 -8
- package/src/command-scanner.js +1 -1
- package/src/file-operations.js +44 -3
- package/src/hook-scanner.js +229 -52
- package/src/index.js +23 -3
- package/src/prompts.js +68 -2
- package/src/templates.js +31 -8
- package/scripts/sync-templates.js +0 -182
- package/templates/common/.claude/commands/git-workflow.md +0 -239
- package/templates/common/.claude/commands/project-setup.md +0 -316
- package/templates/common/CLAUDE.md +0 -109
- package/templates/common/README.md +0 -96
- 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 -13
- 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/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/django-model.md +0 -124
- package/templates/python/.claude/commands/flask-route.md +0 -217
- package/templates/python/.claude/commands/lint.md +0 -111
- package/templates/python/.claude/commands/test.md +0 -73
- package/templates/python/CLAUDE.md +0 -276
- 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
|
-
```
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# Python Linter
|
|
2
|
-
|
|
3
|
-
Run Python code linting and formatting tools.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
This command helps you maintain code quality using Python's best linting and formatting tools.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
/lint
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## What this command does
|
|
16
|
-
|
|
17
|
-
1. **Runs multiple linters** (flake8, pylint, black, isort)
|
|
18
|
-
2. **Provides detailed feedback** on code quality issues
|
|
19
|
-
3. **Auto-fixes formatting** where possible
|
|
20
|
-
4. **Checks type hints** if mypy is configured
|
|
21
|
-
|
|
22
|
-
## Example Commands
|
|
23
|
-
|
|
24
|
-
### Black (code formatting)
|
|
25
|
-
```bash
|
|
26
|
-
# Format all Python files
|
|
27
|
-
black .
|
|
28
|
-
|
|
29
|
-
# Check formatting without changing files
|
|
30
|
-
black --check .
|
|
31
|
-
|
|
32
|
-
# Format specific file
|
|
33
|
-
black src/main.py
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### flake8 (style guide enforcement)
|
|
37
|
-
```bash
|
|
38
|
-
# Check all Python files
|
|
39
|
-
flake8 .
|
|
40
|
-
|
|
41
|
-
# Check specific directory
|
|
42
|
-
flake8 src/
|
|
43
|
-
|
|
44
|
-
# Check with specific rules
|
|
45
|
-
flake8 --max-line-length=88 .
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### isort (import sorting)
|
|
49
|
-
```bash
|
|
50
|
-
# Sort imports in all files
|
|
51
|
-
isort .
|
|
52
|
-
|
|
53
|
-
# Check import sorting
|
|
54
|
-
isort --check-only .
|
|
55
|
-
|
|
56
|
-
# Sort imports in specific file
|
|
57
|
-
isort src/main.py
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### pylint (comprehensive linting)
|
|
61
|
-
```bash
|
|
62
|
-
# Run pylint on all files
|
|
63
|
-
pylint src/
|
|
64
|
-
|
|
65
|
-
# Run with specific score threshold
|
|
66
|
-
pylint --fail-under=8.0 src/
|
|
67
|
-
|
|
68
|
-
# Generate detailed report
|
|
69
|
-
pylint --output-format=html src/ > pylint_report.html
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### mypy (type checking)
|
|
73
|
-
```bash
|
|
74
|
-
# Check types in all files
|
|
75
|
-
mypy .
|
|
76
|
-
|
|
77
|
-
# Check specific module
|
|
78
|
-
mypy src/models.py
|
|
79
|
-
|
|
80
|
-
# Check with strict mode
|
|
81
|
-
mypy --strict src/
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Configuration Files
|
|
85
|
-
|
|
86
|
-
Most projects benefit from configuration files:
|
|
87
|
-
|
|
88
|
-
### .flake8
|
|
89
|
-
```ini
|
|
90
|
-
[flake8]
|
|
91
|
-
max-line-length = 88
|
|
92
|
-
exclude = .git,__pycache__,venv
|
|
93
|
-
ignore = E203,W503
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### pyproject.toml
|
|
97
|
-
```toml
|
|
98
|
-
[tool.black]
|
|
99
|
-
line-length = 88
|
|
100
|
-
|
|
101
|
-
[tool.isort]
|
|
102
|
-
profile = "black"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Best Practices
|
|
106
|
-
|
|
107
|
-
- Run linters before committing code
|
|
108
|
-
- Use consistent formatting across the project
|
|
109
|
-
- Fix linting issues promptly
|
|
110
|
-
- Configure linters to match your team's style
|
|
111
|
-
- Use type hints for better code documentation
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Test Runner
|
|
2
|
-
|
|
3
|
-
Run Python tests with pytest, unittest, or other testing frameworks.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
This command helps you run Python tests effectively with proper configuration and reporting.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
/test
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## What this command does
|
|
16
|
-
|
|
17
|
-
1. **Detects test framework** (pytest, unittest, nose2)
|
|
18
|
-
2. **Runs appropriate tests** with proper configuration
|
|
19
|
-
3. **Provides coverage reporting** if available
|
|
20
|
-
4. **Shows clear test results** with failure details
|
|
21
|
-
|
|
22
|
-
## Example Commands
|
|
23
|
-
|
|
24
|
-
### pytest (recommended)
|
|
25
|
-
```bash
|
|
26
|
-
# Run all tests
|
|
27
|
-
pytest
|
|
28
|
-
|
|
29
|
-
# Run with coverage
|
|
30
|
-
pytest --cov=src --cov-report=html
|
|
31
|
-
|
|
32
|
-
# Run specific test file
|
|
33
|
-
pytest tests/test_models.py
|
|
34
|
-
|
|
35
|
-
# Run with verbose output
|
|
36
|
-
pytest -v
|
|
37
|
-
|
|
38
|
-
# Run tests matching pattern
|
|
39
|
-
pytest -k "test_user"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### unittest
|
|
43
|
-
```bash
|
|
44
|
-
# Run all tests
|
|
45
|
-
python -m unittest discover
|
|
46
|
-
|
|
47
|
-
# Run specific test file
|
|
48
|
-
python -m unittest tests.test_models
|
|
49
|
-
|
|
50
|
-
# Run with verbose output
|
|
51
|
-
python -m unittest -v
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Django tests
|
|
55
|
-
```bash
|
|
56
|
-
# Run all Django tests
|
|
57
|
-
python manage.py test
|
|
58
|
-
|
|
59
|
-
# Run specific app tests
|
|
60
|
-
python manage.py test myapp
|
|
61
|
-
|
|
62
|
-
# Run with coverage
|
|
63
|
-
coverage run --source='.' manage.py test
|
|
64
|
-
coverage report
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Best Practices
|
|
68
|
-
|
|
69
|
-
- Write tests for all critical functionality
|
|
70
|
-
- Use descriptive test names
|
|
71
|
-
- Keep tests isolated and independent
|
|
72
|
-
- Mock external dependencies
|
|
73
|
-
- Aim for high test coverage (80%+)
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
This is a Python project optimized for modern Python development. The project uses industry-standard tools and follows best practices for scalable application development.
|
|
8
|
-
|
|
9
|
-
## Development Commands
|
|
10
|
-
|
|
11
|
-
### Environment Management
|
|
12
|
-
- `python -m venv venv` - Create virtual environment
|
|
13
|
-
- `source venv/bin/activate` (Linux/Mac) or `venv\Scripts\activate` (Windows) - Activate virtual environment
|
|
14
|
-
- `deactivate` - Deactivate virtual environment
|
|
15
|
-
- `pip install -r requirements.txt` - Install dependencies
|
|
16
|
-
- `pip install -r requirements-dev.txt` - Install development dependencies
|
|
17
|
-
|
|
18
|
-
### Package Management
|
|
19
|
-
- `pip install <package>` - Install a package
|
|
20
|
-
- `pip install -e .` - Install project in development mode
|
|
21
|
-
- `pip freeze > requirements.txt` - Generate requirements file
|
|
22
|
-
- `pip-tools compile requirements.in` - Compile requirements with pip-tools
|
|
23
|
-
|
|
24
|
-
### Testing Commands
|
|
25
|
-
- `pytest` - Run all tests
|
|
26
|
-
- `pytest -v` - Run tests with verbose output
|
|
27
|
-
- `pytest --cov` - Run tests with coverage report
|
|
28
|
-
- `pytest --cov-report=html` - Generate HTML coverage report
|
|
29
|
-
- `pytest -x` - Stop on first failure
|
|
30
|
-
- `pytest -k "test_name"` - Run specific test by name
|
|
31
|
-
- `python -m unittest` - Run tests with unittest
|
|
32
|
-
|
|
33
|
-
### Code Quality Commands
|
|
34
|
-
- `black .` - Format code with Black
|
|
35
|
-
- `black --check .` - Check code formatting without changes
|
|
36
|
-
- `isort .` - Sort imports
|
|
37
|
-
- `isort --check-only .` - Check import sorting
|
|
38
|
-
- `flake8` - Run linting with Flake8
|
|
39
|
-
- `pylint src/` - Run linting with Pylint
|
|
40
|
-
- `mypy src/` - Run type checking with MyPy
|
|
41
|
-
|
|
42
|
-
### Development Tools
|
|
43
|
-
- `python -m pip install --upgrade pip` - Upgrade pip
|
|
44
|
-
- `python -c "import sys; print(sys.version)"` - Check Python version
|
|
45
|
-
- `python -m site` - Show Python site information
|
|
46
|
-
- `python -m pdb script.py` - Debug with pdb
|
|
47
|
-
|
|
48
|
-
## Technology Stack
|
|
49
|
-
|
|
50
|
-
### Core Technologies
|
|
51
|
-
- **Python** - Primary programming language (3.8+)
|
|
52
|
-
- **pip** - Package management
|
|
53
|
-
- **venv** - Virtual environment management
|
|
54
|
-
|
|
55
|
-
### Common Frameworks
|
|
56
|
-
- **Django** - High-level web framework
|
|
57
|
-
- **Flask** - Micro web framework
|
|
58
|
-
- **FastAPI** - Modern API framework with automatic documentation
|
|
59
|
-
- **SQLAlchemy** - SQL toolkit and ORM
|
|
60
|
-
- **Pydantic** - Data validation using Python type hints
|
|
61
|
-
|
|
62
|
-
### Data Science & ML
|
|
63
|
-
- **NumPy** - Numerical computing
|
|
64
|
-
- **Pandas** - Data manipulation and analysis
|
|
65
|
-
- **Matplotlib/Seaborn** - Data visualization
|
|
66
|
-
- **Scikit-learn** - Machine learning library
|
|
67
|
-
- **TensorFlow/PyTorch** - Deep learning frameworks
|
|
68
|
-
|
|
69
|
-
### Testing Frameworks
|
|
70
|
-
- **pytest** - Testing framework
|
|
71
|
-
- **unittest** - Built-in testing framework
|
|
72
|
-
- **pytest-cov** - Coverage plugin for pytest
|
|
73
|
-
- **factory-boy** - Test fixtures
|
|
74
|
-
- **responses** - Mock HTTP requests
|
|
75
|
-
|
|
76
|
-
### Code Quality Tools
|
|
77
|
-
- **Black** - Code formatter
|
|
78
|
-
- **isort** - Import sorter
|
|
79
|
-
- **flake8** - Style guide enforcement
|
|
80
|
-
- **pylint** - Code analysis
|
|
81
|
-
- **mypy** - Static type checker
|
|
82
|
-
- **pre-commit** - Git hooks framework
|
|
83
|
-
|
|
84
|
-
## Project Structure Guidelines
|
|
85
|
-
|
|
86
|
-
### File Organization
|
|
87
|
-
```
|
|
88
|
-
src/
|
|
89
|
-
├── package_name/
|
|
90
|
-
│ ├── __init__.py
|
|
91
|
-
│ ├── main.py # Application entry point
|
|
92
|
-
│ ├── models/ # Data models
|
|
93
|
-
│ ├── views/ # Web views (Django/Flask)
|
|
94
|
-
│ ├── api/ # API endpoints
|
|
95
|
-
│ ├── services/ # Business logic
|
|
96
|
-
│ ├── utils/ # Utility functions
|
|
97
|
-
│ └── config/ # Configuration files
|
|
98
|
-
tests/
|
|
99
|
-
├── __init__.py
|
|
100
|
-
├── conftest.py # pytest configuration
|
|
101
|
-
├── test_models.py
|
|
102
|
-
├── test_views.py
|
|
103
|
-
└── test_utils.py
|
|
104
|
-
requirements/
|
|
105
|
-
├── base.txt # Base requirements
|
|
106
|
-
├── dev.txt # Development requirements
|
|
107
|
-
└── prod.txt # Production requirements
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Naming Conventions
|
|
111
|
-
- **Files/Modules**: Use snake_case (`user_profile.py`)
|
|
112
|
-
- **Classes**: Use PascalCase (`UserProfile`)
|
|
113
|
-
- **Functions/Variables**: Use snake_case (`get_user_data`)
|
|
114
|
-
- **Constants**: Use UPPER_SNAKE_CASE (`API_BASE_URL`)
|
|
115
|
-
- **Private methods**: Prefix with underscore (`_private_method`)
|
|
116
|
-
|
|
117
|
-
## Python Guidelines
|
|
118
|
-
|
|
119
|
-
### Type Hints
|
|
120
|
-
- Use type hints for function parameters and return values
|
|
121
|
-
- Import types from `typing` module when needed
|
|
122
|
-
- Use `Optional` for nullable values
|
|
123
|
-
- Use `Union` for multiple possible types
|
|
124
|
-
- Document complex types with comments
|
|
125
|
-
|
|
126
|
-
### Code Style
|
|
127
|
-
- Follow PEP 8 style guide
|
|
128
|
-
- Use meaningful variable and function names
|
|
129
|
-
- Keep functions focused and single-purpose
|
|
130
|
-
- Use docstrings for modules, classes, and functions
|
|
131
|
-
- Limit line length to 88 characters (Black default)
|
|
132
|
-
|
|
133
|
-
### Best Practices
|
|
134
|
-
- Use list comprehensions for simple transformations
|
|
135
|
-
- Prefer `pathlib` over `os.path` for file operations
|
|
136
|
-
- Use context managers (`with` statements) for resource management
|
|
137
|
-
- Handle exceptions appropriately with try/except blocks
|
|
138
|
-
- Use `logging` module instead of print statements
|
|
139
|
-
|
|
140
|
-
## Testing Standards
|
|
141
|
-
|
|
142
|
-
### Test Structure
|
|
143
|
-
- Organize tests to mirror source code structure
|
|
144
|
-
- Use descriptive test names that explain the behavior
|
|
145
|
-
- Follow AAA pattern (Arrange, Act, Assert)
|
|
146
|
-
- Use fixtures for common test data
|
|
147
|
-
- Group related tests in classes
|
|
148
|
-
|
|
149
|
-
### Coverage Goals
|
|
150
|
-
- Aim for 90%+ test coverage
|
|
151
|
-
- Write unit tests for business logic
|
|
152
|
-
- Use integration tests for external dependencies
|
|
153
|
-
- Mock external services in tests
|
|
154
|
-
- Test error conditions and edge cases
|
|
155
|
-
|
|
156
|
-
### pytest Configuration
|
|
157
|
-
```python
|
|
158
|
-
# pytest.ini or pyproject.toml
|
|
159
|
-
[tool.pytest.ini_options]
|
|
160
|
-
testpaths = ["tests"]
|
|
161
|
-
python_files = ["test_*.py", "*_test.py"]
|
|
162
|
-
python_classes = ["Test*"]
|
|
163
|
-
python_functions = ["test_*"]
|
|
164
|
-
addopts = "--cov=src --cov-report=term-missing"
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Virtual Environment Setup
|
|
168
|
-
|
|
169
|
-
### Creation and Activation
|
|
170
|
-
```bash
|
|
171
|
-
# Create virtual environment
|
|
172
|
-
python -m venv venv
|
|
173
|
-
|
|
174
|
-
# Activate (Linux/Mac)
|
|
175
|
-
source venv/bin/activate
|
|
176
|
-
|
|
177
|
-
# Activate (Windows)
|
|
178
|
-
venv\Scripts\activate
|
|
179
|
-
|
|
180
|
-
# Install dependencies
|
|
181
|
-
pip install -r requirements.txt
|
|
182
|
-
pip install -r requirements-dev.txt
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Requirements Management
|
|
186
|
-
- Use `requirements.txt` for production dependencies
|
|
187
|
-
- Use `requirements-dev.txt` for development dependencies
|
|
188
|
-
- Consider using `pip-tools` for dependency resolution
|
|
189
|
-
- Pin versions for reproducible builds
|
|
190
|
-
|
|
191
|
-
## Django-Specific Guidelines
|
|
192
|
-
|
|
193
|
-
### Project Structure
|
|
194
|
-
```
|
|
195
|
-
project_name/
|
|
196
|
-
├── manage.py
|
|
197
|
-
├── project_name/
|
|
198
|
-
│ ├── __init__.py
|
|
199
|
-
│ ├── settings/
|
|
200
|
-
│ ├── urls.py
|
|
201
|
-
│ └── wsgi.py
|
|
202
|
-
├── apps/
|
|
203
|
-
│ ├── users/
|
|
204
|
-
│ ├── products/
|
|
205
|
-
│ └── orders/
|
|
206
|
-
└── requirements/
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Common Commands
|
|
210
|
-
- `python manage.py runserver` - Start development server
|
|
211
|
-
- `python manage.py migrate` - Apply database migrations
|
|
212
|
-
- `python manage.py makemigrations` - Create new migrations
|
|
213
|
-
- `python manage.py createsuperuser` - Create admin user
|
|
214
|
-
- `python manage.py collectstatic` - Collect static files
|
|
215
|
-
- `python manage.py test` - Run Django tests
|
|
216
|
-
|
|
217
|
-
## FastAPI-Specific Guidelines
|
|
218
|
-
|
|
219
|
-
### Project Structure
|
|
220
|
-
```
|
|
221
|
-
src/
|
|
222
|
-
├── main.py # FastAPI application
|
|
223
|
-
├── api/
|
|
224
|
-
│ ├── __init__.py
|
|
225
|
-
│ ├── dependencies.py # Dependency injection
|
|
226
|
-
│ └── v1/
|
|
227
|
-
│ ├── __init__.py
|
|
228
|
-
│ └── endpoints/
|
|
229
|
-
├── core/
|
|
230
|
-
│ ├── __init__.py
|
|
231
|
-
│ ├── config.py # Settings
|
|
232
|
-
│ └── security.py # Authentication
|
|
233
|
-
├── models/
|
|
234
|
-
├── schemas/ # Pydantic models
|
|
235
|
-
└── services/
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Common Commands
|
|
239
|
-
- `uvicorn main:app --reload` - Start development server
|
|
240
|
-
- `uvicorn main:app --host 0.0.0.0 --port 8000` - Start production server
|
|
241
|
-
|
|
242
|
-
## Security Guidelines
|
|
243
|
-
|
|
244
|
-
### Dependencies
|
|
245
|
-
- Regularly update dependencies with `pip list --outdated`
|
|
246
|
-
- Use `safety` package to check for known vulnerabilities
|
|
247
|
-
- Pin dependency versions in requirements files
|
|
248
|
-
- Use virtual environments to isolate dependencies
|
|
249
|
-
|
|
250
|
-
### Code Security
|
|
251
|
-
- Validate input data with Pydantic or similar
|
|
252
|
-
- Use environment variables for sensitive configuration
|
|
253
|
-
- Implement proper authentication and authorization
|
|
254
|
-
- Sanitize data before database operations
|
|
255
|
-
- Use HTTPS for production deployments
|
|
256
|
-
|
|
257
|
-
## Development Workflow
|
|
258
|
-
|
|
259
|
-
### Before Starting
|
|
260
|
-
1. Check Python version compatibility
|
|
261
|
-
2. Create and activate virtual environment
|
|
262
|
-
3. Install dependencies from requirements files
|
|
263
|
-
4. Run type checking with `mypy`
|
|
264
|
-
|
|
265
|
-
### During Development
|
|
266
|
-
1. Use type hints for better code documentation
|
|
267
|
-
2. Run tests frequently to catch issues early
|
|
268
|
-
3. Use meaningful commit messages
|
|
269
|
-
4. Format code with Black before committing
|
|
270
|
-
|
|
271
|
-
### Before Committing
|
|
272
|
-
1. Run full test suite: `pytest`
|
|
273
|
-
2. Check code formatting: `black --check .`
|
|
274
|
-
3. Sort imports: `isort --check-only .`
|
|
275
|
-
4. Run linting: `flake8`
|
|
276
|
-
5. Run type checking: `mypy src/`
|
package/templates/rust/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Rust Claude Code Templates
|
|
2
|
-
|
|
3
|
-
## Coming Soon! 🚧
|
|
4
|
-
|
|
5
|
-
We're actively working on creating comprehensive Claude Code templates for Rust development.
|
|
6
|
-
|
|
7
|
-
### What to Expect
|
|
8
|
-
- Best practices for Rust project structure
|
|
9
|
-
- Integration with popular Rust tools and frameworks
|
|
10
|
-
- Workflow optimizations for Rust development
|
|
11
|
-
- Testing and benchmarking configurations
|
|
12
|
-
- Cross-compilation and deployment setups
|
|
13
|
-
- Memory safety and performance guidelines
|
|
14
|
-
|
|
15
|
-
### Meanwhile...
|
|
16
|
-
You can use the [common templates](../common/README.md) as a starting point for your Rust projects. The universal guidelines and git workflows will work well with Rust development.
|
|
17
|
-
|
|
18
|
-
### Stay Updated
|
|
19
|
-
⭐ Star this repository to get notified when the Rust templates are released!
|
|
20
|
-
|
|
21
|
-
### Contributing
|
|
22
|
-
Interested in helping build these templates? We welcome contributions! Please check the main repository's contribution guidelines and feel free to open an issue or pull request.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
*Expected release: Coming soon*
|