Importing Existing AI Instructions
The prs import command converts existing AI instruction files into PromptScript format. This allows teams to adopt PromptScript without losing their existing configurations.
Supported Formats
| Source Format | File |
|---|---|
| Claude Code | CLAUDE.md |
| GitHub Copilot | .github/copilot-instructions.md |
| Cursor | .cursorrules, .cursor/rules.md |
| Generic Markdown | Any .md file |
Modern Cursor .cursor/rules/*.mdc files are not auto-detected. Import one with
--format cursor, then manually map its frontmatter globs to named @guards entries:
prs import .cursor/rules/project.mdc --format cursorQuick Start
# Import a single fileprs import CLAUDE.md
# Preview the conversionprs import CLAUDE.md --dry-run
# Import with roundtrip validationprs import CLAUDE.md --validate
# Specify output directoryprs import CLAUDE.md --output ./my-projectHow It Works
- Detect Format - Automatically identifies the source format from the filename
- Parse Sections - Extracts markdown headings and content blocks
- Classify - Heuristically maps sections to PromptScript blocks (
@identity,@standards,@restrictions,@knowledge,@context) - Score - Assigns a confidence score (0-100%) to each classification
- Emit - Generates
.prsoutput with# REVIEW:comments on low-confidence sections
Confidence Scoring
Each section receives a confidence score:
- HIGH (>80%) - Strong pattern match (e.g., “You are…” maps to
@identity) - MEDIUM (50-80%) - Ambiguous patterns requiring review
- LOW (<50%) - No clear match, classified as
@context
Sections below HIGH confidence include # REVIEW: comments in the generated output. Always review the imported file before using it in production.
CLI Options
prs import <file> [options]
Options: -f, --format <format> Force source format (claude, github, cursor, generic) -o, --output <dir> Output directory (default: .promptscript) --dry-run Preview output without writing files --validate Run roundtrip validation after importRoundtrip Validation
The --validate flag parses the generated .prs output with the PromptScript parser to verify it is syntactically valid. This catches any edge cases where the import produces invalid PromptScript syntax.
After Import
- Review the generated
imported.prsfile - Check
# REVIEW:comments and adjust block classifications - Add
@metafields (team, description) as needed - Set up
promptscript.yamlwith your compilation targets - Run
prs compileto generate output for your AI tools
Programmatic Usage
@promptscript/importer is not published to npm, so this example works inside the PromptScript repository only. Outside of it, use the prs import command.
import { importFile } from '@promptscript/importer';
const result = await importFile('./CLAUDE.md');console.log(result.prsContent); // Generated .prs contentconsole.log(result.totalConfidence); // Average confidence (0-1)console.log(result.warnings); // Low-confidence warningsconsole.log(result.sections); // Classified sections