← Back to list

validate-inputs
by mvillmow
Training framework written in Mojo
⭐ 11🍴 4📅 Jan 24, 2026
SKILL.md
name: validate-inputs description: "Check function inputs for correctness and safety. Use when implementing defensive programming." mcp_fallback: none category: analysis tier: 2 user-invocable: false
Validate Inputs
Implement input validation to ensure functions receive correct data types, shapes, ranges, and formats.
When to Use
- Adding defensive checks to functions
- Improving error messages for bad inputs
- Ensuring tensor shape/dtype correctness
- Validating configuration parameters
Quick Reference
# Input validation pattern
def validate_tensor(tensor):
assert tensor is not None, "Tensor cannot be None"
assert isinstance(tensor, ExTensor), "Must be ExTensor type"
assert len(tensor.shape) > 0, "Tensor shape cannot be empty"
assert tensor.dtype() in [DType.float32, DType.float64], "Invalid dtype"
return True
# Usage with context
try:
validate_tensor(input_data)
except AssertionError as e:
raise ValueError(f"Invalid input: {e}")
Workflow
- Document expectations: Specify types, shapes, ranges for inputs
- Implement checks: Add validation before processing
- Provide error messages: Clear messages for validation failures
- Test edge cases: Verify validation catches invalid inputs
- Document behavior: Note what validation is performed
Output Format
Input validation specification:
- Parameter name and type
- Constraints (shape, range, valid values)
- Error handling strategy
- Error messages returned
- Test cases for invalid inputs
References
- See
generate-testsskill for validation test cases - See CLAUDE.md > Defensive Programming for best practices
- See
scan-vulnerabilitiesskill for security validation
Score
Total Score
60/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon