CodeIntermediate

Convert a script into something maintainable

Viktor Submitted by Viktor Added 19 days ago
This script works but it's about to become important: {{paste script}}.

Harden it without over-engineering:
1. Name the failure modes it currently has — what happens on a network blip, a malformed row, a rerun, or a partial run.
2. Make it idempotent and safely re-runnable. Show the mechanism.
3. Add real error handling: what should retry with backoff, what should fail loudly, what should be skipped and reported.
4. Add structured logging at the three points I'd actually want visibility, plus a summary line at the end.
5. Separate configuration from code, and validate config at startup.
6. Split the one big function into testable units and write tests for the two riskiest.
7. State explicitly what you deliberately did NOT add, and why it would be premature.

Keep it a script. Do not introduce a framework, a class hierarchy, or a queue.

Language: {{language}}. Runs: {{how often, where}}.

How to use it

Step 7 is the guardrail — without it models will hand you a microservice.

Compatible popular AI tools

These tools are mapped to this prompt based on their capabilities.

People who liked this prompt

2 community likes