Skip to main content

Tutorial NextJS - Day 2

Hari 2 – Navigasi, Layout, & Dynamic Routing Setelah berhasil melakukan instalasi dan membuat halaman pertama di Hari 1 , pada Hari 2 ini kita akan membuat website menjadi lebih hidup. Kita akan belajar cara membuat menu navigasi agar bisa pindah-pindah halaman, membuat tampilan menu yang konsisten (Layout), dan membuat halaman artikel yang pintar (Dynamic Routing). Tutorial ini tetap menggunakan Windows + VS Code dan melanjutan project nextjs-basic dari hari sebelumnya. 1. Navigasi Antar Halaman ( <Link> ) Di HTML biasa, kita menggunakan tag <a> untuk berpindah halaman. Namun, di Next.js kita menggunakan komponen khusus bernama <Link> . Kenapa harus pakai <Link> ? Jika pakai <a> , layar akan berkedip (loading ulang) setiap pindah halaman. Dengan <Link> , perpindahan halaman terjadi instan tanpa refresh. 1.1 Edit Halaman Home Kita akan menambahkan tombol untuk pergi ke halaman About. Buka file src/app/page.tsx , lalu ganti isinya dengan kod...

How to Write Effective Prompts: A Universal Framework for Any AI Model

 

Introduction

In the age of generative AI, the ability to write a good prompt is the new literacy. Whether you are using ChatGPT, Claude, Gemini, or a model that hasn’t been invented yet, the underlying logic remains the same.

Many beginners fall into the trap of "Garbage In, Garbage Out." They type a vague sentence, get a mediocre result, and assume the AI isn't smart enough. The reality is often different: the AI is capable, but the instructions were unclear.

To master AI, you don't need to learn code. You need to learn Prompt Engineering. This guide will teach you a universal framework—The R.T.C.F. Method—that works on every major language model available today.

The Problem with Vague Prompts

Let’s start with a classic mistake. The Prompt: "Write an email about our new product."

This is a weak prompt because it lacks variables. The AI has to guess the tone, the recipient, the length, and the key selling points. The result will likely be generic, robotic fluff.

To fix this, we need structure.

The Universal Framework: R.T.C.F.

To get high-quality outputs consistently, every prompt should contain four specific components. You can remember them with the acronym R.T.C.F.

1. Role (Who is the AI?)

Assigning a persona helps the AI switch its vocabulary and perspective. A "Senior Marketing Manager" writes differently than an "Explain-Like-I'm-Five Teacher."

  • Example: "Act as a senior nutritionist..." / "You are a Python coding tutor..."

2. Task (What is the action?)

This is the core instruction. Be specific with your verbs. Avoid "talk about"; instead use "analyze," "summarize," "draft," or "critique."

  • Example: "...write a 3-day meal plan..." / "...debug this code snippet..."

3. Context (What is the background?)

This is where you provide the constraints and details. Who is the audience? What is the goal? What information should be excluded? The more context you give, the less the AI has to hallucinate.

  • Example: "...for a busy working parent who wants to avoid sugar. The tone should be encouraging and simple."

4. Format (What does the output look like?)

Don't let the AI decide how to present the data. Tell it exactly what you need.

  • Example: "...format the output as a Markdown table." / "...write it as a bulleted list."


Putting It Together: The "Before and After"

Let’s apply the R.T.C.F. framework to our previous weak example to see the difference.

❌ The Weak Prompt

"Write an email about our new coffee machine."

✅ The Effective R.T.C.F. Prompt

(Role) Act as an expert copywriter specializing in e-commerce. (Task) Write a promotional email launching our new espresso machine, the "BrewMaster 3000." (Context) The target audience is coffee enthusiasts who are tired of weak, watery office coffee. Highlight two features: the 15-second heating time and the silent grinder. The tone should be punchy, exciting, and persuasive. (Format) Structure the email with a catchy Subject Line, a Body Paragraph, and a clear Call to Action (CTA).

Why this works: The AI now knows exactly how to write, who to write for, and what structure to use. The result will be 90% usable on the first try.

Pro Tips for Advanced Prompting

Once you master the basic framework, use these advanced techniques to refine your results:

1. Give Examples (Few-Shot Prompting)

The best way to teach an AI your style is to show, not tell. If you want a specific writing style, paste a paragraph of your own writing and say: "Analyze the writing style of the text below and write the new article using the same tone and sentence structure."

2. Chain of Thought

For complex logic or math problems, ask the AI to show its work. Add this phrase to your prompt: "Let’s think step-by-step." This forces the model to break down the problem logically, which significantly reduces errors and hallucinations.

3. Iterate, Don't Abandon

Treat the AI like a junior intern. If the first result isn't perfect, don't start over. Reply with corrections: "That's good, but the tone is too formal. Make it sound more casual and add an analogy in the second paragraph."

Conclusion

The models we use will change. GPT-4 will become GPT-5; Gemini will evolve; new competitors will emerge. However, the logic of clear communication remains constant.

By using the R.T.C.F. Framework, you stop guessing and start directing. You move from being a user to being a commander of the technology. That is the skill that will future-proof your career in the AI era.

Comments

Popular posts from this blog

Why Your React App Shows a Blank Page (And How to Fix It)

Introduction One of the most frustrating problems when working with React JS is opening your app and seeing… nothing . No error message. No UI. Just a blank page . This issue happens frequently, especially after deployment or routing changes. In this article, we’ll explain why React apps show a blank page , the most common causes , and how to fix them step by step . What a “Blank Page” Usually Means in React A blank page usually means: React failed to render the UI JavaScript error stopped execution Routing or build configuration is broken Most of the time, the issue is not React itself , but how the app is configured. 1. JavaScript Error in the Console The first thing you should always check is the browser console. How to Check Open the app Right click → Inspect Open the Console tab If you see a red error message, React stopped rendering. Common Examples Cannot read property of undefined Unexpected token Module not found Fix Read the...

Nginx vs Apache: Which Web Server Should You Use on a VPS?

Introduction When setting up a VPS for hosting websites or applications, one of the first decisions you’ll face is choosing a web server. The two most popular options are Nginx and Apache . Both are powerful, widely used, and production-ready — but they work very differently. In this article, we’ll compare Nginx vs Apache , explain how each one works , highlight their strengths and weaknesses , and help you decide which web server is better for your VPS setup . What Is a Web Server? A web server is software that: Receives requests from browsers Processes those requests Serves HTML, CSS, JavaScript, or API responses Popular web servers include: Nginx Apache LiteSpeed Caddy Among them, Nginx and Apache dominate most VPS environments . What Is Apache? Apache has been around since the mid-1990s and was the most widely used web server for many years. How Apache Works Apache uses a process-based or thread-based model : Each request is handled by a p...

React Build vs Development Mode: What’s the Difference?

Introduction Many React developers are surprised when their app works perfectly during development — but behaves differently after deployment. Features break, routing fails, environment variables disappear, or performance changes dramatically. Most of these issues come from not understanding the difference between React’s development mode and production (build) mode . In this article, we’ll explain: What development mode really does What changes in production builds Why bugs appear only after deployment How to avoid common build-related mistakes What Is Development Mode in React? Development mode is what you use when running commands like: npm start npm run dev In this mode, React prioritizes developer experience , not performance. Key Characteristics of Development Mode Detailed error messages Helpful warnings Hot reloading (instant updates) Slower performance (on purpose) Extra checks for unsafe patterns Development mode helps you find bugs e...