بنقرة واحدة
prompt-architecture
Prompt Architecture is the structural engineering of agent instructions.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Prompt Architecture is the structural engineering of agent instructions.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Parallel Agent Orchestration is the discipline of dispatching, coordinating, and aggregating results from multiple concurrent subagents to dramatically accelerate complex tasks.
Proactive Intelligence enables agents to autonomously seek out external information — web searches, API re-pulls, data freshness checks — during analysis without waiting for explicit user requests
Context Engineering is the discipline of maximizing agent output quality while minimizing token expenditure.
Verification Loops are systematic evaluation pipelines that validate agent outputs at every stage of execution.
Continuous Learning enables agents to automatically extract successful patterns from completed sessions and codify them into reusable skills, rules, and prompt refinements.
Entity Memory Management is the systematic extraction, persistence, and retrieval of named entities across agent sessions, enabling long-term contextual awareness that transforms transient conversations into persistent relationships.
| name | prompt-architecture |
| description | Prompt Architecture is the structural engineering of agent instructions. |
Part of Agent Skills™ by googleadsagent.ai™
Prompt Architecture is the structural engineering of agent instructions. Where casual prompt writing produces fragile, inconsistent results, architectural prompt design creates deterministic, high-performance agent behaviors that hold up under adversarial conditions and scale across thousands of invocations. This skill distills the prompt engineering methodology developed within the googleadsagent.ai™ platform, where Buddy™ handles complex Google Ads analysis through meticulously layered prompt structures.
The fundamental principle is that prompts are not strings — they are programs. A well-architected prompt has a clear execution model: system-level invariants establish the agent's identity and constraints, user-level instructions define the current task, and assistant-level priming shapes the output format and reasoning trajectory. Each layer serves a distinct purpose and must be engineered independently before composition.
Advanced prompt architecture incorporates constraint propagation, output schema enforcement, chain-of-thought scaffolding, and dynamic few-shot example selection. These techniques eliminate the "prompt lottery" problem where identical inputs produce wildly varying output quality across runs.
graph TD
A[System Layer] --> B[Identity & Constraints]
A --> C[Output Schema Definition]
A --> D[Tool Definitions]
B --> E[Prompt Assembly]
C --> E
D --> E
F[User Layer] --> G[Task Specification]
F --> H[Dynamic Few-Shot Examples]
G --> E
H --> E
I[Assistant Layer] --> J[Reasoning Primer]
I --> K[Format Enforcement]
J --> E
K --> E
E --> L[Validation Gate]
L -->|Pass| M[Agent Execution]
L -->|Fail| N[Prompt Revision]
N --> E
The three-layer architecture ensures separation of concerns. The system layer defines who the agent is and what it can do — this layer rarely changes across invocations. The user layer carries the task-specific payload and any dynamically selected examples. The assistant layer provides a "running start" that primes the model's generation trajectory. The validation gate checks assembled prompts against structural rules before execution, catching malformed or conflicting instructions.
Three-Layer Prompt Builder:
interface PromptLayer {
role: "system" | "user" | "assistant";
sections: PromptSection[];
}
interface PromptSection {
name: string;
content: string;
priority: number;
tokenBudget: number;
}
function assemblePrompt(layers: PromptLayer[], maxTokens: number): Message[] {
const messages: Message[] = [];
for (const layer of layers) {
const sections = layer.sections
.sort((a, b) => b.priority - a.priority)
.reduce((acc, section) => {
const currentTokens = countTokens(acc.map(s => s.content).join("\n"));
if (currentTokens + section.tokenBudget <= maxTokens * 0.4) {
acc.push(section);
}
return acc;
}, [] as PromptSection[]);
messages.push({
role: layer.role,
content: sections.map(s => s.content).join("\n\n"),
});
}
return messages;
}
Constrained Output Enforcement:
SCHEMA_ENFORCEMENT_PROMPT = """
You MUST respond with valid JSON matching this exact schema:
{schema}
Rules:
- Every field is required unless marked optional
- String fields must not exceed {max_length} characters
- Numeric fields must be within specified ranges
- Do not include fields not in the schema
- Do not wrap the JSON in markdown code blocks
Begin your response with the opening brace {{.
"""
def build_constrained_prompt(schema: dict, task: str) -> list[dict]:
return [
{"role": "system", "content": SCHEMA_ENFORCEMENT_PROMPT.format(
schema=json.dumps(schema, indent=2),
max_length=500
)},
{"role": "user", "content": task},
{"role": "assistant", "content": "{"} # Prime the generation
]
Dynamic Few-Shot Selection:
class FewShotSelector:
def __init__(self, examples: list[dict], embedder):
self.examples = examples
self.embedder = embedder
self.embeddings = [embedder.encode(ex["input"]) for ex in examples]
def select(self, query: str, k: int = 3) -> list[dict]:
query_emb = self.embedder.encode(query)
similarities = [
cosine_similarity(query_emb, emb) for emb in self.embeddings
]
top_indices = sorted(
range(len(similarities)),
key=lambda i: similarities[i],
reverse=True
)[:k]
return [self.examples[i] for i in top_indices]
def format_examples(self, examples: list[dict]) -> str:
parts = []
for ex in examples:
parts.append(f"Input: {ex['input']}\nOutput: {ex['output']}")
return "\n\n---\n\n".join(parts)
<task>, <constraints>, <examples> tags create unambiguous section delimiters that models parse reliably.{ for JSON, ## Analysis for markdown) dramatically improves format compliance.| Feature | Claude Code | Cursor | Codex | Gemini CLI |
|---|---|---|---|---|
| System prompt layering | ✅ Full | ✅ Rules + Skills | ✅ Instructions | ✅ System prompts |
| Assistant prefill | ✅ Native | ⚠️ Limited | ❌ Not supported | ⚠️ Limited |
| Few-shot injection | ✅ Full | ✅ Full | ✅ Full | ✅ Full |
| XML section tags | ✅ Preferred | ✅ Supported | ✅ Supported | ✅ Supported |
| Temperature control | ✅ API param | ⚠️ Model default | ✅ API param | ✅ API param |
Anthropic’s Mythos Preview write-up shows that a short, single-paragraph task prompt can drive long, complex autonomous work when the harness is right: they launch an isolated container with the project, invoke Claude Code with Mythos Preview, give roughly one paragraph (e.g., ask the model to find a security issue), and let the agent run—reading code, experimenting, and iterating without step-by-step human steering.
That pattern is a useful reference when you want high autonomy without over-specifying every tool call in the prompt. Treat the paragraph as the goal and constraints; rely on the runtime (tools, environment, verification) for execution detail. Source: Mythos Preview.
prompt-architecture, system-prompt, few-shot, chain-of-thought, constrained-generation, output-format, prompt-layering, instruction-hierarchy, temperature-tuning, agent-skills
© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License