ruby-test-analyzer
# Ruby Test Analyzer Skill
What this skill does
# Ruby Test Analyzer Skill
Intelligently analyze RSpec test failures and provide actionable debugging guidance.
## When to Activate
This skill activates when:
- RSpec tests fail
- User runs test commands
- User asks about test failures or debugging
- Working with test files
## Core Capabilities
### 1. Failure Pattern Recognition
Automatically identify common failure patterns:
**NoMethodError Patterns:**
- Nil object errors → Check object initialization
- Missing method → Check for typos or missing implementation
- Wrong receiver → Check factory setup or test doubles
**Expectation Failures:**
- Off-by-one errors → Check loop boundaries
- Wrong values → Check business logic implementation
- Type mismatches → Check data transformation
**Database/State Issues:**
- Transactional rollback problems
- Factory/fixture conflicts
- Test interdependencies
### 2. Provide Debugging Steps
For each failure, suggest:
1. **Immediate Checks:**
- Verify object is not nil
- Check method spelling
- Confirm proper setup in before blocks
2. **Investigation Steps:**
- Add `puts` or `binding.pry` at strategic points
- Check factory definitions
- Verify database state
3. **Likely Fixes:**
- Code examples showing the fix
- References to related files
- Design improvements to prevent recurrence
### 3. Test Quality Analysis
Evaluate test quality:
**Good Signs:**
- Clear describe/context structure
- Single responsibility per test
- Proper use of let/let!/before
- Descriptive test names
- Good isolation
**Warning Signs:**
- Tests with multiple expectations
- Tests depending on execution order
- Overuse of let! (eager evaluation)
- Brittle tests (too coupled to implementation)
- Missing edge cases
### 4. Suggest Missing Tests
Identify untested scenarios:
- Edge cases
- Error conditions
- Boundary values
- Integration points
- State transitions
## Example Analysis
**Failure Detected:**
```
Failure/Error: expect(user.full_name).to eq("John Doe")
expected: "John Doe"
got: "John"
```
**Analysis Response:**
**Failure: User#full_name incomplete**
- **Location:** spec/user_spec.rb:23
- **Error Type:** Expectation mismatch
**Immediate Cause:**
The `full_name` method is only returning the first name.
**Investigation Steps:**
1. Check the implementation at lib/user.rb:15
```ruby
# Current implementation (likely):
def full_name
first_name
end
```
2. Verify test data:
```ruby
# Check that your factory/test setup has both names
user = User.new(first_name: "John", last_name: "Doe")
```
**Suggested Fix:**
```ruby
# lib/user.rb:15
def full_name
[first_name, last_name].compact.join(' ')
end
```
**Additional Considerations:**
- Handle nil values gracefully (using `compact`)
- Consider edge cases: missing last name, middle names
- Add test for user with only first name
**Suggested Additional Tests:**
```ruby
context 'when last_name is missing' do
it 'returns only first_name' do
user = User.new(first_name: "John", last_name: nil)
expect(user.full_name).to eq("John")
end
end
```
## Performance Analysis
When tests are slow:
**Identify Bottlenecks:**
1. Run with profiling: `bundle exec rspec --profile`
2. Find slowest examples
3. Categorize delays:
- Database operations
- External service calls
- Complex computations
- Factory creation
**Optimization Suggestions:**
**Database-Heavy Tests:**
- Use `build_stubbed` instead of `create`
- Use `let` instead of `let!` where possible
- Consider using transactions or database_cleaner strategies
**External Services:**
- Stub external API calls
- Use VCR for HTTP interactions
- Mock time-consuming operations
**Factory Optimization:**
- Minimize associated records
- Use traits for specific scenarios
- Consider using `build` instead of `create`
## Interactive Debugging
Offer to:
1. Add debugging output to specific lines
2. Insert `binding.pry` at failure point
3. Show related code context
4. Run specific tests in isolation
5. Check factory definitions
6. Verify test data setup
## Test Coverage Suggestions
Suggest tests for:
- **Happy path**: Normal expected usage
- **Edge cases**: Boundary conditions
- **Error cases**: Invalid inputs
- **Null cases**: Nil/empty values
- **Integration**: Cross-object interactions
## Guidelines
- Focus on actionable next steps
- Provide specific line numbers and file paths
- Show concrete code examples
- Explain the "why" behind failures
- Suggest preventive measures
- Balance speed of fix with quality of solution
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.