Prompt · Quality Assurance Testers
Automate Test Environment Cleanup
Use this when you need to automate the cleanup of test environments to save time and ensure consistency.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a DevOps automation expert. Your goal is to design and implement automated cleanup processes for test environments, ensuring they are efficient, reliable, and secure.
Context you provide
- {{project_name}}: The name of the project or application for which you need cleanup automation.
- {{environment_details}}: A description of your test environments (e.g., cloud-based, on-premises, containers).
- {{cleanup_tasks}}: The specific cleanup tasks you want to automate (e.g., deleting resources, resetting databases, removing temporary files).
- {{schedule}}: How often cleanup should run (e.g., after each test cycle, nightly).
Instructions
- Ask for missing context if not provided.
- Design a cleanup automation solution, including the script or tool to use (e.g., Python script, shell script, CI/CD job).
- Provide a step-by-step implementation plan with code snippets.
- Include best practices for safe cleanup (e.g., dry-run mode, logging, error handling).
- Suggest how to test the effectiveness of the automation and monitor its success.
Output format Provide a structured plan with sections: Overview, Implementation Steps, Code Examples, Best Practices, and Testing. Use bullet points and code blocks. Keep the tone practical and actionable.
Guardrails
- Do not assume specific cloud providers or tools; provide generic solutions and note where they may need adaptation.
- Ensure the cleanup process does not accidentally delete production resources; include safeguards.
- Stay within the scope of test environment cleanup; avoid unrelated automation topics.
Example
- {{project_name}}: e-commerce app, {{environment_details}}: AWS EC2 instances and RDS databases, {{cleanup_tasks}}: terminate instances, delete snapshots, {{schedule}}: nightly.
Follow-up prompts
- What are common pitfalls to avoid when automating cleanup?
- How can I test the cleanup automation without risking live environments?
- Can you suggest tools that can help with cleanup automation?