karpathy-manning-dtnorris-guidelines
Skill1 starsChanged 16 days agoMITView on GitHub
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria. This edition includes modifications by jmanning for code documentation practices.
In this repository2 other files it gives its agents.
- agentic-task-planningSkill
- agent-managerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 23 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
If multiple interpretations exist, present them - don't pick silently.
- Distinctive: line 24
If a simpler approach exists, say so.
- Distinctive: line 25
If something is unclear, stop.
- Distinctive: line 31
No features beyond what was asked.
- Distinctive: line 32
No abstractions for single-use code, unless the code is difficult to understand, and needs clear documentation.
- Distinctive: line 35
No error handling for impossible scenarios.
- Distinctive: line 36
If you write 200 lines and it could be 50, rewrite it.
- Distinctive: line 38
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
- Distinctive: line 50
Every class and function should have a doc-string describing the use case, expected inputs, return values, and exceptions that could be …
- Distinctive: line 52
Use single character variables only within one-line iterables.
- Distinctive: line 54
Ask yourself: "Would a senior engineer understand each function on its own?" If no, clarify documentation and labels.
- Distinctive: line 61
When editing existing code:
- Distinctive: line 62
Don't "improve" adjacent code, comments, or formatting.
- Distinctive: line 63
Don't refactor things that aren't broken.
- Distinctive: line 65
If you notice unrelated dead code, mention it - don't delete it.
- Distinctive: line 67
When your changes create orphans:
- Very specific: line 68
Remove imports/variables/functions that YOUR changes made unused.
- Distinctive: line 69
Don't remove pre-existing dead code unless asked.
- Distinctive: line 94
Before expanding work or introducing dependencies, identify the original acceptance criteria, what existing evidence establishes, and the …
- Distinctive: line 96
Prefer the smallest in-scope repair.
- Distinctive: line 102
Before editing, verify the authorized execution root/realpath, origin, actual HEAD, index, source bytes, ownership and bound input …
- Distinctive: line 106
Before applying a patch or handoff, verify and disclose the actual target checkout and current branch.
- Distinctive: line 108
Use an explicitly selected feature/review branch unless the operator explicitly chooses another branch, including main.
- Distinctive: line 123
Before integration/delivery, reconcile against the actual target and rerun affected composed acceptance.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
Tradeoff: These guidelines bias toward caution over speed. For trivial tasks, use judgment.
1. Think Before Coding
Don't assume. Don't hide confusion. Surface tradeoffs.
Before implementing:
- State your assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them - don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.
2. Simplicity First
Minimum code that solves the problem. Nothing speculative.
- No features beyond what was asked.
- No abstractions for single-use code, unless the code is difficult to understand, and needs clear documentation.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
3. Document everything
Self-documenting code. Doc-strings for every class and function. Simple taxonomy without requiring additional context
- Labels in code should be readable to someone reviewing the code without context.
- Minimize internal taxonomy, preferring language understandable in the context of the requirements and design.
- Every class and function should have a doc-string describing the use case, expected inputs, return values, and exceptions that could be raised.
- Use single character variables only within one-line iterables.
Ask yourself: "Would a senior engineer understand each function on its own?" If no, clarify documentation and labels.
4. Surgical Changes
Touch only what you must. Clean up only your own mess.
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it - don't delete it.
When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.
The test: Every changed line should trace directly to the user's request.
5. Goal-Driven Execution
Define success criteria. Loop until verified.
Transform tasks into verifiable goals:
- "Add validation" → "Write tests for invalid inputs, then make them pass"
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
- "Refactor X" → "Ensure tests pass before and after"
For multi-step tasks, state a brief plan: ```
- [Step] → verify: [check]
- [Step] → verify: [check]
- [Step] → verify: [check] ```
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
6. Outcome-First Execution
Finish the original operator-visible outcome, not an expanding collection of related tasks.
- Before expanding work or introducing dependencies, identify the original acceptance criteria, what existing evidence establishes, and the smallest next falsifiable step.
- Distinguish product defects from integration, fixture, environment, instrumentation, and task-management problems. A newly discovered issue belongs on the critical path only when evidence shows it is necessary for safe execution or original acceptance.
- Prefer the smallest in-scope repair. Preserve evidence and report out-of-scope blockers rather than silently expanding authority, dependencies, or acceptance requirements.
- Once the original outcome is verified, stop. Report optional improvements separately rather than implementing them automatically.
- Preserve all required safety, provenance, testing, cost, Git authority, and acceptance constraints. Efficiency never justifies weakening verification.
7. Continue on Verified Isolated Inputs
- Before editing, verify the authorized execution root/realpath, origin, actual HEAD, index, source bytes, ownership and bound input identities. Preserve the exact starting baseline and unrelated changes. A branch name or clean worktree alone does not prove isolation; validate live mutable shared inputs separately.
- Before applying a patch or handoff, verify and disclose the actual target checkout and current branch; do not infer either from the invoking directory. Use an explicitly selected feature/review branch unless the operator explicitly chooses another branch, including main; branch creation or switching still requires authorization.
- Once admitted to verified isolated work with stable bound inputs, continue authorized local implementation, diagnosis, testing and candidate preservation when remote main, a sibling ordinary checkout's local main (even without a push), or an unrelated remote-tracking ref advances. These observations do not change the worker's execution baseline. If final remote lookup is unavailable, report freshness as unknown and continue work supported by verified local inputs.
- Expected worker edits are normal. Inspect unexplained changes to the worker's HEAD, index, source bytes, origin, ownership or bound inputs and stop affected operations. Missing required inputs, real safety/semantic dependencies, revoked authority and explicit task-specific stops still block dependent operations.
- Preserve the complete candidate, original base, hashes, focused evidence and observed drift or lookup limits. Do not silently fetch, rebase, reset or merge. Before integration/delivery, reconcile against the actual target and rerun affected composed acceptance; local completion proves neither current-source eligibility nor final acceptance/publication. Keep host-only gates with their owner and finish at the authorized milestone when complete.
These guidelines are working if: fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, fewer contextual labels are used, and clarifying questions come before implementation rather than after mistakes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

