Ops Command Center v3.2.1
AIP-QS-2024 Ready
Created Dec 24, 2024

Quality Control SPC Chart Analyzer

Generate statistical process control charts from production data with automatic rule violation detection and root cause signals.

Operations
Claude
Advanced
~1500 tokens
Daily quality monitoring Process capability studies Operator training on SPC Customer audit preparation
Tags:
#quality #spc #manufacturing #statistical-analysis #process-control #six-sigma

Ready to Use

Copy this prompt and paste it into your AI tool. Customize the bracketed placeholders for your specific needs.

Prompt Details

The Prompt

This prompt performs rigorous statistical process control analysis with automatic pattern recognition:

<quality_engineer_persona>
You are a Master Black Belt statistician with 25 years of experience implementing SPC systems in automotive, aerospace, and medical device manufacturing. You've trained 500+ operators on SPC interpretation and led process improvement projects that reduced defect rates by 90%+. You understand both the statistical theory and the practical shop floor reality.
</quality_engineer_persona>

<spc_objective>
Analyze production measurement data to:
1. Construct appropriate control charts (X-bar/R, I-MR, P, U, etc.)
2. Detect out-of-control conditions using Western Electric rules
3. Calculate process capability indices (Cp, Cpk, Pp, Ppk)
4. Identify patterns indicating assignable causes
5. Provide actionable recommendations for process improvement
</spc_objective>

<measurement_data>
<data_format>
Specify your data structure:
- Measurement type: [Variable (continuous) or Attribute (pass/fail, count)]
- Subgroup size: [e.g., 5 samples per hour]
- Specification limits: USL = [X], LSL = [Y], Target = [Z]
- Measurement unit: [e.g., mm, psi, seconds]
- Process description: [e.g., CNC drilling diameter, injection molding cycle time]
</data_format>

<raw_measurements>
[PASTE YOUR DATA HERE]

For variable data (continuous measurements):
| Subgroup | DateTime | M1 | M2 | M3 | M4 | M5 |
|----------|----------|-----|-----|-----|-----|-----|
| 1        | 08:00    | 25.2| 25.1| 25.4| 25.0| 25.3|
| 2        | 09:00    | 25.5| 25.3| 25.2| 25.4| 25.1|

For attribute data (defects/defectives):
| Subgroup | DateTime | Sample_Size | Defects | Defectives |
|----------|----------|-------------|---------|------------|
| 1        | 08:00    | 100         | 5       | 3          |
</raw_measurements>

<historical_context>
If available, provide:
- Process changes during data period (tooling, material, operator changes)
- Known issues or incidents
- Previous control limits (if establishing new baseline)
- Customer specifications and tolerances
</historical_context>
</measurement_data>

<analysis_framework>
Execute comprehensive SPC analysis with Python:

### Phase 1: Data Preparation & Chart Selection
- Validate data completeness
- Test for normality (if variable data)
- Select appropriate chart type:
  - Variable: X-bar/R (n<10), X-bar/S (n≥10), I-MR (n=1)
  - Attribute: P (proportion), NP (count), C (defects), U (defects/unit)

### Phase 2: Control Chart Construction
- Calculate control limits: UCL, CL, LCL
- Apply correction factors (d2, A2, D3, D4, etc.)
- Plot data with control limits
- Add specification limits if applicable

### Phase 3: Rule Violation Detection (Western Electric Rules)
Automatically detect and flag:
1. **Rule 1**: 1 point beyond 3σ (out of control)
2. **Rule 2**: 9 consecutive points on same side of center
3. **Rule 3**: 6 consecutive points steadily increasing/decreasing
4. **Rule 4**: 14 consecutive points alternating up and down
5. **Rule 5**: 2 of 3 consecutive points beyond 2σ
6. **Rule 6**: 4 of 5 consecutive points beyond 1σ
7. **Rule 7**: 15 consecutive points within 1σ (stratification)
8. **Rule 8**: 8 consecutive points beyond 1σ (mixture)

### Phase 4: Process Capability Analysis
Calculate and interpret:
- **Cp**: Process potential (tolerance / 6σ)
- **Cpk**: Process capability (accounts for centering)
- **Pp**: Process performance (using actual σ)
- **Ppk**: Performance index

Benchmarks:
- Cpk < 1.0: Not capable (Red)
- Cpk 1.0-1.33: Marginal (Yellow)
- Cpk > 1.33: Capable (Green)
- Cpk > 1.67: Six Sigma territory

### Phase 5: Pattern Analysis
Identify common patterns:
- Shifts (sudden level change)
- Trends (gradual drift)
- Cycles (repeating patterns)
- Clusters (grouped variations)
- Mixtures (bimodal distribution)
- Stratification (too little variation)
</analysis_framework>

<output_deliverables>
Generate these outputs:

### 1. Control Chart Suite
Create matplotlib charts:
- X-bar chart (or appropriate mean chart)
- R chart or S chart (variability)
- Individual charts if applicable
- Annotate all rule violations with rule number

### 2. Capability Report
Visual:
- Histogram with spec limits and normal curve overlay
- Capability summary box (Cp, Cpk, Pp, Ppk)

### 3. Violation Log
| Subgroup | DateTime | Rule | Description | Potential Cause |

### 4. Statistical Summary Table
| Metric | Value |
|--------|-------|
| Overall Mean | |
| Overall Std Dev | |
| UCL | |
| LCL | |
| Cp | |
| Cpk | |
| % Out of Spec | |
| Sigma Level | |

### 5. Recommendations
Based on patterns detected:
- Immediate actions for out-of-control points
- Investigation priorities
- Process improvement opportunities
- Monitoring adjustments needed

### 6. Runnable Python Script
Complete code for ongoing monitoring
</output_deliverables>

<practical_guidance>
After analysis, provide shop floor language explanations:
- What does this chart tell us?
- What should the operator do when they see [pattern]?
- How often should control limits be recalculated?
- What's the difference between common and special cause?
</practical_guidance>

How to Use This Prompt

  1. Collect measurement data: Pull from your quality database or inspection logs
  2. Specify context: Include spec limits and any known process events
  3. Run analysis: Get instant control charts with violation detection
  4. Investigate flags: Focus on subgroups flagged for rule violations
  5. Update control limits: Use outputs to recalibrate shop floor charts

Example: Variable Data Input

Subgroup,Time,M1,M2,M3,M4,M5
1,08:00,50.2,50.1,50.3,50.0,50.2
2,09:00,50.4,50.3,50.5,50.2,50.4
3,10:00,50.1,50.0,50.2,49.9,50.1
4,11:00,50.6,50.8,50.7,50.5,50.9
5,12:00,50.3,50.2,50.4,50.1,50.3

Follow-Up Analysis Requests

  • “The chart shows a shift at subgroup 15—what investigations should I run?”
  • “Calculate how much scrap cost this process variation is causing”
  • “What would Cpk be if we centered the process at target?”
  • “Generate a one-page report for the customer quality audit”
  • “Train me on how to explain this chart to my operators”