| file_type | instructions | ||||||
|---|---|---|---|---|---|---|---|
| description | Unified coding standards for all LightSpeedWP projects: applies to all code, documentation, automation, and AI contributions. | ||||||
| applyTo | ** | ||||||
| version | v2.1 | ||||||
| last_updated | 2025-12-04 | ||||||
| owners |
|
||||||
| tags |
|
You are a LightSpeedWP code quality guardian. Follow our organisation-wide coding standards to design, review, and refactor code and documentation. Avoid introducing new dependencies, globals, or conventions that are not documented here or in project-specific instructions.
Applies to all code, documentation, automation, and AI-generated content across LightSpeedWP. Covers general principles, language specifics, formatting, automation, and AI alignment. Excludes project-only conventions—layer those on top where provided.
- Enforce consistency, security, accessibility, and clarity across all artefacts.
- Use automation (lint/format/test) to enforce standards.
- Never commit secrets; sanitise, escape, and validate inputs.
- Align AI output to these standards and any project-specific overrides.
- Do not add a frontmatter
referencesproperty; the schema no longer supports it—link to supporting docs inline or via approved footers.
- See the sections below for general principles, language-specific standards, formatting/automation, documentation rules, and AI guidance.
- Follow linked linting instructions for per-language details.
- Good: Apply Prettier/ESLint before commit, use
/blob/HEAD/links, and avoid new globals. - Avoid: Adding unpinned dependencies or bypassing lint/test steps.
- Run project lint/format/test scripts (CI-required) before merge.
- Validate links in docs and ensure accessibility standards are met.
- Confirm AI outputs adhere to this file and project-specific instructions.
This document is the single source of truth for all coding standards in LightSpeedWP projects. It applies to all code, docs, automation, and AI-generated content.
- General Principles
- Language-Specific Standards
- Formatting & Automation
- Documentation Standards
- AI & Copilot Instructions
- References
- Consistency: All code, scripts, and docs must follow the LightSpeedWP conventions and project-specific configs.
- Automation: All lint, format, and test steps must be enforceable through scripts, CI workflows, and (where possible) pre-commit hooks.
- Clarity: Code and documentation must be readable, maintainable, and accessible.
- Security: Always sanitize, escape, and validate inputs. Never commit secrets or credentials.
- AI alignment: All AI and Copilot-generated content must reference and follow these standards.
-
JavaScript/TypeScript:
- Lint with ESLint (flat/classic) and Prettier.
- Reference:
languages.instructions.md
-
JSON:
- Enforce strict schemas and formatting with Prettier and, where required, AJV.
- Reference:
languages.instructions.md
-
Markdown:
- Use markdownlint and Prettier.
- Reference:
documentation-formats.instructions.md
-
YAML:
- Use yamllint, Spectral, and actionlint for workflows.
- Reference:
languages.instructions.mdandworkflows.instructions.md
- Formatting: All files must be formatted with Prettier, Black, or project-specific formatters.
- Linting: All code must pass lint checks before merge (CI-required).
- Pre-commit hooks: Use Husky or pre-commit to run lint/format on staged files.
- CI: All PRs run lint, format, and test jobs in workflows before merge.
- VS Code Tasks: Use
tasks.jsonto run all standard lint/format/test commands easily.
All documentation links to files within the same repository should use /blob/HEAD/ in URLs to ensure universality across branches and avoid broken links after merges. Always validate links after editing documentation.
- All AI-generated code and docs must reference and follow these standards.
- Use path-specific instructions files and main custom instructions for Copilot.
- See LightSpeed Copilot Prompts Index for reusable prompts.