Claude Track/Advanced Prompting with Claude
Claude Track
Module 2 of 7

Advanced Prompting with Claude

XML tags, thinking mode, system prompts, long context windows, and getting the best output from Claude.

16 min read

What You'll Learn

  • Use XML tags to structure prompts for precise, predictable output
  • Leverage Extended Thinking mode for complex reasoning tasks
  • Write effective system prompts that set persistent behavior and constraints
  • Exploit Claude's long context window for document-heavy workflows
  • Apply advanced prompting patterns: role assignment, few-shot, and structured output

XML Tags: Claude's Secret Weapon

Claude has a unique strength that most users never discover: it responds exceptionally well to XML-structured prompts. While all AI models can process XML tags, Claude was specifically trained to use them as structural markers, making it dramatically more reliable at following complex instructions.

The concept is simple: wrap different parts of your prompt in descriptive XML tags to separate concerns. Instead of writing a long paragraph that mixes instructions, context, and examples, you organize them into labeled sections.

For example:

<example_prompt> You are an expert marketing strategist.

We are a B2B SaaS company selling project management software to mid-market companies (50-500 employees). Our main competitors are Asana, Monday.com, and ClickUp. Our differentiator is deep integration with existing enterprise tools. Write a competitive positioning statement that highlights our integration advantage.
  • Keep it under 100 words

  • Use professional but confident tone

  • Do not mention competitors by name

  • Include a clear value proposition

</example_prompt>

Why does this work so well? The tags create unambiguous boundaries between different types of information. Claude knows exactly where the context ends and the task begins. It knows the constraints are separate from the context. This eliminates the ambiguity that causes other prompting approaches to fail on complex tasks.

Common tag patterns that work well:

  • <context> for background information

  • <task> for what you want done

  • <constraints> for rules and limitations

  • <examples> for few-shot patterns

  • <output_format> for specifying structure

  • <document> for text you want analyzed

You do not need to memorize specific tag names. Claude understands any descriptive tag. The key is consistency: use the same tags across similar prompts for reliable results.

Quick Test: XML Prompting

Take a complex prompt you have used before and restructure it with XML tags.

1. Separate the context, task, constraints, and desired output format into tagged sections.

2. Run both versions (original and XML-structured) through Claude.

3. Compare the results and note which produced more precise, complete output.

Extended Thinking: Watching Claude Reason

Extended Thinking is one of Claude's most powerful features on Pro plans. When enabled, Claude explicitly reasons through problems step by step before generating its final response. You see the thinking process in a collapsible section above the answer.

This is different from simply adding "think step by step" to a prompt (though that helps too). Extended Thinking uses a dedicated reasoning process that is architecturally separate from the response generation. The thinking can be substantially longer and more detailed than the final answer, and it allows Claude to catch errors, consider alternatives, and build up to a well-reasoned conclusion.

When Extended Thinking is most valuable:

  • Complex analysis: Evaluating business strategies, analyzing contracts, weighing pros and cons of competing approaches

  • Math and logic: Any problem that requires multi-step calculation or logical deduction

  • Coding challenges: Debugging complex issues, designing system architecture, identifying edge cases

  • Research synthesis: Combining information from multiple sources into a coherent analysis

  • Decision support: When you need to see the reasoning, not just the recommendation

When to skip Extended Thinking:

  • Simple factual questions

  • Creative brainstorming (you want volume, not deliberation)

  • Quick formatting or editing tasks

  • Time-sensitive responses where speed matters more than depth

The thinking process is also useful as a learning tool. When Claude reasons through a problem you are working on, reading its thinking often reveals considerations you had not thought of. It is like having a smart colleague show their work.

Try This Yourself

Enable Extended Thinking in Claude Pro and ask a multi-step question from your work, such as "Should we build or buy a solution for [specific need]? Consider cost over 3 years, implementation time, maintenance burden, and team skills." Read the thinking section before the answer. Note any considerations Claude raised that you had not thought of. Compare the depth to the same question asked without Extended Thinking.

System Prompts and Persistent Behavior

A system prompt tells Claude how to behave before the conversation begins. In the API, this is a dedicated system message. In Claude.ai, you set persistent behavior through Projects (covered in Module 3) and through the way you frame your initial messages.

What makes a good system prompt for Claude:

Claude is remarkably good at following system prompt instructions, which means the quality of your system prompt directly impacts every response. A well-crafted system prompt should include:

  1. Role definition: "You are a senior financial analyst specializing in SaaS metrics." This shapes the vocabulary, depth, and perspective of every response.

  2. Behavior rules: "Always provide specific numbers when available. If you are uncertain, say so explicitly. Never hedge with vague language like 'it depends' without then explaining what it depends on."

  3. Output format defaults: "Default to bullet points for lists of more than 3 items. Use tables for comparisons. Start every response with a one-sentence summary."

  4. What to avoid: "Do not apologize unnecessarily. Do not include disclaimers about being an AI unless specifically asked. Do not pad responses with filler content."

  5. Handling ambiguity: "If my request is ambiguous, ask one focused clarifying question before proceeding. Do not guess."

The system prompt acts as a persistent layer that shapes every interaction. Invest 15 minutes in writing a detailed system prompt, and every conversation in that context will produce better output without additional effort.

XML tags in system prompts are particularly effective with Claude. You can use tags like <role>, <rules>, <format>, and <examples> to organize your system prompt clearly.

System Prompt Template

Start with this framework: (1) Role: who Claude should be. (2) Context: what it needs to know about your domain. (3) Rules: specific behavior instructions. (4) Format: default output structure. (5) Anti-patterns: what to avoid. A 300-word system prompt with these five sections will outperform a 50-word generic instruction every time.

Leveraging the Long Context Window

Claude's context window is one of its most significant technical advantages. With up to 200K tokens (roughly 500 pages of text), you can have conversations that include entire books, complete codebases, full legal contracts, or extensive research papers.

This changes how you work with AI in fundamental ways:

Full document analysis without chunking. With most AI tools, you have to break large documents into pieces, process each piece separately, and somehow reconcile the results. With Claude, you upload the entire document and ask questions about all of it at once. "What are the three biggest risks identified in this 80-page due diligence report?" Claude reads the entire report, not a summary.

Cross-reference multiple documents. Upload a contract and the company's standard terms. Ask Claude to identify discrepancies. Upload three quarterly reports and ask for trend analysis. The ability to hold multiple documents in context simultaneously enables comparison tasks that would be impossible with smaller windows.

Codebase understanding. Paste or upload your entire codebase (or substantial portions of it) and ask architectural questions. "How does authentication flow through this application?" Claude can trace the logic across multiple files because it sees them all at once.

Research synthesis. Upload 10 academic papers on a topic and ask Claude to synthesize the findings, identify areas of consensus and disagreement, and highlight gaps in the research. This is a genuine research acceleration task.

Practical tips for long context:

  • Place the most important content at the beginning or end of the context. Like humans, Claude pays slightly more attention to the beginning and end of long inputs.

  • Use clear section headers and labels when uploading multiple documents. "Document 1: Q3 Financial Report" and "Document 2: Competitor Analysis" help Claude keep track of which information came from where.

  • Ask specific questions rather than open-ended ones. "What does Document 2 say about market share?" is better than "What is interesting about these documents?"

Try This Yourself

Find two related documents you work with regularly, such as a proposal and the requirements it addresses, or two competing vendor quotes. Upload both to Claude in a single conversation with clear labels ("Document 1: [name]" and "Document 2: [name]"). Ask Claude to compare them and identify three key differences. Notice how Claude references specific sections from both documents in its analysis.

Advanced Prompting Patterns

Beyond XML tags and system prompts, several advanced patterns unlock Claude's full potential.

Structured output with schemas. When you need data in a specific format, describe the schema explicitly:

"Return the analysis as a JSON object with these fields: summary (string, max 100 words), risk_level (high/medium/low), key_findings (array of strings), recommended_actions (array of objects with action and priority fields)."

Claude follows schema instructions with high fidelity, making it excellent for generating structured data that feeds into other systems.

Role stacking. Instead of assigning one role, assign multiple perspectives: "Analyze this business plan from three perspectives: a venture capitalist evaluating investment potential, a customer evaluating whether to buy, and a competitor evaluating the threat to their market position." Claude will produce three distinct, genuinely different analyses.

Iterative refinement with memory. In long conversations, Claude maintains strong coherence. You can build on previous outputs over many turns: "Now take the outline we created and expand section 3 into full prose, maintaining the same voice as the executive summary we wrote earlier." Claude tracks these references accurately across long conversations.

Constraint-based creativity. Claude does its most creative work when given specific constraints rather than open-ended freedom. "Write a product tagline. Constraints: under 8 words, includes a verb, references our integration capability, works as both a headline and a CTA button." Tight constraints produce focused, usable output.

Adversarial review. Ask Claude to argue against its own output: "You just recommended Strategy A. Now argue against it. What are the three strongest reasons Strategy A will fail?" This technique produces more balanced analysis than asking for pros and cons upfront.

Advanced Prompting Challenge

Pick a real work document (report, proposal, plan). Upload it to Claude with Extended Thinking enabled and try the role stacking technique: "Analyze this from three perspectives: (1) the person who wrote it, identifying what they would defend, (2) a skeptical reviewer, identifying weaknesses, and (3) a CEO deciding whether to approve it." Compare the multi-perspective analysis to a simple "review this document" prompt.

Core Insights

  • XML tags are Claude's secret weapon: wrapping prompt components in descriptive tags like <context>, <task>, and <constraints> produces dramatically more precise and complete output
  • Extended Thinking shows Claude's reasoning process and is most valuable for complex analysis, math, coding, and any task where understanding the logic matters as much as the answer
  • A well-crafted system prompt with role, context, rules, format, and anti-patterns shapes every response in a conversation and compounds in value over time
  • Claude's 200K+ token context window enables full-document analysis, multi-document comparison, and codebase understanding without the chunking workarounds other tools require
  • Advanced patterns like role stacking, structured output schemas, constraint-based creativity, and adversarial review unlock capabilities most users never discover