Synced package doc

Sync API

Functions for writing prompt files, agent-specific files, and manifest data to disk.

syncPrompts()

All-in-one sync: write Markdown files, agent files, and manifest.

import { syncPrompts } from "prompts-gpt";

const result = await syncPrompts(prompts, {
  cwd: process.cwd(),
  outDir: ".prompts-gpt",
  overwrite: false,
  agent: "all",       // or "cursor,codex"
});

console.log(result.markdown.written);  // string[] — written file paths
console.log(result.agents.written);    // string[] — agent file paths
console.log(result.manifest.manifestPath); // string — manifest path

Parameters

PropertyTypeDefaultDescription
promptsPromptPack[]Prompts to sync
cwdstringprocess.cwd()Project directory
outDirstring.prompts-gptOutput directory
overwritebooleanfalseOverwrite existing files
agentstring"all"Agent targets
agentsstring"all"Alias for agent

writePromptMarkdownFiles()

Write prompt Markdown files only (no agent files or manifest).

import { writePromptMarkdownFiles } from "prompts-gpt";

const { outDir, written, skipped } = await writePromptMarkdownFiles(prompts, {
  outDir: ".prompts-gpt",
  overwrite: false,
});

writeAgentFiles()

Write agent-specific files for configured targets.

import { writeAgentFiles } from "prompts-gpt";

const { written, skipped, targets } = await writeAgentFiles(prompts, {
  cwd: process.cwd(),
  agent: "cursor,codex,claude-code",
  overwriteAgentFiles: false,
});

Generated Files by Target

TargetFiles
codexAGENTS.md (managed block)
claude-codeCLAUDE.md (managed block)
cursor.cursor/rules/prompts-gpt-.mdc, .cursor/commands/prompts-gpt-.md
vscode.github/copilot-instructions.md, .github/instructions/prompts-gpt.instructions.md, .vscode/prompts-gpt.code-snippets
copilot.github/prompts/prompts-gpt-*.prompt.md
continue.continue/rules/prompts-gpt-*.md
gemini-cliGEMINI.md (managed block)
windsurf.windsurf/rules/prompts-gpt-*.md
cline.clinerules/prompts-gpt-*.md
junie.junie/guidelines.md (managed block)
ampAGENT.md (managed block)

Managed Blocks

Files using managed blocks (AGENTS.md, CLAUDE.md, etc.) are updated idempotently:

<!-- prompts-gpt:start -->
# Prompts-GPT Agent Instructions
...content managed by prompts-gpt...
<!-- prompts-gpt:end -->

Content outside the managed block is preserved on re-sync.

writePromptManifest()

Write the manifest.json file.

import { writePromptManifest } from "prompts-gpt";

const { manifestPath, manifest } = await writePromptManifest(prompts, {
  cwd: process.cwd(),
  outDir: ".prompts-gpt",
});

formatPromptMarkdown()

Format a PromptPack as a Markdown string with YAML frontmatter.

import { formatPromptMarkdown } from "prompts-gpt";

const markdown = formatPromptMarkdown({
  title: "Security Review",
  slug: "security-review",
  summary: "Review code for security issues",
  category: "Code Review",
  promptText: "Review the codebase for...",
  // ...other fields
});

Output format:

---
title: "Security Review"
slug: "security-review"
source: "library"
category: "Code Review"
difficulty: "Intermediate"
outputType: "Text"
supportedTools: ["Codex", "Claude"]
tags: ["security", "review"]
---

# Security Review

Review code for security issues

## Prompt

Review the codebase for...

## Variables

- `targetDir`
- `severity`

## Usage Notes

Focus on OWASP Top 10 vulnerabilities.

See Also