awesome-copilot/instructions/coldfusion-cfc.instructions.md
Nathan Stanford Sr 19d9a3f445
Add instructions for ColdFusion cfc and ColdFusion cfm files (#233)
* Add instructions for ColdFusion cfc and cfm files

* Add ColdFusion coding standards for CFC and CFM files

* Update instructions/coldfusion-cfc-instructions.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address Copilot AI review comments

* Fix description formatting in ColdFusion CFC and CFM instructions

* Add ColdFusion coding standards for CFC and CFM files

* Add ColdFusion coding standards for CFC and CFM files to README instructions

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: = <=>
2025-09-11 10:18:30 +10:00

31 lines
1.4 KiB
Markdown

---
description: 'ColdFusion Coding Standards for CFC component and application patterns'
applyTo: "**/*.cfc"
---
# ColdFusion Coding Standards for CFC Files
- Use CFScript where possible for cleaner syntax.
- Avoid using deprecated tags and functions.
- Follow consistent naming conventions for variables and components.
- Use `cfqueryparam` to prevent SQL injection.
- Escape CSS hash symbols inside <cfoutput> blocks using ##
# Additional Best Practices
- Use `this` scope for component properties and methods when appropriate.
- Document all functions with purpose, parameters, and return values (use Javadoc or similar style).
- Use access modifiers (`public`, `private`, `package`, `remote`) for functions and variables.
- Prefer dependency injection for component collaboration.
- Avoid business logic in setters/getters; keep them simple.
- Validate and sanitize all input parameters in public/remote methods.
- Use `cftry`/`cfcatch` for error handling within methods as needed.
- Avoid hardcoding configuration or credentials in CFCs.
- Use consistent indentation (2 spaces, as per global standards).
- Group related methods logically within the component.
- Use meaningful, descriptive names for methods and properties.
- Avoid using `cfcomponent` attributes that are deprecated or unnecessary.
- Use ternary operators where possible
- Ensure consistent tab alignment.