DEV Community

Rizwan Saleem
Rizwan Saleem

Posted on

How to use LLMs effectively in your daily work: a practical tutorial

How to use LLMs effectively in your daily work: a practical tutorial

LLMs like ChatGPT, Claude, and Gemini can accelerate software work when used with disciplined prompts, clear task decomposition, and rigorous review loops. Below is a compact, practical tutorial with patterns, exercises, and real-world checks you can apply today.

What to use and why it helps

  • Prompt patterns: reusable templates that shape behavior, reduce drift, and surface ambiguities early.
  • Task decomposition: break big goals into verifiable subtasks with owners, constraints, and checkpoints to keep scope and quality in balance.
  • ReAct and planning loops: plan → act → observe → replan to handle tools, web access, and code changes effectively.
  • Structured reviews: multi-layer reviews (requirements fidelity, edge cases, API/security) catch gaps the model may miss.

Prompt patterns you can start using now

  • System-oriented scoping: “From now on, you are a software design assistant focused on reliability and security.” Then add constraints: “Produce outputs that are verifiable by tests; flag ambiguities.”
  • Role-and-scope prompts: “Act as a senior backend engineer. Your task is to design a REST API for X. Highlight assumptions, edge cases, and required tests.”
  • Within-scope checklist: “Within this scope, consider these requirements: latency < 50 ms, memory < 128 MB, compliant with OWASP Top 10. Point out ambiguities and propose concrete alternatives.”
  • Subtask templates: “Decompose the goal into 5 concrete subtasks with owners, inputs, dependencies, and acceptance criteria. After each subtask, request a quick validation from me.”

Task decomposition techniques

  • Define a clear objective: restate the user value in one line and capture success criteria.
  • Break into 3-10 subtasks: each should be self-contained, testable, and assigned an owner.
  • Specify acceptance tests: for each subtask, write one or two concrete tests or checklists.
  • Plan-execute loop: after planning, run each subtask in sequence or in parallel with explicit dependencies; validate before moving on.
  • Use decomposition prompts: explicitly instruct the model to generate a plan first, then generate the implementation prompts for each subtask.

When to use each model or mode

  • ChatGPT: broad ideation, UI/UX prompts, overall strategy, and code scaffolding.
  • Claude: deep coding sessions, long-context reasoning, and multi-file refactoring prompts.
  • Gemini: research-heavy tasks, data gathering, and integrated tool use (web, databases) when you need broader context.
  • For all: start with a focused pit stop prompt to gather assumptions, then narrow down to implementation prompts with explicit edge cases.

Designing high-quality AI-assisted code

  • Prompt for fidelity: after generating code, compare against the original requirements word-for-word; ask the model to map each function to a requirement.
  • Edge-case probing: force the model to consider nulls, empty inputs, extreme values, concurrency, and failure modes.
  • Security as a first-class requirement: require patterns that align with OWASP or your organization’s security playbooks; extract explicit inputs, outputs, and side effects.
  • Testing by default: demand unit tests for each subtask and example scenarios; request test skeletons that compile in your stack.
  • Language and style checks: require consistent naming, idiomatic constructs, and documentation strings.

Evaluation and reviewing AI output

  • Multi-layer review checklist:
    • Requirement fidelity: does the output implement what was asked?
    • Completeness: are there gaps, unfinished branches, missing error handling?
    • Correctness: walk through representative inputs; reason about control flow and edge cases.
    • API compatibility: if external calls are used, verify versions, endpoints, and payload shapes.
    • Security and resilience: identify injection points, auth failure modes, and rate-limiting concerns.
    • Performance expectations: note latency, memory usage, and potential bottlenecks.
  • Quietly probe the model after output: ask clarifying questions, request alternative approaches, and generate test cases to stress the solution.
  • Human-in-the-loop guardrails: use the model to draft, but rely on you to validate critical decisions, assumptions, and risk trade-offs.

Practical exercises

  • Exercise 1: API design prompt
    • Objective: design a REST API for a user profile service.
    • Decomposition: (1) data model, (2) endpoints, (3) validation rules, (4) error handling, (5) tests.
    • Acceptance: at least 3 endpoints, input validation, 2 representative tests, and one security review note.
  • Exercise 2: Refactoring prompt
    • Objective: extract a common utility from duplicate code.
    • Decomposition: (1) locate duplicates, (2) define abstraction, (3) update callers, (4) test suite, (5) measure impact.
    • Acceptance: no functional changes, tests pass, and performance unchanged or improved.
  • Exercise 3: Performance optimization prompt
    • Objective: reduce API latency from 200 ms to under 50 ms.
    • Decomposition: (1) identify bottlenecks, (2) propose optimizations, (3) implement, (4) verify with benchmarks.
    • Acceptance: benchmark results, regression checks, and a rollback plan.

Best practices for staying sharp

  • Treat outputs as starting points, not final answers: always validate assumptions and write your own tests.
  • Use explicit validators in prompts: require the model to generate a validator for each subtask’s acceptance criteria.
  • Maintain a decision journal: note why you accepted or rejected AI-generated decisions and what you learned.
  • Limit context drift: restart conversations periodically or create per-task briefs to keep models aligned to a single goal.
  • Balance speed and safety: push for faster iterations with quick checks, but reserve deep reviews for critical components.

Example prompt you can adapt

  • “Act as a senior software engineer. Objective: design a scalable user-profile API. Deliver in two phases: Phase A - API design (data model, endpoints, validation, error handling) with tests; Phase B - security review and performance notes. For Phase A, provide a plan with subtask owners, dependencies, and acceptance criteria. After the plan, generate the implementation prompts for each subtask. After each subtask’s output, request a quick validation summary from me and highlight ambiguities.”

Illustration: a simple two-column plan

  • Subtask: Define data model
    • Owner: you
    • Dependencies: none
    • Acceptance: data model aligns with requirements, includes constraints, and has migration path
  • Subtask: Implement endpoints
    • Owner: AI assistant
    • Dependencies: data model defined
    • Acceptance: 3 endpoints, input validation, error handling
  • Subtask: Validate with tests
    • Owner: you
    • Dependencies: endpoints implemented
    • Acceptance: suite passes, edge cases covered

Would you like a ready-to-use prompt pack (scoping, task decomposition, review, and testing templates) tailored to your stack and the specific project you’re working on? If so, tell me your tech stack (language, framework, testing tools), target model(s) you prefer, and a concrete goal you’re currently pursuing. How do you want to structure your next AI-assisted task: a design sprint, a bugfix round, or a feature delivery?

-

Rizwan Saleem | https://rizwansaleem.co

Top comments (0)