AI Skill Report Card
Analyzing Test Patterns
YAML--- name: analyzing-test-patterns description: Analyzes repetitive test data to extract structure, frequency patterns, and meaningful insights. Use when encountering placeholder text, test strings, or automated data generation patterns. --- # Quick Start ```python import re from collections import Counter def analyze_test_pattern(text): # Extract base patterns and frequencies matches = re.findall(r'(\w+?)(?:\1+)', text) if matches: base_unit = matches[0] total_length = len(text) unit_length = len(base_unit) repetitions = total_length // unit_length return { 'base_pattern': base_unit, 'repetitions': repetitions, 'total_chars': total_length, 'pattern_type': 'exact_repetition' } return {'pattern_type': 'no_repetition', 'original': text} result = analyze_test_pattern("testtesttest") # {'base_pattern': 'test', 'repetitions': 3, 'total_chars': 12, 'pattern_type': 'exact_repetition'}
Workflow12 / 15
- Pattern Detection - Scan for repetitive sequences using regex
- Structure Analysis - Identify base units, delimiters, variations
- Frequency Mapping - Count occurrences and calculate ratios
- Classification - Categorize pattern types (exact, partial, alternating)
- Insight Extraction - Generate meaningful metrics and summaries
Progress:
- Parse raw input text
- Apply pattern recognition algorithms
- Calculate statistical measures
- Classify pattern structure
- Generate analysis report
Recommendation▾
Add complete working code for all pattern types shown in examples - currently only handles exact repetition
Examples15 / 20
Example 1:
Input: "testtesttest"
Output: {'base_pattern': 'test', 'repetitions': 3, 'total_chars': 12, 'efficiency': 0.25}
Example 2:
Input: "abcabcxyzxyz"
Output: {'patterns': [{'unit': 'abc', 'count': 2}, {'unit': 'xyz', 'count': 2}], 'type': 'alternating'}
Example 3:
Input: "aaaaabbbbbccccc"
Output: {'char_runs': [{'char': 'a', 'length': 5}, {'char': 'b', 'length': 5}, {'char': 'c', 'length': 5}]}
Recommendation▾
Include edge case handling and error scenarios in examples (empty strings, single characters, mixed patterns)
Best Practices
- Use
re.findall()with capturing groups for complex patterns - Apply
Counter()for frequency analysis - Calculate compression ratios to measure redundancy
- Store results in structured dictionaries for downstream processing
- Handle Unicode and special characters appropriately
Common Pitfalls
- Don't assume all repetition indicates test data
- Avoid false positives with natural language repetition
- Don't ignore partial matches that might be meaningful
- Don't process binary or encoded data without proper decoding