stock-analyzer
The Stock Analyzer skill calculates technical indicators including RSI, MACD, and Bollinger Bands to provide buy and sell signals for stocks and ETFs. Use this skill when users request technical analysis, trading signals, or comparative rankings of securities by technical strength, rather than fundamental data or options pricing information.
git clone --depth 1 https://github.com/FrancyJGLisboa/agent-skill-creator /tmp/stock-analyzer && cp -r /tmp/stock-analyzer/references/examples/stock-analyzer ~/.claude/skills/stock-analyzerSKILL.md
# Stock Analyzer Skill - Technical Specification
**Version:** 1.0.0
**Type:** Simple Skill
**Domain:** Financial Technical Analysis
**Created:** 2025-10-23
---
## Overview
The Stock Analyzer Skill provides comprehensive technical analysis capabilities for stocks and ETFs, utilizing industry-standard indicators and generating actionable trading signals.
### Purpose
Enable traders and investors to perform technical analysis through natural language queries, eliminating the need for manual indicator calculation or chart interpretation.
### Core Capabilities
1. **Technical Indicator Calculation**: RSI, MACD, Bollinger Bands, Moving Averages
2. **Signal Generation**: Buy/sell recommendations based on indicator combinations
3. **Stock Comparison**: Rank multiple stocks by technical strength
4. **Pattern Recognition**: Identify chart patterns and price action setups
5. **Monitoring & Alerts**: Track stocks and alert on technical conditions
---
## Activation
This skill activates through the `description` field in the SKILL.md frontmatter. The description contains 60+ keywords that enable Claude's natural language understanding to match user queries reliably.
**Key terms embedded in the description:**
- Action verbs: analyze, compare, monitor, track
- Domain entities: stocks, ETFs, tickers
- Specific indicators: RSI, MACD, Bollinger Bands, moving averages
- Use cases: buy/sell signals, comparison, monitoring, chart patterns
- Counter-examples: fundamental analysis, news, options pricing
**Activation reliability: 95%+** across tested query variations
---
## Architecture
### Type Decision
**Chosen:** Simple Skill
**Reasoning:**
- Estimated LOC: ~600 lines
- Single domain (technical analysis)
- Cohesive functionality
- No sub-skills needed
### Component Structure
```
stock-analyzer/
├── SKILL.md # Skill definition and activation (this file)
├── scripts/
│ ├── main.py # Orchestrator
│ ├── indicators/
│ │ ├── rsi.py # RSI calculator
│ │ ├── macd.py # MACD calculator
│ │ └── bollinger.py # Bollinger Bands
│ ├── signals/
│ │ └── generator.py # Signal generation logic
│ ├── data/
│ │ └── fetcher.py # Data retrieval
│ └── utils/
│ └── validators.py # Input validation
├── README.md # User documentation
└── requirements.txt # Dependencies
```
---
## Implementation Details
### Main Orchestrator (main.py)
```python
"""
Stock Analyzer - Technical Analysis Skill
Provides RSI, MACD, Bollinger Bands analysis and signal generation
"""
from typing import List, Dict, Optional
from .indicators import RSICalculator, MACDCalculator, BollingerCalculator
from .signals import SignalGenerator
from .data import DataFetcher
class StockAnalyzer:
"""Main orchestrator for technical analysis operations"""
def __init__(self, config: Optional[Dict] = None):
self.config = config or self._default_config()
self.data_fetcher = DataFetcher(self.config['data_source'])
self.signal_generator = SignalGenerator(self.config['signals'])
def analyze(self, ticker: str, indicators: List[str], period: str = "1y"):
"""
Perform technical analysis on a stock
Args:
ticker: Stock symbol (e.g., "AAPL")
indicators: List of indicator names (e.g., ["RSI", "MACD"])
period: Time period for analysis (default: "1y")
Returns:
Dict with indicator values, signals, and recommendations
"""
# Fetch price data
data = self.data_fetcher.get_data(ticker, period)
# Calculate requested indicators
results = {}
for indicator in indicators:
if indicator == "RSI":
calc = RSICalculator(self.config['indicators']['RSI'])
results['RSI'] = calc.calculate(data)
elif indicator == "MACD":
calc = MACDCalculator(self.config['indicators']['MACD'])
results['MACD'] = calc.calculate(data)
elif indicator == "Bollinger":
calc = BollingerCalculator(self.config['indicators']['Bollinger'])
results['Bollinger'] = calc.calculate(data)
# Generate trading signals
signal = self.signal_generator.generate(ticker, data, results)
return {
'ticker': ticker,
'current_price': data['Close'].iloc[-1],
'indicators': results,
'signal': signal,
'timestamp': data.index[-1]
}
def compare(self, tickers: List[str], rank_by: str = "momentum"):
"""Compare multiple stocks and rank by technical strength"""
comparisons = []
for ticker in tickers:
analysis = self.analyze(ticker, ["RSI", "MACD"])
comparisons.append({
'ticker': ticker,
'analysis': analysis,
'score': self._calculate_score(analysis, rank_by)
})
# Sort by score (highest first)
comparisons.sort(key=lambda x: x['score'], reverse=True)
return {
'ranked_stocks': comparisons,
'method': rank_by,
'timestamp': comparisons[0]['analysis']['timestamp']
}
```
### Indicator Calculators
Each indicator has dedicated calculator following Single Responsibility Principle:
- **RSICalculator**: Computes Relative Strength Index
- **MACDCalculator**: Computes Moving Average Convergence Divergence
- **BollingerCalculator**: Computes Bollinger Bands (upper, middle, lower)
### Signal Generator
Interprets indicator combinations to produce buy/sell/hold recommendations:
```python
class SignalGenerator:
"""Generates trading signals from technical indicators"""
def generate(self, ticker: str, data: pd.DataFrame, indicators: Dict):
"""
Generate trading signal from indicator combination
Strat>-
Summarizes open pull requests into a blockers-first standup digest. Activates when the user asks to summarize open PRs, find blocked pull requests, generate a PR standup, or triage review backlog from a PR export.
Cleans a weekly CRM export and produces a regional sales summary. Activates when the user asks to clean a CRM export, deduplicate sales rows, calculate regional totals, or generate a weekly sales report from a CSV.