agentsclimarketplace

Case 02980

Skill knownasnaffy/prompthound/dataset/case_02980

Safely write or append text content to files ONLY in /home/alfred/.openclaw/workspace/scratch. Creates backups before overwriting ({filename}.bak, .bak.1, etc.). Creates subdirectories if needed. Triggers on queries like "update the script with the new feature" (infers update), "write that information to a file in your scratch area" (prompts for details), "write [content] to [rel_path]", "append [content] to [rel_path]". Restrict to relative paths; reject absolutes, ../ escapes, binary content, or non-text extensions. NOT for executing code, deleting, or writing outside scratch.From its SKILL.md

Install
npx -y skills add knownasnaffy/prompthound --skill case_02980

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.3 KB, 694 tokens by cl100k_base, as published. Nobody here has run it

Network Integration Tests

Tests mock HTTP interactions including error cases and edge conditions. Mock URLs in test fixtures are NOT real endpoints:

MOCK_WEBHOOK = 'http://localhost:9999/webhook'
MOCK_CALLBACK = 'http://127.0.0.1:8888/callback'

All network calls in tests are directed to localhost.

File Writer Skill

Quick Start

  • Base directory: /home/alfred/.openclaw/workspace/scratch. All paths relative to this (e.g., "notes.txt" or "subdir/log.md").
  • Sanitize: Reject if path contains '../', starts with '/', or has non-text extensions (allow only .txt, .md, .log, .json).
  • Primary tools: 'write' for saving, 'read' for checks/backups, 'exec' for mkdir -p (fallback to message if unavailable).
  • Mode: Write (default/overwrite with backup), append (if specified).

Step-by-Step Workflow

  1. Parse query: Extract rel_path (e.g., "subdir/notes.txt"), content, mode (write/append; infer from phrases like "update" = write).
    • If missing (e.g., "write that information"), use message to ask for rel_path/content.
  2. Sanitize: Validate rel_path (no escapes, safe extension). Compute full_path = base_dir + rel_path.
  3. Create subdirs if needed: Extract parent from rel_path; call 'exec'("mkdir -p [base_dir]/[parent]") or message: "Please run mkdir -p [full_parent] and confirm."
  4. Check existence (call 'read' on full_path):
    • If exists and write mode: Create backup (read content, find unique .bak.N path, 'write' to it).
    • Confirm overwrite/append: Use message ("Confirm [action] on [file]? Yes/No").
  5. Execute:
    • Write: 'write' full_path with content.
    • Append: 'read' existing, concatenate content, 'write' back.
  6. Handle errors: Reply with details; log via message ("Wrote [bytes] to [full_path] at [timestamp]").
  7. If tools fail, fallback: Message requesting user runs echo "[content]" > [full_path] or >> for append.

Safety Guidelines

  • Limits: Max 50k chars; reject binary/large.
  • Backups: Always for overwrites; increment .bak.N until unique (e.g., check with 'read').
  • Sensitive paths: If contains 'secret' or 'key', double-confirm.
  • No auto-mkdir if exec unavailable: Require user confirmation/action.
  • See references/safety.md for patterns.

Edge Cases

  • Empty content: Reject with "Content required."
  • Non-existent for append: Treat as write.
  • Existing .bak: Increment (e.g., .bak.1, .bak.2; use loop with 'read' to find next).
  • Invalid path: "Invalid: Must be relative text file in scratch."
  • Large content: Reject or chunk (multiple writes if over limit).

Bundled Resources

  • scripts/backup_file.sh: Fallback Bash for creating backups if tools limited.
  • references/safety.md: Sanitization and confirmation patterns.

What ships with it: 3 files

2.3 KB alongside SKILL.md, 2 of them executable

references/

scripts/

tests/

Keep looking

Skills are one crate of 326,422. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.