openclacky 0.7.2 → 0.7.4

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.clacky/skills/commit/SKILL.md +252 -74
  3. data/CHANGELOG.md +38 -0
  4. data/bin/openclacky +2 -0
  5. data/lib/clacky/agent/message_compressor_helper.rb +1 -1
  6. data/lib/clacky/agent/system_prompt_builder.rb +9 -8
  7. data/lib/clacky/agent/tool_executor.rb +4 -13
  8. data/lib/clacky/agent.rb +28 -7
  9. data/lib/clacky/cli.rb +22 -5
  10. data/lib/clacky/default_skills/new/SKILL.md +61 -30
  11. data/lib/clacky/default_skills/new/scripts/create_rails_project.sh +176 -0
  12. data/lib/clacky/default_skills/new/scripts/rails_env_checker.sh +389 -0
  13. data/lib/clacky/default_skills/skill-add/SKILL.md +251 -34
  14. data/lib/clacky/default_skills/skill-add/scripts/install_from_github.rb +189 -0
  15. data/lib/clacky/providers.rb +13 -11
  16. data/lib/clacky/tools/invoke_skill.rb +5 -1
  17. data/lib/clacky/tools/safe_shell.rb +2 -2
  18. data/lib/clacky/tools/shell.rb +48 -20
  19. data/lib/clacky/ui2/components/input_area.rb +27 -9
  20. data/lib/clacky/ui2/components/modal_component.rb +22 -2
  21. data/lib/clacky/ui2/components/welcome_banner.rb +33 -10
  22. data/lib/clacky/ui2/layout_manager.rb +107 -26
  23. data/lib/clacky/ui2/line_editor.rb +6 -5
  24. data/lib/clacky/ui2/screen_buffer.rb +0 -15
  25. data/lib/clacky/ui2/terminal_detector.rb +119 -0
  26. data/lib/clacky/ui2/theme_manager.rb +18 -0
  27. data/lib/clacky/ui2/themes/base_theme.rb +22 -1
  28. data/lib/clacky/ui2/themes/hacker_theme.rb +22 -18
  29. data/lib/clacky/ui2/themes/minimal_theme.rb +19 -15
  30. data/lib/clacky/ui2/ui_controller.rb +66 -15
  31. data/lib/clacky/ui2.rb +1 -0
  32. data/lib/clacky/utils/limit_stack.rb +5 -0
  33. data/lib/clacky/version.rb +1 -1
  34. metadata +5 -1
@@ -0,0 +1,389 @@
1
+ #!/bin/bash
2
+ # Rails Environment Checker
3
+ # This script checks and installs required dependencies for Rails 7.x projects
4
+ # Run this BEFORE executing bin/setup in a Rails project
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Print colored messages
16
+ print_info() {
17
+ echo -e "${BLUE}ℹ${NC} $1"
18
+ }
19
+
20
+ print_success() {
21
+ echo -e "${GREEN}✓${NC} $1"
22
+ }
23
+
24
+ print_warning() {
25
+ echo -e "${YELLOW}⚠${NC} $1"
26
+ }
27
+
28
+ print_error() {
29
+ echo -e "${RED}✗${NC} $1"
30
+ }
31
+
32
+ print_step() {
33
+ echo -e "\n${BLUE}==>${NC} $1"
34
+ }
35
+
36
+ # Detect OS
37
+ detect_os() {
38
+ case "$(uname -s)" in
39
+ Linux*) OS=Linux;;
40
+ Darwin*) OS=macOS;;
41
+ CYGWIN*) OS=Windows;;
42
+ MINGW*) OS=Windows;;
43
+ *) OS=Unknown;;
44
+ esac
45
+ print_info "Detected OS: $OS"
46
+
47
+ # Detect Linux distribution
48
+ if [ "$OS" = "Linux" ]; then
49
+ if [ -f /etc/os-release ]; then
50
+ . /etc/os-release
51
+ DISTRO=$ID
52
+ print_info "Detected Linux distribution: $DISTRO"
53
+ else
54
+ DISTRO=unknown
55
+ fi
56
+ fi
57
+ }
58
+
59
+ # Check if command exists
60
+ command_exists() {
61
+ command -v "$1" >/dev/null 2>&1
62
+ }
63
+
64
+ # Compare version strings
65
+ version_ge() {
66
+ # Returns 0 (true) if $1 >= $2
67
+ printf '%s\n%s\n' "$2" "$1" | sort -V -C
68
+ }
69
+
70
+ # Check Node.js version
71
+ check_nodejs() {
72
+ if command_exists node; then
73
+ NODE_VERSION=$(node -v | sed 's/v//')
74
+ print_info "Found Node.js version: $NODE_VERSION"
75
+
76
+ if version_ge "$NODE_VERSION" "22.0.0"; then
77
+ print_success "Node.js version is compatible (>= 22.0.0)"
78
+ return 0
79
+ else
80
+ print_warning "Node.js version $NODE_VERSION is too old (need >= 22.0.0)"
81
+ return 1
82
+ fi
83
+ else
84
+ print_warning "Node.js is not installed"
85
+ return 1
86
+ fi
87
+ }
88
+
89
+ # Check PostgreSQL
90
+ check_postgresql() {
91
+ if command_exists psql; then
92
+ PG_VERSION=$(psql --version | awk '{print $3}')
93
+ print_info "Found PostgreSQL version: $PG_VERSION"
94
+ print_success "PostgreSQL is installed"
95
+
96
+ # Check if postgres user exists
97
+ if command_exists createuser; then
98
+ print_info "Checking PostgreSQL user 'postgres'..."
99
+ if psql -U postgres -c '\q' 2>/dev/null; then
100
+ print_success "PostgreSQL user 'postgres' exists"
101
+ else
102
+ print_warning "PostgreSQL user 'postgres' does not exist"
103
+ print_info "You may need to create it with: createuser -s postgres"
104
+ fi
105
+ fi
106
+ return 0
107
+ else
108
+ print_warning "PostgreSQL is not installed"
109
+ return 1
110
+ fi
111
+ }
112
+
113
+ # Check Ruby version
114
+ check_ruby() {
115
+ if command_exists ruby; then
116
+ RUBY_VERSION=$(ruby -e 'puts RUBY_VERSION' 2>/dev/null)
117
+ print_info "Found Ruby version: $RUBY_VERSION"
118
+
119
+ if version_ge "$RUBY_VERSION" "3.0.0"; then
120
+ print_success "Ruby version is compatible (>= 3.0.0)"
121
+ return 0
122
+ else
123
+ print_warning "Ruby version $RUBY_VERSION is too old (need >= 3.0.0)"
124
+ return 1
125
+ fi
126
+ else
127
+ print_warning "Ruby is not installed"
128
+ return 1
129
+ fi
130
+ }
131
+
132
+ # Install Node.js on macOS
133
+ install_nodejs_macos() {
134
+ print_step "Installing Node.js on macOS..."
135
+
136
+ if ! command_exists brew; then
137
+ print_error "Homebrew is not installed. Please install Homebrew first:"
138
+ echo " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
139
+ return 1
140
+ fi
141
+
142
+ print_info "Installing Node.js via Homebrew..."
143
+ if brew install node@22; then
144
+ print_success "Node.js 22 installed successfully"
145
+ # Add to PATH
146
+ echo 'export PATH="/opt/homebrew/opt/node@22/bin:$PATH"' >> ~/.zshrc
147
+ export PATH="/opt/homebrew/opt/node@22/bin:$PATH"
148
+ return 0
149
+ else
150
+ print_error "Failed to install Node.js"
151
+ return 1
152
+ fi
153
+ }
154
+
155
+ # Install Node.js on Ubuntu/Debian
156
+ install_nodejs_ubuntu() {
157
+ print_step "Installing Node.js on Ubuntu/Debian..."
158
+
159
+ print_info "Setting up NodeSource repository for Node.js 22..."
160
+ if curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -; then
161
+ print_success "NodeSource repository added"
162
+ else
163
+ print_error "Failed to setup NodeSource repository"
164
+ return 1
165
+ fi
166
+
167
+ print_info "Installing Node.js..."
168
+ if sudo apt-get install -y nodejs; then
169
+ print_success "Node.js installed successfully"
170
+ return 0
171
+ else
172
+ print_error "Failed to install Node.js"
173
+ return 1
174
+ fi
175
+ }
176
+
177
+ # Install PostgreSQL on macOS
178
+ install_postgresql_macos() {
179
+ print_step "Installing PostgreSQL on macOS..."
180
+
181
+ if ! command_exists brew; then
182
+ print_error "Homebrew is not installed. Please install Homebrew first:"
183
+ echo " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
184
+ return 1
185
+ fi
186
+
187
+ print_info "Installing PostgreSQL via Homebrew..."
188
+ if brew install postgresql@16; then
189
+ print_success "PostgreSQL installed successfully"
190
+
191
+ # Start PostgreSQL service
192
+ print_info "Starting PostgreSQL service..."
193
+ brew services start postgresql@16
194
+
195
+ # Wait for PostgreSQL to start
196
+ sleep 2
197
+
198
+ # Create postgres user if needed
199
+ print_info "Creating PostgreSQL user 'postgres'..."
200
+ if createuser -s postgres 2>/dev/null; then
201
+ print_success "PostgreSQL user 'postgres' created"
202
+ else
203
+ print_info "PostgreSQL user 'postgres' may already exist"
204
+ fi
205
+
206
+ return 0
207
+ else
208
+ print_error "Failed to install PostgreSQL"
209
+ return 1
210
+ fi
211
+ }
212
+
213
+ # Install PostgreSQL on Ubuntu/Debian
214
+ install_postgresql_ubuntu() {
215
+ print_step "Installing PostgreSQL on Ubuntu/Debian..."
216
+
217
+ print_info "Installing PostgreSQL..."
218
+ if sudo apt-get install -y postgresql postgresql-contrib libpq-dev; then
219
+ print_success "PostgreSQL installed successfully"
220
+
221
+ # Start PostgreSQL service
222
+ print_info "Starting PostgreSQL service..."
223
+ sudo systemctl start postgresql
224
+ sudo systemctl enable postgresql
225
+
226
+ # Create postgres superuser
227
+ print_info "Setting up PostgreSQL user 'postgres'..."
228
+ sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';" 2>/dev/null || true
229
+
230
+ return 0
231
+ else
232
+ print_error "Failed to install PostgreSQL"
233
+ return 1
234
+ fi
235
+ }
236
+
237
+ # Suggest installation for Node.js
238
+ suggest_nodejs_installation() {
239
+ print_step "Node.js Installation Required - Installing automatically..."
240
+ echo ""
241
+
242
+ if [ "$OS" = "macOS" ]; then
243
+ install_nodejs_macos
244
+ return $?
245
+ elif [ "$OS" = "Linux" ]; then
246
+ if [ "$DISTRO" = "ubuntu" ] || [ "$DISTRO" = "debian" ]; then
247
+ install_nodejs_ubuntu
248
+ return $?
249
+ else
250
+ print_error "Automatic installation not supported for this Linux distribution"
251
+ print_info "Manual Installation:"
252
+ echo " Please visit: https://nodejs.org/"
253
+ return 1
254
+ fi
255
+ else
256
+ print_error "Automatic installation not supported for this OS"
257
+ print_info "Please install Node.js 22 from: https://nodejs.org/"
258
+ return 1
259
+ fi
260
+ }
261
+
262
+ # Suggest installation for PostgreSQL
263
+ suggest_postgresql_installation() {
264
+ print_step "PostgreSQL Installation Required - Installing automatically..."
265
+ echo ""
266
+
267
+ if [ "$OS" = "macOS" ]; then
268
+ install_postgresql_macos
269
+ return $?
270
+ elif [ "$OS" = "Linux" ]; then
271
+ if [ "$DISTRO" = "ubuntu" ] || [ "$DISTRO" = "debian" ]; then
272
+ install_postgresql_ubuntu
273
+ return $?
274
+ else
275
+ print_error "Automatic installation not supported for this Linux distribution"
276
+ print_info "Manual Installation:"
277
+ echo " Please install PostgreSQL for your distribution"
278
+ return 1
279
+ fi
280
+ else
281
+ print_error "Automatic installation not supported for this OS"
282
+ print_info "Please install PostgreSQL from: https://www.postgresql.org/"
283
+ return 1
284
+ fi
285
+ }
286
+
287
+ # Placeholder for future extensions
288
+ # This script only checks dependencies, not running bin/setup
289
+
290
+ # Main setup logic
291
+ main() {
292
+ echo ""
293
+ echo "╔═══════════════════════════════════════════════════════════╗"
294
+ echo "║ ║"
295
+ echo "║ 🚀 Rails 7.x Project Setup ║"
296
+ echo "║ ║"
297
+ echo "║ Checking dependencies and setting up project... ║"
298
+ echo "║ ║"
299
+ echo "╚═══════════════════════════════════════════════════════════╝"
300
+ echo ""
301
+
302
+ detect_os
303
+
304
+ NODEJS_OK=false
305
+ POSTGRESQL_OK=false
306
+ RUBY_OK=false
307
+
308
+ # Check Ruby
309
+ print_step "Checking Ruby..."
310
+ if check_ruby; then
311
+ RUBY_OK=true
312
+ else
313
+ print_error "Ruby 3.0+ is required"
314
+ print_info "Please install Ruby using rbenv or mise:"
315
+ echo " # Using mise (recommended)"
316
+ echo " curl https://mise.run | sh"
317
+ echo " mise use -g ruby@3"
318
+ echo ""
319
+ echo " # Or using rbenv"
320
+ echo " rbenv install 3.3.0"
321
+ echo " rbenv global 3.3.0"
322
+ exit 1
323
+ fi
324
+
325
+ # Check Node.js
326
+ print_step "Checking Node.js..."
327
+ if check_nodejs; then
328
+ NODEJS_OK=true
329
+ else
330
+ if ! suggest_nodejs_installation; then
331
+ print_warning "Node.js 22+ is required but not installed"
332
+ print_info "Please install Node.js 22 and run this script again"
333
+ exit 1
334
+ else
335
+ # Verify installation
336
+ if check_nodejs; then
337
+ NODEJS_OK=true
338
+ else
339
+ print_error "Node.js installation verification failed"
340
+ exit 1
341
+ fi
342
+ fi
343
+ fi
344
+
345
+ # Check PostgreSQL
346
+ print_step "Checking PostgreSQL..."
347
+ if check_postgresql; then
348
+ POSTGRESQL_OK=true
349
+ else
350
+ if ! suggest_postgresql_installation; then
351
+ print_warning "PostgreSQL is required but not installed"
352
+ print_info "Please install PostgreSQL and run this script again"
353
+ exit 1
354
+ else
355
+ # Verify installation
356
+ if check_postgresql; then
357
+ POSTGRESQL_OK=true
358
+ else
359
+ print_error "PostgreSQL installation verification failed"
360
+ exit 1
361
+ fi
362
+ fi
363
+ fi
364
+
365
+ # All dependencies are ready
366
+ if [ "$RUBY_OK" = true ] && [ "$NODEJS_OK" = true ] && [ "$POSTGRESQL_OK" = true ]; then
367
+ echo ""
368
+ echo "╔═══════════════════════════════════════════════════════════╗"
369
+ echo "║ ║"
370
+ echo "║ ✨ Environment Check Complete! ║"
371
+ echo "║ ║"
372
+ echo "╚═══════════════════════════════════════════════════════════╝"
373
+ echo ""
374
+ print_success "All required dependencies are installed:"
375
+ echo " ✓ Ruby $RUBY_VERSION"
376
+ echo " ✓ Node.js $NODE_VERSION"
377
+ echo " ✓ PostgreSQL $PG_VERSION"
378
+ echo ""
379
+ print_info "You can now run: ./bin/setup"
380
+ echo ""
381
+ exit 0
382
+ else
383
+ print_error "Some dependencies are missing. Please install them and run this script again."
384
+ exit 1
385
+ fi
386
+ }
387
+
388
+ # Run main setup
389
+ main
@@ -1,66 +1,283 @@
1
1
  ---
2
2
  name: skill-add
3
- description: Guide for creating new SKILL.md files
3
+ description: Create new skills or install from GitHub - supports interactive creation, quick setup, and repository imports
4
4
  disable-model-invocation: false
5
5
  user-invocable: true
6
6
  ---
7
7
 
8
- # Skill Creation Guide
8
+ # Skill Add - Enhanced Skill Creation & Installation
9
9
 
10
- ## SKILL.md Structure
10
+ A comprehensive skill management tool that helps you create new skills interactively or install existing skills from GitHub repositories.
11
11
 
12
- ### 1. Front Matter (Required)
13
- ```yaml
14
- ---
15
- name: skill-name
16
- description: Brief one-line description
17
- disable-model-invocation: false
18
- user-invocable: true
19
- ---
12
+ ## ⚠️ Usage Instructions
13
+
14
+ - **GitHub URL**: Call `ruby lib/clacky/default_skills/skill-add/scripts/install_from_github.rb <url>` via safe_shell
15
+ - **Text description or no arguments**: Handle interactively via conversation, create files with write tool
16
+
17
+ ## Usage Modes
18
+
19
+ ### 1. Install from GitHub Repository
20
+ ```
21
+ /skill-add https://github.com/username/repo-name
22
+ /skill-add https://github.com/username/repo-name.git
20
23
  ```
21
24
 
22
- ### 2. Main Content
23
- ```markdown
24
- # Skill Title
25
+ **When user provides a GitHub URL, execute the `install_from_github.rb` script:**
25
26
 
26
- ## Usage
27
- How to invoke: "command description" or `/skill-name`
27
+ Use the **Skill Directory** path shown below, and call:
28
+ ```bash
29
+ ruby <skill_directory>/scripts/install_from_github.rb <github_url>
30
+ ```
28
31
 
29
- ## Process Steps
32
+ The script will automatically:
33
+ - Validate the GitHub URL
34
+ - Clone the repository to a temporary directory
35
+ - Search for any `skills/` directory containing SKILL.md files
36
+ - Copy all found skills to `.clacky/skills/` in the current project
37
+ - Report installed skills with descriptions
38
+ - Clean up temporary files
39
+
40
+ **Do NOT manually clone or copy files - the script handles everything.**
30
41
 
31
- ### 1. First Step
32
- What to do
42
+ ### 2. Interactive Creation Mode
43
+ ```
44
+ /skill-add Brief description of what the skill should do
45
+ /skill-add Create a skill for database migrations
46
+ ```
33
47
 
34
- ### 2. Next Step
35
- Continue the task
48
+ **Process:**
49
+ 1. Understand the skill requirement from user's description
50
+ 2. Ask clarifying questions:
51
+ - What is the main purpose?
52
+ - What inputs/parameters are needed?
53
+ - Should it have helper scripts?
54
+ - Any specific commands or tools needed?
55
+ 3. Design the skill structure:
56
+ - Skill name (kebab-case)
57
+ - Description
58
+ - Usage instructions
59
+ - Step-by-step process
60
+ - Optional: Create helper scripts in `scripts/` subdirectory
61
+ 4. Create the skill in `.clacky/skills/{skill-name}/`
62
+ 5. Show summary of created files
63
+
64
+ **Example Interaction:**
65
+ ```
66
+ User: /skill-add Create a skill for API testing with curl
67
+
68
+ Agent: I'll help you create an API testing skill. Let me ask a few questions:
69
+
70
+ Q1: What's the main purpose of this skill?
71
+ User: Test REST APIs quickly with different HTTP methods
72
+
73
+ Agent: Great! A few more questions:
74
+ Q2: Should it support authentication (API keys, tokens)?
75
+ User: Yes, Bearer tokens
76
+
77
+ Q3: Should it have pre-configured examples?
78
+ User: Yes, for common patterns like GET, POST, PUT, DELETE
79
+
80
+ Agent: Perfect! Creating skill...
81
+
82
+ Created files:
83
+ ✓ .clacky/skills/api-tester/SKILL.md
84
+ ✓ .clacky/skills/api-tester/scripts/test_endpoint.sh
85
+ ✓ .clacky/skills/api-tester/scripts/examples.json
86
+
87
+ You can now use: /api-tester
88
+ ```
89
+
90
+ ### 3. Quick Start (No Arguments)
91
+ ```
92
+ /skill-add
93
+ ```
94
+
95
+ **Process:**
96
+ - Ask user what they want to create
97
+ - Offer suggestions based on common patterns:
98
+ - Command runner
99
+ - Code analyzer
100
+ - File processor
101
+ - Data transformer
102
+ - Custom workflow
103
+ - Guide them through creation with focused questions
104
+ - Create the skill with best practices
105
+
106
+ ## Implementation Guidelines
107
+
108
+ ### For GitHub Installation
109
+
110
+ Use the `install_from_github.rb` script (available in Supporting Files):
36
111
 
37
- ## Commands Used
38
112
  ```bash
39
- # Key commands
113
+ ruby <skill_directory>/scripts/install_from_github.rb <github_url>
40
114
  ```
41
115
 
42
- ## Notes
43
- - Important points
116
+ The Skill Directory path is shown at the bottom of this document.
117
+
118
+ **Do NOT manually clone, search, or copy files - let the script handle everything.**
119
+
120
+ ### For Interactive Creation
121
+
122
+ When user provides a description or no arguments:
123
+
124
+ 1. **Parse Intent**: Understand what the user wants to create from their description
125
+
126
+ 2. **Gather Requirements**: Ask 3-5 focused questions through conversation:
127
+ - What should we call this skill? (suggest a name based on description)
128
+ - What inputs/arguments does it need?
129
+ - What are the main steps it should perform?
130
+ - Should it have helper scripts? (bash/ruby/python)
131
+ - Any specific tools or commands to use?
132
+
133
+ 3. **Design Structure**: Based on answers, design the SKILL.md content with:
134
+ - Valid YAML frontmatter (name, description, etc.)
135
+ - Clear usage instructions
136
+ - Step-by-step process
137
+ - Examples
138
+ - Scripts if needed
139
+
140
+ 4. **Create Files** using write tool:
141
+ - `.clacky/skills/{skill-name}/SKILL.md`
142
+ - `.clacky/skills/{skill-name}/scripts/` (if needed)
143
+ - Helper scripts with proper permissions
144
+
145
+ 5. **Confirm**: Show what was created and how to use it
146
+
147
+ **Example conversation flow:**
44
148
  ```
149
+ User: /skill-add Create a skill for testing APIs
150
+
151
+ Agent: I'll help you create an API testing skill. Let me ask a few questions:
152
+
153
+ Q1: What should we call this skill?
154
+ Suggestion: "api-tester"
155
+
156
+ User: api-tester sounds good
45
157
 
46
- ## File Location
47
- `.clacky/skills/{skill-name}/SKILL.md`
158
+ Agent: Q2: What inputs does it need?
159
+ User: URL, HTTP method, and optional headers
48
160
 
49
- ## Minimal Example
161
+ Agent: Q3: Should it have a helper script?
162
+ User: Yes, a bash script using curl
163
+
164
+ Agent: Perfect! Creating skill...
165
+
166
+ Created:
167
+ ✓ .clacky/skills/api-tester/SKILL.md
168
+ ✓ .clacky/skills/api-tester/scripts/test.sh
169
+
170
+ You can now use: /api-tester
171
+ ```
172
+
173
+ ## Skill Structure
174
+
175
+ ### Minimal SKILL.md
50
176
  ```markdown
51
177
  ---
52
- name: hello
53
- description: Simple greeting
178
+ name: hello-world
179
+ description: Simple greeting skill
54
180
  disable-model-invocation: false
55
181
  user-invocable: true
56
182
  ---
57
183
 
58
- # Hello Skill
184
+ # Hello World Skill
59
185
 
60
186
  ## Usage
61
- Say "hello" or `/hello`
187
+ Say "hello" or `/hello-world`
62
188
 
63
189
  ## Process Steps
64
- ### 1. Greet user
65
- ### 2. Offer help
190
+ ### 1. Greet the user
191
+ ### 2. Offer assistance
192
+ ```
193
+
194
+ ### Full-Featured Skill
195
+ ```markdown
196
+ ---
197
+ name: db-migrate
198
+ description: Database migration helper with rollback support
199
+ disable-model-invocation: false
200
+ user-invocable: true
201
+ ---
202
+
203
+ # Database Migration Helper
204
+
205
+ ## Usage
206
+ `/db-migrate [action] [options]`
207
+
208
+ Actions:
209
+ - create - Create new migration
210
+ - up - Run pending migrations
211
+ - down - Rollback last migration
212
+ - status - Show migration status
213
+
214
+ ## Process Steps
215
+
216
+ ### 1. Determine Action
217
+ Parse the command arguments to identify the action.
218
+
219
+ ### 2. Execute Action
220
+ Run the appropriate migration script from scripts/ directory.
221
+
222
+ ### 3. Report Results
223
+ Show migration status and any errors.
224
+
225
+ ## Scripts
226
+
227
+ Helper scripts in `scripts/` directory:
228
+ - `create_migration.rb` - Generate migration file
229
+ - `run_migrations.rb` - Execute pending migrations
230
+ - `rollback.rb` - Rollback migrations
231
+
232
+ ## Examples
233
+
234
+ Create a new migration:
235
+ ```bash
236
+ /db-migrate create add_users_table
237
+ ```
238
+
239
+ Run all pending migrations:
240
+ ```bash
241
+ /db-migrate up
242
+ ```
243
+
244
+ Rollback last migration:
245
+ ```bash
246
+ /db-migrate down
247
+ ```
66
248
  ```
249
+
250
+ ## Best Practices
251
+
252
+ 1. **Clear Naming**: Use kebab-case for skill names (e.g., `api-tester`, `code-formatter`)
253
+ 2. **Good Descriptions**: Write concise, actionable descriptions
254
+ 3. **Structured Steps**: Break down process into clear, numbered steps
255
+ 4. **Helper Scripts**: Use scripts/ directory for complex logic
256
+ 5. **Examples**: Always include usage examples
257
+ 6. **Documentation**: Explain all parameters and options
258
+
259
+ ## Commands Used
260
+
261
+ ```bash
262
+ # Clone from GitHub
263
+ git clone <repo-url> /tmp/skills-repo
264
+ cp -r /tmp/skills-repo/skills/* .clacky/skills/
265
+
266
+ # Create skill directory
267
+ mkdir -p .clacky/skills/{skill-name}
268
+ mkdir -p .clacky/skills/{skill-name}/scripts
269
+
270
+ # Write skill file
271
+ cat > .clacky/skills/{skill-name}/SKILL.md << 'EOF'
272
+ ...
273
+ EOF
274
+ ```
275
+
276
+ ## Notes
277
+
278
+ - Skills are installed to `.clacky/skills/` in the current project directory
279
+ - Project skills (`.clacky/skills/`) override global skills (`~/.clacky/skills/`)
280
+ - Skill names must be lowercase with hyphens only
281
+ - SKILL.md must have valid YAML frontmatter
282
+ - Scripts should be executable (chmod +x)
283
+ - Test skills after creation with `/skill-name`