Master Prompts — Prompt Quality Determines Output Quality
The anatomy of a great prompt, why specificity beats length, and 10 master prompts for the most common development tasks.
Every Claude output you will ever receive is a direct function of the prompt that produced it. This is not a metaphor — the quality of your instructions literally determines the quality of what you get back. This page gives you the framework, the anatomy, and 10 reusable master prompts for common development tasks.
The Core Principle
Here is the single most important thing to understand about prompting:
Claude is not guessing what you want. Claude is doing exactly what you described.
When the output is bad, the prompt was bad. When you need to re-explain, you under-explained. When Claude produces something that does not fit your project, you did not give it enough project context.
This is not criticism — it is good news. You have complete control over output quality through the quality of your instructions. A better prompt reliably produces better output. Every time.
The Excel analogy: When you send a spreadsheet to a colleague with the note "please fix this," what happens? They do not know what "fix" means. Which part? What is wrong? What should the result look like? They guess. They fix the wrong thing. You re-explain. They try again.
When you say: "In column D, the running total formula in rows 5 through 50 is using absolute reference when it should use relative reference. Please change all instances and verify the result matches the manual total in cell D51."
They get it right the first time.
Same principle. Same tool. The quality of your instruction is the bottleneck.
The core principle is: 'Claude is not guessing what you want — it is doing exactly what you described.' What does this mean when Claude produces wrong output?
The Anatomy of a Great Prompt
Every strong prompt has five elements. Not all five are required for every task — a simple bug fix might only need three. But understanding all five makes you a more precise communicator.
1. Role Context — Where Are We?
Tell Claude what project you are in, what you are working on, and where in the codebase this lives.
If you have a well-maintained CLAUDE.md, Claude already knows most of this. You can skip it or keep it brief. But if you are working in a new area of the codebase, orient Claude first.
2. Current State — What Exists?
Describe what is already there. This prevents Claude from re-creating things that exist and helps it write code that integrates with what is already built.
3. Desired Outcome — What Do You Want?
Be specific. Name the component, the function, the behavior. Include edge cases you care about.
4. Constraints — What You Do NOT Want
This is often the most valuable part of a prompt. Telling Claude what NOT to do prevents the most common mistakes.
5. Output Format — How Should Claude Respond?
For complex tasks, tell Claude what a good response looks like. This prevents getting a wall of code with no explanation, or an explanation with no code.
The "Show Don't Tell" Principle
The fastest way to get Claude to match your existing style is to show it an example from your codebase, not describe the style in words.
Describing style (less effective):
Showing style (highly effective):
When you give Claude a real example from your codebase, it reverse-engineers your style with near-perfect accuracy. This is faster than any style description you could write.
10 Master Prompts
These are reusable prompt templates for the tasks you will do most frequently. Adapt them to your specific situation — the structure is what matters.
1. New Component
Use this when you need to build a UI component — a card, a table, a modal, a form, a stat block, anything visual.
CA example: "Build an InvoiceRow component for the invoice list. It receives a single invoice (id, client_name, amount_paise, status, created_at). Match the style of the existing ApplicationRow component. Show a loading skeleton while data loads. Display amount_paise as ₹ using formatINR."
2. Bug Fix
Use this when something is broken, not working as expected, or showing an error.
CA example: "Expected: after submitting the new client form, the client appears in the list. Actual: the form submits (spinner disappears) but the list doesn't update. No error in console. Files involved: src/components/clients/NewClientForm.tsx, src/hooks/useClients.ts. Investigate root cause — likely the React Query cache is not being invalidated after the mutation."
3. Database Schema
Use this when you need to design a new database table before building a feature.
CA example: "Design the schema for storing GST filing records. Each record stores: client_id (FK to clients), financial year (text, e.g. '2025-26'), filing_period (text, e.g. 'Apr 2025'), form_type (GSTR-1, GSTR-3B, etc.), status (pending, filed, late), filed_date (nullable), and notes. Owner is the CA firm. Only the owning firm can read/write. Soft-delete required."
4. RLS Policy
Use this when you need to add or fix a Row Level Security policy on a Supabase table.
CA example: "Write the RLS policy for the gst_filings table. Authenticated users with role='ca_firm' can read, create, and update rows where firm_id = their firm_id from the profiles table. Admins can read all rows. Nobody can read rows where is_deleted = true. Follow the same pattern as the clients table policies."
5. React Query Hook
Use this when you need to fetch or mutate data from Supabase in a React component.
CA example: "Create a hook called useGSTFilings for fetching all GST filing records for the current CA firm. Location: src/hooks/useGSTFilings.ts. Fetches from gst_filings table where firm_id = current user's firm_id and is_deleted = false. Returns array of GSTFiling objects. Model after the existing useClients.ts hook."
6. Form with Validation
Use this when you need to build a form that collects user input, validates it, and submits to Supabase.
CA example: "Build a form for adding a new client. Fields: (1) Legal name: text, required, min 2 characters. (2) GSTIN: text, optional, exactly 15 characters if provided. (3) Contact email: email format, optional. (4) State: dropdown from a list of Indian states, required. On submit: create row in clients table and close the modal. Success toast: 'Client added successfully.' Use the same form styles as the NewApplicationForm."
7. Error Handling
Use this when you need to add proper error handling to an operation that currently fails silently or shows raw technical errors.
CA example: "Add proper error handling to the invoice creation flow. Currently: on Supabase error, the form just sits there doing nothing. What should happen: on success — show green toast 'Invoice created', close the modal, refresh the invoice list. On network error — show red sticky toast 'Could not save invoice. Try again or contact support.' On validation error — show inline field errors. No technical error messages shown to the user."
8. API Route / Edge Function
Use this when you need to run server-side logic — for operations that require the service role key, external API calls, or processing that shouldn't run in the browser.
CA example: "Create an edge function called send-gst-reminder. Triggered by HTTP POST from the frontend. It: receives a client_id and period in the body, verifies the caller is authenticated as a CA firm, fetches the client's contact email from Supabase (service role), calls MSG91 to send an SMS reminder, updates the gst_filings row status to 'reminder_sent'. Returns { success: true } or { error: '...' }."
9. Code Review
Use this when you want Claude to review code before you commit it — either code you wrote manually or code Claude just wrote.
CA example: "Review the code in src/hooks/useGSTFilings.ts and src/components/GSTFilingsList.tsx that we just built. Check for: TypeScript any, missing error state, monetary amounts stored as floats, and whether the RLS policy will actually filter correctly."
10. Refactor
Use this when code is working but has become too long, repetitive, or hard to maintain.
CA example: "Refactor src/components/GSTDashboard.tsx — it is 730 lines and handles filing list, filter sidebar, and analytics chart all in one file. Split into: GSTDashboard.tsx (orchestrator, under 100 lines), GSTFilingList.tsx (the table), GSTFilterSidebar.tsx (the filters), GSTAnalyticsChart.tsx (the chart). Do not change any behavior. Run tsc --noEmit after splitting."
Common Prompt Mistakes
Mistake 1: Vague verbs
"Fix the bug" → "The form does not show a success toast after submission. The onSubmit handler is not calling toast.success. Fix the onSubmit function in the ContactForm component."
Mistake 2: Missing constraints
Telling Claude what you want without telling it what you do not want consistently produces output that technically satisfies the request but violates your conventions. Always include "do not" instructions for your most important rules.
Mistake 3: No file context
"Write a hook for fetching users" → Claude has no idea where users are stored, how your hooks are structured, or what query patterns you use. Name the specific file to model after and the specific table to query from.
Mistake 4: Asking for too much at once
"Build the entire admin dashboard" is not a prompt — it is a project. Break it into specific components: the stat cards, then the user table, then the filter sidebar. Smaller, focused prompts produce better, more reviewable output.
Mistake 5: Not verifying the output
Prompting and then blindly committing is the cause of most AI-introduced bugs. Always read what Claude wrote. Run the TypeScript checker. Test the behavior. Claude checks its own work, but your review is the final gate.
Never commit Claude's output without reading it first. Claude can write code that compiles without errors but behaves incorrectly — TypeScript catches type mismatches, not logic errors. Always test the actual behavior in the browser before marking a task done.
Claude keeps adding a new useEffect for data fetching instead of using your existing React Query hook. What is the most effective fix?
Before you move on — can you do all of this?
Click each item you're confident about. Bring the unchecked ones to your next session.
I can name all 5 elements of a strong prompt: role context, current state, desired outcome, constraints, output format
I understand that when output is wrong, the prompt was wrong — not Claude
I use the "show don't tell" principle — paste a real example from my codebase to match my style
My prompts always include explicit constraints ("do not use X, always use Y") for my most important rules
I never commit Claude's output without reading it and testing the actual behavior in the browser