code-generation-standards

A set of code-generation rules for several programming languages that checks for unfinished placeholders, empty stub functions, always-false conditions, and unsuitable debug output.

In plain words
What is it for?
Use it while generating or reviewing PHP, JavaScript, TypeScript, Vue, JSX, TSX, Python, Ruby, and Java files.
Why use it?
Generated code may look complete while still containing temporary or non-working parts. These checks flag common signs that implementation is incomplete or not ready to integrate.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/ivangrynenko/cursorrules/code-generation-standards
Clone the repo
git clone --depth 1 https://github.com/ivangrynenko/cursorrules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 716 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00716
Opus 5 $0.00000 $0.00358
Sonnet 5 $0.00000 $0.00143
Haiku 4.5 $0.00000 $0.00072

Measured yesterday against content hash e90556ea7d40, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-generation-standards scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/code-generation-standards.mdc · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Enhanced Code Generation Standards

Ensures high-quality, executable code generation adhering to best practices across multiple programming languages.

Rule Details

  • Name: enhanced_code_generation_standards

  • Description: Enforce standards for code generation ensuring high quality and integration readiness

Filters

  • file extension pattern: "\\.(php|js|ts|vue|jsx|tsx|py|rb|java)$" # Expanded to include Ruby and Java

Enforcement Checks

  • Conditions:
    • pattern // TODO:|#\\s*TODO: – Replace TODOs with actual implementation - no placeholders allowed.
    • pattern function\\s+\\w+\\s*\\([^)]*\\)\\s*\\{\\s*(?:return\\s+null|throw\\s+new\\s+Error|console\\.log)\\s*\\} – Implement full functionality - no stub methods.
    • pattern \\bif\\b\\s*\\(\\s*false\\s*\\) – Remove or replace conditional statements that are always false.
    • pattern \\bconsole\\.[^(]+|print\\s*\\( – negated DEBUG|LOGGING – Remove debug logging unless it's conditional on a debug flag.
    • pattern ^\\s*#\\s*\\w+:\\s*\\w+\\s*$ – In Python, prefer type hints over comments for type annotations.

Suggestions

  • Guidance: Code Generation Best Practices:
  • Executable Solutions: Generate fully functional code, not just skeletons or stubs.
  • Readability:
    • Prioritize code readability, with clear naming conventions and logical structure.
    • Use whitespace effectively to enhance code clarity.
  • Error Handling:
    • Implement comprehensive error handling with appropriate exceptions or error codes.
    • Consider edge cases and provide meaningful error messages.
  • Imports/Dependencies:
    • Include all necessary imports or require statements at the beginning of the file.
    • Manage dependencies to ensure the code is self-contained or clearly documented for setup.
  • Integration:
    • Code should be immediately usable within the project's existing framework or technology stack.
    • Ensure compatibility with existing patterns or libraries used in the project.
  • Formatting:
    • Adhere to the project's coding style guide (e.g., Prettier, Black for Python, etc.).
    • Use linters and formatters to maintain consistent code style.
  • Testing:
    • Include unit or integration tests where applicable to validate generated code.
    • Encourage test-driven development if part of the project's culture.
  • Documentation:
    • Provide inline comments for complex logic or algorithms.
    • Write docstrings or JSDoc for functions, classes, and modules to describe usage, parameters, and return values.
    • Consider generating external documentation if the project uses tools like Swagger for APIs or Sphinx for Python.
  • Security:
    • Avoid hardcoded credentials or sensitive information.
    • Follow security best practices for the language (e.g., SQL injection prevention in PHP, XSS in JavaScript).
  • Performance: While readability takes precedence, be mindful of performance implications of the generated code.

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 60 lines · 716 tokens per session scan A e90556ea7d40

Subscribe to this mod's changes

code-generation-standards is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (87 stars, last pushed 10mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 716 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.