MÓDULO 3.5 · HANDS-ON

🛠️ Passo a passo: construindo sua app

Tutorial linear do zero ao deploy. 7 passos. Ao final você tem uma app funcional de geração estruturada de prompts rodando em produção. Cada passo tem o código exato para copiar.

💡 Pré-requisitos

  • • Node.js 18+ instalado
  • • Conta na Anthropic (console.anthropic.com) com chave de API — ~$5 de crédito são suficientes para o tutorial
  • • Conta Netlify grátis (netlify.com)
  • • Editor de código (VS Code recomendado)
  • • Terminal familiar com git e npm
1

Setup do projeto (5 minutos)

Crie uma pasta nova, inicialize o Node e instale as dependências mínimas.

Terminal

mkdir minha-app-prompts cd minha-app-prompts npm init -y npm install @anthropic-ai/sdk @netlify/functions npm install -D typescript @types/node netlify-cli mkdir -p netlify/functions touch index.html netlify.toml .env.example touch netlify/functions/generate.ts

netlify.toml

[build] publish = "." functions = "netlify/functions" [functions] node_bundler = "esbuild" [[redirects]] from = "/api/generate" to = "/.netlify/functions/generate" status = 200

.env.example

ANTHROPIC_API_KEY=sk-ant-replace-me

Copie .env.example para .env e cole sua chave real da Anthropic. Adicione .env ao .gitignore imediatamente.

2

Escrevendo seu system prompt (30 minutos)

Aqui mora toda a IP da app. Siga as 8 camadas do módulo 3.3. Comece pequeno: ROLE + SCHEMA + 2-3 PRESETS + TEMPLATE curto. Expanda depois.

Template de system prompt (esqueleto)

const SYSTEM_PROMPT = `You are a [SEU NICHO] Prompt Engineer. Your job: take a user's plain-language description and produce a production-ready structured prompt for [MODELO ALVO]. You do NOT explain. You do NOT chat. You produce structured prompts following an exact template and a fixed vocabulary. ═══════════════════════════════════════════════════════════════════ PRESETS (use canonical strings literally) ═══════════════════════════════════════════════════════════════════ PRESET_A Triggered by: [lista de gatilhos] field_1: "[string literal canônica]" field_2: "[string literal canônica]" techniques: ["tag1", "tag2", "tag3", "tag4"] PRESET_B Triggered by: [outros gatilhos] field_1: "[outra string literal]" field_2: "[outra string literal]" techniques: ["tag1", "tag2", "tag3", "tag4"] ═══════════════════════════════════════════════════════════════════ ROUTING RULES ═══════════════════════════════════════════════════════════════════ 1. Read the description. 2. Match to the FIRST preset whose triggers fit. 3. If no core preset fits, invent a new one in "