claude-agent-framework 1.0.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/README.md +128 -0
- package/bin/claude-framework +3 -0
- package/framework/agents/design-lead.md +240 -0
- package/framework/agents/product-owner.md +179 -0
- package/framework/agents/tech-lead.md +226 -0
- package/framework/commands/ayuda.md +127 -0
- package/framework/commands/a/303/261adir.md +98 -0
- package/framework/commands/backup.md +397 -0
- package/framework/commands/cambiar.md +110 -0
- package/framework/commands/cloud.md +457 -0
- package/framework/commands/code.md +142 -0
- package/framework/commands/debug.md +334 -0
- package/framework/commands/deploy.md +383 -0
- package/framework/commands/deshacer.md +120 -0
- package/framework/commands/estado.md +218 -0
- package/framework/commands/explica.md +227 -0
- package/framework/commands/feature.md +120 -0
- package/framework/commands/git.md +427 -0
- package/framework/commands/historial.md +202 -0
- package/framework/commands/learn.md +408 -0
- package/framework/commands/movil.md +245 -0
- package/framework/commands/nuevo.md +118 -0
- package/framework/commands/plan.md +134 -0
- package/framework/commands/prd.md +113 -0
- package/framework/commands/probar.md +148 -0
- package/framework/commands/revisar.md +208 -0
- package/framework/commands/seeds.md +230 -0
- package/framework/commands/seguridad.md +226 -0
- package/framework/commands/tasks.md +157 -0
- package/framework/skills/architecture/algorithms.md +970 -0
- package/framework/skills/architecture/clean-code.md +1080 -0
- package/framework/skills/architecture/design-patterns.md +1984 -0
- package/framework/skills/architecture/functional-programming.md +972 -0
- package/framework/skills/architecture/solid.md +991 -0
- package/framework/skills/cloud/cloud-aws.md +848 -0
- package/framework/skills/cloud/cloud-azure.md +931 -0
- package/framework/skills/cloud/cloud-gcp.md +848 -0
- package/framework/skills/cloud/message-queues.md +1229 -0
- package/framework/skills/core/accessibility.md +401 -0
- package/framework/skills/core/api.md +474 -0
- package/framework/skills/core/authentication.md +306 -0
- package/framework/skills/core/authorization.md +388 -0
- package/framework/skills/core/background-jobs.md +341 -0
- package/framework/skills/core/caching.md +473 -0
- package/framework/skills/core/code-review.md +341 -0
- package/framework/skills/core/controllers.md +290 -0
- package/framework/skills/core/cua.md +285 -0
- package/framework/skills/core/documentation.md +472 -0
- package/framework/skills/core/file-uploads.md +351 -0
- package/framework/skills/core/hotwire-native.md +296 -0
- package/framework/skills/core/hotwire.md +278 -0
- package/framework/skills/core/i18n.md +334 -0
- package/framework/skills/core/imports-exports.md +750 -0
- package/framework/skills/core/infrastructure.md +337 -0
- package/framework/skills/core/models.md +228 -0
- package/framework/skills/core/notifications.md +672 -0
- package/framework/skills/core/payments.md +581 -0
- package/framework/skills/core/performance.md +361 -0
- package/framework/skills/core/rails-scaffold.md +131 -0
- package/framework/skills/core/search.md +518 -0
- package/framework/skills/core/security.md +565 -0
- package/framework/skills/core/seeds.md +307 -0
- package/framework/skills/core/seo.md +542 -0
- package/framework/skills/core/testing.md +393 -0
- package/framework/skills/core/views.md +260 -0
- package/framework/skills/core/websockets.md +564 -0
- package/framework/skills/data/advanced-sql.md +1204 -0
- package/framework/skills/data/nosql.md +1141 -0
- package/framework/skills/devops/containers-advanced.md +1237 -0
- package/framework/skills/devops/debugging.md +834 -0
- package/framework/skills/devops/git-workflow.md +752 -0
- package/framework/skills/devops/networking.md +932 -0
- package/framework/skills/devops/shell-scripting.md +1132 -0
- package/framework/sub-agents/architecture-patterns-agent.md +1450 -0
- package/framework/sub-agents/cloud-agent.md +677 -0
- package/framework/sub-agents/data.md +504 -0
- package/framework/sub-agents/debugging-agent.md +554 -0
- package/framework/sub-agents/devops.md +483 -0
- package/framework/sub-agents/docs.md +176 -0
- package/framework/sub-agents/frontend-dev.md +349 -0
- package/framework/sub-agents/git-workflow-agent.md +697 -0
- package/framework/sub-agents/integrations.md +630 -0
- package/framework/sub-agents/native-dev.md +434 -0
- package/framework/sub-agents/qa.md +138 -0
- package/framework/sub-agents/rails-dev.md +375 -0
- package/framework/sub-agents/security.md +526 -0
- package/framework/sub-agents/ui.md +437 -0
- package/framework/sub-agents/ux.md +284 -0
- package/framework/templates/api-spec.md +500 -0
- package/framework/templates/component-spec.md +248 -0
- package/framework/templates/feature.json +13 -0
- package/framework/templates/model-spec.md +318 -0
- package/framework/templates/prd-template.md +80 -0
- package/framework/templates/task-plan.md +122 -0
- package/framework/templates/task-user-story.md +52 -0
- package/framework/templates/technical-spec.md +260 -0
- package/framework/templates/user-story.md +95 -0
- package/package.json +42 -0
- package/project-templates/CLAUDE.md +42 -0
- package/project-templates/contexts/architecture.md +25 -0
- package/project-templates/contexts/conventions.md +46 -0
- package/project-templates/contexts/design-system.md +47 -0
- package/project-templates/contexts/requirements.md +38 -0
- package/project-templates/contexts/stack.md +30 -0
- package/project-templates/history/active/models.md +11 -0
- package/project-templates/history/changelog.md +15 -0
- package/project-templates/workspace/.gitkeep +0 -0
- package/src/cli.js +52 -0
- package/src/init.js +104 -0
- package/src/status.js +75 -0
- package/src/update.js +88 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Skill: Seeds
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Generate realistic test data using Faker for development and testing environments.
|
|
5
|
+
|
|
6
|
+
## Basic Seeds
|
|
7
|
+
|
|
8
|
+
### Simple Seed File
|
|
9
|
+
```ruby
|
|
10
|
+
# db/seeds.rb
|
|
11
|
+
|
|
12
|
+
puts "Cleaning database..."
|
|
13
|
+
# Clean in reverse order of dependencies
|
|
14
|
+
Comment.destroy_all
|
|
15
|
+
Article.destroy_all
|
|
16
|
+
User.destroy_all
|
|
17
|
+
|
|
18
|
+
puts "Creating users..."
|
|
19
|
+
admin = User.create!(
|
|
20
|
+
email_address: "admin@example.com",
|
|
21
|
+
password: "password123",
|
|
22
|
+
role: "admin"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
users = 10.times.map do
|
|
26
|
+
User.create!(
|
|
27
|
+
email_address: Faker::Internet.unique.email,
|
|
28
|
+
password: "password123"
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
puts "Creating articles..."
|
|
33
|
+
users.each do |user|
|
|
34
|
+
rand(1..5).times do
|
|
35
|
+
user.articles.create!(
|
|
36
|
+
title: Faker::Lorem.sentence(word_count: 4),
|
|
37
|
+
body: Faker::Lorem.paragraphs(number: rand(3..8)).join("\n\n"),
|
|
38
|
+
published: [true, true, true, false].sample,
|
|
39
|
+
created_at: Faker::Time.between(from: 6.months.ago, to: Time.current)
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
puts "Creating comments..."
|
|
45
|
+
Article.published.each do |article|
|
|
46
|
+
rand(0..10).times do
|
|
47
|
+
article.comments.create!(
|
|
48
|
+
user: users.sample,
|
|
49
|
+
body: Faker::Lorem.paragraph,
|
|
50
|
+
created_at: Faker::Time.between(from: article.created_at, to: Time.current)
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
puts "Seed complete!"
|
|
56
|
+
puts " - #{User.count} users"
|
|
57
|
+
puts " - #{Article.count} articles"
|
|
58
|
+
puts " - #{Comment.count} comments"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Modular Seeds
|
|
62
|
+
|
|
63
|
+
### Organized Structure
|
|
64
|
+
```
|
|
65
|
+
db/
|
|
66
|
+
├── seeds.rb
|
|
67
|
+
└── seeds/
|
|
68
|
+
├── 01_users.rb
|
|
69
|
+
├── 02_categories.rb
|
|
70
|
+
├── 03_articles.rb
|
|
71
|
+
├── 04_comments.rb
|
|
72
|
+
└── development_only.rb
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Main Seed File
|
|
76
|
+
```ruby
|
|
77
|
+
# db/seeds.rb
|
|
78
|
+
|
|
79
|
+
# Load seed files in order
|
|
80
|
+
Dir[Rails.root.join("db/seeds/*.rb")].sort.each do |file|
|
|
81
|
+
puts "Loading #{File.basename(file)}..."
|
|
82
|
+
load file
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
puts "\nSeeding complete!"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Individual Seed File
|
|
89
|
+
```ruby
|
|
90
|
+
# db/seeds/01_users.rb
|
|
91
|
+
|
|
92
|
+
# Create admin user
|
|
93
|
+
User.find_or_create_by!(email_address: "admin@example.com") do |user|
|
|
94
|
+
user.password = "password123"
|
|
95
|
+
user.role = "admin"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Create test users
|
|
99
|
+
unless User.where.not(role: "admin").exists?
|
|
100
|
+
20.times do |i|
|
|
101
|
+
User.create!(
|
|
102
|
+
email_address: Faker::Internet.unique.email,
|
|
103
|
+
password: "password123",
|
|
104
|
+
role: "user",
|
|
105
|
+
created_at: Faker::Time.between(from: 1.year.ago, to: 1.month.ago)
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
puts " Created #{User.count} users"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Environment-Specific Seeds
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
# db/seeds.rb
|
|
117
|
+
|
|
118
|
+
# Always run
|
|
119
|
+
load Rails.root.join("db/seeds/essential.rb")
|
|
120
|
+
|
|
121
|
+
# Development only
|
|
122
|
+
if Rails.env.development?
|
|
123
|
+
load Rails.root.join("db/seeds/development.rb")
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Production (minimal data)
|
|
127
|
+
if Rails.env.production?
|
|
128
|
+
load Rails.root.join("db/seeds/production.rb")
|
|
129
|
+
end
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```ruby
|
|
133
|
+
# db/seeds/development.rb
|
|
134
|
+
|
|
135
|
+
puts "Creating development data..."
|
|
136
|
+
|
|
137
|
+
# More extensive fake data for development
|
|
138
|
+
100.times do
|
|
139
|
+
user = User.create!(
|
|
140
|
+
email_address: Faker::Internet.unique.email,
|
|
141
|
+
password: "password123"
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Each user has varying activity
|
|
145
|
+
rand(0..20).times do
|
|
146
|
+
user.articles.create!(
|
|
147
|
+
title: Faker::Book.title,
|
|
148
|
+
body: Faker::Lorem.paragraphs(number: 5).join("\n\n"),
|
|
149
|
+
published: Faker::Boolean.boolean(true_ratio: 0.7)
|
|
150
|
+
)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Faker Examples
|
|
156
|
+
|
|
157
|
+
### User Data
|
|
158
|
+
```ruby
|
|
159
|
+
Faker::Name.name # "John Smith"
|
|
160
|
+
Faker::Internet.email # "john@example.com"
|
|
161
|
+
Faker::Internet.unique.email # Guaranteed unique
|
|
162
|
+
Faker::Internet.username # "john_smith"
|
|
163
|
+
Faker::PhoneNumber.phone_number # "555-123-4567"
|
|
164
|
+
Faker::Address.full_address # "123 Main St, City, ST 12345"
|
|
165
|
+
Faker::Avatar.image # URL to avatar image
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Content
|
|
169
|
+
```ruby
|
|
170
|
+
Faker::Lorem.sentence # "Lorem ipsum dolor sit."
|
|
171
|
+
Faker::Lorem.paragraph # Full paragraph
|
|
172
|
+
Faker::Lorem.paragraphs(number: 3) # Array of paragraphs
|
|
173
|
+
Faker::Markdown.emphasis # "*emphasis*"
|
|
174
|
+
Faker::Markdown.sandwich # Headers + paragraphs
|
|
175
|
+
Faker::Book.title # "The Great Gatsby"
|
|
176
|
+
Faker::Quote.famous_last_words # Famous quote
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Dates and Times
|
|
180
|
+
```ruby
|
|
181
|
+
Faker::Date.between(from: 1.year.ago, to: Date.today)
|
|
182
|
+
Faker::Time.between(from: 1.month.ago, to: Time.current)
|
|
183
|
+
Faker::Date.birthday(min_age: 18, max_age: 65)
|
|
184
|
+
Faker::Time.forward(days: 30) # Random future time
|
|
185
|
+
Faker::Time.backward(days: 30) # Random past time
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Numbers and Booleans
|
|
189
|
+
```ruby
|
|
190
|
+
Faker::Number.between(from: 1, to: 100)
|
|
191
|
+
Faker::Number.decimal(l_digits: 2, r_digits: 2)
|
|
192
|
+
Faker::Boolean.boolean # true/false
|
|
193
|
+
Faker::Boolean.boolean(true_ratio: 0.8) # 80% true
|
|
194
|
+
rand(1..10) # Ruby native
|
|
195
|
+
[true, false].sample # Random pick
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Commerce/Business
|
|
199
|
+
```ruby
|
|
200
|
+
Faker::Commerce.product_name # "Ergonomic Steel Chair"
|
|
201
|
+
Faker::Commerce.price # 29.99
|
|
202
|
+
Faker::Company.name # "Acme Inc"
|
|
203
|
+
Faker::Company.catch_phrase # "Innovative solution"
|
|
204
|
+
Faker::Job.title # "Software Engineer"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Images (URLs)
|
|
208
|
+
```ruby
|
|
209
|
+
Faker::LoremFlickr.image(size: "300x300", search_terms: ['nature'])
|
|
210
|
+
Faker::Placeholdit.image(size: "300x300")
|
|
211
|
+
Faker::Avatar.image(slug: "user-#{id}", size: "100x100")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Idempotent Seeds
|
|
215
|
+
|
|
216
|
+
```ruby
|
|
217
|
+
# Find or create pattern
|
|
218
|
+
admin = User.find_or_create_by!(email_address: "admin@example.com") do |user|
|
|
219
|
+
user.password = "password123"
|
|
220
|
+
user.role = "admin"
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Check before creating
|
|
224
|
+
unless Article.count >= 50
|
|
225
|
+
50.times do
|
|
226
|
+
Article.create!(
|
|
227
|
+
title: Faker::Lorem.sentence,
|
|
228
|
+
body: Faker::Lorem.paragraphs(number: 3).join("\n\n"),
|
|
229
|
+
user: User.all.sample
|
|
230
|
+
)
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Using find_or_initialize_by
|
|
235
|
+
category = Category.find_or_initialize_by(name: "Technology")
|
|
236
|
+
category.update!(description: "Tech articles") if category.new_record?
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## With Attachments
|
|
240
|
+
|
|
241
|
+
```ruby
|
|
242
|
+
# Using remote URLs
|
|
243
|
+
user = User.create!(
|
|
244
|
+
email_address: Faker::Internet.email,
|
|
245
|
+
password: "password123"
|
|
246
|
+
)
|
|
247
|
+
user.avatar.attach(
|
|
248
|
+
io: URI.open(Faker::Avatar.image),
|
|
249
|
+
filename: "avatar.jpg",
|
|
250
|
+
content_type: "image/jpeg"
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# Using local files
|
|
254
|
+
article = Article.create!(
|
|
255
|
+
title: Faker::Lorem.sentence,
|
|
256
|
+
body: Faker::Lorem.paragraphs.join("\n\n"),
|
|
257
|
+
user: users.sample
|
|
258
|
+
)
|
|
259
|
+
article.images.attach(
|
|
260
|
+
io: File.open(Rails.root.join("db/seed_files/sample.jpg")),
|
|
261
|
+
filename: "sample.jpg",
|
|
262
|
+
content_type: "image/jpeg"
|
|
263
|
+
)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Running Seeds
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Run all seeds
|
|
270
|
+
rails db:seed
|
|
271
|
+
|
|
272
|
+
# Reset and seed
|
|
273
|
+
rails db:reset # drop, create, migrate, seed
|
|
274
|
+
|
|
275
|
+
# Specific environment
|
|
276
|
+
RAILS_ENV=production rails db:seed
|
|
277
|
+
|
|
278
|
+
# Custom seed task
|
|
279
|
+
rails db:seed:development
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Custom Rake Task
|
|
283
|
+
```ruby
|
|
284
|
+
# lib/tasks/seed.rake
|
|
285
|
+
namespace :db do
|
|
286
|
+
namespace :seed do
|
|
287
|
+
desc "Load development seeds"
|
|
288
|
+
task development: :environment do
|
|
289
|
+
load Rails.root.join("db/seeds/development.rb")
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
desc "Load minimal production seeds"
|
|
293
|
+
task production: :environment do
|
|
294
|
+
load Rails.root.join("db/seeds/production.rb")
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Best Practices
|
|
301
|
+
|
|
302
|
+
1. **Make seeds idempotent** - Safe to run multiple times
|
|
303
|
+
2. **Use Faker::UniqueGenerator** - Avoid duplicates
|
|
304
|
+
3. **Order by dependencies** - Create parents before children
|
|
305
|
+
4. **Print progress** - Show what's being created
|
|
306
|
+
5. **Handle attachments** - Include sample files or URLs
|
|
307
|
+
6. **Separate environments** - Different data needs
|