agentleFS
tyecodetyecode/skills/.cursor/rules/karpathy-guidelines.mdc

skills / rules

Cursor rule0 starsChanged 3 months agoMITView on GitHub

Tyecode's coding guidelines — think before coding, simplicity, security, and surgical changes.

The file

Show its rules and text

We split this karpathy-guidelines.mdc into the rules it gives an agent

27 rules. About 0 are common, 22 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈22

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't assume. Don't hide confusion.

    line 12
  2. Distinctive:

    If something is unclear, stop and ask.

    line 14
  3. Distinctive:

    No features beyond what was asked.

    line 20
  4. Distinctive:

    No abstractions for single-use code.

    line 21
  5. Distinctive:

    If 200 lines could be 50, rewrite it.

    line 23
  6. Distinctive:

    Don't "improve" adjacent code, comments, or formatting.

    line 28
  7. Distinctive:

    Don't refactor things that aren't broken.

    line 29
  8. Distinctive:

    Remove imports YOUR changes made unused.

    line 31
  9. Distinctive:

    Use strict mode always

    line 46
  10. Very specific:

    Prefer const over let, avoid var

    line 47
  11. Distinctive:

    Use meaningful variable names

    line 48
  12. Very specific:

    Use unknown instead of any

    line 49
  13. Distinctive:

    Use functional components with hooks

    line 54
  14. Distinctive:

    Keep components small and focused

    line 55
  15. Distinctive:

    Use composition over prop drilling

    line 56
  16. Very specific:

    Use conventional commits: feat:, fix:, docs:, refactor:, test:

    line 61
  17. Distinctive:

    Never commit directly to main

    line 63
  18. Very specific:

    Use specific error types, not generic new Error('something went wrong')

    line 72
  19. Distinctive:

    Write a failing test before fixing any bug

    line 79
  20. Distinctive:

    Test behavior, not implementation

    line 80
  21. Distinctive:

    Keep tests fast and isolated

    line 81
  22. Very specific:

    Use descriptive test names: it('returns null when user is not found')

    line 82
  23. Distinctive:

    Before marking any feature complete that touches user input, auth, or data:

    line 88
  24. Distinctive:

    Use parameterized queries — never concatenate user input into SQL

    line 91
  25. Distinctive:

    Check authorization on every protected route (not just authentication)

    line 92
  26. Distinctive:

    Never log passwords, tokens, API keys, or PII

    line 93
  27. Distinctive:

    Never hardcode secrets — use environment variables

    line 94

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
karpathy-guidelines.mdc
---
description: Tyecode's coding guidelines — think before coding, simplicity, security, and surgical changes.
alwaysApply: true
---

# Tyecode's Coding Guidelines

## Core Principles

### 1. Think Before Coding

- Don't assume. Don't hide confusion.
- State assumptions explicitly. If uncertain, ask.
- If something is unclear, stop and ask.
- Present multiple interpretations if ambiguity exists.

### 2. Simplicity First

- Minimum code that solves the problem.
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" that wasn't requested.
- If 200 lines could be 50, rewrite it.

### 3. Surgical Changes

- Touch only what you must.
- 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.
- Remove imports YOUR changes made unused.

### 4. Goal-Driven Execution

- Define success criteria before starting.
- "Add validation" → "Write tests, then make them pass"
- "Fix the bug" → "Write test that reproduces it, then fix"
- For multi-step tasks: state a plan with verification steps.

---

## Code Style

### TypeScript / JavaScript

- Use strict mode always
- Prefer `const` over `let`, avoid `var`
- Use meaningful variable names
- Use `unknown` instead of `any`
- No `as` casts inside business logic — fix the types instead

### React

- Use functional components with hooks
- Keep components small and focused
- Use composition over prop drilling
- Extract reusable logic into custom hooks

### Git

- Use conventional commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:`
- One logical change per commit
- Never commit directly to `main`
- Branch naming: `feature/description` or `fix/description`

---

## Error Handling

- Handle errors explicitly — never silently catch
- Return errors, don't throw unless truly exceptional
- Use specific error types, not generic `new Error('something went wrong')`
- Log errors with context, never swallow them

---

## Testing

- Write a failing test before fixing any bug
- Test behavior, not implementation
- Keep tests fast and isolated
- Use descriptive test names: `it('returns null when user is not found')`

---

## Security

Before marking any feature complete that touches user input, auth, or data:

- Validate all input at the boundary — never trust user data
- Use parameterized queries — never concatenate user input into SQL
- Check authorization on every protected route (not just authentication)
- Never log passwords, tokens, API keys, or PII
- Never hardcode secrets — use environment variables
- Return generic error messages to clients — never expose stack traces
- Rate limit public API endpoints

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.