1
0
Fork 0
claude-code-complete-agent/examples/02-shell-and-files/prompt.md
Kjell Tore Guttormsen 2491f5c732 feat: initial companion repo for OpenClaw vs Claude Code article
40 files demonstrating every major OpenClaw capability using Claude Code:
- 3 agents (researcher, writer, reviewer)
- 3 skills (daily-briefing, slack-message, web-research)
- 2 security hooks (pre-tool-use blocker, post-tool-use logger)
- 10 self-contained examples with copy-paste prompts
- Complete feature map (20 capabilities, 11 full match, 7 different, 2 gap)
- Security docs including NemoClaw comparison
- Automation, messaging, browser, memory documentation

Zero dependencies. Clone and run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 09:47:29 +01:00

1.6 KiB

Example 02: Shell Execution and File I/O

Capability: Claude Code runs shell commands and reads/writes files as part of the same task. Shell output becomes input to the next step automatically.

OpenClaw equivalent: exec tool with PTY support + read/write/edit file tools.


The Prompt

Create a directory called 'project-scaffold', add these files inside it:

1. package.json with name "my-project", version "0.1.0", and description
   "A scaffolded project created by Claude Code"

2. README.md with a project overview section and a "Getting Started" section
   with placeholder install instructions

3. .gitignore for Node.js (node_modules, .env, dist, .DS_Store)

Then run 'find project-scaffold -type f' to verify all three files exist
and show me the contents of package.json.

What Happens

Claude Code will:

  1. Use Bash to run mkdir project-scaffold
  2. Use Write to create each of the three files
  3. Use Bash to run find project-scaffold -type f and capture the output
  4. Use Read to show the contents of package.json
  5. Report back with the directory tree and file verification

Why This Matters

Shell execution and file I/O are the foundation of every automation. Claude Code handles both in the same task context, so shell output can feed directly into file content decisions.

The permission system controls what shell commands are allowed. In the settings.json in this repo, rm -rf and a handful of other destructive patterns are blocked by the pre-tool-use.sh hook before execution reaches the shell. See examples/09-security-hooks/ for details.