Agent skill

Resilient Data Gathering

by HKUDS in HKUDS/OpenSpace

Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability

MITAuto-check passed

Install Resilient Data Gathering

skills CLI
$ npx skills add HKUDS/OpenSpace --skill resilient-data-gathering -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace resilient-data-gathering --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/resilient-data-gathering .claude/skills/resilient-data-gathering && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
resilient-data-gathering
GitHub stars
7.8k
Token cost
~2.2k tokens
SKILL.md length
387 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability

  • Works in 11 steps: Recognize Tool Failure Pattern → Gather Known Domain Data → Embed Data in run_shell Python Script → …
  • SKILL.md covers Purpose, When to Use This Pattern, Step-by-Step Instructions and Best Practices, plus 3 more sections
  • Calls python3

What it does

Resilient Data Gathering is an agent skill from HKUDS/OpenSpace. Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It works with Python. The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

Example prompts

  • “/resilient-data-gathering”

Requirements

  • Python 3

Workflow steps

11 steps, taken from the step headings in SKILL.md.

  1. Recognize Tool Failure Pattern
  2. Gather Known Domain Data
  3. Embed Data in run_shell Python Script
  4. Execute via run_shell
  5. Persist and Verify Intermediate Results
  6. Chain Subsequent Operations
  7. Data Versioning
  8. Incremental Persistence
  9. Clear Artifact Signaling
  10. Error Boundaries
  11. Documentation Trail

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Resilient Data Gathering loads about 2.2k tokens when it runs. Until then it costs about 33 tokens; SKILL.md has 387 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~33
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 387 words, ~2,159 tokens.

Download SKILL.mdSave it as .claude/skills/resilient-data-gathering/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
resilient-data-gathering
description
Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability

Resilient Data Gathering Workflow

Purpose

When search_web, shell_agent, and execute_code_sandbox all fail repeatedly with 'unknown error' or similar tool execution failures, fall back to embedding known domain data directly into run_shell Python scripts and persisting intermediate data to JSON files for auditability and recovery.

When to Use This Pattern

Apply this pattern when:

  1. Trigger condition: 2-3 consecutive failures across multiple tools (search_web, shell_agent, execute_code_sandbox) with 'unknown error' messages
  2. You have domain knowledge: The required data is known or can be reasonably estimated from context
  3. Auditability needed: Intermediate results must be preserved for verification or rollback

Step-by-Step Instructions

Step 1: Recognize Tool Failure Pattern

Monitor for repeated failures across multiple execution tools:

  • search_web returns errors or empty results
  • shell_agent fails to complete autonomous tasks
  • execute_code_sandbox throws 'unknown error' repeatedly

Decision point: After 2-3 failures, switch to the fallback pattern rather than continuing to retry failing tools.

Step 2: Gather Known Domain Data

Collect all data you already know or can reasonably infer:

  • Product specifications, prices, SKUs
  • Competitor information from context
  • Business rules and constraints
  • Historical data from previous task phases

Document this data in a structured format before embedding.

Step 3: Embed Data in run_shell Python Script

Create a Python script that embeds the known data directly as literals or constants:

python
import json
import os
from datetime import datetime

# ============================================
# EMBEDDED DOMAIN DATA (known from context)
# ============================================
PRODUCT_DATA = {
    "sku_001": {
        "name": "Product A",
        "competitor_price": 29.99,
        "weight_oz": 12,
        "category": "beverage"
    },
    "sku_002": {
        "name": "Product B", 
        "competitor_price": 34.99,
        "weight_oz": 16,
        "category": "snack"
    }
}

BUSINESS_RULES = {
    "margin_target": 0.25,
    "price_floor": 19.99,
    "price_ceiling": 99.99
}

# ============================================
# ANALYSIS LOGIC
# ============================================
def analyze_products(products, rules):
    results = {}
    for sku, data in products.items():
        price_per_oz = data["competitor_price"] / data["weight_oz"]
        recommended_price = data["competitor_price"] * (1 + rules["margin_target"])
        recommended_price = max(rules["price_floor"], min(rules["price_ceiling"], recommended_price))
        
        results[sku] = {
            **data,
            "price_per_oz": round(price_per_oz, 2),
            "recommended_price": round(recommended_price, 2),
            "analysis_timestamp": datetime.now().isoformat()
        }
    return results

# Execute analysis
analysis_results = analyze_products(PRODUCT_DATA, BUSINESS_RULES)

# ============================================
# PERSIST INTERMEDIATE DATA (audit trail)
# ============================================
output_file = "intermediate_analysis.json"
with open(output_file, "w") as f:
    json.dump({
        "metadata": {
            "generated_at": datetime.now().isoformat(),
            "source": "embedded_domain_data",
            "fallback_reason": "tool_execution_failures"
        },
        "results": analysis_results
    }, f, indent=2)

# Signal artifact location for downstream tools
print(f"ARTIFACT_PATH:{os.path.abspath(output_file)}")

# Output results for immediate consumption
print("\n=== ANALYSIS RESULTS ===")
print(json.dumps(analysis_results, indent=2))
Step 4: Execute via run_shell

Run the embedded script using run_shell:

bash
python3 << 'EOF'
[paste the full script from Step 3]
EOF

Or save to a file first:

bash
cat > analysis_script.py << 'SCRIPT'
[paste script content]
SCRIPT

python3 analysis_script.py
Show full SKILL.md (157 more words)Show less
Step 5: Persist and Verify Intermediate Results

Ensure JSON files are created and contain valid data:

python
import json

# Verify persistence
with open("intermediate_analysis.json", "r") as f:
   验证数据 = json.load(f)
    assert "results" in 验证数据
    assert "metadata" in 验证数据
    print(f"✓ Persisted {len(验证数据['results'])} records")
Step 6: Chain Subsequent Operations

Use persisted JSON as input for downstream operations:

python
import json

# Load previous intermediate results
with open("intermediate_analysis.json", "r") as f:
    previous_results = json.load(f)["results"]

# Build on previous work
for sku, data in previous_results.items():
    # Continue analysis using persisted data
    pass

Best Practices

1. Data Versioning

Always include timestamps and source metadata in persisted JSON:

json
{
  "metadata": {
    "generated_at": "2024-01-15T10:30:00",
    "source": "embedded_domain_data",
    "version": "1.0"
  },
  "results": {...}
}
2. Incremental Persistence

Save intermediate results at each major step, not just at the end:

python
# After each significant transformation
with open(f"step_{step_num}_results.json", "w") as f:
    json.dump(current_state, f, indent=2)
3. Clear Artifact Signaling

Use ARTIFACT_PATH: prefix to mark files for downstream tools:

python
print(f"ARTIFACT_PATH:{os.path.abspath('output.json')}")
4. Error Boundaries

Wrap operations in try/except to ensure partial results are saved:

python
try:
    results = complex_analysis(data)
except Exception as e:
    print(f"Warning: {e}, saving partial results")
    results = partial_results

with open("results.json", "w") as f:
    json.dump(results, f, indent=2)
5. Documentation Trail

Include fallback reason in metadata for post-execution analysis:

python
"metadata": {
    "fallback_reason": "search_web and shell_agent failed 3x",
    "original_approach": "web_research_then_analysis",
    "fallback_approach": "embedded_data_direct_analysis"
}

Example: Complete Fallback Workflow

python
# ===== FALLBACK DATA GATHERING SCRIPT =====
import json
import os
from datetime import datetime

# Known data embedded directly (no external calls)
KNOWN_COMPETITORS = {
    "competitor_a": {"product_x": 24.99, "product_y": 34.99},
    "competitor_b": {"product_x": 26.99, "product_y": 32.99}
}

OUR_PRODUCTS = ["product_x", "product_y"]

# Step 1: Calculate benchmarks
benchmarks = {}
for product in OUR_PRODUCTS:
    prices = [KNOWN_COMPETITORS[c][product] for c in KNOWN_COMPETITORS if product in KNOWN_COMPETITORS[c]]
    benchmarks[product] = {
        "min_price": min(prices),
        "max_price": max(prices),
        "avg_price": sum(prices) / len(prices)
    }

# Step 2: Persist Step 1 results
with open("step1_benchmarks.json", "w") as f:
    json.dump(benchmarks, f, indent=2)
print("ARTIFACT_PATH:step1_benchmarks.json")

# Step 3: Generate recommendations
recommendations = {}
for product, benchmark in benchmarks.items():
    recommendations[product] = {
        "recommended_price": round(benchmark["avg_price"] * 0.95, 2),
        "rationale": f"5% below competitor average of ${benchmark['avg_price']:.2f}"
    }

# Step 4: Persist final results
final_output = {
    "metadata": {
        "created": datetime.now().isoformat(),
        "method": "embedded_data_fallback",
        "preceding_artifact": "step1_benchmarks.json"
    },
    "benchmarks": benchmarks,
    "recommendations": recommendations
}

with open("final_recommendations.json", "w") as f:
    json.dump(final_output, f, indent=2)
print("ARTIFACT_PATH:final_recommendations.json")

print(json.dumps(final_output, indent=2))

Recovery and Audit

After execution, verify the audit trail:

bash
# List all generated artifacts
ls -la *.json

# Validate JSON structure
python3 -c "import json; [json.load(open(f)) for f in ['step1_benchmarks.json', 'final_recommendations.json']]; print('✓ All JSON files valid')"

# Review metadata for fallback context
python3 -c "import json; print(json.load(open('final_recommendations.json'))['metadata'])"

When to Return to Primary Tools

After completing the task with this fallback pattern:

  1. Document which tools failed and why
  2. Report the successful fallback completion
  3. Suggest investigating root cause of tool failures for future runs
  4. Note that the pattern preserved data integrity despite tool issues

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/resilient-data-gathering of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Resilient Data Gathering next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Resilient Data Gathering compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Resilient Data Gathering this skillHKUDS/OpenSpace7.8k—~2.2kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k63 repos~2.3kAutomated safety check: PassApache-2.0
PDF Processinganthropics/skills180k48 repos~2kAutomated safety check: PassProprietary
NotebookLM Research AssistantPleasePrompto/notebooklm-skill7.8k14 repos~2.4kAutomated safety check: NotesMIT
Manim Video Productionbrowser-use/video-use28k6 repos~3kAutomated safety check: PassMIT
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 63 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • PDF Processing

    anthropics/skills

    Official

    Handles everyday PDF jobs in Python and on the command line: extract text and tables, merge, split, rotate, watermark, fill forms, encrypt and OCR.

    180k GitHub starsUsed in 48 repos~2k tokens
    Documents & OfficeAuto-check passed
  • NotebookLM Research Assistant

    PleasePrompto/notebooklm-skill

    Lets Claude Code ask questions of your Google NotebookLM notebooks through browser automation and return answers grounded in your uploaded sources.

    7.8k GitHub starsUsed in 14 repos~2.4k tokens
    Knowledge ManagementAuto-check: notes
  • Manim Video Production

    browser-use/video-use

    Produces math and technical explainer videos with Manim Community Edition: concept animations, equation derivations, algorithm walkthroughs and data stories.

    28k GitHub starsUsed in 6 repos~3k tokens
    Media & CreativeAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • PPT Master

    hugohe3/ppt-master

    Generates editable PowerPoint decks, rebuilds slides from images, fills .pptx templates and polishes existing presentations through routed workflows.

    58k GitHub starsUsed in 1 repo~2.5k tokens
    Documents & OfficeAuto-check passed

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.8k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.8k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.8k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.8k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Resilient Data Gathering

What does Resilient Data Gathering do?

Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability. Resilient Data Gathering is an agent skill from HKUDS/OpenSpace.

How do I install Resilient Data Gathering in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill resilient-data-gathering -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/resilient-data-gathering in HKUDS/OpenSpace) into .claude/skills/resilient-data-gathering in your project. Claude Code loads it when a task matches its description.

How do I install Resilient Data Gathering in Codex?

Run `npx skills add HKUDS/OpenSpace --skill resilient-data-gathering -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/resilient-data-gathering in HKUDS/OpenSpace) into .agents/skills/resilient-data-gathering in your project. Codex loads it when a task matches its description.

Can I use Resilient Data Gathering in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill resilient-data-gathering -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/resilient-data-gathering, .gemini/skills/resilient-data-gathering, .github/skills/resilient-data-gathering and .opencode/skills/resilient-data-gathering in your project.

What does Resilient Data Gathering need to run?

Going by SKILL.md and its folder, Resilient Data Gathering needs the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Resilient Data Gathering access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Resilient Data Gathering safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Resilient Data Gathering use?

Resilient Data Gathering is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Resilient Data Gathering use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Resilient Data Gathering?

Skills that share tags, products or a category with Resilient Data Gathering: MCP Server Builder (anthropics/skills, 180k stars), PDF Processing (anthropics/skills, 180k stars), NotebookLM Research Assistant (PleasePrompto/notebooklm-skill, 7.8k stars) and Manim Video Production (browser-use/video-use, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Resilient Data Gathering?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,750 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.