CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
100/100
Scores the file, not the repository.Length
581 words
24 headings · 3 code blocksRepository
5
— · pushed 301 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Project Overview67A Dart package for parsing `.prompt` files for LLM interactions. Based on [Google's dotprompt specification](https://google.github.io/dotprompt/getting-started/), this implementation converts Pico Schema to JSON Schema, provides schema validation, template rendering with Handlebars/Mustache, and model configuration management.89This package does NOT execute prompts itself - it parses and prepares them for execution by other libraries like [dartantic_ai](https://pub.dev/packages/dartantic_ai).1011## Common Commands1213### Testing14```bash15# Run all tests16dart test1718# Run a single test file19dart test test/pico_schema_test.dart2021# Run tests with verbose output22dart test --reporter=expanded23```2425### Development26```bash27# Run the example28dart run example/main.dart2930# Analyze code31dart analyze3233# Format code34dart format .35```3637### Publishing38```bash39# Check package for publish readiness40dart pub publish --dry-run4142# Publish to pub.dev43dart pub publish44```4546## Architecture4748### Core Components49501. **DotPrompt** ([lib/src/dot_prompt.dart](lib/src/dot_prompt.dart)) - Main entry point51 - Parses .prompt files with YAML front-matter and Handlebars templates52 - Factory constructor `DotPrompt(String)` for string content53 - Static method `DotPrompt.stream(Stream<List<int>>, {name, defaults})` for loading from streams (required for web/wasm compatibility)54 - `render(Map<String, dynamic>)` method validates input against schema and renders template55 - Merges default values with input before validation56572. **PicoSchema** ([lib/src/pico_schema.dart](lib/src/pico_schema.dart)) - Schema conversion engine58 - Detects schema type (JSON Schema vs Pico Schema) using `schemaType()`59 - Top-level `type` property triggers JSON Schema mode (short-circuits Pico Schema parsing)60 - Mixed schemas throw `FormatException`61 - Expands Pico Schema shorthand into valid JSON Schema62 - 100+ tests ensure spec compliance63 - Key features:64 - Optional fields: `name?: string`65 - Type annotations: `settings(object)`, `tags(array)`66 - Enums: `theme: [light, dark]` or `theme(enum): [light, dark]`67 - Wildcards: `(*): any` for additionalProperties68 - Inline descriptions: `name: string, The user's name`69703. **DotPromptFrontMatter** ([lib/src/dot_prompt_front_matter.dart](lib/src/dot_prompt_front_matter.dart))71 - Parses YAML front-matter between `---` delimiters72 - Includes model config, input/output schemas, and custom extensions73 - Supports namespaced keys (e.g., `myext.temperature`)74754. **InputOutputConfig** ([lib/src/input_output_config.dart](lib/src/input_output_config.dart))76 - Manages input/output schemas and defaults77 - Creates `JsonSchema` objects from Pico Schema or JSON Schema78 - Stores default values for input validation7980### Template System8182Uses [mustache_template](https://pub.dev/packages/mustache_template) package for template expansion. NOT fully spec-compliant with Google's Handlebars implementation - see README.md "Handlebar Implementation Shortcomings" section for known limitations.8384### Web/WASM Compatibility8586Version 0.3.0+ replaced `DotPrompt.file(filename)` with `DotPrompt.stream(bytes, name: filename)` for web/wasm compatibility. Use `File(filename).openRead()` to create the stream for file system sources.8788## Project-Specific Rules8990### PRD Reference91- Read [PRD.md](PRD.md) at the start of each session92- Reference PRD when implementing features93- Update PRD if implementation requires requirement changes94- Document changes to core functionality, API design, architecture, dependencies, or user stories9596### Collaboration Boundaries97- Only implement what is explicitly requested98- Present ideas as suggestions ("I have an idea...") without implementing99- Ask for clarification if scope is unclear100- Wait for explicit approval before actions beyond immediate request101102### Validation & Planning103- Verify understanding before implementation104- Validate against [official dotprompt docs](https://google.github.io/dotprompt/)105- Check library implementation details and best practices106- Ensure changes align with existing codebase patterns107108## Key Dependencies109110- `json_schema`: ^5.2.1 - JSON Schema validation111- `yaml`: ^3.1.2 - YAML front-matter parsing112- `mustache_template`: ^2.0.0 - Template expansion113- `path`: ^1.8.0 - Path manipulation114- `collection`: ^1.19.1 - Collection utilities115116## Testing Philosophy117118Tests are comprehensive with 100+ tests focused on Pico Schema conversion. Tests should be silent on success and report failures via `expect()`. No print statements except for diagnostics (which should be removed before commit).119
Also in csells/dotprompt_dart
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| csells/dotprompt_dart.cursor/rules/collaboration-boundaries.mdc · 5 | Cursor rules | no sections | 30/100 | 3 days ago | |
| csells/dotprompt_dart.cursor/rules/prd-handling.mdc · 5 | Cursor rules | no sections | 30/100 | 3 days ago | |
| csells/dotprompt_dart.cursor/rules/validation-planning.mdc · 5 | Cursor rules | no sections | 30/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago | |
| ente/enteweb/CLAUDE.md · 28k | CLAUDE.md | setupbuildlint-formatarch+4 | 97/100 | 3 days ago | |
| imaNNeo/fl_chartCLAUDE.md · 7.6k | CLAUDE.md | teststylearchtesting-strategy+2 | 94/100 | 3 days ago | |
| jiangtian616/JHenTaiCLAUDE.md · 5.3k | CLAUDE.md | buildlint-formatarchdependencies+2 | 81/100 | 2 days ago | |
| mobile-dev-inc/Maestroe2e/demo_app/CLAUDE.md · 15k | CLAUDE.md | buildteststylesecurity+1 | 81/100 | 3 days ago | |
| chen08209/FlClashplugins/rust_api/CLAUDE.md · 47k | CLAUDE.md | buildarchagent-behaviour | 66/100 | 3 days ago | |
| fzyzcjy/flutter_rust_bridgeCLAUDE.md · 5.4k | CLAUDE.md | do-not | 51/100 | 2 days ago | |
| localsend/localsendCLAUDE.md · 87k | CLAUDE.md | agent-behaviour | 24/100 | 3 days ago |
