This file provides guidance for AI agents working in this repository. Human developers should also read this file before contributing.
This is the LightSpeed Theme WordPress block theme repository (lightspeedwp/ls-theme).
It is a production block theme for client and commercial work at LightSpeed.
It is not specifically packaged for WordPress.org submission. Do not add WordPress.org-specific bureaucracy unless there is clear value.
/
├── AGENTS.md # This file — AI and developer guidance
├── CLAUDE.md # Points to AGENTS.md
├── CHANGELOG.md # Keep a Changelog / SemVer
├── README.md # Root developer README
├── readme.txt # Light distribution placeholder
├── style.css # Block theme header + minimal CSS
├── theme.json # Primary theme settings (theme-first)
├── functions.php # Minimal PHP
├── screenshot.png # Create manually
├── CODEOWNERS # GitHub code ownership
├── .editorconfig
├── .gitignore
├── .gitattributes
├── .nvmrc
├── .coderabbit.yml
├── .lintstagedrc.json
├── package.json
├── composer.json
├── theme-utils.mjs # Validation and utility script
├── assets/
│ ├── fonts/ # Binary font assets (.woff2 etc.)
│ ├── icons/
│ ├── logos/
│ ├── images/
│ ├── css/ # Compiled or authored CSS
│ └── js/ # Authored JS
├── docs/ # End-user documentation
├── inc/ # Optional PHP include files
├── parts/ # Block template parts
├── patterns/ # Block patterns (PHP or HTML)
├── styles/ # Style variations
│ ├── blocks/
│ ├── sections/
│ └── dark.json
├── templates/ # Block templates
├── .github/
│ ├── copilot-instructions.md
│ ├── instructions/
│ ├── prompts/
│ ├── reports/
│ ├── tasks/
│ └── workflows/
└── .agents/
├── skills/
└── agents/
theme.jsonandstyles/**/*.json(block-style and section-style JSON partials) are the single source of truth for styling. This includes colour, typography, spacing, layout, borders, shadows, and block-level structural properties.- Author Sass/CSS in
src/scss/**/*.scssonly for what a JSON style genuinely cannot express::hover/:focus-withinstates not covered by anelements.*pseudo-state key,content:""pseudo-elements, comma-separated selectors, SVGfill, aria-attribute selectors, or parent-triggered child-selector motion. See.agents/skills/wp-block-style-audit/references/block-style-json-anatomy.mdfor the authoritative JSON-vs-CSS decision table. - Before writing any new Sass/CSS rule, check whether a JSON equivalent already
exists — look at sibling files in
styles/**for the established pattern first. - When writing a new or modifying an existing CSS rule that is genuinely
unavoidable, add a comment directly above it naming the specific limitation
that forced it, e.g.:
// JSON limitation: block-level :hover has no theme.json pseudo-state key — see AGENTS.md Theme-First ApproachThis applies to new/modified rules going forward — it does not require retroactively commenting every pre-existing valid CSS exception already in the codebase. - Structural properties — layout (flex/grid), spacing, sizing, positioning — use
JSON or block attributes whenever a supported key exists, regardless of what
folder or filename the CSS would otherwise land in (a file named "motion" is
not exempt). Only fall back to Sass/CSS, with a "JSON limitation" comment,
for structural properties JSON genuinely has no key for (e.g.
overflow,max-width,width— see.agents/skills/wp-block-style-audit/references/block-style-json-anatomy.mdfor the full list). - Motion/animation files (
src/scss/animations/**,src/scss/gsap/**) may contain only@keyframes,transition,transform,animation, andwill-changerules, plus theirprefers-reduced-motioncompanions. Any other property in those files is a defect and must be moved to a JSON style partial or removed. assets/css/animations.css(and the SCSS it's compiled from) may only contain genuinely global styling — content that loads sitewide through the header or footer template parts (including anything nested in them, e.g. the mobile menu or mega menus). Styling tied to a specific page or pattern does not belong there, no matter how small, and must live in its own dedicated file instead.- GSAP is permitted only for JS-driven interaction that CSS transition/animation structurally cannot achieve (e.g. scroll-triggered sequencing, cursor-tracked effects) — never as a default choice for "this pattern has motion."
- Do not register a new
is-stylevariant for a single-use, one-off treatment with no second option ever offered. If it's used in exactly one place, style it inline on the pattern's block attributes instead of creating a global style-picker entry. - Prefer
theme.jsonover PHP for colours, typography, spacing, and layout. - Keep
functions.phpminimal. Only register block supports, enqueue assets, or add editor styles there. - Use
inc/only for genuine PHP logic that does not belong infunctions.php. - Do not invent PHP architecture that
theme.jsoncan handle. - Before using an attribute or attribute value on a core WordPress block, verify it is actually supported by that block (check the block's registered attributes/supports or an existing working usage) rather than guessing.
- Core WordPress blocks first. Prefer the most semantic core block available
before reaching for a generic layout block. Post-aware content uses
core/post-title,core/post-excerpt,core/post-date,core/post-terms,core/post-featured-image,core/post-time-to-read, andcore/query+core/post-templatefor listings — not acore/group/core/columnshand-rolled substitute. Site identity usescore/site-logo,core/site-title,core/site-tagline; navigation usescore/navigation; calls to action usecore/buttons+core/button. Fall back tocore/group,core/columns,core/heading,core/paragraph,core/image, orcore/coveronly when no semantic core block fits the design intent, and note the fallback in the pattern's description. See the Core Blocks reference for the full inventory.
This theme uses the following identifiers consistently:
| Key | Value |
|---|---|
| Theme name | LightSpeed Theme |
| Theme slug | ls-theme |
| Text domain | ls-theme |
| Theme URI | https://lightspeedwp.agency/ |
| Author | LightSpeed |
| Author URI | https://lightspeedwp.agency/ |
| Repo | lightspeedwp/ls-theme |
Rules:
- Text domain must match the theme slug (
ls-theme) everywhere. - Keep the slug consistent in
style.css,theme.json,composer.json, andpackage.json.
- Use semantic HTML in all templates and parts.
- Use correct heading hierarchy. Do not skip heading levels.
- Provide descriptive
alttext for images. - Ensure interactive elements are keyboard accessible.
- Follow WCAG 2.1 AA as a baseline.
- Use ARIA attributes only where genuinely needed — do not over-ARIA.
- Do not remove focus styles.
- Always escape output in PHP files. Use
esc_html(),esc_attr(),esc_url(),wp_kses_post()as appropriate. - Sanitise input before using it. Use
sanitize_text_field(),absint(), or similar. - Validate data before acting on it.
- Never use
echo $_GET[...]or similar unescaped output. - Never use
eval(). - Avoid direct database queries. If necessary, use
$wpdb->prepare(). - Review
patterns/*.php,inc/**/*.php, andfunctions.phpwith special care. - Use translation functions correctly:
__(),esc_html__(),esc_attr__().
- Keep
functions.phpas short as sensibly possible. - Use
inc/for optional, well-named PHP includes. - Do not add a plugin-like architecture to the theme.
- Do not add features that belong in plugins.
- Prefer hooks and filters from WordPress core over custom implementations.
| Asset type | Folder |
|---|---|
| Font files | assets/fonts/ |
| SVG/icon files | assets/icons/ |
| Logo files | assets/logos/ |
| Images | assets/images/ |
| CSS | assets/css/ |
| JavaScript | assets/js/ |
- Font files are binary (
*.woff2,*.woff, etc.). They are not JSON. - Do not validate font files as JSON.
- Do not create schema validation that targets
assets/fonts/.
- Style variations live in
styles/. - One style variation is provided:
dark.json. Light is the default intheme.json. - Additional variations can be added as
styles/*.json. styles/blocks/andstyles/sections/files carry theblockTypes+slugschema, which WordPress 6.6+ auto-discovers recursively and registers as live, editor-facing style-picker entries. Every file added here is a real, user-visible option — do not add one as a one-off hack for a single pattern (see Theme-First Approach above).- Keep variation files small and focused.
Run these before committing:
# Install Node dependencies
npm install
# Validate JSON schema for theme.json and styles
npm run schema:validate
# Validate theme consistency (slugs, required files, etc.)
npm run theme:validate
# Check PHP patterns for escaping issues
npm run patterns:escape
# Run PHP security scan
npm run security:scan
# Run all linting
npm run lint
# Install Composer dependencies
composer install
# Run PHP code sniffer
composer run phpcs
# Fix auto-fixable PHP issues
composer run phpcbf
# Lint PHP syntax
composer run lint:php- Follow Keep a Changelog.
- Follow Semantic Versioning.
- Update
CHANGELOG.mdon every meaningful change. - Add new entries under
## [Unreleased]. - Move entries to a versioned section on release.
docs/is for end-user documentation — setup guides, editor guides, client-facing notes.- Developer reports belong in
.github/reports/, not indocs/. - Keep
docs/clean and human-readable.
| Folder | Purpose |
|---|---|
.github/prompts/ |
Reusable GitHub Copilot prompt files |
.github/reports/ |
Developer and AI-generated reports |
.github/tasks/ |
Task lists and AI-maintained work tracking |
.github/instructions/ |
Copilot instruction files per file type |
.agents/skills/ |
Portable, reusable AI skills |
.agents/agents/ |
Agent persona definitions |
Key skill: .agents/skills/wp-block-style-audit/ — the JSON-vs-CSS decision
procedure for migrating CSS-selector-soup into proper theme.json-style JSON
(elements, blocks, pseudo-states). Read this before authoring or auditing any
styles/**/*.json file or src/scss/**/*.scss partial.
- Prefer small diffs. Make minimal, targeted changes. Do not rewrite files that do not need rewriting.
- Avoid unnecessary dependencies. Do not add npm or Composer packages without justification.
- Avoid inventing a build pipeline. This repo does not use Webpack, Vite, or similar unless explicitly added later.
- Keep the theme lean. Do not add features beyond the scope of a block theme.
- Escape output correctly. Every PHP
echomust use an appropriate escaping function. - Sanitise and validate input. Do not trust data from
$_GET,$_POST, or similar. - Review pattern PHP carefully. Patterns with PHP output are a common source of escaping issues.
- Keep reports in
.github/reports/. Do not write developer reports to the root or todocs/. - Keep task lists in
.github/tasks/. Updatetask-list.mdas tasks are created, in-progress, or completed. - Keep prompt files in
.github/prompts/. Do not scatter prompt files across the repo. - Keep portable skills in
.agents/skills/. Skills should be self-contained and reusable. - Keep agent personas in
.agents/agents/. Agent persona files describe specialist roles. - Do not modify
.github/workflows/without understanding CI impacts. - Always update
CHANGELOG.mdwhen making meaningful changes. - Keep slug and text domain consistent — use
ls-themeas both the theme slug and text domain.