Agent Platform Examples¶
These examples cover core agent-platform capabilities. Open the Playground and choose Complete Agent Platform or Regular Field Replacement to compile the same examples in your browser.
PromptScript 1.16 task examples:
| Task | Example |
|---|---|
| Predict composition results | Composition and Order |
| Choose merge or replacement | Merge vs Replace |
| Fix PS038 shape warnings | Fix Block Shape Warnings |
| Customize generated titles | Custom Section Headers |
| Build portable lifecycle policy | Portable Hooks |
Complete Agent Platform¶
This syntax 1.6 example connects reusable skills, MCP tools, a specialist agent, lifecycle automation, a release workflow, and a plugin bundle:
@meta {
id: "checkout-agent-platform"
syntax: "1.5.0"
tags: ["payments", "typescript"]
}
@identity {
"""
You are working on a payment service.
Preserve transaction integrity and auditability.
"""
}
@standards {
code: ["Use strict TypeScript", "Write tests for business rules"]
}
@skills {
security-review: {
description: "Review payment changes for security risks"
allowedTools: ["Read", "Grep", "Bash"]
content: """
Inspect authentication, authorization, secrets, and payment data handling.
Report findings by severity and include concrete remediation steps.
"""
}
}
@mcpServers {
issue-tracker: {
transport: "stdio"
command: ["node", "./tools/issues.mjs"]
timeoutMs: 30000
}
}
@agents {
reviewer: {
description: "Review changes before merge"
tools: ["Read", "Grep", "Glob", "Bash"]
model: "sonnet"
skills: ["security-review"]
mcpServers: ["issue-tracker"]
content: "Review changed code, tests, and operational impact."
}
}
@hooks {
validate-changes: {
event: "post-tool-use"
matcher: "Edit|Write"
command: ["pnpm", "run", "typecheck"]
timeoutMs: 120000
statusMessage: "Checking TypeScript"
}
}
@workflows {
release: {
description: "Validate and prepare a release"
content: """
1. Review changes since the previous release
2. Run formatting, linting, type checks, and tests
3. Summarize changes and prepare release metadata
4. Stop before publishing and request approval
"""
}
}
@plugins {
payment-engineering: {
description: "Payment engineering capability bundle"
version: "1.0.0"
skills: ["security-review"]
hooks: ["validate-changes"]
mcpServers: ["issue-tracker"]
}
}
The references between blocks are validated before output is generated:
- The
revieweragent preloadssecurity-reviewand receives access toissue-tracker. - The plugin groups the skill, hook, and MCP server as one capability bundle.
- Rich target modes emit native agent, skill, MCP, hook, workflow, and plugin files where supported.
Use full target modes to generate native capability files:
id: checkout-agent-platform
syntax: '1.5.0'
targets:
- claude:
version: full
- cursor:
version: full
- factory:
version: full
- codex:
version: full
Regular Field Replacement¶
Syntax 1.3 introduced field!: value inside regular @extend blocks. Marked fields replace their complete previous value, while unmarked fields retain normal merge behavior:
For new syntax 1.6 projects, prefer @override when replacing a complete existing target. See Merge vs Replace.
@meta {
id: "field-replacement"
syntax: "1.3.0"
}
@identity {
"""
You are a TypeScript development assistant.
"""
}
@standards {
testing: ["Use Jest", "Use integration tests"]
linting: ["Use ESLint"]
deployment: {
platform: "Kubernetes"
regions: ["us-east-1"]
}
}
@extend standards {
testing!: ["Use Vitest", "Follow the AAA pattern"]
linting: ["Run lint checks before commits"]
deployment!: {
platform: "Cloud Run"
regions: ["us-central1", "europe-west1"]
}
}
The resolved standards use only the new testing and deployment values. The linting array contains both entries because it was not marked for replacement.
Portable Skill Resources¶
Directory skills can bundle supporting references, scripts, assets, contracts, and licenses:
.promptscript/skills/security-review/
|-- SKILL.md
|-- LICENSE
|-- references/
| `-- threat-model.md
|-- scripts/
| `-- scan.sh
`-- assets/
`-- report-template.md
Declare the bundled files and typed contract in SKILL.md:
---
name: security-review
description: Review code for application security risks
references:
- references/threat-model.md
scripts:
- scripts/scan.sh
inputs:
path:
type: string
description: Path to review
outputs:
report:
type: string
description: Review report
---
Review selected code and use bundled references when evaluating risk.
PromptScript preserves the directory structure when emitting native skill packages.
Monorepo Build Profiles¶
Named builds compile scoped agent configuration for multiple packages from one repository. A payments platform with two services keeps one shared team config and one entry per service:
payments-platform/
├── .promptscript/
│ ├── team.prs # Shared team config
│ ├── api.prs # payments-api entry
│ └── web.prs # checkout-web entry
├── packages/
│ ├── api/
│ └── web/
└── promptscript.yaml
Create the shared team config, .promptscript/team.prs. Both service entries inherit it, so team rules live in exactly one file:
@meta {
id: "payments-team"
syntax: "1.5.0"
tags: ["payments"]
}
@identity {
"""
You work on the ACME payments platform.
Preserve transaction integrity and auditability.
"""
}
@standards {
code: ["Use strict TypeScript", "Write tests for business rules"]
testing: ["Use Vitest with the AAA pattern", "Cover failure and retry paths"]
}
@restrictions {
- "Never log PAN, CVV, or raw webhook secrets"
}
Each entry inherits the team config and adds only service-specific blocks. .promptscript/api.prs:
@meta {
id: "payments-api"
syntax: "1.5.0"
}
@inherit ./team
@context {
service: "payments-api"
framework: "Fastify"
owns: ["authorization", "retries"]
}
@agents {
api-reviewer: {
description: "Review payments-api changes before merge"
tools: ["Read", "Grep", "Glob", "Bash"]
model: "sonnet"
content: "Inspect handlers, tests, and migration impact. Reject changes that weaken idempotency."
}
}
.promptscript/web.prs:
@meta {
id: "checkout-web"
syntax: "1.5.0"
}
@inherit ./team
@context {
service: "checkout-web"
framework: "React 18"
owns: ["checkout flow", "payment forms"]
}
@skills {
payment-forms: {
description: "Review payment form changes for PCI and a11y risk"
allowedTools: ["Read", "Grep"]
content: "Check card-data handling, error states, and keyboard access in checkout forms."
}
}
Declare one build profile per service in promptscript.yaml:
builds:
api:
entry: .promptscript/api.prs
output: packages/api
targets:
- factory:
version: full
- codex:
version: full
output: AGENTS.override.md
agentsFile: AGENTS.override.md
web:
entry: .promptscript/web.prs
output: packages/web
targets:
- cursor:
version: full
Validate every entry, then compile each build separately:
prs validate .promptscript/team.prs .promptscript/api.prs .promptscript/web.prs --strict
prs compile --build api
prs compile --build web
prs compile --all-builds
In CI, fan the builds out through a matrix so each service validates and compiles in its own job:
# .github/workflows/promptscript.yml
name: PromptScript
on:
pull_request:
push:
branches: [main]
jobs:
promptscript:
runs-on: ubuntu-latest
strategy:
matrix:
build: [api, web]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g @promptscript/cli@1.19.1
- run: prs validate .promptscript/team.prs .promptscript/${{ matrix.build }}.prs --strict
- run: prs compile --build ${{ matrix.build }} --dry-run