Skip to content

Modify AI code prompt to not include comments and logging statements#1178

Merged
ravikiranvm merged 2 commits into
mainfrom
ops-2328
Aug 22, 2025
Merged

Modify AI code prompt to not include comments and logging statements#1178
ravikiranvm merged 2 commits into
mainfrom
ops-2328

Conversation

@ravikiranvm

@ravikiranvm ravikiranvm commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

Fixes OPS-2328.

Additional Notes

I've tried to put it under Code Quality Requirements as Clean: Generate code without any comments or logging statements. But LLM didn't always follow these instructions. So I put them under FORBIDDEN

After changes to the prompt

Screenshot 2025-08-21 at 4 27 12 PM

Before making changes to the prompt

Screenshot 2025-08-21 at 4 27 53 PM

@linear

linear Bot commented Aug 21, 2025

Copy link
Copy Markdown

@ravikiranvm
ravikiranvm marked this pull request as ready for review August 21, 2025 11:03
Copilot AI review requested due to automatic review settings August 21, 2025 11:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the AI code generation prompt to explicitly forbid comments and logging statements in generated code. The change moves these restrictions from a quality requirement to the forbidden operations list to ensure better compliance from LLM responses.

  • Adds explicit prohibitions against comments and logging statements in the FORBIDDEN section
  • Removes the instruction to add comments from the Code Quality Requirements section

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ai-prompts/code.txt Outdated
- **NO** file system operations
- **NO** network requests, meaning we can't use libraries that rely on HTTP requests like `aws-sdk`
- **NO** environment variables access
- **NO** comments in the code (do not add inline, block, or documentation comments)

Copilot AI Aug 21, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Prohibiting all comments including documentation comments may reduce code maintainability. Consider allowing documentation comments for public APIs while restricting inline comments.

Suggested change
- **NO** comments in the code (do not add inline, block, or documentation comments)
- **NO** inline or block comments in the code (do not add `//` or `/* ... */` comments)

Copilot uses AI. Check for mistakes.
Comment thread ai-prompts/code.txt Outdated
- **NO** file system operations
- **NO** network requests, meaning we can't use libraries that rely on HTTP requests like `aws-sdk`
- **NO** environment variables access
- **NO** comments in the code (do not add inline, block, or documentation comments)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add to both "unless explicitly requested by the user"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@bigfluffycookie bigfluffycookie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, besides ritas comment.

@sonarqubecloud

Copy link
Copy Markdown

@ravikiranvm
ravikiranvm merged commit 1c1f784 into main Aug 22, 2025
19 checks passed
@ravikiranvm
ravikiranvm deleted the ops-2328 branch August 22, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants