prompt-refactor

Rewrites informal user prompts into structured XML-tagged instructions for AI agents.

6|Updated May 18, 2026
One-click install
npx skills add https://github.com/mokhtarabadi/cognitive-lead-hq --skill prompt-refactor-mokhtarabadi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prompt-refactor
Source: https://github.com/mokhtarabadi/cognitive-lead-hq/tree/main/skill-templates/prompt-refactor
Command: npx skills add https://github.com/mokhtarabadi/cognitive-lead-hq --skill prompt-refactor-mokhtarabadi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Vague, informal, or non-English prompts cause AI agents to hallucinate, skip reasoning, and produce inconsistent output. This Skill converts weak instructions into rigorously structured prompts with enforced reasoning steps and explicit constraints. ## Core Features & Use Cases - Structured Prompt Generation: Produces prompts with five mandatory XML blocks: role, system_context, agentic_reasoning, execution_rules, and output_format. - Input Validation & Typo Correction: Scans raw input for typos, nonsensical words, and ambiguity, halting with a clarification request when the clarity score falls below 3. - Bilingual Translation & Enrichment: Translates non-English or informal input into technical English and adds inferred edge cases, security implications, and architectural constraints marked as [INFERRED]. - Use Case: A manager pastes a rough request like "make the login faster and secure" and receives a complete system prompt defining the engineer persona, a mandatory reasoning_log before coding, and strict constraints such as forbidden placeholder code. ## Quick Start Ask the agent to refactor your rough prompt into a max-power instruction using the prompt-refactor skill.

Frequently Asked Questions about prompt-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I turn a vague prompt into a structured AI instruction?▼

Provide your raw prompt and the skill rewrites it into five XML blocks: role, system_context, agentic_reasoning, execution_rules, and output_format. The result forces the target AI to log its reasoning before acting and follow explicit constraints.

How to reduce hallucination in AI agent responses?▼

Use prompts that mandate a reasoning_log before any action, covering logical dependencies, risk assessment, and abductive reasoning. This skill generates exactly that structure, plus constraints forbidding placeholder code and hallucinated variables.

Can I refactor prompts written in languages other than English?▼

Yes. The workflow translates non-English or informal input into technical English, then enriches it with inferred edge cases, security implications, and architectural constraints, each marked as [INFERRED] for transparency.

What happens when my input prompt is ambiguous or unclear?▼

The skill rates input clarity from 1 to 5. If the score falls below 3, it halts and requests clarification instead of guessing. Typos are corrected silently and logged, while nonsensical words are flagged for review.

What are the limitations of automated prompt refactoring?▼

Refactoring cannot recover intent that is missing from the original input; inferred enrichments are only educated guesses marked [INFERRED]. Highly domain-specific requirements still need manual review by the manager before deployment.