{"slug": "6-ways-to-get-dramatically-better-results-from-claude", "title": "6 Ways to Get Dramatically Better Results From Claude", "summary": "A developer shares six techniques for getting better results from Claude, including writing specific prompts, using XML tags for context, asking for a plan before code, providing examples, splitting tasks into stages, and clearing context between tasks. The techniques aim to reduce ambiguity and improve output quality in API, Claude Code, or claude.ai.", "body_md": "Some developers treat Claude like autocomplete: paste some code, get some code back, iterate blindly. The gap between a mediocre response and a genuinely great one usually isn't the model — it's how you're prompting it. Here are six concrete techniques, each with a real before/after you can use in the API, Claude Code, or claude.ai.\n\nVague prompts get vague code, because Claude has to guess what \"done\" means — and it'll guess conservatively.\n\n**Before:** `\"Write a function to validate emails.\"`\n\n**After:**\n\n```\nWrite a TypeScript function `validateEmail(input: string): boolean`.\nRequirements:\n- RFC 5322-compatible, but reject addresses without a TLD\n- No external dependencies\n- Include 3 unit tests covering valid, invalid, and edge cases (e.g. plus-addressing)\n```\n\nNow you get a function that matches your actual constraints instead of a generic regex you have to rewrite anyway.\n\nWhen a prompt mixes instructions with pasted source, Claude can blur which is which — especially in long files. Tags remove the ambiguity.\n\n```\n<file path=\"auth/session.ts\">\n[paste file contents]\n</file>\n\n<error>\nTypeError: Cannot read properties of undefined (reading 'userId')\n</error>\n\nUsing only the file above, find the line that causes this error and explain why.\n```\n\nThis is also how you should structure multi-file context: one `<file>`\n\nblock per file, each labeled with its path.\n\nFor anything beyond a one-liner — a new feature, a refactor, a tricky bug — ask Claude to reason through the approach before writing code. This surfaces bad assumptions before they're baked into 200 lines.\n\n**Before:** `\"Add caching to this API endpoint.\"`\n\n**After:** `\"Before writing code, outline your approach to caching this endpoint: what to cache, invalidation strategy, and where the cache lives. Then implement it.\"`\n\nYou catch a wrong assumption (\"cache the whole response\" when only one field is expensive) at the plan stage, not the PR review stage.\n\nIf you want Claude's output to match your codebase's conventions, show it a pattern instead of describing it.\n\n**Before:** `\"Write an error handler for this endpoint.\"`\n\n**After:**\n\n``` js\nFollow this existing pattern from our codebase:\n\nexport const getUser = async (req, res) => {\n  try {\n    const user = await db.users.find(req.params.id);\n    if (!user) return res.status(404).json({ error: 'not_found' });\n    return res.json(user);\n  } catch (e) {\n    return res.status(500).json({ error: 'internal_error' });\n  }\n};\n\nNow write `getOrder` following the exact same structure and error shape.\n```\n\nOne good example saves you a round trip of \"actually, use our error format.\"\n\nAsking for an entire feature in one shot tends to produce something shallow or inconsistent. Splitting into stages — plan, implement, review, fix — gets a stronger result because each step has one job.\n\n**Before:** `\"Build a rate limiter for our API.\"`\n\n`\"Propose 2-3 rate-limiting strategies for a Node/Redis stack, with tradeoffs.\"`\n\n`\"Implement the sliding-window approach as Express middleware.\"`\n\n`\"Review this middleware for race conditions and edge cases.\"`\n\n`\"Fix the issues you found.\"`\n\nEach step is easy to verify on its own, which is exactly why the end result holds together.\n\nLong agentic sessions degrade when context fills with irrelevant history — a fix for bug A that's still sitting in context while you debug unrelated bug B.\n\n`/clear`\n\nbetween unrelated tasks in Claude Code instead of continuing the same thread.`/clear`\n\nand write a better initial prompt with what you learned, rather than correcting a third time.`CLAUDE.md`\n\nfile instead of repeating them in every prompt.None of this is a magic prompt template — it's giving Claude the same things you'd give a new teammate: clear requirements, relevant context, your existing patterns, and room to think before acting. Try one of these on your next prompt and see how much less cleanup you have to do afterward.", "url": "https://wpnews.pro/news/6-ways-to-get-dramatically-better-results-from-claude", "canonical_source": "https://dev.to/soverflowed/6-ways-to-get-dramatically-better-results-from-claude-4331", "published_at": "2026-08-03 20:18:16+00:00", "updated_at": "2026-08-03 20:43:23.317052+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "developer-tools"], "entities": ["Claude", "Claude Code", "claude.ai", "TypeScript", "Node", "Redis", "Express"], "alternates": {"html": "https://wpnews.pro/news/6-ways-to-get-dramatically-better-results-from-claude", "markdown": "https://wpnews.pro/news/6-ways-to-get-dramatically-better-results-from-claude.md", "text": "https://wpnews.pro/news/6-ways-to-get-dramatically-better-results-from-claude.txt", "jsonld": "https://wpnews.pro/news/6-ways-to-get-dramatically-better-results-from-claude.jsonld"}}