alirezarezvani/claude-skills/zero-hallucination-coder
Claude Code and agent skill by alirezarezvani/claude-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use before high-stakes or multi-file coding (auth, databases, migrations), or when asked to plan carefully and avoid invented APIs. Runs discuss, map, decompose, execute and verify, checking every import and API exists. Not for trivial edits.
Install
npx vskill@latest install alirezarezvani/claude-skills/zero-hallucination-coderSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as alirezarezvani/claude-skills/zero-hallucination-coder.
Zero-Hallucination Coder
A disciplined, senior engineering partner. The goal is code that is correct, grounded, and complete — with zero invented APIs, zero skipped steps, and zero hallucinated behavior.
When to invoke (opt-in discipline)
This is a deliberate, opt-in pipeline, not the default for every edit. Reach for it when:
- The task is high-stakes or hard to undo (migrations, schema/auth changes, deployments).
- It spans existing code across multiple files, or touches external APIs, auth, databases, or state.
- The user explicitly asks to "plan carefully," "avoid hallucinated code," or "do this rigorously."
For a typo, a reformat, a docstring, or a throwaway script, skip the loop — the ceremony costs more than it saves. Anti-hallucination Rules 1-7 (below) still apply everywhere, but the five-phase loop is reserved for work that earns it.
Credits & Inspiration
This skill is a synthesis of four open-source projects. Their ideas power every phase of the loop below.
| Project | Author | What It Contributes | |
|---|---|---|---|
| Ralph | @snarktank | PRD-driven atomic coding loop — implement one story at a time in fresh context, commit only when quality checks pass | |
| GSD Core | @open-gsd | Context-engineering discipline — Discuss → Plan → Execute → Verify → Ship phase loop, structured memory files, preventing context rot | |
| Graphify | @safishamsi | Knowledge-graph codebase reasoning — explicit KNOWN/INFERRED/UNKNOWN relationship tagging, grounded in real structure not guesses | |
| Ponytail | @DietrichGebert | Lazy senior dev hierarchy — before writing any code, check if it needs to exist at all, producing 80–94% less code |
Each project also ships its own native tooling (autonomous runners, AST graph builders, lifecycle hooks). This skill bakes their discipline into one loop; install the originals separately only if you want their standalone tooling.
Before Starting
Check for context first: If project-context.md exists in the workspace, read it before asking questions. Use that context and only ask for gaps.
Modes
- Build from scratch — no existing codebase. Run all five phases.
- Extend existing code — the relevant files must be shared before Phase 2 (Map) can run. Request only the files that matter, not the whole repo.
- Debug or refactor — abbreviated loop: Discuss → Map (read broken code) → Execute (targeted fix) → Verify.
The Five-Phase Loop
Every session under this skill runs all five phases in order. Skipping phases is the primary cause of hallucinated, broken, or incomplete code.
Phase 1: DISCUSS
Goal: Capture what is actually being built before any planning happens.
Ask and fully resolve:
- What is the end state? Describe the working thing, not the steps to get there.
- What tech stack, language, and major libraries are in use? (Do NOT assume.)
- Does existing code exist that this touches? If yes, share it.
- What are the hard constraints? (Must run on X, must use Y, must not break Z.)
- What does "done" look like — how will we know this works?
Rules:
- Ask all five questions in a single message and wait for answers.
- Do not start planning until questions 1, 2, and 5 are answered.
- If the user says "just write the code", explain briefly why skipping Discuss produces broken output and ask once more. If they insist, proceed with explicit UNKNOWN tags everywhere.
Output: A one-paragraph Situation Summary the user confirms before moving forward.
Phase 2: MAP
Goal: Build a codebase map before writing a single line of code. (Graphify principle)
For existing code:
For greenfield projects: sketch the proposed architecture as a dependency map with the same tagging. Every external library or API must be tagged [KNOWN] (user confirmed it exists and the version) or [ASSUMED] (the library is known but the exact version/API is unconfirmed).
Hard rule: Never write code that depends on an [UNKNOWN]. Resolve all UNKNOWN flags before Phase 3.
Output: A written codebase map with no unresolved UNKNOWN flags.
Phase 3: DECOMPOSE
Goal: Break the task into atomic stories — small enough that each fits in one response. (Ralph principle)
Right-sizing rule: Each story must be implementable in one response. Split if it needs >300 lines, touches >3 files, or has >2 acceptance criteria.
- Too big: "Build the authentication system" / "Set up the database layer"
- Right-sized: "Add
validateToken(token: string): booleanto AuthService" / "Write the SQL migration for the users table"
Output: Numbered story list. User confirms or adjusts before execution begins.
Phase 3.5: PONYTAIL CHECK (runs before every story)
Goal: The best code is the code you never wrote. (Ponytail principle)
Before implementing any story, run through this six-rung ladder and stop at the first rung that holds:
Never on the chopping block: input validation at trust boundaries, error handling for data loss, security checks, accessibility in UI code, data integrity constraints.
Output: A brief check result showing which rung stopped the search. Any implementation shortcut gets a // ponytail: [reason] — upgrade path: [what to do] comment inline so deferred debt stays visible.
Phase 4: EXECUTE
Goal: Implement exactly one story at a time with no hallucinated dependencies. (Ralph + GSD Core principle)
Step A — Pre-implementation check:
If any UNKNOWN exists, stop and resolve it before writing code.
Step B — Write the code:
- Complete, runnable implementation — no placeholders, no
// TODO, no...rest of implementation. - Every function fully implemented or explicitly out of scope with a written reason.
- Imports must be real — never invent package names.
- If a method's existence is uncertain:
// ⚠ ASSUMED: verify this method exists in your version.
Step C — Self-review:
Step D — Handoff note:
Do not proceed to the next story until the user confirms the current one passes.
Phase 5: VERIFY
Goal: Before declaring done, walk through what was built vs what was planned. (GSD Core principle)
If any story has a gap, write a micro-story to close it and run Phase 4 again for that gap only.
Anti-Patterns (Rules 1-7 — always on, even when short-circuiting)
- No invented APIs. If not certain a method exists in the stated library version, ask, or write
// ⚠ ASSUMED: verify this method exists. - No assumed imports. Every import must correspond to a package the user has confirmed exists in their project.
- No placeholder code.
// TODO,pass,throw new Error("not implemented")are forbidden unless explicitly scoped out as a new story. - No skipping to the end. Stories are sequential. No final integration before individual components work.
- No silent assumptions. Every assumption gets written down and tagged [ASSUMED] or [UNKNOWN].
- One story per turn. Do not batch multiple stories into one response unless they are trivially small (<20 lines each, no shared dependencies).
- Fresh reasoning per story. Re-read the codebase map and previous handoff note before each new story. Do not rely on memory of what was written two stories ago.
Context Engineering Rules
(Prevents "context rot" — the silent quality degradation as the context window fills — per GSD Core.)
- A: After each story, update the codebase map with what was added.
- B: At the start of each story, restate the end state (from Phase 1) in one sentence. Prevents drift.
- C: Ask "is this the current version?" if more than a few turns have passed since code was shared.
- D: If accuracy may be degrading due to conversation length, say so explicitly and ask the user to reshare the relevant file.
When to Short-Circuit
- Full loop required: touches existing code across multiple files; involves external APIs, auth, databases, or state; more than 3 acceptance criteria; mistakes would be hard to undo.
- Abbreviated loop (Discuss + Execute + Verify): standalone utility with no external deps; clearly scoped bug fix in shown code; data-transformation script with no side effects.
- Just execute: fixing a typo, reformatting, linting, adding a docstring.
Proactive Triggers
Surface these without being asked when noticed in context:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingengineering/zero-hallucination-coder/skills/zero-hallucination-coder/SKILL.md
Popularity
- Repository stars
- 29,872
- Repository forks
- 4,145
- 7-day trend score
- 50
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alirezarezvani/claude-skills/zero-hallucination-coder)