Skip to content

[WIP] Your task is to "onboard" this repository to Copilot coding agent by adding a .github/copilot-instructions.md file in the repository that contains information describing how a coding agent seeing it for the first time can work most efficiently. You wi... - #16

Closed
Rushaway with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-a287fe5e-5e8a-49b3-b91e-ee3b74be74df

Conversation

Copilot AI commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original description:

Your task is to "onboard" this repository to Copilot coding agent by adding a .github/copilot-instructions.md file in the repository that contains information describing how a coding agent seeing it for the first time can work most efficiently.

You will do this task only one time per repository and doing a good job can SIGNIFICANTLY improve the quality of the agent's work, so take your time, think carefully, and search thoroughly before writing the instructions.

SourcePawn Plugin Development Guidelines

Repository Overview

This repository contains SourcePawn plugins for SourceMod, a scripting platform for Source engine games. These plugins extend game functionality through the SourceMod API, providing additional features and customizations for Source-based game servers.

Technical Environment

  • Language: SourcePawn
  • Platform: SourceMod 1.12+ (latest stable release)
  • Compiler: Latest compatible SourcePawn compiler
  • Build Tools: SourceMod compiler (spcomp)

Code Style & Standards

  • Indentation with tabs: 4 spaces
  • Follow camelCase for local variables and function parameters
  • Use PascalCase for function names and global variables
  • Prefix global variables with "g_"
  • Use descriptive variable and function names
  • Delete trailing spaces
  • Use #pragma semicolon 1 and #pragma newdecls required

Documentation Requirements

  • Do not create an header or un-necessary comments/description for the plugin
  • Document all native functions (*.inc file) with description, parameters, and return values
  • Include comments for complex logic sections

Best Practices

  • Properly handle memory allocation and deallocation
  • Use StringMap/ArrayList instead of arrays where appropriate
  • Implement error handling for all API calls
  • Use translation files for all user-facing messages
  • Follow SourceMod's event-based programming model
  • Avoid hardcoded values; use configuration files where possible
  • Use methodmap for native functions
  • All SQL queries must be asynchronous (use methodmap)
  • No need to check for null when using delete
  • Use delete for closehandle / set it to null
  • Never use .Clear() for StringMap/ArrayList as they create memory leaks; use delete instead and create a new one
  • Use transactions in SQL when needed
  • Use delete directly without checking if it's null before delete

Project Structure

  • Implement OnPluginStart() for initialization
  • Implement OnPluginEnd() for cleanup if necessary
  • Register commands with proper descriptions and permissions
  • Use modules/includes for shared functionality
  • Organize files in standard SourceMod directory structure:
    • addons/sourcemod/scripting - Source code (.sp files)
    • addons/sourcemod/translations - Language files
    • addons/sourcemod/configs - Configuration files
    • addons/sourcemod/gamedata - Game signatures and offsets

Build & Validation Process

  • Compile plugins using the SourceMod compiler (spcomp)
  • Test plugins on a development server before deployment
  • Check for memory leaks using SourceMod's built-in profiler
  • Validate SQL queries (all must be async + escape strings + check for SQL injection)
  • Ensure compatibility with the minimum required SourceMod version (1.12+)

Version Control

  • Use semantic versioning (MAJOR.MINOR.PATCH)
  • Commit messages should clearly describe changes
  • Keep plugin versions synchronized with repository tags

Performance Considerations

  • Minimize use of timers where possible
  • Be mindful of operations in frequently called functions
  • Cache results of expensive operations
  • Always try to improve complexity from O(n) to O(1)
  • Avoid unnecessary loops and string operations in frequently called functions
  • Consider the impact of your code on server tick rate

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

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.

2 participants