claude-code-templates 1.16.1 → 1.17.1
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/README.md +7 -7
- package/bin/create-claude-config.js +17 -8
- package/package.json +2 -3
- package/src/analytics/core/AgentAnalyzer.js +17 -3
- package/src/analytics/core/ProcessDetector.js +23 -7
- package/src/analytics/core/StateCalculator.js +102 -33
- package/src/analytics/data/DataCache.js +7 -7
- package/src/analytics-web/chats_mobile.html +2590 -0
- package/src/analytics-web/components/App.js +10 -10
- package/src/analytics-web/components/SessionTimer.js +1 -1
- package/src/analytics-web/components/Sidebar.js +5 -14
- package/src/analytics-web/index.html +932 -78
- package/src/analytics.js +263 -5
- package/src/chats-mobile.js +682 -0
- package/src/claude-api-proxy.js +460 -0
- package/src/file-operations.js +239 -36
- package/src/health-check.js +310 -0
- package/src/index.js +1256 -36
- package/src/tracking-service.js +31 -34
- package/components/agents/api-security-audit.md +0 -92
- package/components/agents/database-optimization.md +0 -94
- package/components/agents/react-performance-optimization.md +0 -64
- package/components/commands/check-file.md +0 -53
- package/components/commands/generate-tests.md +0 -68
- package/components/mcps/deepgraph-nextjs.json +0 -12
- package/components/mcps/deepgraph-react.json +0 -12
- package/components/mcps/deepgraph-typescript.json +0 -12
- package/components/mcps/deepgraph-vue.json +0 -12
- package/components/mcps/filesystem-access.json +0 -12
- package/components/mcps/github-integration.json +0 -11
- package/components/mcps/memory-integration.json +0 -8
- package/components/mcps/mysql-integration.json +0 -11
- package/components/mcps/postgresql-integration.json +0 -11
- package/components/mcps/web-fetch.json +0 -8
- package/src/analytics-web/components/AgentsPage.js +0 -4761
- 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/django-app/agents/django-api-security.md +0 -642
- package/templates/python/examples/django-app/agents/django-database-optimization.md +0 -752
- 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,360 +0,0 @@
|
|
|
1
|
-
# Ruby Model Generator
|
|
2
|
-
|
|
3
|
-
Create Ruby classes and models with proper structure and best practices.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
This command helps you quickly create Ruby model classes with proper initialization, attributes, and methods following Ruby conventions.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
/model
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## What this command does
|
|
16
|
-
|
|
17
|
-
1. **Creates model classes** with proper initialization methods
|
|
18
|
-
2. **Adds attribute accessors** and instance variables
|
|
19
|
-
3. **Includes validation methods** and error handling
|
|
20
|
-
4. **Follows Ruby conventions** and best practices
|
|
21
|
-
5. **Generates related test files** when applicable
|
|
22
|
-
|
|
23
|
-
## Example Output
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
# app/models/user.rb
|
|
27
|
-
class User
|
|
28
|
-
attr_accessor :name, :email, :age
|
|
29
|
-
attr_reader :id, :created_at
|
|
30
|
-
|
|
31
|
-
def initialize(attributes = {})
|
|
32
|
-
@id = attributes[:id] || generate_id
|
|
33
|
-
@name = attributes[:name]
|
|
34
|
-
@email = attributes[:email]
|
|
35
|
-
@age = attributes[:age]
|
|
36
|
-
@created_at = Time.now
|
|
37
|
-
@errors = []
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def valid?
|
|
41
|
-
@errors.clear
|
|
42
|
-
validate_presence_of_name
|
|
43
|
-
validate_email_format
|
|
44
|
-
validate_age_range
|
|
45
|
-
@errors.empty?
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def errors
|
|
49
|
-
@errors.dup
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def save
|
|
53
|
-
return false unless valid?
|
|
54
|
-
|
|
55
|
-
# Persist logic here
|
|
56
|
-
true
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def to_h
|
|
60
|
-
{
|
|
61
|
-
id: @id,
|
|
62
|
-
name: @name,
|
|
63
|
-
email: @email,
|
|
64
|
-
age: @age,
|
|
65
|
-
created_at: @created_at
|
|
66
|
-
}
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def to_json(*args)
|
|
70
|
-
JSON.generate(to_h, *args)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
private
|
|
74
|
-
|
|
75
|
-
def validate_presence_of_name
|
|
76
|
-
if @name.nil? || @name.strip.empty?
|
|
77
|
-
@errors << "Name cannot be blank"
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def validate_email_format
|
|
82
|
-
if @email && !@email.match?(/\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i)
|
|
83
|
-
@errors << "Email format is invalid"
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def validate_age_range
|
|
88
|
-
if @age && (@age < 0 || @age > 150)
|
|
89
|
-
@errors << "Age must be between 0 and 150"
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def generate_id
|
|
94
|
-
SecureRandom.uuid
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# Example with inheritance
|
|
99
|
-
class AdminUser < User
|
|
100
|
-
attr_accessor :permissions
|
|
101
|
-
|
|
102
|
-
def initialize(attributes = {})
|
|
103
|
-
super
|
|
104
|
-
@permissions = attributes[:permissions] || []
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def admin?
|
|
108
|
-
true
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def has_permission?(permission)
|
|
112
|
-
@permissions.include?(permission)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
private
|
|
116
|
-
|
|
117
|
-
def validate_permissions
|
|
118
|
-
unless @permissions.is_a?(Array)
|
|
119
|
-
@errors << "Permissions must be an array"
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Advanced Features
|
|
126
|
-
|
|
127
|
-
### Module Inclusion
|
|
128
|
-
```ruby
|
|
129
|
-
module Timestamps
|
|
130
|
-
def self.included(base)
|
|
131
|
-
base.extend(ClassMethods)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
module ClassMethods
|
|
135
|
-
def with_timestamps
|
|
136
|
-
attr_reader :created_at, :updated_at
|
|
137
|
-
|
|
138
|
-
define_method :initialize do |*args|
|
|
139
|
-
super(*args)
|
|
140
|
-
@created_at ||= Time.now
|
|
141
|
-
@updated_at = @created_at
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
define_method :touch do
|
|
145
|
-
@updated_at = Time.now
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
class Post
|
|
152
|
-
include Timestamps
|
|
153
|
-
with_timestamps
|
|
154
|
-
|
|
155
|
-
attr_accessor :title, :content
|
|
156
|
-
|
|
157
|
-
def initialize(attributes = {})
|
|
158
|
-
@title = attributes[:title]
|
|
159
|
-
@content = attributes[:content]
|
|
160
|
-
super
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Class Methods and Scopes
|
|
166
|
-
```ruby
|
|
167
|
-
class User
|
|
168
|
-
@@users = []
|
|
169
|
-
|
|
170
|
-
def self.all
|
|
171
|
-
@@users.dup
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
def self.find_by_email(email)
|
|
175
|
-
@@users.find { |user| user.email == email }
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
def self.where(conditions = {})
|
|
179
|
-
@@users.select do |user|
|
|
180
|
-
conditions.all? { |key, value| user.send(key) == value }
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
def self.create(attributes = {})
|
|
185
|
-
user = new(attributes)
|
|
186
|
-
if user.save
|
|
187
|
-
@@users << user
|
|
188
|
-
user
|
|
189
|
-
else
|
|
190
|
-
nil
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
def save
|
|
195
|
-
return false unless valid?
|
|
196
|
-
|
|
197
|
-
unless @@users.include?(self)
|
|
198
|
-
@@users << self
|
|
199
|
-
end
|
|
200
|
-
true
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
def destroy
|
|
204
|
-
@@users.delete(self)
|
|
205
|
-
end
|
|
206
|
-
end
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
## Testing Template
|
|
210
|
-
|
|
211
|
-
```ruby
|
|
212
|
-
# spec/models/user_spec.rb
|
|
213
|
-
require 'spec_helper'
|
|
214
|
-
|
|
215
|
-
RSpec.describe User do
|
|
216
|
-
let(:valid_attributes) do
|
|
217
|
-
{
|
|
218
|
-
name: 'John Doe',
|
|
219
|
-
email: 'john@example.com',
|
|
220
|
-
age: 30
|
|
221
|
-
}
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
describe '#initialize' do
|
|
225
|
-
it 'sets attributes correctly' do
|
|
226
|
-
user = User.new(valid_attributes)
|
|
227
|
-
|
|
228
|
-
expect(user.name).to eq('John Doe')
|
|
229
|
-
expect(user.email).to eq('john@example.com')
|
|
230
|
-
expect(user.age).to eq(30)
|
|
231
|
-
expect(user.id).not_to be_nil
|
|
232
|
-
expect(user.created_at).to be_a(Time)
|
|
233
|
-
end
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
describe '#valid?' do
|
|
237
|
-
it 'returns true for valid attributes' do
|
|
238
|
-
user = User.new(valid_attributes)
|
|
239
|
-
expect(user).to be_valid
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
it 'returns false when name is blank' do
|
|
243
|
-
user = User.new(valid_attributes.merge(name: ''))
|
|
244
|
-
expect(user).not_to be_valid
|
|
245
|
-
expect(user.errors).to include('Name cannot be blank')
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
it 'returns false for invalid email format' do
|
|
249
|
-
user = User.new(valid_attributes.merge(email: 'invalid-email'))
|
|
250
|
-
expect(user).not_to be_valid
|
|
251
|
-
expect(user.errors).to include('Email format is invalid')
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
it 'returns false for invalid age' do
|
|
255
|
-
user = User.new(valid_attributes.merge(age: -5))
|
|
256
|
-
expect(user).not_to be_valid
|
|
257
|
-
expect(user.errors).to include('Age must be between 0 and 150')
|
|
258
|
-
end
|
|
259
|
-
end
|
|
260
|
-
|
|
261
|
-
describe '#save' do
|
|
262
|
-
it 'saves valid user' do
|
|
263
|
-
user = User.new(valid_attributes)
|
|
264
|
-
expect(user.save).to be true
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
it 'does not save invalid user' do
|
|
268
|
-
user = User.new(name: '')
|
|
269
|
-
expect(user.save).to be false
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
describe '#to_h' do
|
|
274
|
-
it 'returns hash representation' do
|
|
275
|
-
user = User.new(valid_attributes)
|
|
276
|
-
hash = user.to_h
|
|
277
|
-
|
|
278
|
-
expect(hash).to include(
|
|
279
|
-
name: 'John Doe',
|
|
280
|
-
email: 'john@example.com',
|
|
281
|
-
age: 30
|
|
282
|
-
)
|
|
283
|
-
expect(hash[:id]).not_to be_nil
|
|
284
|
-
expect(hash[:created_at]).to be_a(Time)
|
|
285
|
-
end
|
|
286
|
-
end
|
|
287
|
-
end
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## Best Practices Included
|
|
291
|
-
|
|
292
|
-
- **Proper initialization** with hash parameters
|
|
293
|
-
- **Attribute accessors** for public attributes
|
|
294
|
-
- **Validation methods** with error collection
|
|
295
|
-
- **JSON serialization** support
|
|
296
|
-
- **Class and instance methods** separation
|
|
297
|
-
- **Error handling** and reporting
|
|
298
|
-
- **Ruby naming conventions** (snake_case)
|
|
299
|
-
- **Encapsulation** with private methods
|
|
300
|
-
|
|
301
|
-
## Common Patterns
|
|
302
|
-
|
|
303
|
-
### Value Objects
|
|
304
|
-
```ruby
|
|
305
|
-
class Money
|
|
306
|
-
include Comparable
|
|
307
|
-
|
|
308
|
-
attr_reader :amount, :currency
|
|
309
|
-
|
|
310
|
-
def initialize(amount, currency = 'USD')
|
|
311
|
-
@amount = amount.to_f
|
|
312
|
-
@currency = currency.to_s.upcase
|
|
313
|
-
end
|
|
314
|
-
|
|
315
|
-
def +(other)
|
|
316
|
-
raise ArgumentError, "Currency mismatch" unless currency == other.currency
|
|
317
|
-
Money.new(amount + other.amount, currency)
|
|
318
|
-
end
|
|
319
|
-
|
|
320
|
-
def <=>(other)
|
|
321
|
-
raise ArgumentError, "Currency mismatch" unless currency == other.currency
|
|
322
|
-
amount <=> other.amount
|
|
323
|
-
end
|
|
324
|
-
|
|
325
|
-
def to_s
|
|
326
|
-
"#{currency} #{format('%.2f', amount)}"
|
|
327
|
-
end
|
|
328
|
-
end
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Service Objects
|
|
332
|
-
```ruby
|
|
333
|
-
class UserRegistrationService
|
|
334
|
-
attr_reader :user, :errors
|
|
335
|
-
|
|
336
|
-
def initialize(user_params)
|
|
337
|
-
@user_params = user_params
|
|
338
|
-
@errors = []
|
|
339
|
-
end
|
|
340
|
-
|
|
341
|
-
def call
|
|
342
|
-
@user = User.new(@user_params)
|
|
343
|
-
|
|
344
|
-
if @user.valid?
|
|
345
|
-
@user.save
|
|
346
|
-
send_welcome_email
|
|
347
|
-
true
|
|
348
|
-
else
|
|
349
|
-
@errors = @user.errors
|
|
350
|
-
false
|
|
351
|
-
end
|
|
352
|
-
end
|
|
353
|
-
|
|
354
|
-
private
|
|
355
|
-
|
|
356
|
-
def send_welcome_email
|
|
357
|
-
# Email sending logic
|
|
358
|
-
end
|
|
359
|
-
end
|
|
360
|
-
```
|