The anatomy of a perfect /goal prompt in Claude Code!
(save for later and use it to reduce token usage)
The way /goal works is that two models run in a loop.
- Sonnet/Opus handles the actual coding.
- After every turn, Haiku reads the full conversation transcript and checks whether completion conditions were met.
- If Haiku says "not yet," Sonnet/Opus starts another turn automatically.
The Haiku evaluator costs almost nothing. But the worker still runs at full Sonnet/Opus rates.
So the condition you write directly controls how many expensive turns Claude takes before the loop terminates.
Anthropic recommends three things in a /goal condition:
- a measurable end state
- a stated check
- and constraints.
They also suggest adding a turn cap.
What the docs don't cover is what happens when any of those pieces are missing.
A vague condition like "make the app production-ready" loops indefinitely because no command output ever proves that claim.
A subjective condition like "complete the migration" lets Claude self-report completion, and Haiku accepts it because the judge only sees the transcript.
The nine-section template in the image expands Anthropic's three-part recommendation into a structured prompt that addresses both failure modes.
โ GOAL defines the objective in a single sentence, eliminating ambiguity.
โ CONTEXT gives Claude the background it needs, so it doesn't waste turns exploring the codebase.
โ CONSTRAINTS set hard scope boundaries.
โ PRIORITY controls execution order so Claude tackles easy wins first.
โ PLAN states the approach explicitly, preventing aimless exploration that burns tokens.
โ DONE WHEN forces a binary, observable outcome like pytest exits 0, not a subjective state like "code quality is improved."
โ VERIFY makes Claude run a specific command whose raw output lands in the transcript, so Haiku judges machine evidence, not self-reports.
โ OUTPUT specifies what Claude should surface when done.
โ STOP RULES cap the downside with a turn limit. Without this, a slightly wrong condition loops forever.
For even stronger guarantees, pair /goal with a Stop hook that runs your test suite or hits a CI endpoint after every turn. That moves verification from the prompt layer to the infrastructure layer, where it's deterministic.
I found this template on findskill(.)ai while researching the perfect way to use /goal command. They don't claim to have created it either, but mentioned it as a community-created template that circulated on X.
____
Find me โ @_avichawla
Every day, I share tutorials and insights on DS, ML, LLMs, and RAGs.
Este repo es una joya: tutoriales crear agentes de IA.
Listos para producciรณn y con casos de uso reales.
Todo el cรณdigo disponible y explica cรณmo desplegarlos:
https://t.co/Bf4WLIdNmM
If you want to boost your software engineering career, star + bookmark these 12 GitHub repos:
1 Vision Agent
โณ https://t.co/M7OIzZVAKA
2 System design
โณ https://t.co/57FAu0f9Oz
3 Public APIs
โณ https://t.co/Ikt9Zyy2m4
4 Tech interview handbook
โณ https://t.co/3ZpaTKgDzE
5 Coding interview university
โณ https://t.co/cQhGu0zI2E
6 Engineering leadership
โณ https://t.co/i7vTHC5Foz
7 Freecodecamp
โณ https://t.co/HbP9utSuZE
8 Developer roadmaps
โณ https://t.co/RXQVuYKr8z
9 Path to senior engineer handbook
โณ https://t.co/X4kepQW20p
10 Free programming books
โณ https://t.co/WuauWJKWQ6
11 Build your own x
โณ https://t.co/gW3qDjnCxa
12 Awesome lists
โณ https://t.co/fdOmRT2iLF
Remember, star + bookmark these repos right now.
(What else would you add?)
โโ
๐พ Save this for later & RT to help others become good software engineers.
๐ค Follow @systemdesignone + turn on notifications.
If you want to get started with SYSTEM DESIGN (in 2026), learn these 20 concepts:
1 How Idempotent API Works
โณ https://t.co/afe7ACuSYE
2 Saga Design Pattern
โณ https://t.co/2CffTodOHL
3 Redis Use Cases
โณ https://t.co/hZ571ruVeA
4 How JWT Works
โณ https://t.co/SZXXrlBsWH
5 How RPC Actually Works
โณ https://t.co/yeIgcmAxQx
6 How Consistent Hashing Works
โณ https://t.co/7d6EipPcKF
7 How Service Discovery Works
โณ https://t.co/BcL3tgxx1u
8 Monolith vs Microservices Architecture
โณ https://t.co/KwVAEGVkA9
9 What Happens When You Type a URL Into Your Browser
โณ https://t.co/P3SiURMFlW
10 Microservices Lessons From Netflix
โณ https://t.co/XgS7VQoBFv
11 Frontend System Design 101
โณ https://t.co/ViPOQrLZzA
12 How Websockets Work
โณ https://t.co/JfT6mj4mrv
13 How Bloom Filters Work
โณ https://t.co/ntZXq7LxVn
14 How Databases Keep Passwords Securely
โณ https://t.co/KSfIhpAT2j
15 How Does HTTPS Work
โณ https://t.co/r5rUtVpw0O
16 Modular Monolith Architecture
โณ https://t.co/VVV6v3KGHJ
17 API Design Best Practices
โณ https://t.co/I2ejJ0kbYq
18 How DNS Works
โณ https://t.co/H7hcZnws8N
19 System Design 101
โณ https://t.co/DgL8xz0KTQ
20 API Versioning - A Deep Dive
โณ https://t.co/OHAtKSUgVN
(What else should make this list?)
โโ
๐ PS - Want my System Design Playbook for FREE?
Join my newsletter with 200K+ software engineers:
โ https://t.co/ByOFTtOihX
โโโ
๐พ Save this for later, and RT to help others learn system design.
๐ค Follow @systemdesignone + turn on notifications.
LLM fine-tuning techniques I'd learn if I were to customize them:
Bookmark this.
1. LoRA
2. QLoRA
3. Prefix Tuning
4. Adapter Tuning
5. Instruction Tuning
6. P-Tuning
7. BitFit
8. Soft Prompts
9. RLHF
10. RLAIF
11. DPO (Direct Preference Optimization)
12. GRPO (Group Relative Policy Optimization)
13. RLAIF (RL with AI Feedback)
14. Multi-Task Fine-Tuning
15. Federated Fine-Tuning
My favourite is GRPO for building reasoning models. What about you?
I've shared my full tutorial on GRPO in the replies.
A senior Google engineer just dropped a 400-page free book on Agentic Design Patterns (Google Docs).
Table of contents looks wild:
โข Advanced Prompt Techniques
โข Multi-Agent Patterns
โข Everything you need to know about agents + code
Reply send and repost, and I will dm it.
Deploy AI apps by just adding a Python decorator (open-source)!
Beam is an open-source alternative to Modal for deploying serverless AI workloads.
Simply uv add beam-client, add a decorator, and turn any workflow into a serverless endpoint!
RAG is not Memory for AI Agents.
5 AI memory engines to build agents that maintain long-term context and learn continuously:
(Last 2 released just this month)
1. Zep builds and queries temporally-aware knowledge graphs that evolve with every interaction.
100% Opensource.
voyage-context-3 embedding model by @MongoDB solves this.
It is a contextualized chunk embedding model that produces vectors for chunks that capture the full document context without any manual metadata and context augmentation.
Check this visual ๐
I finally understand how large language models actually work
After reading the 2025 textbook โFoundations of LLMsโ
It blew my mind and cleared up years of confusion
Hereโs everything i learned (in plain english):
Make Claude Code 10x more powerful!
Code Context is an MCP plugin that brings semantic code search to Claude Code, Gemini CLI, or any AI coding agent.
Full codebase indexing means richer context and better code generation.
100% open-source.
Building a ๐ฝ๐ฟ๐ผ๐ฑ๐๐ฐ๐๐ถ๐ผ๐ป ๐ด๐ฟ๐ฎ๐ฑ๐ฒ ๐ฅ๐ฒ๐๐ฟ๐ถ๐ฒ๐๐ฎ๐น ๐๐๐ด๐บ๐ฒ๐ป๐๐ฒ๐ฑ ๐๐ฒ๐ป๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป (๐ฅ๐๐) ๐ฏ๐ฎ๐๐ฒ๐ฑ ๐๐ ๐๐๐๐๐ฒ๐บ is a difficult task. Don't miss the ๐) and read until the end to understand why ๐
Here are some of the moving parts in the RAG based systems that you will need to take care of and continuously tune in order to achieve desired results:
๐ฅ๐ฒ๐๐ฟ๐ถ๐ฒ๐๐ฎ๐น:
๐ ) Chunking - how do you chunk the data that you will use for external context.
- Small, Large chunks.
- Sliding or tumbling window for chunking.
- Retrieve parent or linked chunks when searching or just use originally retrieved data.
๐ ) Choosing the embedding model to embed and query and external context to/from the latent space. Considering Contextual embeddings.
๐ ) Vector Database.
- Which Database to choose.
- Where to host.
- What metadata to store together with embeddings.
- Indexing strategy.
๐ ) Vector Search
- Choice of similarity measure.
- Choosing the query path - metadata first vs. ANN first.
- Hybrid search.
๐ ) Heuristics - business rules applied to your retrieval procedure.
- Time importance.
- Reranking.
- Duplicate context (diversity ranking).
- Source retrieval.
- Conditional document preprocessing.
๐๐ฒ๐ป๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป:
๐ ) LLM - Choosing the right Large Language Model to power your application.
โ It is becoming less of a headache the further we are into the LLM craze. The performance of available LLMs are converging, both open source and proprietary. The main choice nowadays is around using a proprietary model or self-hosting.
๐ ) Prompt Engineering - having context available for usage in your prompts does not free you from the hard work of engineering the prompts. You will still need to align the system to produce outputs that you desire and prevent jailbreak scenarios.
And letโs not forget the less popular part:
๐) Observing, Evaluating, Monitoring and Securing your application in production!
What other pieces of the system am I missing? Let me know in the comments ๐
#LLM #AI #MachineLearning
Boost your testing game with GitHub Copilot! Learn tips and see examples on how to generate unit tests efficiently using AI. #GitHubCopilot#UnitTesting#AI
https://t.co/JzKX7tJ4UA