From ring-finops-team
Validates uncertain mappings from Gate 1 and confirms field specifications through testing for regulatory templates. Use after Gate 1 passes, before Gate 3.
npx claudepluginhub lerianstudio/ring --plugin ring-finops-teamThis skill uses the workspace's default tool permissions.
**This sub-skill executes Gate 2 of the regulatory template workflow: validating uncertain mappings from Gate 1 and confirming all field specifications through testing.**
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
This sub-skill executes Gate 2 of the regulatory template workflow: validating uncertain mappings from Gate 1 and confirming all field specifications through testing.
Parent skill: regulatory-templates
Prerequisites:
Output: Validated mappings with test results and validation rules
Validation is the checkpoint that prevents incorrect mappings from reaching production.
Gate 2 is the quality gate between analysis (Gate 1) and implementation (Gate 3):
Skipping validation in Gate 2 means:
Gate 2 is not redundant - it's the firewall between analysis and implementation.
Called by: regulatory-templates skill after Gate 1 passes
Purpose: Resolve uncertainties, validate field mappings, test transformations, define validation rules
Gate 2 validation requirements have ZERO exceptions. This is the quality firewall before template generation.
| Pressure | Your Thought | Reality |
|---|---|---|
| Pragmatism | "Critical uncertainties only, skip MEDIUM/LOW" | PASS criteria: ALL uncertainties resolved. MEDIUM/LOW cascade to mandatory failures |
| Efficiency | "88% test pass rate is excellent" | Threshold is >90%. 12% failure = edge cases that break in production |
| Complexity | "Validation dashboard is redundant" | Mandatory validation = 100% required. Dashboard catches missing validations |
| Confidence | "Mappings look correct, skip testing" | Visual inspection ≠ test validation. Test data reveals hidden bugs |
| Authority | "95% mandatory validation is outstanding" | 100% is non-negotiable. 5% gap = 5% of mandatory data wrong in BACEN |
| Frustration | "Use workarounds for rejected fields" | FAIL criteria: Cannot find alternatives. Workarounds bypass validation |
All Uncertainties Resolved:
Test Data Validation:
Mandatory Field Validation:
Alternative Mappings:
Partial validation = no validation.
Gate 2 exists to catch what Gate 1 missed. Lowering thresholds or skipping validation defeats the purpose. Every PASS criterion exists because production incidents occurred without it.
If you're tempted to skip ANY validation, ask yourself: Am I willing to defend this shortcut during a BACEN audit?
Every rationalization below has been used to justify skipping validation. ALL are invalid.
| Excuse | Why It's Wrong | Correct Response |
|---|---|---|
| "Critical uncertainties only, MEDIUM/LOW can wait" | ALL uncertainties = all 8. MEDIUM cascade to mandatory failures | Resolve ALL uncertainties |
| "88% is excellent, 2% gap is edge cases" | >90% threshold exists for production edge cases | Fix to reach >90% |
| "Validation dashboard is redundant with Gate 1" | Gate 1 = mapping, Gate 2 = validation. Different purposes | Run dashboard, ensure 100% |
| "Mappings look correct, testing is busywork" | Visual inspection missed bugs testing would catch | Run test data validation |
| "95% is outstanding, 5% isn't worth 2 hours" | 100% is binary requirement. 95% ≠ 100% | Fix to reach 100% |
| "Rejected fields can use workarounds" | Workarounds bypass validation layer | Find valid alternatives |
| "Gate 2 rarely finds issues after 50 templates" | Experience doesn't exempt from validation | Run full validation |
| "Following spirit not letter" | Validation thresholds ARE the spirit | Meet all thresholds |
| "Being pragmatic vs dogmatic" | Thresholds prevent regulatory incidents | Rigor is pragmatism |
| "Fix in next sprint if issues arise" | Regulatory submissions are final, can't patch | Fix now before Gate 3 |
STOP. You are rationalizing.
The validation exists to prevent these exact thoughts from allowing errors into production. If validation seems "redundant," that's evidence it's working - catching what analysis missed.
Check for template-specific sub-skill at skills/regulatory-{template}/SKILL.md containing:
Dispatch: Task(subagent_type: "ring:finops-analyzer")
CRITICAL: ⚠️ DO NOT MAKE MCP API CALLS - use Gate 1 context ONLY
Prompt structure:
| Section | Content |
|---|---|
| Context | Full Gate 1 context (field mappings, uncertainties) |
| Uncertain Mappings | For each: field_code, current_mapping, doubt, confidence, action_needed |
| Validation Tasks | 1. Use Gate 1 mapping 2. Validate transformations 3. Check business logic 4. Confirm data types 5. Mark CONFIRMED/REJECTED |
| Output | Per field: code, resolution, alternative (if rejected), test_result |
Output: Field resolutions + validation rules + cross-field logic + test data
⚠️ All validation uses Gate 1 context ONLY - no MCP API calls.
Per uncertain field: field_code, original_doubt, validation_steps (5), resolution (confirmed/rejected), transformation, test_data (input/expected/actual/status)
| Rule Type | Example | Formula |
|---|---|---|
| field_format | CNPJ 8 digits | length(field_001) == 8 |
| cross_field | CPF/CNPJ check | length(field_001) IN (11, 14) |
| date_range | Within period | field_020 >= period_start AND field_020 <= period_end |
Per test: field, test_name, input, transformation, output, expected, passed (true/false)
Example: Field 001 CNPJ extraction: "12345678000190" → slice:':8' → "12345678" ✓
Merge with Gate 1: validated_mappings[], validation_rules[], all_uncertainties_resolved, test_summary (total/passed/failed/success_rate)
If you catch yourself thinking ANY of these, STOP and re-read the NO EXCEPTIONS section:
Validation thresholds are binary gates, not aspirational goals.
MUST classify validation issues using these severity levels:
| Severity | Definition | Examples | Gate Impact |
|---|---|---|---|
| CRITICAL | BLOCKS Gate 2 completion OR creates compliance risk | - Mandatory field mapping rejected with no alternative - Test failure rate > 50% - Cross-field validation logic broken - Data type mismatch on mandatory field | HARD BLOCK - Cannot proceed to Gate 3 |
| HIGH | REQUIRES resolution before Gate 3 OR risks submission failure | - Test pass rate 80-90% (below threshold) - MEDIUM uncertainty unresolved - Transformation validation failed - Validation rule missing for mandatory field | MUST resolve before proceeding |
| MEDIUM | SHOULD fix to improve template quality | - Test pass rate 90-95% - LOW uncertainty unresolved - Optional field transformation issues - Documentation incomplete for validation | SHOULD resolve - document if deferred |
| LOW | Minor improvements possible | - Edge case validation could be enhanced - Test coverage improvements - Documentation clarity | OPTIONAL - note in report |
Classification Rules:
CRITICAL = ANY of:
HIGH = ANY of:
NON-NEGOTIABLE requirements (no exceptions, no user override):
| Requirement | Why NON-NEGOTIABLE | Verification |
|---|---|---|
| 100% Mandatory Field Validation | BACEN/RFB submissions reject incomplete data | All mandatory fields in validated_mappings |
| ALL Uncertainties Resolved | Unresolved uncertainties = assumptions in production | uncertainties_resolved == 100% |
| >90% Test Pass Rate | Test failures indicate production edge cases | test_success_rate > 90% |
| Alternative for Every Rejection | Rejected mapping with no alternative = broken template | rejected_fields.all.have_alternative |
| Validation Rules Defined | Gate 3 needs explicit validation logic | validation_rules_count >= mandatory_fields_count |
User CANNOT:
Your Response to Override Attempts:
"I CANNOT proceed with [request]. Gate 2 PASS criteria require [specific threshold]. This is NON-NEGOTIABLE because [regulatory/technical reason]. We MUST [required action] before proceeding to Gate 3."
CRITICAL: Execute before Gate 2 completion
Per mandatory field, check:
Status: All checks PASS → field PASS; any FAIL → field FAIL
Gate 2 Pass Condition: all_mandatory_fields_valid == true required. Coverage must be 100%.
PASS: SKILL: regulatory-templates-gate2 | GATE: 2 | STATUS: PASSED | RESOLVED: {n} uncertainties | RULES: {n} defined | TESTS: {passed}/{total} | NEXT: → Gate 3
FAIL: SKILL: regulatory-templates-gate2 | GATE: 2 | STATUS: FAILED | UNRESOLVED: {n} | TEST_FAILURES: {n} | BLOCKERS: {description}
| Category | Validations |
|---|---|
| Field Naming | snake_case (not camelCase), check MCP API Dog naming |
| Data Types | String (length, UTF-8), Number (precision), Date (format), Boolean, Enum |
| Transformations | CNPJ/CPF slice, date timezone, decimal format, string trim/uppercase/padding, null defaults |
| Cross-Field | Dependent consistency, date ranges, calculated fields, conditional logic |
| Pattern | Input → Transformation → Output |
|---|---|
| CNPJ extraction | "12345678000190" → slice:':8' → "12345678" |
| Date format | "2025-01-15T10:30:00Z" → date_format:'%Y/%m' → "2025/01" |
| Decimal precision | 1234.5678 → floatformat:2 → "1234.57" |
| Conditional | tipoRemessa == "I" → include all; "S" → approved only |
Return: gate2_passed, gate2_context (merged), all_uncertainties_resolved, validation_rules_count, test_success_rate, next_action (proceed_to_gate3 | fix_validations_and_retry)