diff --git a/instructions/cfc.instructions.md b/instructions/cfc.instructions.md new file mode 100644 index 0000000..812415e --- /dev/null +++ b/instructions/cfc.instructions.md @@ -0,0 +1,30 @@ +--- +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 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 +- Make sure all tabs start and end line up vertically. diff --git a/instructions/coldfusion.instructions.md b/instructions/coldfusion.instructions.md new file mode 100644 index 0000000..e2e9a59 --- /dev/null +++ b/instructions/coldfusion.instructions.md @@ -0,0 +1,28 @@ +--- +description: "ColdFusion cfm files and application patterns" +applyTo: "**/*.cfm" +--- + +# ColdFusion Coding Standards + +- 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 blocks using ## +- When using HTMX inside blocks, escape hash symbols (#) by using double hashes (##) to prevent unintended variable interpolation. +- If you are in a HTMX target file then make sure the top line is: + +# Additional Best Practices + +- Use `Application.cfc` for application settings and request handling. +- Organize code into reusable CFCs (components) for maintainability. +- Validate and sanitize all user input. +- Use `cftry`/`cfcatch` for error handling and logging. +- Avoid hardcoding credentials or sensitive data in source files. +- Use consistent indentation (2 spaces, as per global standards). +- Comment complex logic and document functions with purpose and parameters. +- Prefer `cfinclude` for shared templates, but avoid circular includes. + +- Use ternary operators where possible +- Make sure all tabs start and end line up vertically.