| name | Single-Pass Validation |
| description | Eliminate token-wasting retry loops by validating requirements and formats BEFORE execution. Get tasks right the first time through systematic pre-flight checks. |
| when_to_use | For ALL: (1) File creation operations, (2) API calls and MCP tool usage, (3) Database operations, (4) Formula-based calculations, (5) Data transformations, (6) Artifact generation. Applies to every execution task without exception. |
| version | 1.0.0 |
| dependencies | none |
Single-Pass Validation - Token Optimization Skill
Core Principle
VALIDATE BEFORE EXECUTE - Zero retries. One attempt. Correct output.
The Retry Problem
Without Validation (Token Waste):
Attempt 1: Create file → Error: #REF! in formulas (2,000 tokens)
Attempt 2: Fix formulas → Error: Wrong format (2,000 tokens)
Attempt 3: Fix format → Error: Missing fields (2,000 tokens)
Attempt 4: Add fields → Success (2,000 tokens)
Total: 8,000 tokens, 4 attempts
With Validation (Token Efficiency):
Pre-flight: Validate all requirements (500 tokens)
Attempt 1: Create file → Success (2,000 tokens)
Total: 2,500 tokens, 1 attempt
Savings: 69% reduction + user satisfaction
Pre-Flight Validation Checklist
Before ANY Execution:
1. Requirements Check
- All required inputs present?
- Input formats correct?
- Dependencies available?
- Output format specified or inferrable?
2. Format Validation
- File extension correct?
- Data structure matches target?
- Schema requirements met?
- Encoding/charset specified?
3. Compatibility Check
- Target system supports this format?
- API version compatible?
- Tool available and configured?
- Permissions sufficient?
4. Data Validation
- Required fields present?
- Data types correct?
- Constraints satisfied?
- References valid?
5. Logic Validation
- Formulas syntactically correct?
- No circular references?
- All cell references exist?
- Calculations mathematically sound?
Validation Patterns by Task Type
Pattern 1: Excel File Creation
Pre-Flight Checks:
# Mental checklist BEFORE creating file:
1. All formulas use absolute/relative refs correctly?
2. No #REF!, #DIV/0!, #VALUE! possible?
3. All referenced sheets/columns exist?
4. Data types match formula expectations?
5. Headers properly formatted?
6. All required columns present?
Execution:
# Only execute after ALL checks pass
create_excel_file(validated_structure)
Result: Zero formula errors, first attempt success
Pattern 2: Notion Page Creation
Pre-Flight Checks:
# Before API call:
1. Database ID valid and accessible?
2. All properties match database schema?
3. Property types correct (select vs multi_select)?
4. Required fields populated?
5. Relations reference valid page IDs?
6. Content formatted as proper Notion blocks?
Common Failures to Prevent:
- Wrong property name → Check exact spelling
- Text in select field → Verify select options exist
- Invalid date format → Use ISO 8601
- Missing required field → Check schema first
- Raw text instead of blocks → Convert to block format
Pattern 3: API/MCP Tool Calls
Pre-Flight Checks:
# Before tool invocation:
1. Authentication credentials present?
2. Required parameters provided?
3. Parameter types correct?
4. Endpoint/method exists?
5. Rate limits not exceeded?
6. Response handling prepared?
WordPress MCP Example:
# DON'T DO THIS:
wordpress.create_post(title=123) # Type error
# DO THIS:
# Validate first:
- title: string ✓
- content: string ✓
- status: 'publish'|'draft' ✓
- Then execute
Pattern 4: Data Transformations
Pre-Flight Checks:
# Before processing:
1. Input data exists and readable?
2. Expected columns/fields present?
3. Data types suitable for operations?
4. Output format requirements clear?
5. Edge cases handled (nulls, duplicates)?
6. Memory requirements reasonable?
CSV Processing Example:
# Check headers match expectations
# Validate no missing critical columns
# Confirm data types before calculations
# Then process
Pattern 5: Artifact Creation
Pre-Flight Checks:
# Before building artifact:
1. Component requirements clear?
2. Dependencies available (Tailwind, React)?
3. Data structure defined?
4. Interactivity requirements specified?
5. Mobile responsiveness needed?
6. Browser compatibility requirements?
Pattern 6: File Modifications
Pre-Flight Checks:
# Before str_replace:
1. Target string exists in file?
2. Target string appears only once?
3. Replacement maintains format?
4. No syntax breaking changes?
5. Line endings preserved?
Validation Decision Tree
Task received
↓
Can I execute immediately with 100% confidence?
↓ YES → Execute
↓ NO
↓
What could cause failure?
↓
Check each failure mode
↓
All checks pass?
↓ YES → Execute
↓ NO → Fix issues OR ask for clarification
Common Failure Modes & Prevention
Excel Formulas
| Failure | Prevention |
|---|---|
| #REF! | Verify all cell references exist |
| #DIV/0! | Check for zero denominators |
| #VALUE! | Validate data types match formula |
| #NAME? | Confirm function names are correct |
| #N/A | Handle missing lookup values |
Notion API
| Failure | Prevention |
|---|---|
| Invalid property | Check database schema first |
| Type mismatch | Validate property types |
| Missing required field | Review schema requirements |
| Invalid relation | Verify target page exists |
| Rate limit | Track API call count |
File Operations
| Failure | Prevention |
|---|---|
| File not found | Check path exists |
| Permission denied | Verify write access |
| Invalid format | Validate structure before save |
| Encoding error | Specify charset explicitly |
| Path too long | Check system limits |
MCP Tools
| Failure | Prevention |
|---|---|
| Auth failure | Verify credentials present |
| Invalid params | Check parameter schema |
| Connection timeout | Test connectivity first |
| Malformed response | Prepare error handling |
| Tool unavailable | Verify MCP connection |
Automatic Validation Triggers
These patterns trigger mandatory validation:
- Formula creation → Check all references
- Database writes → Validate schema match
- API calls → Verify all parameters
- File creation → Check format requirements
- Data processing → Validate input structure
- MCP operations → Confirm tool availability
When to Ask vs. Infer
ASK when:
- Critical ambiguity (data could be deleted)
- Multiple valid interpretations
- Requirements genuinely unclear
- User expertise needed for decision
INFER when:
- Standard patterns apply
- Context provides clues
- Default behavior is safe
- User has established preferences
VALIDATE SILENTLY when:
- All requirements can be checked programmatically
- No user input needed for validation
- Checks are fast (<1 second)
- User doesn't care about validation details
Implementation Pattern
# Every execution task should follow:
def execute_task(request):
# Step 1: Parse requirements
requirements = parse_request(request)
# Step 2: Validate requirements
validation = validate_requirements(requirements)
if validation.failed:
# Don't execute, ask for clarification
return ask_for_missing_info(validation.issues)
# Step 3: Execute with confidence
result = perform_task(requirements)
# Step 4: Concise confirmation
return f"✅ Done. {result.link}"
Token Impact
Validation Cost vs. Retry Cost
| Scenario | Validation Cost | Retry Cost | Net Savings |
|---|---|---|---|
| Excel with formulas | 300 tokens | 6,000 tokens | 95% |
| Notion page creation | 200 tokens | 4,000 tokens | 95% |
| API integration | 250 tokens | 5,000 tokens | 95% |
| Data transformation | 400 tokens | 3,000 tokens | 87% |
| File operation | 150 tokens | 2,000 tokens | 93% |
Average: 93% token savings by preventing retries
Real Conversation Impact
Without Validation:
- 10 tasks attempted
- 3 tasks need retries (30% failure rate)
- 3 retries × 3,000 tokens = 9,000 extra tokens
- Total: 29,000 tokens
With Validation:
- 10 tasks attempted
- 0 tasks need retries (validation catches issues)
- 10 validations × 250 tokens = 2,500 tokens
- Total: 22,500 tokens
Savings: 22% overall + 100% first-attempt success
Quality Metrics
A properly validated task should have:
- ✅ Zero errors on execution
- ✅ No retry messages needed
- ✅ Complete output on first attempt
- ✅ User satisfaction (no frustration)
Integration with Other Skills
Works synergistically with:
- concise-execution-mode: Validate silently, execute quickly
- reference-file-system: Validate file exists before referencing
- data-processing-templates: Pre-validate data structure
- mcp-tool-efficiency: Check tool availability before batching
User Communication
When Validation Fails
DON'T:
"I tried to create the file but encountered an error because
the formula references don't exist and the data format is..."
DO:
"Need clarification before creating:
- Column 'Revenue' not in dataset (found: Sales, Cost, Profit)
- Formula needs [Revenue] or use [Sales]?
When Validation Passes
DON'T:
"I've validated all the requirements and everything looks
good, so I'll proceed with creating the file..."
DO:
[Execute immediately, confirm results]
✅ Done. [Link]
Success Indicators
You're using this skill correctly when:
- 95%+ tasks succeed on first attempt
- Retry messages are rare
- User rarely says "that didn't work"
- Token usage is predictable and efficient
- Confidence in execution is high
Red Flags (You're NOT validating properly)
- Frequent retry loops
- User corrections after execution
- Formula errors in outputs
- API call failures
- "Let me fix that" messages
The Golden Rule
Better to spend 200 tokens validating than 6,000 tokens retrying.
Deployment Path: /mnt/skills/user/single-pass-validation/SKILL.md
Restart Required: Yes (restart Claude Desktop after deployment)
Token Impact: 85-95% reduction in retry-related token waste
Success Rate: 95%+ first-attempt success on all tasks