@codyswann/lisa 1.66.2 → 1.67.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/all/copy-overwrite/.claude/rules/base-rules.md +137 -0
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -10
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +2 -14
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -12
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -12
- package/plugins/src/base/.claude-plugin/plugin.json +0 -9
- package/plugins/src/expo/.claude-plugin/plugin.json +2 -13
- package/plugins/src/rails/.claude-plugin/plugin.json +0 -11
- package/plugins/src/typescript/.claude-plugin/plugin.json +0 -11
- package/typescript/copy-contents/.husky/commit-msg +6 -0
- package/plugins/lisa/rules/README.md +0 -240
- package/plugins/lisa-rails/rules/lisa.md +0 -42
- package/plugins/lisa-typescript/rules/lisa.md +0 -37
- package/plugins/src/base/rules/README.md +0 -240
- package/plugins/src/base/rules/coding-philosophy.md +0 -428
- package/plugins/src/base/rules/verfication.md +0 -594
- package/plugins/src/expo/rules/expo-verification.md +0 -261
- package/plugins/src/rails/rules/lisa.md +0 -42
- package/plugins/src/rails/rules/rails-conventions.md +0 -176
- package/plugins/src/typescript/rules/lisa.md +0 -37
- /package/{plugins/lisa → all/copy-overwrite/.claude}/rules/coding-philosophy.md +0 -0
- /package/{plugins/lisa/rules/verfication.md → all/copy-overwrite/.claude/rules/verification.md} +0 -0
- /package/{plugins/lisa-expo → expo/copy-overwrite/.claude}/rules/expo-verification.md +0 -0
- /package/{plugins/lisa-rails → rails/copy-overwrite/.claude}/rules/rails-conventions.md +0 -0
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
# Expo Verification Capabilities
|
|
2
|
-
|
|
3
|
-
This rule documents the native and web verification surfaces available in Expo projects. Agents must use these tools when verifying UI changes, features, and bugs.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Environment Strategy
|
|
8
|
-
|
|
9
|
-
Frontend changes are typically verified against the **remote dev backend**, not a local backend. The backend is generally deployed before the frontend, so the dev environment is the default target for verification.
|
|
10
|
-
|
|
11
|
-
Use `:local` variants only when explicitly running the companion backend repo locally. Use `:dev` for most verification work.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Native Simulator Testing
|
|
16
|
-
|
|
17
|
-
Expo manages simulator and emulator lifecycle directly. Never use `xcrun simctl` or manual emulator commands.
|
|
18
|
-
|
|
19
|
-
### Start Dev Server with Simulator
|
|
20
|
-
|
|
21
|
-
These commands copy the target environment file, launch the Expo dev server, and open the app in the simulator automatically:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# iOS Simulator
|
|
25
|
-
bun run start:simulator:ios:local # Against local backend
|
|
26
|
-
bun run start:simulator:ios:dev # Against dev backend (default for verification)
|
|
27
|
-
bun run start:simulator:ios:staging # Against staging backend
|
|
28
|
-
bun run start:simulator:ios:production # Against production backend
|
|
29
|
-
|
|
30
|
-
# Android Emulator
|
|
31
|
-
bun run start:simulator:android:local # Against local backend
|
|
32
|
-
bun run start:simulator:android:dev # Against dev backend (default for verification)
|
|
33
|
-
bun run start:simulator:android:staging # Against staging backend
|
|
34
|
-
bun run start:simulator:android:production # Against production backend
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Build Native Binary and Run on Simulator
|
|
38
|
-
|
|
39
|
-
These commands compile a full native binary and install it on the simulator. Slower than dev server but closer to production:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# iOS Simulator
|
|
43
|
-
bun run build-and-run:simulator:ios:local # Against local backend
|
|
44
|
-
bun run build-and-run:simulator:ios:dev # Against dev backend
|
|
45
|
-
bun run build-and-run:simulator:ios:staging # Against staging backend
|
|
46
|
-
bun run build-and-run:simulator:ios:production # Against production backend
|
|
47
|
-
|
|
48
|
-
# Android Emulator
|
|
49
|
-
bun run build-and-run:simulator:android:local # Against local backend
|
|
50
|
-
bun run build-and-run:simulator:android:dev # Against dev backend
|
|
51
|
-
bun run build-and-run:simulator:android:staging # Against staging backend
|
|
52
|
-
bun run build-and-run:simulator:android:production # Against production backend
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Use `build-and-run` when testing native modules, push notifications, deep linking, or any feature that requires a full native build.
|
|
56
|
-
|
|
57
|
-
### Dev Server Only (Manual Simulator Selection)
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
bun run start:local # Start dev server, then press 'i' for iOS or 'a' for Android
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Native E2E Testing with Maestro
|
|
66
|
-
|
|
67
|
-
Maestro provides automated native UI testing on simulators and emulators.
|
|
68
|
-
|
|
69
|
-
### Run All Flows
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
bun run maestro:test
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Run Smoke Tests Only
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
bun run maestro:test:smoke
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Interactive Flow Development
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
bun run maestro:studio
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Maestro flows live in `.maestro/flows/`. Tag flows with `smoke` for the smoke test subset.
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Web Testing with Playwright
|
|
92
|
-
|
|
93
|
-
### Run Playwright Tests
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
bun run playwright:test # Build and run all tests
|
|
97
|
-
bun run playwright:test:ui # Build and run with interactive UI
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Ad-Hoc Browser Verification
|
|
101
|
-
|
|
102
|
-
Use the Playwright MCP tools (`browser_snapshot`, `browser_click`, `browser_take_screenshot`, `browser_navigate`, `browser_console_messages`, `browser_network_requests`) for interactive browser verification without writing test files.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Cross-Repo Log Correlation
|
|
107
|
-
|
|
108
|
-
When debugging frontend issues, errors often originate on the server side. Agents must check both client and server logs to diagnose problems.
|
|
109
|
-
|
|
110
|
-
### Client-Side Logs
|
|
111
|
-
|
|
112
|
-
Use the Playwright MCP tools to capture browser logs during verification:
|
|
113
|
-
|
|
114
|
-
- `browser_console_messages` — Console output (errors, warnings, info, debug)
|
|
115
|
-
- `browser_network_requests` — Failed API calls, status codes, response payloads
|
|
116
|
-
|
|
117
|
-
For native simulators, check the Expo dev server terminal output for Metro bundler errors and React Native logs.
|
|
118
|
-
|
|
119
|
-
### Server-Side Logs
|
|
120
|
-
|
|
121
|
-
When the frontend is configured as an additional working directory alongside a companion backend repo (or vice versa), agents have access to both codebases. Use this to:
|
|
122
|
-
|
|
123
|
-
1. **Read the backend's CLAUDE.md and verification rules** to understand how to check server logs
|
|
124
|
-
2. **Check backend logs locally** if the backend is running via `bun run start:local` in the companion repo
|
|
125
|
-
3. **Check remote logs** using whatever observability tools the backend documents (CloudWatch, Sentry, etc.)
|
|
126
|
-
|
|
127
|
-
### Debugging Workflow
|
|
128
|
-
|
|
129
|
-
When a frontend action produces an error:
|
|
130
|
-
|
|
131
|
-
1. **Capture the client error** — Use `browser_console_messages` and `browser_network_requests` to identify the failing request (URL, status code, error body)
|
|
132
|
-
2. **Correlate with server logs** — Use the companion backend repo's documented log-checking tools to find the corresponding server-side error
|
|
133
|
-
3. **Identify the root cause** — Determine whether the issue is a frontend bug (bad request, missing field, wrong query) or a backend bug (server error, schema mismatch, auth failure)
|
|
134
|
-
4. **Document both sides** — Include client and server log excerpts in proof artifacts
|
|
135
|
-
|
|
136
|
-
This cross-repo correlation is especially valuable for:
|
|
137
|
-
|
|
138
|
-
- GraphQL query errors (client sends bad query vs. server resolver failure)
|
|
139
|
-
- Authentication failures (expired token vs. misconfigured auth)
|
|
140
|
-
- Data inconsistencies (frontend cache staleness vs. backend data issue)
|
|
141
|
-
- Network errors (frontend timeout vs. backend performance)
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Deployment
|
|
146
|
-
|
|
147
|
-
### Authentication
|
|
148
|
-
|
|
149
|
-
Before deploying, ensure you are logged into EAS:
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
bun run eas:whoami # Check current login status
|
|
153
|
-
bun run eas:login # Log in to Expo account (interactive)
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### EAS Build (Full Native Deploy)
|
|
157
|
-
|
|
158
|
-
`eas:deploy` triggers a full native build in the EAS cloud. Use this when native code has changed (new native modules, SDK upgrades, native config changes). Builds take several minutes.
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
bun run eas:deploy:dev # Build for dev environment
|
|
162
|
-
bun run eas:deploy:staging # Build for staging environment
|
|
163
|
-
bun run eas:deploy:production # Build for production environment
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Build profiles are defined in `eas.json`. Each profile specifies its channel, environment variables, and distribution settings.
|
|
167
|
-
|
|
168
|
-
### EAS Update (OTA Publish)
|
|
169
|
-
|
|
170
|
-
`eas:publish` pushes an over-the-air JavaScript bundle update. Use this for JS-only changes (bug fixes, UI tweaks, logic changes) that don't require a new native build. Updates are fast (seconds, not minutes).
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
bun run eas:publish:dev # Publish OTA update to dev channel
|
|
174
|
-
bun run eas:publish:staging # Publish OTA update to staging channel
|
|
175
|
-
bun run eas:publish:production # Publish OTA update to production channel
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### When to Use Build vs Update
|
|
179
|
-
|
|
180
|
-
| Scenario | Command |
|
|
181
|
-
|----------|---------|
|
|
182
|
-
| New native module added | `eas:deploy` (full build required) |
|
|
183
|
-
| SDK version upgrade | `eas:deploy` (full build required) |
|
|
184
|
-
| Native config change (`app.json`, `eas.json`) | `eas:deploy` (full build required) |
|
|
185
|
-
| JS bug fix | `eas:publish` (OTA update) |
|
|
186
|
-
| UI change (styles, layout, text) | `eas:publish` (OTA update) |
|
|
187
|
-
| New screen or feature (JS-only) | `eas:publish` (OTA update) |
|
|
188
|
-
|
|
189
|
-
### Deployment Verification
|
|
190
|
-
|
|
191
|
-
After deploying, verify the deployment landed:
|
|
192
|
-
|
|
193
|
-
1. **For OTA updates**: Check the EAS dashboard or run `eas update:list` to confirm the update was published to the correct channel
|
|
194
|
-
2. **For full builds**: Check the EAS dashboard or run `eas build:list` to confirm the build completed successfully
|
|
195
|
-
3. **End-to-end**: Open the app on a device/simulator pointed at the target environment and verify the changes are present
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## Verification Quick Reference
|
|
200
|
-
|
|
201
|
-
| Change Type | Verification Method | Command |
|
|
202
|
-
|-------------|-------------------|---------|
|
|
203
|
-
| UI feature (web) | Playwright MCP tools or tests | `bun run playwright:test` |
|
|
204
|
-
| UI feature (native) | Maestro flows | `bun run maestro:test` |
|
|
205
|
-
| Unit/integration logic | Jest | `bun run test -- path/to/file` |
|
|
206
|
-
| Type safety | TypeScript compiler | `bun run typecheck` |
|
|
207
|
-
| Code quality | ESLint | `bun run lint` |
|
|
208
|
-
| Native module integration | Build and run on simulator | `bun run build-and-run:simulator:ios:dev` |
|
|
209
|
-
| Full native E2E | Maestro smoke suite | `bun run maestro:test:smoke` |
|
|
210
|
-
| Client-side errors | Playwright browser logs | `browser_console_messages` MCP tool |
|
|
211
|
-
| Server-side errors | Companion backend repo logs | Check backend CLAUDE.md for log commands |
|
|
212
|
-
| Deploy (native change) | EAS Build | `bun run eas:deploy:dev` |
|
|
213
|
-
| Deploy (JS-only change) | EAS Update (OTA) | `bun run eas:publish:dev` |
|
|
214
|
-
| Check EAS auth | EAS CLI | `bun run eas:whoami` |
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## Verification Patterns for Native Changes
|
|
219
|
-
|
|
220
|
-
### UI Feature on Native
|
|
221
|
-
|
|
222
|
-
End user: human on iOS or Android device.
|
|
223
|
-
|
|
224
|
-
Required proof:
|
|
225
|
-
|
|
226
|
-
- Maestro flow recording or screenshots from simulator
|
|
227
|
-
- Console output showing flow passed
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
# Start the app on iOS simulator against dev backend
|
|
231
|
-
bun run start:simulator:ios:dev
|
|
232
|
-
|
|
233
|
-
# Run Maestro verification
|
|
234
|
-
bun run maestro:test
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Native Module or Platform-Specific Code
|
|
238
|
-
|
|
239
|
-
End user: application on device.
|
|
240
|
-
|
|
241
|
-
Required proof:
|
|
242
|
-
|
|
243
|
-
- Successful native build (no build errors)
|
|
244
|
-
- App launches and target feature is functional
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
# Build and install native binary against dev backend
|
|
248
|
-
bun run build-and-run:simulator:ios:dev
|
|
249
|
-
|
|
250
|
-
# Verify with Maestro
|
|
251
|
-
bun run maestro:test:smoke
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Cross-Platform Verification
|
|
255
|
-
|
|
256
|
-
For changes that affect both web and native, agents must verify on both surfaces:
|
|
257
|
-
|
|
258
|
-
1. **Web**: Playwright MCP tools or `bun run playwright:test`
|
|
259
|
-
2. **Native**: `bun run start:simulator:ios:dev` + `bun run maestro:test`
|
|
260
|
-
|
|
261
|
-
If only one surface is available, label the result as **PARTIALLY VERIFIED** with explicit gap documentation.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Lisa-Managed Files
|
|
2
|
-
|
|
3
|
-
The following files are managed by Lisa and will be overwritten on every `lisa` run. Never edit them directly. Where a local override exists, edit that instead.
|
|
4
|
-
|
|
5
|
-
## Files with local overrides (edit the override, not the managed file)
|
|
6
|
-
|
|
7
|
-
| Managed File (do not edit) | Local Override (edit this instead) |
|
|
8
|
-
|---|---|
|
|
9
|
-
| `.rubocop.yml` | `.rubocop.local.yml` |
|
|
10
|
-
|
|
11
|
-
## Create-only files (edit freely, Lisa won't overwrite)
|
|
12
|
-
|
|
13
|
-
- `.claude/rules/PROJECT_RULES.md`
|
|
14
|
-
- `.rubocop.local.yml`
|
|
15
|
-
- `.simplecov`
|
|
16
|
-
- `.reek.yml`
|
|
17
|
-
- `.rspec`
|
|
18
|
-
- `simplecov.thresholds.json`
|
|
19
|
-
- `rubocop.thresholds.yml`
|
|
20
|
-
- `sonar-project.properties`
|
|
21
|
-
- `spec/spec_helper.rb`
|
|
22
|
-
- `spec/rails_helper.rb`
|
|
23
|
-
- `.github/workflows/ci.yml`
|
|
24
|
-
- `.github/workflows/claude-nightly-test-coverage.yml`
|
|
25
|
-
- `.github/workflows/claude-nightly-code-complexity.yml`
|
|
26
|
-
- `.github/workflows/claude-nightly-test-improvement.yml`
|
|
27
|
-
- `VERSION`
|
|
28
|
-
|
|
29
|
-
## Deep-merged by Lisa (Lisa wins conflicts, but project can add its own keys)
|
|
30
|
-
|
|
31
|
-
- `.claude/settings.json`
|
|
32
|
-
|
|
33
|
-
## Plugin-managed content (agents, skills, hooks, commands, rules)
|
|
34
|
-
|
|
35
|
-
These resources are distributed via the stack Claude Code plugin (`rails@lisa`). Rules — including this file — are injected into each prompt automatically. Do not add these files to your project directory.
|
|
36
|
-
|
|
37
|
-
## Copy-overwrite files (do not edit — full list)
|
|
38
|
-
|
|
39
|
-
- `.safety-net.json`
|
|
40
|
-
- `.rubocop.yml`, `.versionrc`, `lefthook.yml`, `Gemfile.lisa`
|
|
41
|
-
- `config/initializers/version.rb`
|
|
42
|
-
- `.coderabbit.yml`, `commitlint.config.cjs`
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# Rails Coding Conventions
|
|
2
|
-
|
|
3
|
-
This rule enforces Rails-specific coding standards for consistency, maintainability, and performance.
|
|
4
|
-
|
|
5
|
-
## Fat Models, Skinny Controllers
|
|
6
|
-
|
|
7
|
-
Controllers handle HTTP concerns only. Business logic belongs in models or service objects.
|
|
8
|
-
|
|
9
|
-
```ruby
|
|
10
|
-
# Correct — controller delegates to model
|
|
11
|
-
class OrdersController < ApplicationController
|
|
12
|
-
def create
|
|
13
|
-
@order = Order.place(order_params, current_user)
|
|
14
|
-
redirect_to @order
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Wrong — business logic in controller
|
|
19
|
-
class OrdersController < ApplicationController
|
|
20
|
-
def create
|
|
21
|
-
@order = Order.new(order_params)
|
|
22
|
-
@order.user = current_user
|
|
23
|
-
@order.total = @order.line_items.sum(&:price)
|
|
24
|
-
@order.apply_discount(current_user.discount_rate)
|
|
25
|
-
@order.save!
|
|
26
|
-
OrderMailer.confirmation(@order).deliver_later
|
|
27
|
-
redirect_to @order
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Service Objects
|
|
33
|
-
|
|
34
|
-
Extract complex business logic into service objects when a model method would be too large or spans multiple models.
|
|
35
|
-
|
|
36
|
-
```ruby
|
|
37
|
-
# app/services/order_placement_service.rb
|
|
38
|
-
class OrderPlacementService
|
|
39
|
-
def initialize(user:, params:)
|
|
40
|
-
@user = user
|
|
41
|
-
@params = params
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def call
|
|
45
|
-
order = Order.new(@params)
|
|
46
|
-
order.user = @user
|
|
47
|
-
order.calculate_total
|
|
48
|
-
order.save!
|
|
49
|
-
OrderMailer.confirmation(order).deliver_later
|
|
50
|
-
order
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Concerns
|
|
56
|
-
|
|
57
|
-
Use concerns to share behavior across models or controllers. Keep concerns focused on a single responsibility.
|
|
58
|
-
|
|
59
|
-
```ruby
|
|
60
|
-
# app/models/concerns/searchable.rb
|
|
61
|
-
module Searchable
|
|
62
|
-
extend ActiveSupport::Concern
|
|
63
|
-
|
|
64
|
-
included do
|
|
65
|
-
scope :search, ->(query) { where("name ILIKE ?", "%#{query}%") }
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## ActiveRecord Patterns
|
|
71
|
-
|
|
72
|
-
### Scopes over class methods for chainable queries
|
|
73
|
-
|
|
74
|
-
```ruby
|
|
75
|
-
# Correct — scope
|
|
76
|
-
scope :active, -> { where(active: true) }
|
|
77
|
-
scope :recent, -> { order(created_at: :desc) }
|
|
78
|
-
|
|
79
|
-
# Wrong — class method for simple query
|
|
80
|
-
def self.active
|
|
81
|
-
where(active: true)
|
|
82
|
-
end
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Validations
|
|
86
|
-
|
|
87
|
-
```ruby
|
|
88
|
-
# Use built-in validators
|
|
89
|
-
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
|
90
|
-
validates :age, numericality: { greater_than: 0 }
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Callbacks — use sparingly
|
|
94
|
-
|
|
95
|
-
Prefer explicit service objects over callbacks for complex side effects. Callbacks are acceptable for simple data normalization.
|
|
96
|
-
|
|
97
|
-
```ruby
|
|
98
|
-
# Acceptable — simple normalization
|
|
99
|
-
before_validation :normalize_email
|
|
100
|
-
|
|
101
|
-
private
|
|
102
|
-
|
|
103
|
-
def normalize_email
|
|
104
|
-
self.email = email&.downcase&.strip
|
|
105
|
-
end
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## N+1 Query Prevention
|
|
109
|
-
|
|
110
|
-
Always use `includes`, `preload`, or `eager_load` to prevent N+1 queries. The Bullet gem is included to detect these in development.
|
|
111
|
-
|
|
112
|
-
```ruby
|
|
113
|
-
# Correct — eager loading
|
|
114
|
-
@posts = Post.includes(:author, :comments).where(published: true)
|
|
115
|
-
|
|
116
|
-
# Wrong — N+1 query
|
|
117
|
-
@posts = Post.where(published: true)
|
|
118
|
-
@posts.each { |post| post.author.name } # N+1!
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Strong Parameters
|
|
122
|
-
|
|
123
|
-
Always use strong parameters in controllers. Never use `permit!`.
|
|
124
|
-
|
|
125
|
-
```ruby
|
|
126
|
-
# Correct
|
|
127
|
-
def order_params
|
|
128
|
-
params.require(:order).permit(:product_id, :quantity, :notes)
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Wrong — permits everything
|
|
132
|
-
def order_params
|
|
133
|
-
params.require(:order).permit!
|
|
134
|
-
end
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Database Migrations
|
|
138
|
-
|
|
139
|
-
- Use `strong_migrations` gem constraints (included via Gemfile.lisa)
|
|
140
|
-
- Never modify `db/schema.rb` directly
|
|
141
|
-
- Always add indexes for foreign keys and commonly queried columns
|
|
142
|
-
- Use `change` method when the migration is reversible; use `up`/`down` when it is not
|
|
143
|
-
|
|
144
|
-
```ruby
|
|
145
|
-
class AddIndexToOrdersUserId < ActiveRecord::Migration[7.2]
|
|
146
|
-
def change
|
|
147
|
-
add_index :orders, :user_id
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Testing with RSpec
|
|
153
|
-
|
|
154
|
-
- Use `let` and `let!` for test setup
|
|
155
|
-
- Use `described_class` instead of repeating the class name
|
|
156
|
-
- Use `factory_bot` for test data, not fixtures
|
|
157
|
-
- Use `shoulda-matchers` for model validation tests
|
|
158
|
-
- Keep tests focused — one assertion concept per example
|
|
159
|
-
|
|
160
|
-
```ruby
|
|
161
|
-
RSpec.describe Order, type: :model do
|
|
162
|
-
describe "validations" do
|
|
163
|
-
it { is_expected.to validate_presence_of(:user) }
|
|
164
|
-
it { is_expected.to validate_numericality_of(:total).is_greater_than(0) }
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
describe ".recent" do
|
|
168
|
-
it "returns orders in descending creation order" do
|
|
169
|
-
old_order = create(:order, created_at: 1.day.ago)
|
|
170
|
-
new_order = create(:order, created_at: 1.hour.ago)
|
|
171
|
-
|
|
172
|
-
expect(described_class.recent).to eq([new_order, old_order])
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
```
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Lisa-Managed Files
|
|
2
|
-
|
|
3
|
-
The following files are managed by Lisa and will be overwritten on every `lisa` run. Never edit them directly. Where a local override exists, edit that instead.
|
|
4
|
-
|
|
5
|
-
## Files with local overrides (edit the override, not the managed file)
|
|
6
|
-
|
|
7
|
-
| Managed File (do not edit) | Local Override (edit this instead) |
|
|
8
|
-
|---|---|
|
|
9
|
-
| `eslint.config.ts` | `eslint.config.local.ts` |
|
|
10
|
-
| `vitest.config.ts` | `vitest.config.local.ts` |
|
|
11
|
-
| `tsconfig.json` | `tsconfig.local.json` |
|
|
12
|
-
|
|
13
|
-
## Create-only files (edit freely, Lisa won't overwrite)
|
|
14
|
-
|
|
15
|
-
- `.claude/rules/PROJECT_RULES.md`
|
|
16
|
-
- `eslint.thresholds.json`
|
|
17
|
-
- `vitest.thresholds.json`
|
|
18
|
-
|
|
19
|
-
## Deep-merged by Lisa (Lisa wins conflicts, but project can add its own keys)
|
|
20
|
-
|
|
21
|
-
- `.claude/settings.json`
|
|
22
|
-
|
|
23
|
-
## Plugin-managed content (agents, skills, hooks, commands, rules)
|
|
24
|
-
|
|
25
|
-
These resources are distributed via the stack Claude Code plugin (e.g., `typescript@lisa`). Rules — including this file — are injected into each prompt automatically. Do not add these files to your project directory.
|
|
26
|
-
|
|
27
|
-
## Copy-overwrite files (do not edit — full list)
|
|
28
|
-
|
|
29
|
-
- `.prettierrc.json`, `.prettierignore`, `.lintstagedrc.json`, `.versionrc`, `.nvmrc`
|
|
30
|
-
- `.yamllint`, `.gitleaksignore`, `.coderabbit.yml`, `commitlint.config.cjs`, `sgconfig.yml`, `knip.json`
|
|
31
|
-
- `.safety-net.json`, `audit.ignore.config.json`
|
|
32
|
-
- `eslint.base.ts`, `eslint.typescript.ts` (+ `expo`/`nestjs`/`cdk` variants), `eslint.slow.config.ts`
|
|
33
|
-
- `vitest.config.ts`
|
|
34
|
-
- `tsconfig.base.json`, `tsconfig.typescript.json` (+ variants), `tsconfig.eslint.json`, `tsconfig.build.json`, `tsconfig.spec.json`
|
|
35
|
-
- `.github/workflows/quality.yml`, `release.yml`, `claude.yml`, and all other Claude/CI workflows
|
|
36
|
-
- `.github/dependabot.yml`, `.github/GITHUB_ACTIONS.md`
|
|
37
|
-
- `ast-grep/rules/`, `ast-grep/utils/`, `ast-grep/rule-tests/`
|
|
File without changes
|
/package/{plugins/lisa/rules/verfication.md → all/copy-overwrite/.claude/rules/verification.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|