Reusable prompt templates for planning, coding, reviewing and debugging bots without asking an AI model to guess missing requirements.
In plain English
This guide uses AI to help plan, write, review or debug code. Generated output still needs version checks, compilation, tests and human-defined production rules.
promptruntime versionreviewtest
A good prompt is a specification
AI coding tools are most useful when you define the runtime, language, data format, failure behavior and tests. “Make me a profitable bot” is a weak prompt because it mixes infrastructure, strategy and an unprovable performance goal.
Universal prompt skeleton
You are helping me build a [TYPE OF BOT].
Runtime: [Cloudflare Worker / Python VPS / MT5 / Pine Script v6].
Environment: [demo/paper first].
Inputs: [exact JSON/schema/data source].
Outputs/actions: [exact expected actions].
State: [SQLite / KV / none].
Safety rules: [no duplicate events, max size, existing-position check].
Secrets: use environment variables; never hard-code credentials.
Logging: structured logs with event_id and rejection reason.
Failure behavior: fail closed; never retry an uncertain order blindly.
Tests: write unit tests and a manual demo checklist.
Before coding, list assumptions and missing information.
Then produce the smallest working version and explain how to test it.
Prompt: Cloudflare webhook receiver
Build a Cloudflare Worker that receives POST /api/webhook.
Require valid JSON with event_id, symbol, action and created_at.
Reject all other methods, malformed JSON, missing fields and duplicate event IDs.
Use Worker secrets for authentication. Do not put broker credentials in the webhook.
Return quickly and forward only validated events to BACKEND_URL.
Give me the Worker code, configuration variables, curl tests, and a threat checklist.
Prompt: MetaTrader 5 Expert Advisor
Write an MQL5 Expert Advisor for MetaTrader 5.
Use current MQL5, not MQL4 syntax.
Strategy rules: [write exact rules].
Risk rules: one position per symbol, configurable lot size, stop-loss required,
maximum spread filter, cooldown after exit, and no martingale/grid.
Log every entry rejection reason.
Make parameters inputs so they can be tested in Strategy Tester.
Explain OnTick/OnTradeTransaction behavior and provide a test plan before live use.
Prompt: Pine Script v6 strategy + webhook JSON
Write a TradingView Pine Script v6 strategy.
Do not use lookahead or future data. Avoid repainting logic.
Signal rules: [exact rules].
Include plots so signals can be visually inspected.
Create alert messages as valid JSON with event_id, symbol, action, timeframe and strategy_version.
Do not include passwords, broker keys or account numbers.
After the code, list every assumption and every place where TradingView behavior must be verified.
Prompt: Python broker adapter
Create a Python BrokerAdapter interface with methods:
get_market(), get_positions(), place_order(), close_position(), health().
Then implement a DEMO-only adapter for [BROKER] using its current official API docs.
Validate order size and existing positions immediately before order submission.
Separate authentication, HTTP transport, strategy logic and state.
Use typed data models and tests with mocked HTTP responses.
Do not invent endpoints: flag any endpoint you cannot verify.
Prompt: debug an existing bot
I will give you code, logs and the expected behavior.
Do not rewrite everything first.
1. Build a timeline from the logs.
2. Identify the first incorrect state transition.
3. Separate infrastructure errors from strategy errors.
4. Propose the smallest fix.
5. Add a regression test that would have caught it.
6. State what evidence would prove the fix works.
Do not claim profitability from a successful technical test.
Prompt: adversarial code review
Review this bot as if you are trying to make it fail safely.
Look for duplicate orders, stale webhooks, race conditions, timeouts after accepted orders,
secret leakage, incorrect symbol mapping, minimum size errors, open-position conflicts,
restart loops, database corruption and missing health checks.
Rank findings by severity and give a test for every high-severity finding.
Best workflow: use one AI pass to design, one to implement, and a separate pass to attack/review the design. Do not let the same optimistic prompt both invent the strategy and certify it.
Before you rely on this in production
- Prompt states exact language/platform version.
- Generated APIs/functions are verified against documentation.
- Secrets are removed from prompts.
- Generated code is compiled/run and tested before deployment.
