|
| 1 | +--- |
| 2 | +description: "Instructions for creating, formatting, and reviewing agent specification files in block-theme-scaffold" |
| 3 | +applyTo: ".github/agents/*.agent.md" |
| 4 | +version: 1.0 |
| 5 | +lastUpdated: 2025-12-11 |
| 6 | +owner: "LightSpeedWP Engineering" |
| 7 | +--- |
| 8 | + |
| 9 | +# Agent Spec Instructions |
| 10 | + |
| 11 | +You are an agent specification author for the LightSpeed block theme scaffold. Follow this guide to produce deterministic, auditable `.agent.md` specs using the template at `.github/agents/template.agent.md`. Keep scope tight, prefer block-first solutions, and treat every listed tool as an explicit permission. |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +Use this instruction file when drafting or reviewing any `.agent.md` in `.github/agents`. Specs must describe how agents operate within a block-theme-first WordPress workflow, linking to their prompts, scripts, tests, and workflows. |
| 16 | + |
| 17 | +## General Rules |
| 18 | + |
| 19 | +- Start with value, then clarity, then governance: define purpose, make IO deterministic, then enforce guardrails. |
| 20 | +- Keep scope explicit: what the agent owns, what it refuses, and which repos/APIs it can touch. |
| 21 | +- Design for determinism: consistent outputs, clear error handling, and default-safe behaviours. |
| 22 | +- Front-load guardrails: non-negotiable safety, confirmation rules, and escalation paths. |
| 23 | +- Treat tools as permissions: if a tool is not listed, the agent must ignore it. |
| 24 | +- Use mustache placeholders (`{{agent_slug}}`, `{{agent_version}}`, etc.) in templates and prompts. |
| 25 | +- Align with block theme conventions: prefer `theme.json`, block components, patterns, and template parts over bespoke PHP. |
| 26 | + |
| 27 | +## Structure & Frontmatter |
| 28 | + |
| 29 | +- Copy the frontmatter pattern from `.github/agents/template.agent.md`. |
| 30 | +- Required fields: `title`, `description`, `version`, `last_updated`, `owners`, `tags`, `status`, `apply_to`, `runtime`, `entrypoint`, `tools`, `references`, and `metadata.guardrails`. |
| 31 | +- Keep references up to date: spec path, prompt, script, workflow, and related instructions. |
| 32 | +- Do not embed secrets or real environment variable values; list names only. |
| 33 | + |
| 34 | +## Authoring Steps |
| 35 | + |
| 36 | +1. Copy `.github/agents/template.agent.md` to `.github/agents/{{agent_slug}}.agent.md`. |
| 37 | +2. Replace placeholders with the agent’s details and block-theme context. |
| 38 | +3. Map the spec to its prompt, script, tests, and workflow in the repository mapping table. |
| 39 | +4. Define role, scope, capabilities, tools, input/output schemas, guardrails, failure handling, and observability. |
| 40 | +5. Add three validation tasks (typical, edge, failure) with expected behaviours. |
| 41 | +6. Update the changelog within the spec when you revise it. |
| 42 | + |
| 43 | +## Inputs and Outputs |
| 44 | + |
| 45 | +- Specify accepted natural-language inputs plus any structured schemas (JSON/YAML/forms). |
| 46 | +- Provide examples and, where structure matters, a JSON Schema. |
| 47 | +- Define deterministic output shapes for success, warnings, and errors, including required fields for automation. |
| 48 | + |
| 49 | +## Safety & Guardrails |
| 50 | + |
| 51 | +- Prohibit secret handling, destructive actions, and production mutations without explicit human confirmation. |
| 52 | +- Require adherence to build/lint/test workflows (`block-theme-build-and-e2e.yml`) before changes ship. |
| 53 | +- Escalate when tasks exceed scope or missing approvals; prefer read-only diagnostics. |
| 54 | + |
| 55 | +## Tools & Integrations |
| 56 | + |
| 57 | +- Enumerate every allowed tool or integration (GitHub scopes, CLI commands, internal scripts). |
| 58 | +- List required environment variable names; never include values. |
| 59 | +- If a tool is missing from the list, the agent must assume it is unavailable. |
| 60 | + |
| 61 | +## Observability & Logging |
| 62 | + |
| 63 | +- Require logging of timestamps, tool calls, external interactions, and key decisions. |
| 64 | +- Point logs to `logs/agents/YYYY-MM-DD-{{agent_slug}}.log` and reports to `.github/reports/agents/`. |
| 65 | +- Include audit and privacy notes; avoid storing secrets or personal data. |
| 66 | + |
| 67 | +## Validation |
| 68 | + |
| 69 | +- Confirm all placeholders are replaced and references resolve to real files. |
| 70 | +- Ensure the three validation tasks cover: normal flow, edge-case handling, and failure response. |
| 71 | +- Keep output formats parseable and consistent with downstream automation. |
| 72 | +- When applicable, align agent behaviour with tests in `tests/agents/{{agent_slug}}.agent.test.js` and workflows in `.github/workflows/`. |
| 73 | + |
| 74 | +## Effective Spec Tips |
| 75 | + |
| 76 | +- Keep scope extremely clear: name owned repos, workflows, and forbidden areas. |
| 77 | +- Make outputs deterministic: defined shapes, explicit error formats, and safe defaults. |
| 78 | +- Front-load guardrails: precise, enforceable, and testable constraints. |
| 79 | +- Treat each tool as a permission; omit tools the agent must not use. |
| 80 | +- Use realistic test tasks drawn from LightSpeed block-theme workflows. |
| 81 | + |
| 82 | +## Review Checklist |
| 83 | + |
| 84 | +- [ ] Purpose is unambiguous; boundaries are explicit. |
| 85 | +- [ ] Capabilities match supported workflows; limitations are stated. |
| 86 | +- [ ] All tools/integrations are listed with required auth notes. |
| 87 | +- [ ] Inputs/outputs are defined with examples and error formats. |
| 88 | +- [ ] Safety rules include confirmations and align with security policy. |
| 89 | +- [ ] Failure/rollback behaviour is documented. |
| 90 | +- [ ] Three validation tasks cover typical, edge, and failure cases. |
| 91 | +- [ ] Observability requirements (logs/reports) are included. |
| 92 | +- [ ] Changelog updated and references (prompt/script/tests/workflow) are accurate. |
| 93 | + |
| 94 | +## References |
| 95 | + |
| 96 | +- `.github/agents/template.agent.md` |
| 97 | +- `.github/agents/agent.md` |
| 98 | +- `.github/instructions/instructions.instructions.md` |
| 99 | +- `.github/instructions/copilot-ai-agent.instructions.md` |
| 100 | +- `.github/workflows/block-theme-build-and-e2e.yml` |
0 commit comments