feat(skill): integrate Karpathy behavioral guidelines into every CLAUDE.md (#25)

This commit is contained in:
Alireza Rezvani
2026-05-19 01:55:12 +02:00
committed by GitHub
parent e7512689c1
commit ffff0fc4c3
9 changed files with 233 additions and 1 deletions
+33
View File
@@ -352,6 +352,12 @@ class TemplateSelector:
lines.extend(self._generate_core_principles(template))
lines.append("")
# Add behavioral guidelines (Karpathy principles) - applied to every project
lines.append("## Behavioral Guidelines")
lines.append("")
lines.extend(self._generate_karpathy_guidelines())
lines.append("")
# Add tech stack section
if self.tech_stack:
lines.append("## Tech Stack")
@@ -437,6 +443,33 @@ class TemplateSelector:
return lines
def _generate_karpathy_guidelines(self) -> List[str]:
"""Emit the embedded Karpathy guidelines section.
Distilled summary intended for every generated CLAUDE.md. Full skill
text lives in the ``karpathy-guidelines`` skill installed alongside
ClaudeForge.
"""
return [
"Behavioral guardrails applied to every coding, review, and refactoring task.",
"Full skill: `~/.claude/skills/karpathy-guidelines/SKILL.md`.",
"",
"1. **Think before coding.** State load-bearing assumptions; if a request "
"has multiple reasonable interpretations, surface them instead of picking "
"silently. Stop and ask when something is genuinely unclear.",
"2. **Simplicity first.** Write the minimum code that solves the stated "
"problem. No speculative abstractions, no unrequested configuration, no "
"error handling for conditions that cannot occur. If the first draft is "
"much larger than necessary, rewrite before shipping.",
"3. **Surgical changes.** Touch only what the task requires. Do not "
"opportunistically reformat or refactor adjacent code, and match the "
"surrounding style. Every changed line should trace directly to the "
"user's request.",
"4. **Goal-driven execution.** Convert vague requests into verifiable "
"success criteria before coding (e.g. failing test first), and state a "
"step-by-step plan with per-step verification for multi-step work.",
]
def _generate_workflow_section(self) -> List[str]:
"""Generate workflow section based on specified workflows."""
lines = []