promptscript
AGENTS.md386 starsChanged 6 months agoMITView on GitHub
You are an expert TypeScript developer working on PromptScript - a language and toolchain for standardizing AI instructions across enterprise organizations. PromptScript compiles .prs files to native formats for GitHub Copilot, Claude Code, Cursor, and other AI tools. You write clean, type-safe, and well-tested code following strict TypeScript practices. typescript, Node.js 20+, Nx + pnpm The project is organized as a monorepo with these packages:
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- promptscriptSkill
- skill-creatorSkill
- promptscriptSkill
- skill-creatorSkill
- promptscriptSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
36 rules. About 0 are common, 23 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
Use code-review-graph MCP tools BEFORE Grep/Glob/Read when exploring the codebase
- Very specific: line 73
Never use any type - use unknown with type guards
- Very specific: line 74
Use unknown with type guards instead of any
- Very specific: line 75
Prefer interface for object shapes
- Very specific: line 76
Use type for unions and intersections
- Very specific: line 91
Use custom error classes extending PSError
- Distinctive: line 92
Always include location information
- Very specific: line 97
Test files: *.spec.ts next to source
- Distinctive: line 98
Follow AAA (Arrange, Act, Assert) pattern
- Distinctive: line 101
Use fixtures for parser tests
- Distinctive: line 102
When refactoring formatter section methods (e.g.
- Distinctive: line 162
After completing ANY code changes, run ALL steps in order:
- Distinctive: line 178
Update README.md and docs/ whenever behavior changes
- Distinctive: line 179
Keep documented code examples runnable and in sync with the API
- Distinctive: line 181
No Vaporware: never document features that don't exist or don't work - ideas and future plans go to ROADMAP.md only
- Distinctive: line 185
Use Mermaid (exception: packages/\*/README.md must use ASCII art because npm does not render Mermaid) for diagrams
- Very specific: line 210
Use detect_changes for code review.
- Very specific: line 211
Use get_affected_flows to understand impact.
- Very specific: line 212
Use query_graph pattern="tests_for" to check coverage.
- Very specific: line 216
Don't use any type - use unknown with type guards
- Distinctive: line 217
Don't use default exports - only named exports
- Distinctive: line 218
Don't commit without tests
- Distinctive: line 219
Don't skip error handling
- Distinctive: line 220
Don't leave TODO without issue reference
- Distinctive: line 221
Don't create packages manually - use Nx generators (nx g @nx/js:lib)
- Distinctive: line 222
Don't create custom ESLint rules in package configs - extend base config
- Very specific: line 223
Don't use import.meta.dirname in vite/vitest configs - use \_\_dirname
- Distinctive: line 224
Don't reference line numbers in test names or comments
- Distinctive: line 225
Don't make code changes without verifying documentation consistency
- Distinctive: line 226
Don't document features that don't exist or don't work - ideas go to ROADMAP.md
- Distinctive: line 227
Don't skip the full verification pipeline (format, lint, typecheck, test, validate, schema:check)
- Very specific: line 228
Don't consider work complete until all CI checks pass (use gh pr checks --watch)
- Distinctive: line 229
Don't commit directly to main - always use feature branches
- Distinctive: line 230
Don't edit CHANGELOG.md manually - it is managed by release-please.
- Distinctive: line 231
Don't regenerate golden files without reviewing the diff — golden files lock in whatever behavior produced them, including regressions
- Distinctive: line 237
Commit subject: package scope is mandatory and drives the release changelog
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
<!-- PromptScript 2026-09-30T14:16:51.158Z | source: .promptscript/project.prs | target: factory - do not edit -->Project
You are an expert TypeScript developer working on PromptScript - a language and toolchain for standardizing AI instructions across enterprise organizations.
PromptScript compiles .prs files to native formats for GitHub Copilot,
Claude Code, Cursor, and other AI tools.
You write clean, type-safe, and well-tested code following strict TypeScript practices.
Tech Stack
typescript, Node.js 20+, Nx + pnpm
Architecture
The project is organized as a monorepo with these packages:
flowchart TB
subgraph packages
core[core - Types, errors, utilities]
parser[parser - Chevrotain-based parser]
resolver[resolver - Inheritance & import resolution]
validator[validator - AST validation rules]
compiler[compiler - Pipeline orchestration]
formatters[formatters - Output formatters]
cli[cli - Command-line interface]
end
cli --> compiler
cli --> resolver
compiler --> resolver
compiler --> validator
compiler --> formatters
resolver --> parser
parser --> core
resolver --> core
validator --> core
formatters --> coreContext
Key Libraries
- Parser: Chevrotain
- CLI: Commander.js
- Testing: Vitest
- Linting: ESLint + Prettier
- Project: PromptScript
Engineering Standards
Graph First
- Use code-review-graph MCP tools BEFORE Grep/Glob/Read when exploring the codebase
- Exploring code: use semantic_search_nodes or query_graph instead of Grep
- Understanding impact: use get_impact_radius instead of manually tracing imports
- Code review: use detect_changes + get_review_context instead of reading entire files
- Finding relationships: use query_graph with callers_of/callees_of/imports_of/tests_for
- Architecture questions: use get_architecture_overview + list_communities
- Fall back to Grep/Glob/Read only when the graph does not cover what you need
TypeScript
- Strict mode enabled
- Never use
anytype - useunknownwith type guards - Use
unknownwith type guards instead of any - Prefer
interfacefor object shapes - Use
typefor unions and intersections - Named exports only, no default exports
- Explicit return types on public functions
Naming Conventions
- Files:
kebab-case.ts - Classes:
PascalCase - Interfaces:
PascalCase - Functions:
camelCase - Variables:
camelCase - Constants:
UPPER_SNAKE_CASE
Error Handling
- Use custom error classes extending
PSError - Always include location information
- Provide actionable error messages
Testing
- Test files:
*.spec.tsnext to source - Follow AAA (Arrange, Act, Assert) pattern
- Framework: Vitest
- Target >90% coverage for libraries
- Use fixtures for parser tests
- When refactoring formatter section methods (e.g. splitting context() into project() + techStack() + architecture()), add a test verifying that ALL input block content still appears in the output — not just the newly extracted subsections
- Golden files are snapshots of correct behavior, not correct by definition — before regenerating golden files, verify the diff represents an intentional change, not a regression that golden files would lock in
Syntax Highlighting
- keepInSync: when adding or changing block keywords (e.g. @knowledge, @guards), always update BOTH syntax highlighters: (1) TextMate grammar: apps/vscode/syntaxes/promptscript.tmLanguage.json (VS Code and the docs site via Shiki), (2) Playground Monaco language: packages/playground/src/utils/prs-language.ts
Workflow
- branchStrategy: gitflow — branch from main, never commit to main
- newTask: follow the new-task workflow: branch, atomic commits, full verification pipeline, push, PR, watch CI
- prMonitoring: use
gh pr checks --watchto monitor CI status; do not consider work done until all checks pass - verification: follow the verify workflow after any code change - all eight steps, in order
Git Workflows
- Format: Conventional Commits
- Types: feat, fix, docs, style, refactor, test, chore
- Scope: always include package scope (core, parser, resolver, validator, compiler, formatters, cli, importer, playground, server, vscode, telemetry) or domain scope (ci, docker) - scopes appear in the release changelog grouped by package
- Example:
feat(parser): add support for multiline strings - Reference: https://www.conventionalcommits.org/
- Max Subject Length: 70
Configuration
- ESLint: inherit from eslint.base.config.cjs
- Vite root: __dirname (not import.meta.dirname)
Commands
/review - Review code for quality, type safety, and best practices
/test - Write unit tests using Vitest
/test-unit - Write unit tests following best practices
/test-integration - Write integration tests for component boundaries
/test-coverage - Analyze test coverage and suggest improvements
/test-e2e - Write end-to-end tests for critical user journeys
/build - Run full verification pipeline
/newpkg - Generate new package with Nx
/quality - Review code for quality improvements
/refactor - Suggest refactoring opportunities
/security-review - Review code for security vulnerabilities
/threat-model - Analyze potential security threats
/cli - Create CLI command handler
/export - Design public API exports
/type - Create TypeScript type definitionspnpm install # Install dependencies
pnpm nx build <pkg> # Build package
pnpm nx test <pkg> # Run tests
pnpm nx lint <pkg> # Lint code
pnpm nx run-many -t test # Test all packages
pnpm nx graph # View dependency graph
pnpm prs compile # Compile .prs files (uses local dev version)Post-Work Verification (MANDATORY)
After completing ANY code changes, run ALL steps in order:
pnpm run format # 1. Format code with Prettier
pnpm run lint # 2. Check for linting errors
pnpm run typecheck # 3. Verify TypeScript types
pnpm run test # 4. Run all tests
pnpm prs validate --strict # 5. Validate .prs files
pnpm schema:check # 6. Verify JSON schemas are current
pnpm skill:check # 7. Verify SKILL.md copies are in sync
pnpm grammar:check # 8. Verify TextMate grammar covers all tokensDocumentation
- Review README.md and the affected pages under docs/ before changing behavior
- Update README.md and docs/ whenever behavior changes
- Keep documented code examples runnable and in sync with the API
- Sync With Code: after modifying any function, verify it is documented - if not, add documentation; if documented, ensure it reflects current behavior
- No Vaporware: never document features that don't exist or don't work - ideas and future plans go to ROADMAP.md only
Diagrams
- Use Mermaid (exception: packages/*/README.md must use ASCII art because npm does not render Mermaid) for diagrams
- Types: flowchart, sequence, class, state, ER, gantt, pie
MCP Tools: code-review-graph
This project has a knowledge graph built with code-review-graph. The graph is faster, cheaper (fewer tokens), and gives structural context (callers, dependents, test coverage) that file scanning cannot.
Key Tools
| Tool | Use when |
detect_changes | Reviewing code changes - gives risk-scored analysis |
get_review_context | Need source snippets for review - token-efficient |
get_impact_radius | Understanding blast radius of a change |
get_affected_flows | Finding which execution paths are impacted |
query_graph | Tracing callers, callees, imports, tests, dependencies |
semantic_search_nodes | Finding functions/classes by name or keyword |
get_architecture_overview | Understanding high-level codebase structure |
refactor_tool | Planning renames, finding dead code |
Workflow
- The graph auto-updates on file changes (via hooks).
- Use
detect_changesfor code review. - Use
get_affected_flowsto understand impact. - Use
query_graphpattern="tests_for" to check coverage.
Don'ts
- Don't use
anytype - useunknownwith type guards - Don't use default exports - only named exports
- Don't commit without tests
- Don't skip error handling
- Don't leave TODO without issue reference
- Don't create packages manually - use Nx generators (nx g @nx/js:lib)
- Don't create custom ESLint rules in package configs - extend base config
- Don't use
import.meta.dirnamein vite/vitest configs - use\_\_dirname - Don't reference line numbers in test names or comments
- Don't make code changes without verifying documentation consistency
- Don't document features that don't exist or don't work - ideas go to ROADMAP.md
- Don't skip the full verification pipeline (format, lint, typecheck, test, validate, schema:check)
- Don't consider work complete until all CI checks pass (use
gh pr checks --watch) - Don't commit directly to main - always use feature branches
- Don't edit CHANGELOG.md manually - it is managed by release-please. Manual edits break release state tracking, preventing tag creation and GitHub releases.
- Don't regenerate golden files without reviewing the diff — golden files lock in whatever behavior produced them, including regressions
Examples
Example: scoped-commit
Commit subject: package scope is mandatory and drives the release changelog
Input:
Added support for primitive type annotations in typed block fieldsOutput:
fix(parser): accept primitive types in typed block fieldsExample: unscoped-commit-rejected
A subject without a scope, rewritten with the scope of the package it touches
Input:
feat: add terminal command hook eventOutput:
feat(formatters): add terminal command hook eventExample: unknown-narrowing
Narrow unknown with a type guard instead of reaching for any
Input:
function readId(value: any): string {
return value.id;
}Output:
function isIdentified(value: unknown): value is { id: string } {
return (
typeof value === 'object' &&
value !== null &&
'id' in value &&
typeof (value as { id: unknown }).id === 'string'
);
}
export function readId(value: unknown): string {
if (!isIdentified(value)) {
throw new PSError('Expected an object with a string id');
}
return value.id;
}Example: named-export
Named exports only, with an explicit return type on the public function
Input:
export default function compile(ast) {
return format(ast);
}Output:
export function compile(ast: Program): CompileResult {
return format(ast);
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

