Dpla script workflow

From dpla/ingestion3 · View interactive version

Dpla script workflow is an AI agent skill from the GitHub repository dpla/ingestion3. Follow the project workflow when adding or modifying shell or Python scripts. Use when the user asks to add a script, create a new script, modify a script, or write a script for a task. Ensures POSIX bash, common.sh, documentation in SCRIPTS.md, and tests are created or updated and run.

How to use this skill

Skill file

DPLA Script Workflow

Purpose

When adding or modifying scripts in this repo, follow the project's conventions so scripts are documented, portable, and tested.

When to Use

Environment: When running the test suite or any script that depends on project env, run source .env from repo root first.

Project Rules (apply to all new/changed scripts)

  1. Python: Use the virtualenv at ./venv/ (e.g. ./venv/bin/python or source ./venv/bin/activate). Never assume system Python.
  2. AWS CLI: Use --profile dpla for any AWS commands.
  3. Shell scripts: Write POSIX-compliant bash. Avoid macOS- or Linux-specific flags (e.g. sed -i, readlink -f). Use helpers from scripts/common.sh: sed_i, get_script_dir, get_common_dir, log_info, die, etc.

Workflow Checklist

For new scripts

For modified scripts

Key References

| Resource | Path |

|----------|------|

| Script docs | scripts/SCRIPTS.md |

| Updating docs | SCRIPTS.md section "Updating This Documentation" |

| Shared helpers | scripts/common.sh |

| Test suite | scripts/tests/test-scripts.sh |

Quick Commands

# Run full script test suite
./scripts/tests/test-scripts.sh

# Quick syntax / lightweight checks
./scripts/tests/test-scripts.sh --quick

# Verbose test output
./scripts/tests/test-scripts.sh --verbose

Example: Adding a new bash script

  1. Create script under scripts/ with shebang #!/usr/bin/env bash, set -euo pipefail, and source "$(get_script_dir)/common.sh" (or equivalent via get_common_dir).
  2. Use sed_i, get_script_dir, log_info, die instead of raw sed -i or readlink -f.
  3. Add row to Quick Reference in SCRIPTS.md.
  4. Add a test in scripts/tests/test-scripts.sh (e.g. syntax check, help output, or sourcing common.sh).
  5. Run ./scripts/tests/test-scripts.sh and fix any failures.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.