{"data":{"slug":"discovered-af9f4f5db142643dac25e3c0cb99209c8c72a3cf06af3c83","title":"Optimize Prompt","summary":"Optimize a raw task prompt for a coding agent by adding clarity, structure, and verification steps based on the user's input and project configuration.","url":"https:\/\/skillshunter.net\/skills\/discovered-af9f4f5db142643dac25e3c0cb99209c8c72a3cf06af3c83","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-af9f4f5db142643dac25e3c0cb99209c8c72a3cf06af3c83","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-af9f4f5db142643dac25e3c0cb99209c8c72a3cf06af3c83.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-af9f4f5db142643dac25e3c0cb99209c8c72a3cf06af3c83\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"The user must provide the raw prompt, and the skill requires read access to the active host's instruction file and working directory. The inventory step reads specific blocks from the instruction file or falls back to the skill folder and MCP config if the block is missing.","instructions":"---\nname: andino-optimize-prompt\ndescription: Use when the user explicitly asks to optimize, tidy or rewrite a raw task prompt for a coding agent, or invokes andino-optimize-prompt. Operates under Andino Workflow governance.\n---\n\n# Optimize a raw task prompt\n\nInternal method ID: `andino-optimize-prompt` (alias: `optimize-prompt`).\n\n> **Andino Workflow Member Skill**\n> Operates under Andino Workflow: proportional investigation, evidence-based\n> decisions, one durable checkpoint and clean handoff. Do not invoke the workflow\n> recursively. Loading this resource changes neither tools nor permissions.\n\n## Purpose\n\nHand back the user's own prompt, made easy for a coding agent to act on: their shape, voice,\nlanguage mix, order of thought and every choice they made stay, and the prompt gains what an agent\nneeds to finish well and prove it: facts checked in the project, an observable end, the user's\nlimits stated plainly and a way to verify. Every addition is labelled and traceable to the user's\nwords, the project or the host. A prompt that already has all of this comes back almost unchanged.\n\n## Trigger and non-trigger\n\nUse when the user explicitly asks to optimize, tidy or rewrite a task prompt, including\n`\/andino-optimize-prompt` and `$andino-optimize-prompt`.\n\nDo not select for:\n\n- an ordinary task prompt: do the task instead;\n- polishing prose that is not a task prompt: `natural-writing`;\n- a prompt for a web chatbot without skills: WebBased module R.\n\n## Select a resource, not a second lifecycle\n\n| Current need | Resource | Skip when |\n| :--- | :--- | :--- |\n| Which facts to check, what to ask and which verification step fits the task | [intent checklists](resources\/intent-checklists.md) | Never: every run classifies the task |\n| Labels people use, and the skill and MCP suggestion tables | [prompt patterns](resources\/prompt-patterns.md) | No suggestion or label question arises |\n| Two complete runs, a strong prompt and a weak one | [worked example](resources\/worked-example.md) | The procedure is already clear |\n\n## Prerequisites\n\nThe raw prompt, the active host's instruction file and read access to the working directory. Reading\nis the only access this skill uses.\n\n## Procedure\n\n1. **Inventory the host.** Read the block between `<!-- ai-rules:global-defaults:start -->` and\n   `<!-- ai-rules:global-defaults:end -->` in the active host's instruction file, opened with a file\n   tool: a copy already loaded into context can lose these comment markers. Without the block, list\n   the skill folder and the MCP config instead. Record which source you used. The inventory only\n   checks what the user named and feeds suggestions; it never removes or adds anything in the prompt.\n\n   | Host | Instruction file | Skill folder | MCP config |\n   | --- | --- | --- | --- |\n   | Claude Code | `~\/.claude\/CLAUDE.md` | `~\/.claude\/skills` | `~\/.claude.json` (`mcpServers`) |\n   | Codex | `~\/.codex\/AGENTS.md` | `~\/.agents\/skills` | `~\/.codex\/config.toml` (`mcp_servers`) |\n   | OpenCode | `~\/.config\/opencode\/AGENTS.md` | `~\/.config\/opencode\/skills` | `~\/.config\/opencode\/opencode.json` (`mcp`) |\n   | Antigravity CLI \/ IDE | `~\/.gemini\/AGENTS.md` | `~\/.gemini\/antigravity-cli\/skills`, `~\/.gemini\/config\/skills` | `~\/.gemini\/config\/mcp_config.json` (`mcpServers`) |\n\n2. **Pin the user's choices and facts.** Keep verbatim and in the user's order every skill,\n   workflow member (`andino-*`, `andino-workflow`, `search-first`, `focus`), MCP server, mode and\n   phase sequence the user wrote, such as \"tanya dulu, lalu council, lalu andino-planning\". Keep\n   verbatim every error text, path, file name, version, URL, name, number, quoted title and count.\n   The user chose these on purpose, so overlap with another skill or with the workflow's own phase\n   routing is never a reason to drop, merge or reorder them. The prompt gains no skill, technology,\n   cause, fix, requirement or device the user did not give.\n\n3. **Classify the task** with the [intent checklists](resources\/intent-checklists.md): bug, UI,\n   feature, refactor, research, review, install or docs. The matching rows name the project facts to\n   check, the facts to ask for and the verification step. Done when every task in the prompt has a\n   row.\n\n4. **Check the project.** When the prompt is about the working directory, read only what the rows\n   name: `AGENTS.md` or `CLAUDE.md` in the project, the manifest (`package.json` scripts,\n   `pyproject.toml`, `go.mod`, `Cargo.toml`), the files and functions the prompt names, their tests\n   and their callers. Record each fact with the file it came from. Keep facts about where things\n   are, which commands run them, what tests exist and which project rules apply; what the code does\n   wrong is for the agent to find. When the prompt targets another project, or a read fails, record\n   no facts and write \"not checked\" in the diagnosis. Done when every fact you will add has a\n   source file you opened in this run.\n\n5. **Edit.** The light edits:\n   - Keep the labels the user wrote (`skill:`, `mode:`, `mcp:`, `task:`, `Skills:`, Indonesian\n     labels) with their spelling. If the user named skills inside a sentence, leave them there.\n   - Fix typos in plain words when the meaning is certain. Never change identifiers, paths, names\n     or quoted text.\n   - Split a long paragraph into short paragraphs or bullets along the user's own points, in the\n     same order.\n   - Gather paths, URLs, references and target locations scattered through the story into a short\n     list under the user's own wording (`referensi:`, `implementasikan di:`), keeping who likes what.\n   - Remove exact repetition only.\n\n   Then add, after the user's text, only the blocks the prompt lacks, in the user's language, each\n   from its one allowed source:\n\n   | Block (Indonesian \/ English) | Source |\n   | --- | --- |\n   | `fakta proyek (dicek):` \/ `project facts (checked):` | Step 4, each fact naming its file |\n   | `batasan:` \/ `constraints:` | Limits the user wrote (\"tanpa ubah perilaku\", \"jangan ada field baru\"), restated as lines |\n   | `selesai jika:` \/ `done when:` | Observable checks built only from the user's own words and numbers |\n   | `verifikasi:` \/ `verify:` | The checklist row's verification step, using the project's real commands and the host's tools, ending with \"cocokkan hasil dengan `selesai jika` dan laporkan hasil cek yang sebenarnya\" \/ \"check the result against `done when` and report the real check output\" |\n\n   A prompt written in the template labels (`Skills:`, `Tools\/MCP:`, `Mode:`, `Task:`,\n   `Context\/evidence:`, `Done when:`, `Constraints:`) keeps them: facts go under\n   `Context\/evidence:`, end checks and verification under `Done when:`, limits under\n   `Constraints:`, one item per `- ` line. A block the user already wrote is extended, never\n   duplicated. Done when every added line traces to the user's words, a checked file or the host\n   block.\n\n6. **Weak prompt.** When the prompt lacks a fact only the user knows and that fact changes the\n   result (which project or page, what is wrong now, what done looks like), return the lightly\n   edited prompt with no added blocks that would need that fact, and at most three short questions\n   about those facts, each carrying your best guess from the project (\"the Toko Kopi app in this\n   folder?\"). Never ask what the project already shows. Do not fill the gap with a guess or a\n   `[placeholder]`.\n\n7. **Diagnose.** One table, at most five rows, columns `Jenis | Isi` (English `Kind | Detail`).\n   Row kinds, in this order, only when they apply: strength (what the prompt already does well);\n   changed (the light edits); added (each block and its source); not installed, not checked or\n   conflict (a named skill or MCP missing from the inventory, which stays in the prompt; facts you\n   could not check; two named choices that pull against each other, such as `ponytail` for the\n   least code while the result must be detailed, kept for the user to settle); could add (optional\n   skills or MCP from the suggestion tables, phrased as \"bisa ditambah\" \/ \"you could add\"). Overlap\n   between workflow members is not a conflict, and no row explains why a user choice is redundant.\n\n8. **Return** in the user's language, in this order:\n   1. the prompt in one `text` block;\n   2. the diagnosis table;\n   3. the questions, if any;\n   4. one line offering to run the prompt in this session.\n\n   Stop there. Run the prompt only after an explicit yes. It then becomes the task, and the\n   workflow routes it like any other, honoring the choices it names.\n\n## Rules for every prompt\n\n- Added lines use imperative verbs and state one action or check each (\"Tulis tes yang gagal untuk\n  kasus 2 barang @50000 diskon 10%\").\n- Added text says what to do; a limit the user wrote is restated as they meant it.\n- Size follows the prompt: a one-line task gains at most `selesai jika` and `verifikasi`; a long\n  story gains structure along its own points.\n- Every slot is filled with real content or left out: the user never receives a placeholder.\n- One prompt per reply, with no second \"short\" version.\n\n## Shortcuts that weaken a prompt\n\n| Shortcut | Do instead |\n| --- | --- |\n| \"The bug is obvious from the code, I'll name the cause.\" | Add where the code and its tests are; the agent proves the cause with a failing test. |\n| \"This feature obviously also needs security, pagination and logging.\" | Add only what the user wrote; offer the rest as a \"could add\" row. |\n| \"The template is clearer, I'll convert their story into seven labels.\" | Keep their shape; add blocks after their text. |\n| \"I'll ask which framework they use.\" | Read the manifest. Ask only what the project cannot show. |\n| \"A second, shorter version helps.\" | One prompt; the diagnosis carries the explanation. |\n| \"I'll settle the conflict between two named skills for them.\" | Name it in the diagnosis and keep both. |\n\n## Red flags\n\n- A named skill, MCP, mode or phase missing, renamed or moved in the output.\n- A fact in `fakta proyek` without a file you read in this run.\n- A root cause, library choice, page, device or requirement the user did not give, inside the\n  prompt.\n- A question the manifest or code already answers.\n- More than five diagnosis rows, or more than three questions.\n- The task carried out instead of the prompt handed back.\n\n## Ownership and permission boundary\n\nAndino coordinates selection, shared progress, resource guards and final status from evidence.\nThis skill owns its full procedure, required resources, artifact detail and technical checks.\nCoordinator brevity never truncates these. User\/project authority, Focus\/research\/domain\nboundaries and real invocation controls still apply. Native `andino-optimize-prompt` and this guide\nexpose one method, without recursive workflow invocation.\n\nReading the host's instruction file, skill folder, MCP config and the project is read-only. The\nskill never edits them, installs a capability or runs the task before the user says yes.\n\n## Output\n\nThe reply from step 8: one prompt in a `text` block, a diagnosis table of at most five rows, up to\nthree questions and one offer to run it. Nothing else is produced.\n\n## Verification\n\nCompare the output with the raw prompt before sending:\n\n- [ ] every pinned choice and fact appears unchanged and in the user's order;\n- [ ] no skill or MCP server was added to the prompt; suggestions sit in the diagnosis;\n- [ ] the user's labels and overall shape remain, and every edit is on the allowed list;\n- [ ] every added block has its allowed source, and every project fact names a file read in this run;\n- [ ] at most three questions, none answered by the project;\n- [ ] the diagnosis has at most five rows and no redundancy comment.\n\n## Worked example and anti-pattern\n\nThe [worked example](resources\/worked-example.md) runs a strong prompt and a weak one end to end.\n\nPositive request: \"Optimalkan prompt ini: bikin scene three.js pakai ponytail dan council.\"\nNegative request: \"Bikin scene three.js pakai ponytail dan council.\" (do the task)\n\nAnti-patterns: dropping `andino-planning` because `mode: brainstorm-first` \"already covers it\";\nrewriting a free-form prompt into the template labels; putting a suggested skill into the skill\nline; copying checks from an example into `selesai jika`; a \"dugaan penyebab\" line read off the\ncode; asking the user to fill placeholders for things they never mentioned.\n\n## Fallback\n\nWithout a readable Layer 1 block, skill folder or MCP config, keep the prompt as edited, say in the\ndiagnosis that the named capabilities could not be checked, and name nothing as installed. Without\na readable project, add no `fakta proyek` block and use only the user's own words for the other\nblocks.\n\n## Local resources\n\n- [Intent checklists](resources\/intent-checklists.md)\n- [Prompt patterns](resources\/prompt-patterns.md)\n- [Worked example](resources\/worked-example.md)\n- Notices: [references\/license.md](references\/license.md)\n\n## Operational example (offline)\n\nThis fixture checks two properties of an output: pinned tokens keep their order, and added blocks\nuse only the allowed labels. It does not measure prompt quality.\n\n```python andino-operational-example\nimport os\nimport re\n\nALLOWED = ('fakta proyek (dicek):', 'batasan:', 'selesai jika:', 'verifikasi:',\n           'project facts (checked):', 'constraints:', 'done when:', 'verify:')\n\ndef problems(raw, output, pins):\n    found = [output.find(pin) for pin in pins]\n    issues = [pin for pin, at in zip(pins, found) if at < 0]\n    if not issues and found != sorted(found):\n        issues.append('order')\n    added = output[len(raw):] if output.startswith(raw) else output\n    for label in re.findall(r'(?m)^([a-z][a-z ()]*:)\\s*$', added):\n        if label not in ALLOWED:\n            issues.append(label)\n    return issues\n\nif __name__ == '__main__':\n    raw = 'skill: andino-workflow, council\\ncek src\/lib\/cart.ts\\n'\n    good = raw + '\\nselesai jika:\\n- total 90000\\n\\nverifikasi:\\n1. npm test\\n'\n    assert problems(raw, good, ['andino-workflow', 'council', 'src\/lib\/cart.ts']) == []\n    bad = 'skill: council, andino-workflow\\n\\ndugaan penyebab:\\n- diskon\\n'\n    assert problems(raw, bad, ['andino-workflow', 'council']) == ['order', 'dugaan penyebab:']\n    raise SystemExit(1 if os.environ.get('ANDINO_NEGATIVE') == '1' else 0)\n```\n\n## Provenance\n\nOriginal Andino member. The fact-preservation and material-assumption rules adapt module R of the\nWebBased branch of this repository ([references\/license.md](references\/license.md)). The task\nchecklists, checked project facts, verification step and diagnosis table were added after a blind\ncomparison with the ECC, GitHub awesome-copilot, Sentry and Hashaam101 prompt optimizers, recorded in\n`docs\/validation\/optimize-prompt\/` of the AI-RULES repository; no text from those skills is copied.\n","use_cases":["Refining a raw task prompt for a coding agent","Adding structured verification steps to a prompt","Ensuring a prompt includes clear instructions and user-defined limits"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/andinoferdi\/andino-skills\/blob\/639c62b294a835b77a167cc4af1aa1f306d0cc45\/skills\/andino-workflow\/skills\/optimize-prompt\/SKILL.md","source_commit":"639c62b294a835b77a167cc4af1aa1f306d0cc45","license":null,"version":null,"listing_approved_at":"2026-11-30","created_at":"2026-11-29T10:50:46.000000Z","updated_at":"2026-11-30T06:51:23.000000Z","seo_title":"Optimize Prompt for Coding Agents","seo_description":"Improve task prompts for coding agents by adding clarity, structure, and verification steps based on user input and project configuration.","seo_keywords":["optimize prompt","coding agent prompt","task prompt refinement","prompt structure","verification steps in prompts"]}}