@vetala/vetala 0.1.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @vetala/vetala might be problematic. Click here for more details.
- package/CONTRIBUTING.md +77 -0
- package/LICENSE +184 -0
- package/README.md +136 -0
- package/THIRD_PARTY_LICENSES.md +17 -0
- package/dist/src/agent.d.ts +30 -0
- package/dist/src/agent.js +216 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/approvals.d.ts +18 -0
- package/dist/src/approvals.js +81 -0
- package/dist/src/approvals.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +87 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +12 -0
- package/dist/src/config.js +183 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-memory.d.ts +7 -0
- package/dist/src/context-memory.js +96 -0
- package/dist/src/context-memory.js.map +1 -0
- package/dist/src/ink/command-suggestions.d.ts +7 -0
- package/dist/src/ink/command-suggestions.js +179 -0
- package/dist/src/ink/command-suggestions.js.map +1 -0
- package/dist/src/ink/ink-terminal-ui.d.ts +36 -0
- package/dist/src/ink/ink-terminal-ui.js +79 -0
- package/dist/src/ink/ink-terminal-ui.js.map +1 -0
- package/dist/src/ink/repl-app.d.ts +9 -0
- package/dist/src/ink/repl-app.js +789 -0
- package/dist/src/ink/repl-app.js.map +1 -0
- package/dist/src/ink/transcript-cards.d.ts +6 -0
- package/dist/src/ink/transcript-cards.js +24 -0
- package/dist/src/ink/transcript-cards.js.map +1 -0
- package/dist/src/path-policy.d.ts +11 -0
- package/dist/src/path-policy.js +67 -0
- package/dist/src/path-policy.js.map +1 -0
- package/dist/src/process-utils.d.ts +13 -0
- package/dist/src/process-utils.js +52 -0
- package/dist/src/process-utils.js.map +1 -0
- package/dist/src/repl.d.ts +9 -0
- package/dist/src/repl.js +13 -0
- package/dist/src/repl.js.map +1 -0
- package/dist/src/sarvam/client.d.ts +15 -0
- package/dist/src/sarvam/client.js +208 -0
- package/dist/src/sarvam/client.js.map +1 -0
- package/dist/src/sarvam/models.d.ts +2 -0
- package/dist/src/sarvam/models.js +7 -0
- package/dist/src/sarvam/models.js.map +1 -0
- package/dist/src/search-provider.d.ts +6 -0
- package/dist/src/search-provider.js +8 -0
- package/dist/src/search-provider.js.map +1 -0
- package/dist/src/session-store.d.ts +19 -0
- package/dist/src/session-store.js +318 -0
- package/dist/src/session-store.js.map +1 -0
- package/dist/src/skills/runtime.d.ts +26 -0
- package/dist/src/skills/runtime.js +317 -0
- package/dist/src/skills/runtime.js.map +1 -0
- package/dist/src/skills/types.d.ts +25 -0
- package/dist/src/skills/types.js +2 -0
- package/dist/src/skills/types.js.map +1 -0
- package/dist/src/terminal-ui.d.ts +29 -0
- package/dist/src/terminal-ui.js +236 -0
- package/dist/src/terminal-ui.js.map +1 -0
- package/dist/src/tools/filesystem.d.ts +2 -0
- package/dist/src/tools/filesystem.js +622 -0
- package/dist/src/tools/filesystem.js.map +1 -0
- package/dist/src/tools/git.d.ts +2 -0
- package/dist/src/tools/git.js +326 -0
- package/dist/src/tools/git.js.map +1 -0
- package/dist/src/tools/index.d.ts +6 -0
- package/dist/src/tools/index.js +21 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/registry.d.ts +15 -0
- package/dist/src/tools/registry.js +59 -0
- package/dist/src/tools/registry.js.map +1 -0
- package/dist/src/tools/shell.d.ts +2 -0
- package/dist/src/tools/shell.js +97 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/skill.d.ts +3 -0
- package/dist/src/tools/skill.js +130 -0
- package/dist/src/tools/skill.js.map +1 -0
- package/dist/src/tools/web.d.ts +3 -0
- package/dist/src/tools/web.js +144 -0
- package/dist/src/tools/web.js.map +1 -0
- package/dist/src/types.d.ts +236 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/workspace-trust.d.ts +3 -0
- package/dist/src/workspace-trust.js +31 -0
- package/dist/src/workspace-trust.js.map +1 -0
- package/dist/src/xdg.d.ts +9 -0
- package/dist/src/xdg.js +77 -0
- package/dist/src/xdg.js.map +1 -0
- package/package.json +57 -0
- package/skill/agents-md-generator/SKILL.md +75 -0
- package/skill/agents-md-generator/references/agents_md_template.md +160 -0
- package/skill/agents-md-generator/references/loc_measurement.md +67 -0
- package/skill/agents-md-generator/references/monorepo_detection.md +78 -0
- package/skill/agents-md-generator/references/monorepo_strategy.md +60 -0
- package/skill/agents-md-generator/references/read_only_commands.md +151 -0
- package/skill/agents-md-generator/references/update_strategy.md +160 -0
- package/skill/agents-md-generator/references/working_agreements.md +53 -0
- package/skill/biz-opportunity-scout/SKILL.md +53 -0
- package/skill/biz-opportunity-scout/references/competitive_analysis.md +84 -0
- package/skill/biz-opportunity-scout/references/market_sizing.md +68 -0
- package/skill/biz-opportunity-scout/references/pmf_indicators.md +94 -0
- package/skill/biz-opportunity-scout/references/report_template.md +243 -0
- package/skill/biz-opportunity-scout/references/unit_economics.md +97 -0
- package/skill/code-review/SKILL.md +86 -0
- package/skill/code-review/references/change_analysis.md +116 -0
- package/skill/code-review/references/git_operations.md +115 -0
- package/skill/code-review/references/impact_detection.md +149 -0
- package/skill/code-review/references/output_format.md +137 -0
- package/skill/code-review/references/severity_criteria.md +100 -0
- package/skill/code-security-audit/SKILL.md +123 -0
- package/skill/code-security-audit/references/audit_process.md +277 -0
- package/skill/code-security-audit/references/remediation_patterns.md +599 -0
- package/skill/code-security-audit/references/report_format.md +391 -0
- package/skill/code-security-audit/references/security_domains.md +830 -0
- package/skill/code-security-audit/references/vulnerability_patterns.md +813 -0
- package/skill/composition-patterns/SKILL.md +83 -0
- package/skill/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/skill/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/skill/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/skill/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/skill/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/skill/composition-patterns/rules/state-context-interface.md +191 -0
- package/skill/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/skill/composition-patterns/rules/state-lift-state.md +125 -0
- package/skill/deploy-to-vercel/SKILL.md +293 -0
- package/skill/deploy-to-vercel/resources/deploy-sandbox.sh +301 -0
- package/skill/deploy-to-vercel/resources/deploy.sh +301 -0
- package/skill/doc/SKILL_GUIDELINES.md +138 -0
- package/skill/git-workflow/SKILL.md +94 -0
- package/skill/git-workflow/references/advanced-git.md +632 -0
- package/skill/git-workflow/references/branching-strategies.md +344 -0
- package/skill/git-workflow/references/ci-cd-integration.md +683 -0
- package/skill/git-workflow/references/code-quality-tools.md +351 -0
- package/skill/git-workflow/references/commit-conventions.md +439 -0
- package/skill/git-workflow/references/github-releases.md +288 -0
- package/skill/git-workflow/references/pull-request-workflow.md +773 -0
- package/skill/git-workflow/scripts/verify-git-workflow.sh +263 -0
- package/skill/jetbrains-vmoptions/SKILL.md +51 -0
- package/skill/jetbrains-vmoptions/references/common-options.md +357 -0
- package/skill/jetbrains-vmoptions/references/gc-options.md +350 -0
- package/skill/jetbrains-vmoptions/references/memory-options.md +339 -0
- package/skill/jetbrains-vmoptions/references/prerequisite-check.md +65 -0
- package/skill/kysely-converter/SKILL.md +62 -0
- package/skill/kysely-converter/references/delete.md +323 -0
- package/skill/kysely-converter/references/insert.md +386 -0
- package/skill/kysely-converter/references/operators.md +331 -0
- package/skill/kysely-converter/references/select.md +1000 -0
- package/skill/kysely-converter/references/update.md +349 -0
- package/skill/kysely-converter/references/window_function.md +537 -0
- package/skill/react-best-practices/SKILL.md +131 -0
- package/skill/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/skill/react-best-practices/rules/advanced-init-once.md +42 -0
- package/skill/react-best-practices/rules/advanced-use-latest.md +39 -0
- package/skill/react-best-practices/rules/async-api-routes.md +38 -0
- package/skill/react-best-practices/rules/async-defer-await.md +80 -0
- package/skill/react-best-practices/rules/async-dependencies.md +51 -0
- package/skill/react-best-practices/rules/async-parallel.md +28 -0
- package/skill/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/skill/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/skill/react-best-practices/rules/bundle-conditional.md +31 -0
- package/skill/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/skill/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/skill/react-best-practices/rules/bundle-preload.md +50 -0
- package/skill/react-best-practices/rules/client-event-listeners.md +74 -0
- package/skill/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/skill/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/skill/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/skill/react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/skill/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/skill/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/skill/react-best-practices/rules/js-cache-storage.md +70 -0
- package/skill/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/skill/react-best-practices/rules/js-early-exit.md +50 -0
- package/skill/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/skill/react-best-practices/rules/js-index-maps.md +37 -0
- package/skill/react-best-practices/rules/js-length-check-first.md +49 -0
- package/skill/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/skill/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/skill/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/skill/react-best-practices/rules/rendering-activity.md +26 -0
- package/skill/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/skill/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/skill/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/skill/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/skill/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/skill/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/skill/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/skill/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/skill/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/skill/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/skill/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/skill/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/skill/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/skill/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/skill/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/skill/react-best-practices/rules/rerender-memo.md +44 -0
- package/skill/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/skill/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/skill/react-best-practices/rules/rerender-transitions.md +40 -0
- package/skill/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/skill/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/skill/react-best-practices/rules/server-auth-actions.md +96 -0
- package/skill/react-best-practices/rules/server-cache-lru.md +41 -0
- package/skill/react-best-practices/rules/server-cache-react.md +76 -0
- package/skill/react-best-practices/rules/server-dedup-props.md +65 -0
- package/skill/react-best-practices/rules/server-hoist-static-io.md +142 -0
- package/skill/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/skill/react-best-practices/rules/server-serialization.md +38 -0
- package/skill/react-native-skills/SKILL.md +115 -0
- package/skill/react-native-skills/rules/animation-derived-value.md +53 -0
- package/skill/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
- package/skill/react-native-skills/rules/animation-gpu-properties.md +65 -0
- package/skill/react-native-skills/rules/design-system-compound-components.md +66 -0
- package/skill/react-native-skills/rules/fonts-config-plugin.md +71 -0
- package/skill/react-native-skills/rules/imports-design-system-folder.md +68 -0
- package/skill/react-native-skills/rules/js-hoist-intl.md +61 -0
- package/skill/react-native-skills/rules/list-performance-callbacks.md +44 -0
- package/skill/react-native-skills/rules/list-performance-function-references.md +132 -0
- package/skill/react-native-skills/rules/list-performance-images.md +53 -0
- package/skill/react-native-skills/rules/list-performance-inline-objects.md +97 -0
- package/skill/react-native-skills/rules/list-performance-item-expensive.md +94 -0
- package/skill/react-native-skills/rules/list-performance-item-memo.md +82 -0
- package/skill/react-native-skills/rules/list-performance-item-types.md +104 -0
- package/skill/react-native-skills/rules/list-performance-virtualize.md +67 -0
- package/skill/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
- package/skill/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
- package/skill/react-native-skills/rules/navigation-native-navigators.md +188 -0
- package/skill/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
- package/skill/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
- package/skill/react-native-skills/rules/react-state-dispatcher.md +91 -0
- package/skill/react-native-skills/rules/react-state-fallback.md +56 -0
- package/skill/react-native-skills/rules/react-state-minimize.md +65 -0
- package/skill/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
- package/skill/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
- package/skill/react-native-skills/rules/scroll-position-no-state.md +82 -0
- package/skill/react-native-skills/rules/state-ground-truth.md +80 -0
- package/skill/react-native-skills/rules/ui-expo-image.md +66 -0
- package/skill/react-native-skills/rules/ui-image-gallery.md +104 -0
- package/skill/react-native-skills/rules/ui-measure-views.md +78 -0
- package/skill/react-native-skills/rules/ui-menus.md +174 -0
- package/skill/react-native-skills/rules/ui-native-modals.md +77 -0
- package/skill/react-native-skills/rules/ui-pressable.md +61 -0
- package/skill/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
- package/skill/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
- package/skill/react-native-skills/rules/ui-styling.md +87 -0
- package/skill/react-vite-guide/SKILL.md +101 -0
- package/skill/react-vite-guide/references/composition-patterns.md +709 -0
- package/skill/react-vite-guide/references/performance-optimization.md +1222 -0
- package/skill/react-vite-guide/references/vite-specific.md +385 -0
- package/skill/react-vite-guide/references/web-interface.md +146 -0
- package/skill/skill-maker/SKILL.md +52 -0
- package/skill/skill-maker/references/content_spec.md +67 -0
- package/skill/skill-maker/references/frontmatter_spec.md +96 -0
- package/skill/skill-maker/references/input_validation.md +90 -0
- package/skill/skill-maker/references/skill_structure.md +74 -0
- package/skill/system-prompt-creator/SKILL.md +50 -0
- package/skill/system-prompt-creator/references/data_format_selection.md +135 -0
- package/skill/system-prompt-creator/references/multi_prompt_architecture.md +386 -0
- package/skill/system-prompt-creator/references/prompt_structure.md +140 -0
- package/skill/system-prompt-creator/references/quality_criteria.md +83 -0
- package/skill/typst-creator/SKILL.md +51 -0
- package/skill/typst-creator/references/layout.md +401 -0
- package/skill/typst-creator/references/math.md +297 -0
- package/skill/typst-creator/references/scripting.md +237 -0
- package/skill/typst-creator/references/styling.md +217 -0
- package/skill/typst-creator/references/syntax.md +234 -0
- package/skill/web-design-guidelines/SKILL.md +35 -0
- package/terminal.png +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# Multi-Prompt Architecture
|
|
2
|
+
|
|
3
|
+
Defines architecture patterns for complex tasks requiring multiple system prompts.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Architecture Patterns](#architecture-patterns)
|
|
8
|
+
- [1. Sequential Pipeline](#1-sequential-pipeline)
|
|
9
|
+
- [2. Parallel Split](#2-parallel-split)
|
|
10
|
+
- [3. Conditional Branch](#3-conditional-branch)
|
|
11
|
+
- [4. Iterative Refinement](#4-iterative-refinement)
|
|
12
|
+
- [5. Step-back Pipeline](#5-step-back-pipeline)
|
|
13
|
+
- [6. Fan-out / Fan-in](#6-fan-out--fan-in)
|
|
14
|
+
- [Pattern Selection Matrix](#pattern-selection-matrix)
|
|
15
|
+
- [Inter-Prompt Data Contract](#inter-prompt-data-contract)
|
|
16
|
+
- [Architecture Design Process](#architecture-design-process)
|
|
17
|
+
- [Examples](#examples)
|
|
18
|
+
|
|
19
|
+
## Architecture Patterns
|
|
20
|
+
|
|
21
|
+
### Notation Legend
|
|
22
|
+
|
|
23
|
+
To avoid ambiguity, the structures in this section use the notation below.
|
|
24
|
+
|
|
25
|
+
- `A`, `B`, `C`: Generic prompt nodes executed in sequence or branches
|
|
26
|
+
- `S`: Step-back prompt node (extracts general principles before the main task)
|
|
27
|
+
- `B₁..Bₙ`: Multiple parallel prompt nodes of the same role/type
|
|
28
|
+
- `X`: Routing condition or classification result used for branching
|
|
29
|
+
- `Input`: Raw user/task input entering the architecture
|
|
30
|
+
- `Output`: Final result returned to the caller
|
|
31
|
+
- `intermediate_*`: Structured intermediate artifact passed between prompts
|
|
32
|
+
- `→`: Data flow between prompt nodes
|
|
33
|
+
- `[B, C, D]`: Parallel branches receiving the same upstream input
|
|
34
|
+
- `(loop)`: Iterative cycle that repeats until a termination condition is met
|
|
35
|
+
|
|
36
|
+
Prompt counts (`2~N`, `3~N`) indicate the number of distinct system prompts in the architecture template, not the number of runtime executions.
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
- pattern: Sequential Pipeline
|
|
40
|
+
structure: A → B → C
|
|
41
|
+
prompts: 2~N
|
|
42
|
+
use_case: Step-by-step transformation/processing
|
|
43
|
+
- pattern: Parallel Split
|
|
44
|
+
structure: A → [B, C, D]
|
|
45
|
+
prompts: 2~N
|
|
46
|
+
use_case: Processing the same input from multiple perspectives
|
|
47
|
+
- pattern: Conditional Branch
|
|
48
|
+
structure: A → if X then B else C
|
|
49
|
+
prompts: 2~N
|
|
50
|
+
use_case: Branching based on input conditions
|
|
51
|
+
- pattern: Iterative Refinement
|
|
52
|
+
structure: A → B → A (loop)
|
|
53
|
+
prompts: 2 (repeated)
|
|
54
|
+
use_case: Quality improvement loop
|
|
55
|
+
- pattern: Step-back Pipeline
|
|
56
|
+
structure: S → A (→ B optional)
|
|
57
|
+
prompts: 2~N
|
|
58
|
+
use_case: Working after activating background knowledge, then optional post-processing
|
|
59
|
+
- pattern: Fan-out / Fan-in
|
|
60
|
+
structure: "A → [B₁..Bₙ] → C"
|
|
61
|
+
prompts: 3~N
|
|
62
|
+
use_case: Integration after distributed processing
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 1. Sequential Pipeline
|
|
66
|
+
|
|
67
|
+
The most basic multi-prompt pattern for sequentially transforming inputs.
|
|
68
|
+
|
|
69
|
+
### Structure
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
Step 1: Input --> [Prompt A] --> intermediate_1
|
|
73
|
+
Step 2: intermediate_1 --> [Prompt B] --> intermediate_2
|
|
74
|
+
Step 3: intermediate_2 --> [Prompt C] --> Output
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Characteristics
|
|
78
|
+
|
|
79
|
+
- **Data Flow**: Unidirectional, linear
|
|
80
|
+
- **Role of each prompt**: Receives the output of the previous step as input and transforms it
|
|
81
|
+
- **Error Propagation**: Errors in early stages propagate to subsequent stages
|
|
82
|
+
- **Suitable Tasks**: Analysis → Transformation → Formatting, Extraction → Classification → Summarization
|
|
83
|
+
|
|
84
|
+
### Design Principles
|
|
85
|
+
|
|
86
|
+
- **Single Responsibility**: Each prompt performs only one transformation
|
|
87
|
+
- **Explicit Output Format**: Explicitly define the output format of each prompt to be used as input for the next
|
|
88
|
+
- **Error Boundary**: Include input validation at each step
|
|
89
|
+
- **Intermediate Format**: Structured formats (JSON, YAML) are recommended for intermediate data
|
|
90
|
+
|
|
91
|
+
## 2. Parallel Split
|
|
92
|
+
|
|
93
|
+
A pattern where multiple prompts process the same input simultaneously.
|
|
94
|
+
|
|
95
|
+
### Structure
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
Input --> [Prompt B1] --> Output1
|
|
99
|
+
Input --> [Prompt B2] --> Output2
|
|
100
|
+
Input --> [Prompt B3] --> Output3
|
|
101
|
+
(all branches receive the same Input, executed independently)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Characteristics
|
|
105
|
+
|
|
106
|
+
- **Data Flow**: 1:N branch
|
|
107
|
+
- **Role of each prompt**: Processes the same input from different perspectives/roles
|
|
108
|
+
- **Independence**: Each branch is independent of the others
|
|
109
|
+
- **Suitable Tasks**: Multi-persona interpretation, multi-language translation, multi-format generation
|
|
110
|
+
|
|
111
|
+
### Design Principles
|
|
112
|
+
|
|
113
|
+
- **Shared Input Contract**: All branch prompts receive the same input format
|
|
114
|
+
- **Role Differentiation**: Each prompt has a unique role/perspective
|
|
115
|
+
- **Output Independence**: Each output can be used independently
|
|
116
|
+
|
|
117
|
+
## 3. Conditional Branch
|
|
118
|
+
|
|
119
|
+
A pattern that branches into different prompts based on the characteristics of the input.
|
|
120
|
+
|
|
121
|
+
### Structure
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
Step 1: Input --> [Prompt A: Router] --> category label
|
|
125
|
+
Step 2: Route by category:
|
|
126
|
+
- Type X --> [Prompt B]
|
|
127
|
+
- Type Y --> [Prompt C]
|
|
128
|
+
- Type Z --> [Prompt D]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Characteristics
|
|
132
|
+
|
|
133
|
+
- **Data Flow**: Conditional branching
|
|
134
|
+
- **Role of Router prompt**: Classifies input and selects the appropriate path
|
|
135
|
+
- **Suitable Tasks**: Specialized processing by input type, processing branches by complexity
|
|
136
|
+
|
|
137
|
+
### Router Prompt Design
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
Classify the following input into one of these categories:
|
|
141
|
+
- TYPE_A: [description]
|
|
142
|
+
- TYPE_B: [description]
|
|
143
|
+
- TYPE_C: [description]
|
|
144
|
+
|
|
145
|
+
Return only the category label.
|
|
146
|
+
|
|
147
|
+
Input: {input}
|
|
148
|
+
Category:
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 4. Iterative Refinement
|
|
152
|
+
|
|
153
|
+
A pattern where two prompts execute alternately to gradually improve output quality.
|
|
154
|
+
|
|
155
|
+
### Structure
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
Step 1: Input --> [Prompt A: Generator] --> draft
|
|
159
|
+
Step 2: draft --> [Prompt B: Critic] --> feedback
|
|
160
|
+
Step 3: Input + feedback --> [Prompt A: Generator] --> revised draft
|
|
161
|
+
Repeat Step 2-3 until termination condition (max N iterations or Critic approval)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Characteristics
|
|
165
|
+
|
|
166
|
+
- **Data Flow**: Cyclic (Generator ↔ Critic)
|
|
167
|
+
- **Termination Condition**: Fixed number of iterations or Critic's approval
|
|
168
|
+
- **Suitable Tasks**: High-quality document generation, code review/correction, translation verification
|
|
169
|
+
|
|
170
|
+
### Design Principles
|
|
171
|
+
|
|
172
|
+
- **Generator Role**: Generates initial draft or revision reflecting feedback
|
|
173
|
+
- **Critic Role**: Evaluates quality and provides specific improvement points
|
|
174
|
+
- **Convergence**: Set an upper limit on the number of iterations (to prevent infinite loops)
|
|
175
|
+
- **Feedback Format**: Structured feedback (score + itemized comments)
|
|
176
|
+
|
|
177
|
+
## 5. Step-back Pipeline
|
|
178
|
+
|
|
179
|
+
A pattern that first reasons through general principles and then uses the results as context to perform specific tasks.
|
|
180
|
+
|
|
181
|
+
### Structure
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
Step 1: Input --> [Prompt S: Step-back] --> general_principles
|
|
185
|
+
Step 2: Input + general_principles --> [Prompt A: Main Task] --> Output
|
|
186
|
+
Optional Step 3: Output --> [Prompt B: Post-Processor/Verifier] --> Final Output
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Characteristics
|
|
190
|
+
|
|
191
|
+
- **Data Flow**: 2-step sequential (abstract → concrete), with optional 3rd post-processing step
|
|
192
|
+
- **Role of Step-back prompt**: Extracts general principles/core elements of the domain
|
|
193
|
+
- **Role of Main prompt**: Performs specific tasks using the Step-back result as context
|
|
194
|
+
- **Role of Optional prompt B**: Reformats, validates, or quality-checks the main output when needed
|
|
195
|
+
- **Suitable Tasks**: Expert analysis, creative content generation, strategy development
|
|
196
|
+
|
|
197
|
+
## 6. Fan-out / Fan-in
|
|
198
|
+
|
|
199
|
+
A pattern that splits input for parallel processing and then integrates the results.
|
|
200
|
+
|
|
201
|
+
### Structure
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
Step 1: Input --> [Prompt A: Splitter] --> [chunk1, chunk2, ..., chunkN]
|
|
205
|
+
Step 2: chunk1 --> [Prompt B] --> result1
|
|
206
|
+
chunk2 --> [Prompt B] --> result2
|
|
207
|
+
chunkN --> [Prompt B] --> resultN
|
|
208
|
+
(all chunks processed independently with the same Prompt B)
|
|
209
|
+
Step 3: [result1, result2, ..., resultN] --> [Prompt C: Aggregator] --> Output
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Characteristics
|
|
213
|
+
|
|
214
|
+
- **Data Flow**: Split → Parallel processing → Integration
|
|
215
|
+
- **Suitable Tasks**: Large-volume text processing, multi-source analysis
|
|
216
|
+
- **Caution**: Potential context loss at split boundaries
|
|
217
|
+
|
|
218
|
+
## Pattern Selection Matrix
|
|
219
|
+
|
|
220
|
+
Guide for pattern selection based on requirements:
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
- requirement: Step-by-step transformation required
|
|
224
|
+
pattern: Sequential Pipeline
|
|
225
|
+
rationale: Optimize each step independently
|
|
226
|
+
- requirement: Same data from different perspectives
|
|
227
|
+
pattern: Parallel Split
|
|
228
|
+
rationale: Specialized prompt for each perspective
|
|
229
|
+
- requirement: Diverse input types
|
|
230
|
+
pattern: Conditional Branch
|
|
231
|
+
rationale: Optimal processing for each type
|
|
232
|
+
- requirement: High output quality required
|
|
233
|
+
pattern: Iterative Refinement
|
|
234
|
+
rationale: Iterative quality improvement
|
|
235
|
+
- requirement: Complex domain analysis
|
|
236
|
+
pattern: Step-back Pipeline
|
|
237
|
+
rationale: Activate background knowledge
|
|
238
|
+
- requirement: Large-volume input processing
|
|
239
|
+
pattern: Fan-out / Fan-in
|
|
240
|
+
rationale: Parallel distributed processing
|
|
241
|
+
- requirement: Combination of patterns required
|
|
242
|
+
pattern: Hybrid (Composite)
|
|
243
|
+
rationale: Combine patterns as nodes
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Inter-Prompt Data Contract
|
|
247
|
+
|
|
248
|
+
Data transfer protocols between multiple prompts:
|
|
249
|
+
|
|
250
|
+
### Recommended Intermediate Data Formats
|
|
251
|
+
|
|
252
|
+
```yaml
|
|
253
|
+
- priority: 1st
|
|
254
|
+
format: YAML
|
|
255
|
+
use_case: Nested structure data (62.1% accuracy)
|
|
256
|
+
- priority: 2nd
|
|
257
|
+
format: Markdown-KV
|
|
258
|
+
use_case: 1D key-value data (60.7% accuracy)
|
|
259
|
+
- priority: 3rd
|
|
260
|
+
format: JSON
|
|
261
|
+
use_case: Cases requiring programming integration (50.3~52.3% accuracy)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Data Contract Definition Pattern
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
# Prompt A Output Contract
|
|
268
|
+
## Output Format: YAML
|
|
269
|
+
## Fields:
|
|
270
|
+
- analysis_result: string (summary of analysis result)
|
|
271
|
+
- categories: list[string] (classification results)
|
|
272
|
+
- confidence: float (0.0~1.0)
|
|
273
|
+
- details: map[string, string] (itemized detailed explanation)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Architecture Design Process
|
|
277
|
+
|
|
278
|
+
Judgment criteria when designing a multi-prompt architecture:
|
|
279
|
+
|
|
280
|
+
```yaml
|
|
281
|
+
- step: 1
|
|
282
|
+
question: Can the task be solved with a single prompt?
|
|
283
|
+
decision: "Yes → Single prompt, No → Next"
|
|
284
|
+
- step: 2
|
|
285
|
+
question: Can the task be decomposed into independent steps?
|
|
286
|
+
decision: "Yes → Sequential Pipeline"
|
|
287
|
+
- step: 3
|
|
288
|
+
question: Are multiple perspectives required for the same input?
|
|
289
|
+
decision: "Yes → Parallel Split"
|
|
290
|
+
- step: 4
|
|
291
|
+
question: Does processing differ based on the input type?
|
|
292
|
+
decision: "Yes → Conditional Branch"
|
|
293
|
+
- step: 5
|
|
294
|
+
question: Is iterative improvement of output quality required?
|
|
295
|
+
decision: "Yes → Iterative Refinement"
|
|
296
|
+
- step: 6
|
|
297
|
+
question: Is activation of domain expert knowledge required?
|
|
298
|
+
decision: "Yes → Step-back Pipeline"
|
|
299
|
+
- step: 7
|
|
300
|
+
question: Should the above patterns be combined?
|
|
301
|
+
decision: "Yes → Hybrid"
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Examples
|
|
305
|
+
|
|
306
|
+
### Example 1: Code → Multi-audience Documentation
|
|
307
|
+
|
|
308
|
+
A 2-step architecture that analyzes code and transforms it into language understandable by QA/PMs/Designers.
|
|
309
|
+
|
|
310
|
+
```text
|
|
311
|
+
Architecture: Sequential Pipeline + Parallel Split
|
|
312
|
+
|
|
313
|
+
Step 1: [Prompt A - Code Analyzer]
|
|
314
|
+
Input: Source code
|
|
315
|
+
Output: Structured analysis (YAML)
|
|
316
|
+
- functionality summary
|
|
317
|
+
- data flow
|
|
318
|
+
- UI interactions
|
|
319
|
+
- business rules
|
|
320
|
+
- edge cases
|
|
321
|
+
|
|
322
|
+
Step 2: [Parallel Split]
|
|
323
|
+
Input: Step 1 output
|
|
324
|
+
|
|
325
|
+
[Prompt B₁ - QA Translator]
|
|
326
|
+
Role: Senior QA Engineer
|
|
327
|
+
Output: Test scenarios, edge cases, regression points
|
|
328
|
+
|
|
329
|
+
[Prompt B₂ - PM Translator]
|
|
330
|
+
Role: Product Manager
|
|
331
|
+
Output: Feature description, user stories, acceptance criteria
|
|
332
|
+
|
|
333
|
+
[Prompt B₃ - Designer Translator]
|
|
334
|
+
Role: UX Designer
|
|
335
|
+
Output: Interaction flows, UI states, accessibility notes
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Example 2: Customer Inquiry Router
|
|
339
|
+
|
|
340
|
+
A conditional branch architecture that handles customer inquiries according to their type.
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
Architecture: Conditional Branch
|
|
344
|
+
|
|
345
|
+
[Prompt A - Router]
|
|
346
|
+
Input: Customer message
|
|
347
|
+
Output: Category (BILLING | TECHNICAL | GENERAL | COMPLAINT)
|
|
348
|
+
|
|
349
|
+
[Prompt B₁ - Billing Handler]
|
|
350
|
+
Role: Billing specialist
|
|
351
|
+
Context: Pricing plans, refund policy
|
|
352
|
+
|
|
353
|
+
[Prompt B₂ - Technical Handler]
|
|
354
|
+
Role: Technical support engineer
|
|
355
|
+
Context: Product docs, known issues
|
|
356
|
+
|
|
357
|
+
[Prompt B₃ - General Handler]
|
|
358
|
+
Role: Customer service representative
|
|
359
|
+
|
|
360
|
+
[Prompt B₄ - Complaint Handler]
|
|
361
|
+
Role: Customer relations manager
|
|
362
|
+
Context: Escalation policy, compensation guidelines
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Example 3: High-quality Document Generator
|
|
366
|
+
|
|
367
|
+
An iterative refinement architecture that generates high-quality documents through repeated improvements.
|
|
368
|
+
|
|
369
|
+
```text
|
|
370
|
+
Architecture: Step-back + Iterative Refinement
|
|
371
|
+
|
|
372
|
+
[Prompt S - Step-back]
|
|
373
|
+
Input: Document topic + requirements
|
|
374
|
+
Output: Domain principles, key aspects, quality criteria
|
|
375
|
+
|
|
376
|
+
[Prompt A - Generator]
|
|
377
|
+
Input: Topic + Step-back output + (previous feedback if any)
|
|
378
|
+
Output: Document draft
|
|
379
|
+
|
|
380
|
+
[Prompt B - Critic]
|
|
381
|
+
Input: Draft + quality criteria from Step-back
|
|
382
|
+
Output: Score (1-10) + itemized feedback
|
|
383
|
+
Termination: Score >= 8 or max 3 iterations
|
|
384
|
+
|
|
385
|
+
Loop: A --> B --> A --> B --> ... --> Final Output
|
|
386
|
+
```
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# System Prompt Structure
|
|
2
|
+
|
|
3
|
+
Building blocks and assembly order used when assembling a system prompt.
|
|
4
|
+
|
|
5
|
+
## Building Blocks
|
|
6
|
+
|
|
7
|
+
A system prompt is composed of a combination of the blocks below. Not all blocks are mandatory; select only the blocks needed based on the nature of the task.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
- block: Role
|
|
11
|
+
role: Model's identity and expertise
|
|
12
|
+
required: Recommended
|
|
13
|
+
- block: Context
|
|
14
|
+
role: Domain background, terminology, and rules
|
|
15
|
+
required: Case-by-case
|
|
16
|
+
- block: Task
|
|
17
|
+
role: Clear description of the task to be performed
|
|
18
|
+
required: Required
|
|
19
|
+
- block: Input Format
|
|
20
|
+
role: Definition of the input data format
|
|
21
|
+
required: When input exists
|
|
22
|
+
- block: Output Format
|
|
23
|
+
role: Definition of the output form and structure
|
|
24
|
+
required: Recommended
|
|
25
|
+
- block: Examples
|
|
26
|
+
role: Demonstration of input-output pairs
|
|
27
|
+
required: When pattern guidance is needed
|
|
28
|
+
- block: Guardrails
|
|
29
|
+
role: Scope limits, error handling, and safety
|
|
30
|
+
required: Case-by-case
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Assembly Order
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
[Role] → Who am I
|
|
37
|
+
[Context] → What is the situation
|
|
38
|
+
[Task] → What am I doing
|
|
39
|
+
[Input] → What am I receiving
|
|
40
|
+
[Output] → What am I outputting
|
|
41
|
+
[Examples] → Showing how it's done
|
|
42
|
+
[Guardrails] → What NOT to do / Exception handling
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This order is designed to help the model build context cumulatively: "I am who → The situation is this → The task is this → The input is this → The output is this."
|
|
46
|
+
|
|
47
|
+
## Block Details
|
|
48
|
+
|
|
49
|
+
### Role
|
|
50
|
+
|
|
51
|
+
Assigning an identity to the model activates domain-specific vocabulary and perspectives.
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
You are a [Title/Role] with expertise in [Expertise Area].
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- The more specific the role, the deeper the response.
|
|
58
|
+
- If tone/style is important, specify it in the Role: "in a direct, technical style"
|
|
59
|
+
- If multiple perspectives are needed, separate primary and secondary roles.
|
|
60
|
+
|
|
61
|
+
### Context
|
|
62
|
+
|
|
63
|
+
Background information for the task. Unlike the Role, this changes dynamically per task.
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
Context:
|
|
67
|
+
- [Domain Background]
|
|
68
|
+
- [Current Situation/Conditions]
|
|
69
|
+
- [Target User Characteristics]
|
|
70
|
+
- [Characteristics of Data to be Processed]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Task
|
|
74
|
+
|
|
75
|
+
Describes the work to be performed. **Prioritize using positive instructions.**
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
- method: Instruction (Positive)
|
|
79
|
+
example: "Summarize into 3 items"
|
|
80
|
+
priority: Use first
|
|
81
|
+
- method: Constraint (Negative)
|
|
82
|
+
example: "Do not include personal information"
|
|
83
|
+
priority: Only for safety/format requirements
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Starting with a verb makes it clear: Analyze, Classify, Compare, Create, Extract, Generate, Identify, List, Parse, Rank, Summarize, Translate.
|
|
87
|
+
|
|
88
|
+
### Input Format
|
|
89
|
+
|
|
90
|
+
Specify the format when the input is structured. Using variables increases prompt reusability.
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Input:
|
|
94
|
+
- Type: [text / JSON / code / table]
|
|
95
|
+
- Variable: {input_text}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Output Format
|
|
99
|
+
|
|
100
|
+
Specifying the output structure reduces hallucinations and ensures consistency.
|
|
101
|
+
|
|
102
|
+
- Providing a Schema can enforce the output structure.
|
|
103
|
+
- For format selection when including data within a prompt, refer to [data_format_selection.md](data_format_selection.md).
|
|
104
|
+
|
|
105
|
+
### Examples
|
|
106
|
+
|
|
107
|
+
Including input-output examples helps guide the model's output pattern.
|
|
108
|
+
|
|
109
|
+
- **Quantity**: At least 3–5; more for complex tasks
|
|
110
|
+
- **Diversity**: For classification, include each class evenly and mix the order
|
|
111
|
+
- **Edge Cases**: Include methods for handling unstructured input
|
|
112
|
+
- **Quality**: An error in a single example can contaminate the entire output
|
|
113
|
+
|
|
114
|
+
### Guardrails
|
|
115
|
+
|
|
116
|
+
Scope limits and exception handling. Concentrated placement of Constraints here.
|
|
117
|
+
|
|
118
|
+
- **Scope**: "Respond only within the scope of the provided data"
|
|
119
|
+
- **Fallback**: "If unable to judge, return 'Indeterminable'"
|
|
120
|
+
- **Safety**: "Respond in a respectful manner"
|
|
121
|
+
|
|
122
|
+
## Minimal vs Full Prompt
|
|
123
|
+
|
|
124
|
+
### Minimal (Simple Tasks)
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
[Role] + [Task] + [Output Format]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Standard (Most Tasks)
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
[Role] + [Context] + [Task] + [Output Format] + [Guardrails]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Full (Complex Tasks)
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
[Role] + [Context] + [Task] + [Input Format] + [Output Format] + [Examples] + [Guardrails]
|
|
140
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Quality Criteria
|
|
2
|
+
|
|
3
|
+
Quality standards and checklists for production-ready system prompts.
|
|
4
|
+
|
|
5
|
+
## Production-Ready Checklist
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
- check: Task Clarity
|
|
9
|
+
criteria: Is the task to be performed by the model described without ambiguity?
|
|
10
|
+
- check: Output Definition
|
|
11
|
+
criteria: Are the form, structure, and length of the output specified?
|
|
12
|
+
- check: Scope Limitation
|
|
13
|
+
criteria: Is the range within which the model should respond clearly bounded?
|
|
14
|
+
- check: Fallback Handling
|
|
15
|
+
criteria: Is the response defined for inputs that cannot be processed?
|
|
16
|
+
- check: Reproducibility
|
|
17
|
+
criteria: Does the structure produce consistent output for the same input?
|
|
18
|
+
- check: Variable Separation
|
|
19
|
+
criteria: Are dynamic inputs separated into variables without hardcoding?
|
|
20
|
+
- check: Self-Containment
|
|
21
|
+
criteria: Can the task be performed using only the prompt without external explanation?
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quality Degradation Patterns
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
- pattern: Ambiguous Task
|
|
28
|
+
problem: "Write a good article" → Model interprets arbitrarily
|
|
29
|
+
fix: Specify concrete verbs + length + target
|
|
30
|
+
- pattern: Undefined Output
|
|
31
|
+
problem: Output format changes every time
|
|
32
|
+
fix: Specify structure/format/length
|
|
33
|
+
- pattern: Excessive Constraints
|
|
34
|
+
problem: "Listing only 'Do not...' → Unclear what the model can do"
|
|
35
|
+
fix: Prioritize positive instructions; use constraints only for safety
|
|
36
|
+
- pattern: Unbounded Scope
|
|
37
|
+
problem: Model generates freely from all training data → Hallucination
|
|
38
|
+
fix: "Only within the scope of the provided input"
|
|
39
|
+
- pattern: Missing Examples
|
|
40
|
+
problem: Conveying complex output patterns through explanation only
|
|
41
|
+
fix: Add 3–5 input-output examples
|
|
42
|
+
- pattern: Erroneous Examples
|
|
43
|
+
problem: Typos/logic errors in examples → Model learns error patterns
|
|
44
|
+
fix: Directly verify examples before including them
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Single vs. Multi-Prompt Decision Criteria
|
|
48
|
+
|
|
49
|
+
A multi-prompt architecture is needed when a single system prompt cannot solve the task.
|
|
50
|
+
|
|
51
|
+
- **Task can be completed with a single role**: Single
|
|
52
|
+
- **Input → Output is a single transformation**: Single
|
|
53
|
+
- **Intermediate transformation steps exist (A→B→C)**: Multi: Sequential
|
|
54
|
+
- **Processing the same input from different perspectives**: Multi: Parallel
|
|
55
|
+
- **Processing differs based on the input type**: Multi: Conditional
|
|
56
|
+
- **Iterative draft → review → revision cycle is needed**: Multi: Iterative
|
|
57
|
+
|
|
58
|
+
For multi-prompt design, refer to [multi_prompt_architecture.md](multi_prompt_architecture.md).
|
|
59
|
+
|
|
60
|
+
## Principles for Writing Instructions
|
|
61
|
+
|
|
62
|
+
- **Positive First**: "Do X" > "Don't do Y"
|
|
63
|
+
- **Start with a Verb**: Analyze, Classify, Extract, Generate, Summarize, etc.
|
|
64
|
+
- **Specific Length**: "3 items", "2 paragraphs", "Within 100 characters"
|
|
65
|
+
- **Processing Order**: "First perform A, then perform B based on the result"
|
|
66
|
+
- **Scope Specification**: "Only within the given text", "Based on the data below"
|
|
67
|
+
|
|
68
|
+
## Methods for Ensuring Output Quality
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
- method: Enforce Structured Format (JSON, YAML)
|
|
72
|
+
effect: Reduces hallucinations, ensures consistency
|
|
73
|
+
when: During programming integration
|
|
74
|
+
- method: Provide Schema
|
|
75
|
+
effect: Strictly enforces output structure
|
|
76
|
+
when: When outputting complex structures
|
|
77
|
+
- method: Include Examples (Few-shot)
|
|
78
|
+
effect: Maximizes consistency through pattern learning
|
|
79
|
+
when: When outputting unstructured patterns
|
|
80
|
+
- method: Specify Length
|
|
81
|
+
effect: Prevents unnecessarily long responses
|
|
82
|
+
when: Always recommended
|
|
83
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typst-creator
|
|
3
|
+
description: Generate Typst source code for documents, reports, papers, and presentations, covering markup, math, scripting, and layout syntax.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Typst Document Creation Capability
|
|
7
|
+
|
|
8
|
+
This skill enables the agent to create Typst documents with correct syntax, styling, and mathematical formulas.
|
|
9
|
+
|
|
10
|
+
> **Version**: Based on Typst v0.14.2
|
|
11
|
+
|
|
12
|
+
## Core Capability
|
|
13
|
+
|
|
14
|
+
- **Function**: Generate Typst source code for documents, reports, papers, and presentations
|
|
15
|
+
- **Output Format**: `.typ` files with proper Typst syntax
|
|
16
|
+
- **Modes**: Markup, Math, and Code modes
|
|
17
|
+
|
|
18
|
+
## Typst Syntax Overview
|
|
19
|
+
|
|
20
|
+
| Mode | Entry Syntax | Purpose |
|
|
21
|
+
|------|--------------|---------|
|
|
22
|
+
| Markup | Default | Text, headings, lists, emphasis |
|
|
23
|
+
| Math | `$...$` | Mathematical formulas |
|
|
24
|
+
| Code | `#` prefix | Variables, functions, logic |
|
|
25
|
+
|
|
26
|
+
## Domain Knowledge
|
|
27
|
+
|
|
28
|
+
| Topic | Reference |
|
|
29
|
+
|-------|-----------|
|
|
30
|
+
| **Syntax** | Markup, math, and code mode syntax. See [./references/syntax.md](./references/syntax.md) |
|
|
31
|
+
| **Styling** | Set rules and show rules for styling. See [./references/styling.md](./references/styling.md) |
|
|
32
|
+
| **Scripting** | Variables, functions, control flow. See [./references/scripting.md](./references/scripting.md) |
|
|
33
|
+
| **Math** | Mathematical notation and symbols. See [./references/math.md](./references/math.md) |
|
|
34
|
+
| **Layout** | Page setup, grids, alignment. See [./references/layout.md](./references/layout.md) |
|
|
35
|
+
|
|
36
|
+
## Key Differences from LaTeX
|
|
37
|
+
|
|
38
|
+
| Feature | LaTeX | Typst |
|
|
39
|
+
|---------|-------|-------|
|
|
40
|
+
| Bold | `\textbf{text}` | `*text*` |
|
|
41
|
+
| Italic | `\textit{text}` | `_text_` |
|
|
42
|
+
| Heading | `\section{Title}` | `= Title` |
|
|
43
|
+
| Fraction | `\frac{a}{b}` | `a/b` or `frac(a, b)` |
|
|
44
|
+
| Function call | `\func{arg}` | `#func(arg)` |
|
|
45
|
+
| Set property | preamble commands | `#set func(prop: value)` |
|
|
46
|
+
|
|
47
|
+
## Constraints
|
|
48
|
+
|
|
49
|
+
- **File Extension**: Output files use `.typ` extension
|
|
50
|
+
- **Unicode Support**: Typst natively supports Unicode symbols
|
|
51
|
+
- **No Packages Required**: Most features are built-in (unlike LaTeX)
|