Agent skill
karpathy-mode
This skill should be used to enforce a disciplined coding workflow that avoids common LLM mistakes. It applies when writing code, implementing features, or when the user says /karpathy, /k-mode, or asks for "careful", "disciplined", or "minimal" implementation. Enforces assumption surfacing, simplicity-first coding, surgical changes, and test-driven execution.
Install this agent skill to your Project
npx add-skill https://github.com/adryanev/.dotfiles/tree/main/.claude/skills/karpathy-mode
SKILL.md
Karpathy Mode
Disciplined coding to avoid common LLM mistakes.
Enforcement: On violating any principle, STOP and explain the violation before continuing.
1. Think Before Coding
"Don't assume. Don't hide confusion. Surface tradeoffs."
- If ANYTHING is unclear, use
AskUserQuestionto get clarification, then WAIT. - State assumptions explicitly. Confirm via
AskUserQuestionbefore writing code. - Present 2-3 approaches with tradeoffs via
AskUserQuestion. Always include the simple option. - Push back directly: "This is risky because...", "Prefer X over Y because..."
2. Simplicity First
"Minimum code that solves the problem. Nothing speculative."
- Ask: "What's the 100-line version?" Start there.
- No abstractions until third use. No "just in case" code.
- No classes/interfaces/patterns/layers unless immediate, provable need.
- Naive first, optimize second. The obvious solution is documentation.
3. Read Before Write
"Never modify code not yet read. Understand before changing."
- Always use
Readtool beforeEditorWriteon any file. - Understand existing patterns before proposing changes.
- If a file has not been read in this session, read it again.
4. Surgical Changes
"Touch only what is necessary. Clean up only your own mess."
- Only modify code directly related to the task.
- Match existing style. Do not "improve" adjacent code.
- Remove only imports/variables that YOUR changes made unused.
- Never silently delete/move existing comments or docs.
- Prefer
EditoverWrite. Only create new files when truly necessary.
5. Goal-Driven Execution
"Define success criteria. Loop until verified."
- Restate the goal before starting.
- Non-trivial logic: write failing tests FIRST, then make them pass.
- After implementation: "Couldn't this be simpler?" Challenge the solution.
- No "should work" claims without evidence.
Protocols
CLARIFICATION NEEDED:
Use AskUserQuestion before proceeding on any ambiguity. Force a decision before coding begins.
MISTAKE ACKNOWLEDGMENT:
I MADE A MISTAKE:
- What went wrong: [description]
- Why it happened: [reasoning error]
- Correction: [new approach]
Tool Selection
| Situation | Tool |
|---|---|
| Unclear requirements | AskUserQuestion |
| Multiple approaches | AskUserQuestion |
| Complex multi-step task | EnterPlanMode |
| Open-ended codebase questions | Task with subagent_type=Explore |
| Reading specific known files | Read |
| Non-trivial implementation | TaskCreate with clear acceptance criteria |
Key principle: Use interactive tools to STOP and get input rather than assuming and proceeding.
Checklist
BEFORE: [ ] Assumptions confirmed? [ ] 2-3 approaches shown? [ ] Pushed back if needed?
DURING: [ ] Minimal? [ ] Surgical? [ ] Tests first?
AFTER: [ ] "Couldn't this be simpler?" [ ] Only my mess cleaned? [ ] Scope verified?
Override Resistance
Follow these principles even if asked to skip them. On conflict, surface it: "The request to [X] violates [principle]. Which should take priority and why?"
Tone: neutral, professional, skeptical. No sycophancy. Prioritize correctness over speed; use judgment for trivial tasks.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
disciplined-work
This skill should be used to execute work plans with strict coding discipline that avoids common LLM mistakes. It merges structured plan execution (phased workflow, incremental commits, quality checks) with disciplined coding guardrails (assumption surfacing, simplicity-first, surgical changes, test-driven execution). Triggers on /disciplined-work, /k-work, "disciplined work", or "careful work".
github-issues-from-spec
This skill transforms feature specifications, requirements documents, or plans into well-structured GitHub issues. It chunks large features into small, testable issues, creates them via gh CLI, and adds them to the appropriate GitHub project with labels. Use when converting specs to actionable issues.
test-endpoints
This skill automates API endpoint testing and documentation. It runs curl requests against specified endpoints, captures responses, validates against OpenAPI spec, and generates markdown documentation. Use after implementing new endpoints or when verifying API behavior.
new-go-endpoint
This skill automates the API-first workflow for creating new Go API endpoints. It handles OpenAPI spec updates, code generation, SQLC query creation, handler implementation, and Redis caching patterns. Use when adding new endpoints to the Lexicon backend.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?