Enterprise Setup¶
This guide covers deploying PromptScript across an enterprise organization.
Architecture Overview¶
flowchart TB
subgraph Central["Central Registry"]
org["@org/base<br/>Organization standards"]
sec["@core/security<br/>Security policies"]
comp["@core/compliance<br/>Compliance rules"]
end
subgraph Teams["Team Registries"]
fe["@frontend/base"]
be["@backend/base"]
mobile["@mobile/base"]
end
subgraph Projects["Projects"]
p1["web-app"]
p2["api-service"]
p3["mobile-app"]
end
org --> fe
org --> be
org --> mobile
sec --> fe
sec --> be
sec --> mobile
comp --> fe
comp --> be
comp --> mobile
fe --> p1
be --> p2
mobile --> p3 Central Registry Setup¶
Repository Structure¶
Create a central registry repository:
promptscript-registry/
├── README.md
├── CHANGELOG.md
├── @org/
│ ├── base.prs # Organization base
│ ├── security.prs # Security standards
│ └── compliance.prs # Compliance requirements
├── @teams/
│ ├── frontend.prs
│ ├── backend.prs
│ ├── mobile.prs
│ └── data.prs
├── @fragments/
│ ├── testing.prs
│ ├── documentation.prs
│ └── logging.prs
└── @templates/
├── web-app.prs
├── api-service.prs
└── library.prs
Organization Base Configuration¶
# @org/base.prs
@meta {
id: "@org/base"
syntax: "1.0.0"
org: "ACME Corporation"
}
@identity {
"""
You are an AI assistant at ACME Corporation.
Core values:
- Quality over speed
- Security first
- User-centric design
- Collaborative development
"""
}
@standards {
code: {
review: required
documentation: required
testing: required
}
git: {
conventionalCommits: true
branchNaming: "feature|bugfix|hotfix/TICKET-description"
prRequired: true
}
}
@restrictions {
- "Never commit secrets or credentials"
- "Never bypass security reviews"
- "Always follow data protection policies"
- "Never use deprecated dependencies with known vulnerabilities"
}
@shortcuts {
"/security": "Review code for security vulnerabilities"
"/docs": "Generate or update documentation"
}
Security Configuration¶
# @org/security.prs
@meta {
id: "@org/security"
syntax: "1.0.0"
}
@identity {
"""
Apply ACME security standards to all code.
"""
}
@standards {
security: {
authentication: {
mfa: required
sessionTimeout: 3600
}
authorization: {
rbac: true
leastPrivilege: true
}
dataProtection: {
encryption: "AES-256"
pii: "masked in logs"
}
dependencies: {
vulnerabilityScan: required
updatePolicy: "weekly"
}
}
}
@restrictions {
- "Never store passwords in plain text"
- "Never log sensitive data"
- "Never disable security features"
- "Never use eval() or similar unsafe functions"
- "Always validate and sanitize user input"
- "Always use parameterized queries"
}
@knowledge {
"""
## Security Resources
- Security guidelines: https://wiki.acme.com/security
- Vulnerability reporting: security@acme.com
- Security review checklist: https://wiki.acme.com/security-checklist
"""
}
Team Configuration¶
Frontend Team¶
# @teams/frontend.prs
@meta {
id: "@teams/frontend"
syntax: "1.0.0"
team: "Frontend"
}
@inherit @org/base
@use @org/security
@identity {
"""
You are a frontend development expert.
Expertise:
- React and TypeScript
- Modern CSS and design systems
- Performance optimization
- Accessibility (WCAG 2.1 AA)
"""
}
@context {
"""
## Tech Stack
- Framework: React 18+
- Language: TypeScript 5+
- Build: Vite
- Styling: TailwindCSS
- Testing: Vitest + Testing Library
- State: React Query + Zustand
## Architecture
- Component-driven development
- Feature-based folder structure
- Shared design system (@acme/ui)
"""
}
@standards {
code: {
patterns: ["hooks", "composition", "render props"]
components: {
style: "functional"
props: "TypeScript interfaces"
}
}
accessibility: {
wcag: "2.1 AA"
testing: required
}
performance: {
bundleSize: "monitored"
coreWebVitals: "tracked"
}
}
@shortcuts {
"/component": "Create a React component"
"/hook": "Create a custom hook"
"/test": "Write tests with Vitest"
"/a11y": "Review accessibility"
}
Backend Team¶
# @teams/backend.prs
@meta {
id: "@teams/backend"
syntax: "1.0.0"
team: "Backend"
}
@inherit @org/base
@use @org/security
@identity {
"""
You are a backend development expert.
Expertise:
- Node.js and TypeScript
- RESTful and GraphQL APIs
- Database design and optimization
- Microservices architecture
"""
}
@context {
"""
## Tech Stack
- Runtime: Node.js 20+
- Language: TypeScript 5+
- Framework: NestJS
- Database: PostgreSQL + Redis
- ORM: Prisma
- Testing: Jest
## Architecture
- Clean architecture
- Domain-driven design
- Event-driven microservices
"""
}
@standards {
api: {
versioning: "URL path (/v1, /v2)"
documentation: "OpenAPI 3.0"
authentication: "JWT + OAuth2"
}
database: {
migrations: required
indexing: "reviewed"
queryOptimization: required
}
}
@shortcuts {
"/api": "Design API endpoint"
"/schema": "Design database schema"
"/test": "Write tests with Jest"
"/migrate": "Create database migration"
}
Project Integration¶
Project Configuration¶
# .promptscript/project.prs
@meta {
id: "customer-portal"
syntax: "1.0.0"
}
@inherit @teams/frontend
@context {
project: "Customer Portal"
repository: "github.com/acme/customer-portal"
"""
## Project Overview
Self-service portal for ACME customers.
Features:
- Account management
- Order history
- Support tickets
- Billing information
## Key Integrations
- Auth: Okta SSO
- Payments: Stripe
- Analytics: Mixpanel
"""
}
@knowledge {
"""
## API Endpoints
Base URL: https://api.acme.com/v1
- GET /customers/:id - Get customer
- GET /orders - List orders
- POST /tickets - Create support ticket
## Design System
Use @acme/ui components:
- Button, Input, Select
- Card, Modal, Drawer
- DataTable, Pagination
"""
}
Project Config File¶
# promptscript.yaml
input:
entry: .promptscript/project.prs
registry:
url: https://github.com/acme/promptscript-registry
auth:
token: ${GITHUB_TOKEN}
targets:
github:
enabled: true
output: .github/copilot-instructions.md
claude:
enabled: true
output: CLAUDE.md
cursor:
enabled: true
output: .cursorrules
validation:
strict: true
CI/CD Integration¶
GitHub Actions Workflow¶
# .github/workflows/promptscript.yml
name: PromptScript CI
on:
push:
paths:
- '.promptscript/**'
- 'promptscript.yaml'
pull_request:
paths:
- '.promptscript/**'
- 'promptscript.yaml'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install PromptScript
run: npm install -g @promptscript/cli
- name: Validate
run: prs validate --strict
env:
GITHUB_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
- name: Check compiled files
run: |
prs compile
git diff --exit-code || {
echo "::error::Compiled files are out of date. Run 'prs compile' and commit."
exit 1
}
env:
GITHUB_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
Registry CI/CD¶
# .github/workflows/registry.yml (in registry repo)
name: Registry CI
on:
push:
branches: [main]
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install PromptScript
run: npm install -g @promptscript/cli
- name: Validate all files
run: |
find . -name "*.prs" -exec prs validate {} \;
- name: Check for breaking changes
if: github.event_name == 'pull_request'
run: |
# Custom script to detect breaking changes
./scripts/check-breaking-changes.sh
Governance¶
Versioning Strategy¶
Follow semantic versioning for registry files:
- Major (1.0.0 → 2.0.0): Breaking changes to block structure
- Minor (1.0.0 → 1.1.0): New features, non-breaking additions
- Patch (1.0.0 → 1.0.1): Bug fixes, documentation updates
Change Management¶
- Propose changes via pull request to registry
- Review by relevant stakeholders
- Test with sample projects
- Communicate changes to teams
- Deprecate old versions with migration path
Access Control¶
| Role | Permissions |
|---|---|
| Admin | Full registry access |
| Team Lead | Team namespace write |
| Developer | Read-only, PR creation |
Rollout Strategy¶
Phase 1: Pilot (2-4 weeks)¶
- Select 2-3 pilot teams
- Set up central registry
- Migrate existing instructions
- Gather feedback
Phase 2: Team Rollout (4-8 weeks)¶
- Create team configurations
- Onboard remaining teams
- Establish governance
- Train developers
Phase 3: Organization-Wide (Ongoing)¶
- Mandate for new projects
- Migration support for existing
- Continuous improvement
- Regular reviews
Best Practices¶
Registry Organization
Keep the registry organized with clear namespaces and documentation.
Version Pinning
Pin versions in production projects to avoid unexpected changes.
Change Communication
Notify teams before making registry changes.
Security Review
Review security-related changes carefully before merging.
Breaking Changes
Use major version bumps and provide migration guides for breaking changes.