Applies to: {agent}/package.json in all agents
Validation: checked by PackageJsonValidator, which runs only when you invoke
node scripts/validation/phase-4-structure-audit.js directly. No npm script or
workflow calls it, and there is no validate:package-json script. The
audit:structure script runs a different program that does not use this
validator, so this is a manual check rather than a CI gate.
{
"name": "@lightspeedwp/{agent-name}",
"version": "1.0.0",
"description": "Brief one-line description of the agent",
"main": "index.js",
"type": "module",
"license": "GPL-3.0-or-later"
}Constraints:
-
name: MUST be
<scope>/{agent-name}, where<scope>is the scope of the repository rootpackage.json(currently@lightspeedwp)- Matches folder name:
agents/prd-agent/→"name": "@lightspeedwp/prd-agent" - Used for npm scoping and imports
- Matches folder name:
-
version: MUST match latest entry in CHANGELOG.md
- Format: Semantic versioning (MAJOR.MINOR.PATCH)
- Examples:
1.0.0,2.1.3,0.1.0
-
description: Brief summary (50-100 characters)
- Appears in agent registry
- Example:
"Generates product requirements documents using templates"
-
main: Entry point file
- Typically
index.jsorsrc/index.js - MUST be resolvable from package root
- Typically
-
type: MUST be
"module"(ES modules)- Required for modern Node.js
- Enables
importstatements
-
license: MUST match the repository root
package.jsonlicence (currently"GPL-3.0-or-later")- Consistent across all agents
{
"engines": {
"node": ">=18.0.0"
}
}Constraint: Node.js >= 18.0.0 (LTS minimum)
{
"scripts": {
"test": "jest",
"lint": "eslint .",
"format": "prettier --write ."
}
}Required scripts:
-
test: Run test suite (typically
jest)- Runs all tests in
tests/folder - MUST exit 0 on pass, non-zero on failure
- Example:
"test": "jest --coverage"
- Runs all tests in
-
lint: Lint code (typically
eslint)- MUST check syntax and style
- Example:
"lint": "eslint . --max-warnings 0"
Optional scripts (if applicable):
- build: Compile/transpile code
- start: Run the agent standalone
- pretest: Setup before tests
- posttest: Cleanup after tests
{
"dependencies": {
"dep-name": "^1.0.0"
},
"devDependencies": {
"jest": "^29.0.0",
"eslint": "^8.0.0",
"prettier": "^3.0.0"
}
}Rules:
-
No production dependencies on other agents
- Agents must be independently deployable
- Use shared
skills/folder for shared functionality
-
devDependencies for testing, linting, formatting
- Must include:
jest,eslint,prettier - Versions should be recent but stable
- Must include:
-
Version constraints: Prefer caret (
^1.0.0) for flexibility- Allows patch/minor updates automatically
- Prevents major breaking changes
{
"keywords": ["agent", "lightspeedwp", "prd"],
"author": "LightSpeedWP",
"repository": {
"type": "git",
"url": "https://github.com/lightspeedwp/.github"
},
"bugs": {
"url": "https://github.com/lightspeedwp/.github/issues"
}
}Reported as an error, so they fail the run:
- ✅ Valid JSON syntax
- ✅
namematches the agent folder name - ✅
versionis valid semver - ✅
mainfile exists. Existence only; the validator does not resolve or load it. - ✅
typeis"module" - ✅
licensematches the organisation licence in the rootpackage.json - ✅
testandlintscripts are declared. Presence only — the validator never executes them, so a declared script that fails is not caught here. - ✅
dependenciesdo not reference another agent
Reported as a warning, so they do not fail the run:
engines.nodeis a valid range resolving to 18 or later.devDependenciesdo not reference another agent.
Not implemented. No check covers any of the following:
versionmatching CHANGELOG.md.testorlintbeing executed and passing.
Required fields are name, version, description, main, type and license.
Problem: Folder is agents/prd-agent/ but package.json has "name": "prd-agent"
Fix: Change to "name": "@lightspeedwp/prd-agent"
Problem: package.json has "version": "1.0.0" but CHANGELOG.md latest is 2.0.0
Fix: Update package.json to match CHANGELOG.md, or vice versa
Problem: package.json missing test or lint scripts
Fix: Add to scripts section:
{
"scripts": {
"test": "jest",
"lint": "eslint ."
}
}Problem: dependencies includes agents-other-agent
Fix: Move shared code to skills/ folder, import as skill instead
See agent-structure-template/package.json