Run2 Output Result to JSON File
Write the final result dictionary to a JSON file at `/root/answer.json` with proper formatting and field validation. Use this skill as the final step to save the analysis result.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill run2_Output-Result-to-JSON-FileAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
0.9 KB, 159 tokens by cl100k_base, as published. Nobody here has run it
import json
def save_result_to_json(result, output_path='/root/answer.json'):
"""
Save result to JSON file with proper formatting.
Args:
result: Dictionary with earthquake result data
output_path: Path where JSON file should be written
"""
# Validate all required fields are present
required_fields = ['id', 'place', 'time', 'magnitude', 'latitude', 'longitude', 'distance_km']
for field in required_fields:
if field not in result:
raise ValueError(f"Missing required field: {field}")
with open(output_path, 'w') as f:
json.dump(result, f, indent=2)
print(f"Result saved to {output_path}")
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.