home / skills / openclaw / skills / django-claw-skill

django-claw-skill skill

/skills/manojrammurthy/django-claw-skill

This skill helps you manage Django projects by executing sanctioned commands and queries through predefined scripts for migrations, inspection, and versioning.

npx playbooks add skill openclaw/skills --skill django-claw-skill

Review the files below or copy the command above to add this skill to your agents.

Files (18)
SKILL.md
4.0 KB
---
name: django-claw
description: Run Django management commands (migrate, showmigrations, makemigrations, check, version, logs, readonly) or Django ORM queries on any configured Django project.
user-invocable: true
metadata: {"openclaw":{"emoji":"🐍","requires":{"bins":["bash","python3"],"os":["darwin","linux"]}}}
---

# django-claw
> ⚠️ This is the canonical django skill. Always use django-claw commands. Never use django-manage.

## CRITICAL: Command Dispatch Rules
You are a dispatcher. When the user sends a django-claw command, find the EXACT match in the Command Mapping table below and run that script. Do NOT interpret, paraphrase, or substitute scripts.

- `django-claw readonly` → ALWAYS runs `readonly.sh` — NOT db-stats.sh, NOT any other script
- `django-claw readonly on` → ALWAYS runs `readonly.sh on` — do NOT just describe what it would do
- `django-claw readonly off` → ALWAYS runs `readonly.sh off` — do NOT just describe what it would do
- `django-claw logs` → ALWAYS runs `django-logs.sh` — do NOT say "I don't have a log command"
- `django-claw shell: <code>` → ALWAYS runs `run-query.sh "<code>"` — do NOT run it yourself

## STRICT RULES — never violate these
- NEVER run `python --version` or `python3 --version` directly — ALWAYS use python-version.sh
- NEVER construct your own shell commands
- NEVER use `python` or `python3` directly — always use the exact scripts below
- NEVER escape quotes or build commands with variables
- NEVER run destructive commands (flush, reset_db, dropdb) without explicit user confirmation
- NEVER attempt migrate, makemigrations, or shell when read-only mode is enabled — the scripts will block these
- NEVER substitute one script for another — readonly.sh is NOT db-stats.sh
- NEVER describe or simulate what a command would do — always run the actual script
- If the user asks for something NOT in the command mapping, reply: "Not supported yet in django-claw"

## Command Mapping — use EXACTLY as shown

| User Says | Exact Command to Run |
|-----------|----------------------|
| django-claw setup | bash {baseDir}/scripts/setup.sh |
| django-claw models | bash {baseDir}/scripts/list-models.sh |
| django-claw apps | bash {baseDir}/scripts/list-apps.sh |
| django-claw urls | bash {baseDir}/scripts/list-urls.sh |
| django-claw users | bash {baseDir}/scripts/list-users.sh |
| django-claw db | bash {baseDir}/scripts/db-stats.sh |
| django-claw pending | bash {baseDir}/scripts/pending-migrations.sh |
| django-claw settings | bash {baseDir}/scripts/settings-check.sh |
| django-claw showmigrations | bash {baseDir}/scripts/run.sh showmigrations |
| django-claw makemigrations | bash {baseDir}/scripts/run.sh makemigrations |
| django-claw migrate | bash {baseDir}/scripts/run.sh migrate |
| django-claw version | bash {baseDir}/scripts/run.sh version |
| django-claw check | bash {baseDir}/scripts/run.sh check |
| django-claw python | bash {baseDir}/scripts/python-version.sh |
| django-claw logs | bash {baseDir}/scripts/django-logs.sh |
| django-claw shell: <code> | bash {baseDir}/scripts/run-query.sh "<code>" |
| django-claw readonly | bash {baseDir}/scripts/readonly.sh |
| django-claw readonly on | bash {baseDir}/scripts/readonly.sh on |
| django-claw readonly off | bash {baseDir}/scripts/readonly.sh off |

## Migration commands explained
- `django-claw pending` — shows only unapplied migrations (quick check)
- `django-claw showmigrations` — shows ALL migrations with [X] applied and [ ] pending (full history)
- `django-claw migrate` — applies pending migrations (blocked in read-only mode)
- `django-claw makemigrations` — creates new migrations (blocked in read-only mode)

## Output format
Return raw script output in a code block. Follow with one plain-English summary line.

## Failure handling
- If a script exits non-zero, show the exact error. Do not retry with a modified command.
- If config is missing, the setup wizard will run automatically. Do not intervene.
- If a command is blocked by read-only mode, show the ⛔ message and stop. Do not try to work around it.

Overview

This skill runs Django management commands and ORM queries against any configured Django project using exact, pre-defined wrapper scripts. It acts as a strict dispatcher: when you issue a django-claw command it runs the exact corresponding script rather than interpreting or reconstructing commands. It enforces read-only controls and safe usage rules to prevent accidental destructive actions.

How this skill works

Commands map to specific shell scripts under the project's scripts directory and are executed exactly as defined. Read-only mode blocks migration and makemigrations operations; the skill returns raw script output and a one-line English summary. It never constructs ad-hoc shell commands, never invokes python or python3 directly, and will respond "Not supported yet in django-claw" for unknown requests.

When to use it

  • Run common Django management tasks (migrate, showmigrations, makemigrations, check, version).
  • Inspect runtime state: list apps, models, URLs, or users.
  • Get database and migration status or logs quickly and reproducibly.
  • Execute read-only ORM queries via shell: <code> command mapping.
  • Toggle and verify read-only mode on an environment.

Best practices

  • Always use the exact django-claw command names; the skill dispatches to exact scripts.
  • Check read-only status before attempting migrations or makemigrations—those are blocked when enabled.
  • Avoid asking for commands not listed; unsupported requests return a clear "Not supported yet in django-claw" reply.
  • Do not expect simulated output — the skill returns raw script output and an English summary line.
  • Require explicit confirmation before any destructive operations; the skill will not run destructive scripts without it.

Example use cases

  • Apply pending migrations safely: run the migrate mapping to execute the migration script.
  • Inspect unapplied migrations with pending to review what will change.
  • Run a one-off ORM query via shell: <code> mapping to fetch or inspect data without manual shell construction.
  • Enable read-only to freeze writes during maintenance using readonly on, then verify with readonly.
  • Tail Django logs using logs mapping to diagnose runtime errors.

FAQ

What if I request a command not in the mapping?

The skill replies: "Not supported yet in django-claw" and will not attempt to run anything not listed.

Can I run migrations while read-only is enabled?

No. migrate and makemigrations are blocked in read-only mode; the scripts will return a blocked message and the skill stops.