karpathy-guidelines

Guide code writing and review to reduce LLM-induced errors.

Updated Dec 22, 2024
One-click install
npx skills add https://github.com/lvstb/nix-config --skill karpathy-guidelines-lvstb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: karpathy-guidelines
Source: https://github.com/lvstb/nix-config/tree/main/home/opencode/skills/karpathy-guidelines
Command: npx skills add https://github.com/lvstb/nix-config --skill karpathy-guidelines-lvstb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers and AI assistants avoid common pitfalls in code generation and modification, leading to more robust, simpler, and maintainable software.

Core Features & Use Cases

  • Promotes thoughtful design: Encourages stating assumptions and considering tradeoffs before coding.
  • Enforces simplicity: Guides against over-engineering and unnecessary complexity.
  • Ensures surgical changes: Minimizes unintended side effects when modifying existing code.
  • Drives goal-oriented development: Emphasizes defining clear success criteria for tasks.
  • Use Case: When an LLM is asked to refactor a piece of code, these guidelines ensure it only touches what's necessary and doesn't introduce new issues.

Quick Start

Apply the karpathy-guidelines skill to ensure all code changes are minimal and well-justified.

Frequently Asked Questions about karpathy-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent LLM coding mistakes when refactoring existing code?

To prevent LLM coding mistakes, apply behavioral guidelines that enforce surgical modifications and pre-coding deliberation. This ensures changes are minimal and well-justified, reducing unintended side effects during refactoring.

What are the best practices for reducing code complexity with AI assistants?

Best practices for reducing code complexity involve enforcing simplicity and avoiding over-engineering. Define clear success criteria and state assumptions beforehand to guide goal-oriented development and maintainable software.

How do I ensure AI-generated code modifications are surgical?

To ensure surgical code modifications, establish guidelines that minimize unintended side effects. Focus on touching only what is necessary and justifying every change against predefined goals.

Why should I state assumptions before writing code with an LLM?

Stating assumptions before writing code promotes thoughtful design and considers tradeoffs early. This pre-coding deliberation mitigates common LLM-induced errors by anchoring generation on clear requirements.

Can these coding guidelines be applied to human developers as well as AI?

Yes, these coding guidelines apply to both human developers and AI coding assistants. The principles of simplicity, surgical modification, and goal-driven execution improve code quality universally.

What is the best way to define clear success criteria for code generation tasks?

The best way to define success criteria is through goal-oriented development. Establish explicit objectives and expected outcomes before coding to drive focused execution and verify results.