arch-analysis
Analyze LangGraph application architecture, identify bottlenecks, and propose multiple improvement strategies
What this skill does
# LangGraph Architecture Analysis Skill
A skill for analyzing LangGraph application architecture, identifying bottlenecks, and proposing multiple improvement strategies.
## ๐ Overview
This skill analyzes existing LangGraph applications and proposes graph structure improvements:
1. **Current State Analysis**: Performance measurement and graph structure understanding
2. **Problem Identification**: Organizing bottlenecks and architectural issues
3. **Improvement Proposals**: Generate 3-5 diverse improvement proposals (**all candidates for parallel exploration**)
**Important**:
- This skill only performs analysis and proposals. It does not implement changes.
- **Output all improvement proposals**. The arch-tune command will implement and evaluate them in parallel.
## ๐ฏ When to Use
Use this skill in the following situations:
1. **When performance improvement of existing applications is needed**
- Latency exceeds targets
- Cost is too high
- Accuracy is insufficient
2. **When considering architecture-level improvements**
- Prompt optimization (fine-tune) has limitations
- Graph structure changes are needed
- Considering introduction of new patterns
3. **When you want to compare multiple improvement options**
- Unclear which architecture is optimal
- Want to understand trade-offs
## ๐ Analysis and Proposal Workflow
### Step 1: Verify Evaluation Environment
**Purpose**: Prepare for performance measurement
**Actions**:
1. Verify existence of evaluation program (`.langgraph-architect/evaluation/` or specified directory)
2. If not present, confirm evaluation criteria with user and create
3. Verify test cases
**Output**: Evaluation program ready
### Step 2: Measure Current Performance
**Purpose**: Establish baseline
**Actions**:
1. Run test cases 3-5 times
2. Record each metric (accuracy, latency, cost, etc.)
3. Calculate statistics (mean, standard deviation, min, max)
4. Save as baseline
**Output**: `baseline_performance.json`
### Step 3: Analyze Graph Structure
**Purpose**: Understand current architecture
**Actions**:
1. **Identify graph definitions with Serena MCP**
- Search for StateGraph, MessageGraph with `find_symbol`
- Identify graph definition files (typically `graph.py`, `main.py`, etc.)
2. **Analyze node and edge structure**
- List node functions with `get_symbols_overview`
- Verify edge types (sequential, parallel, conditional)
- Check for subgraphs
3. **Understand each node's role**
- Read node functions
- Verify presence of LLM calls
- Summarize processing content
**Output**: Graph structure documentation
### Step 4: Identify Bottlenecks
**Purpose**: Identify performance problem areas
**Actions**:
1. **Latency Bottlenecks**
- Identify nodes with longest execution time
- Verify delays from sequential processing
- Discover unnecessary processing
2. **Cost Issues**
- Identify high-cost nodes
- Verify unnecessary LLM calls
- Evaluate model selection optimality
3. **Accuracy Issues**
- Identify nodes with frequent errors
- Verify errors due to insufficient information
- Discover architecture constraints
**Output**: List of issues
### Step 5: Consider Architecture Patterns
**Purpose**: Identify applicable LangGraph patterns
**Actions**:
1. **Consider patterns based on problems**
- Latency issues โ Parallelization
- Diverse use cases โ Routing
- Complex processing โ Subgraph
- Staged processing โ Prompt Chaining, Map-Reduce
2. **Reference langgraph-architect skill**
- Verify characteristics of each pattern
- Evaluate application conditions
- Reference implementation examples
**Output**: List of applicable patterns
### Step 6: Generate Improvement Proposals
**Purpose**: Create 3-5 diverse improvement proposals (all candidates for parallel exploration)
**Actions**:
1. **Create improvement proposals based on each pattern**
- Change details (which nodes/edges to modify)
- Expected effects (impact on accuracy, latency, cost)
- Implementation complexity (low/medium/high)
- Estimated implementation time
2. **Evaluate improvement proposals**
- Feasibility
- Risk assessment
- Expected ROI
**Important**: Output all improvement proposals. The arch-tune command will **implement and evaluate all proposals in parallel**.
**Output**: Improvement proposal document (including all proposals)
### Step 7: Create Report
**Purpose**: Organize analysis results and proposals
**Actions**:
1. Current state analysis summary
2. Organize issues
3. **Document all improvement proposals in `improvement_proposals.md`** (with priorities)
4. Present recommendations for reference (first recommendation, second recommendation, reference)
**Important**: Output all proposals to `improvement_proposals.md`. The arch-tune command will read these and implement/evaluate them in parallel.
**Output**:
- `analysis_report.md` - Current state analysis and issues
- `improvement_proposals.md` - **All improvement proposals** (Proposal 1, 2, 3, ...)
## ๐ Output Formats
### baseline_performance.json
```json
{
"iterations": 5,
"test_cases": 20,
"metrics": {
"accuracy": {
"mean": 75.0,
"std": 3.2,
"min": 70.0,
"max": 80.0
},
"latency": {
"mean": 3.5,
"std": 0.4,
"min": 3.1,
"max": 4.2
},
"cost": {
"mean": 0.020,
"std": 0.002,
"min": 0.018,
"max": 0.023
}
}
}
```
### analysis_report.md
```markdown
# Architecture Analysis Report
Execution Date: 2024-11-24 10:00:00
## Current Performance
| Metric | Mean | Std Dev | Target | Gap |
|--------|------|---------|--------|-----|
| Accuracy | 75.0% | 3.2% | 90.0% | -15.0% |
| Latency | 3.5s | 0.4s | 2.0s | +1.5s |
| Cost | $0.020 | $0.002 | $0.010 | +$0.010 |
## Graph Structure
### Current Configuration
\```
analyze_intent โ retrieve_docs โ generate_response
\```
- **Node Count**: 3
- **Edge Type**: Sequential only
- **Parallel Processing**: None
- **Conditional Branching**: None
### Node Details
#### analyze_intent
- **Role**: Classify user input intent
- **LLM**: Claude 3.5 Sonnet
- **Average Execution Time**: 0.5s
#### retrieve_docs
- **Role**: Search related documents
- **Processing**: Vector DB query + reranking
- **Average Execution Time**: 1.5s
#### generate_response
- **Role**: Generate final response
- **LLM**: Claude 3.5 Sonnet
- **Average Execution Time**: 1.5s
## Issues
### 1. Latency Bottleneck from Sequential Processing
- **Issue**: analyze_intent and retrieve_docs are sequential
- **Impact**: Total 2.0s delay (57% of total)
- **Improvement Potential**: -0.8s or more reduction possible through parallelization
### 2. All Requests Follow Same Flow
- **Issue**: Simple and complex questions go through same processing
- **Impact**: Unnecessary retrieve_docs execution (wasted Cost and Latency)
- **Improvement Potential**: -50% reduction possible for simple cases through routing
### 3. Use of Low-Relevance Documents
- **Issue**: retrieve_docs returns only top-k (no reranking)
- **Impact**: Low Accuracy (75%)
- **Improvement Potential**: +10-15% improvement possible through multi-stage RAG
## Applicable Architecture Patterns
1. **Parallelization** - Parallelize analyze_intent and retrieve_docs
2. **Routing** - Branch processing flow based on intent
3. **Subgraph** - Dedicated subgraph for RAG processing (retrieve โ rerank โ select)
4. **Orchestrator-Worker** - Execute multiple retrievers in parallel and integrate results
```
### improvement_proposals.md
```markdown
# Architecture Improvement Proposals
Proposal Date: 2024-11-24 10:30:00
## Proposal 1: Parallel Document Retrieval + Intent Analysis
### Changes
**Current**:
\```
analyze_intent โ retrieve_docs โ generate_response
\```
**After Change**:
\```
START โ [analyze_intent, retrieve_docs] โ generate_response
โ parallel execution โ
\```
### Implementation Details
1. Add parallel edges to StateGraph
2. AddRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.