LangGPT: Structured Prompt Design Framework
repository·main·Indexed 11 days ago
https://github.com/langgptai/langgptA systematic, template-based methodology for creating high-quality LLM prompts, treating prompt engineering like a programming language. It utilizes a role-based framework with modular components such as Role, Profile, Goal, Skills, Rules, and Workflow. The ecosystem includes tools like PromptShow for creating prompt images, PromptVer for semantic versioning, and specialized meta-prompts for automated prompt generation.
What's inside LangGPT
- PromptShow is a tool designed to create and share visually appealing images of LLM (Large Language Model) prompts. It allows users to transform text-based prompts into beautiful, shareable snippets with customizable themes, making them suitable for social media platforms like Twitter and Slack.
Overview of Carbon
mainCarbon is a tool designed to transform source code into beautiful, aesthetically pleasing images suitable for sharing on social media (like Twitter). It allows users to create high-quality code screenshots with customizable themes and styles.Explore the LangGPT Ecosystem
mainThe LangGPT ecosystem consists of several specialized tools and collections:
Core Framework & Tools
- LangGPT: The core framework and methodology.
- PromptVer: Semantic versioning for prompts (version control like Git).
- PromptShow: Tool to create beautiful prompt images.
- Minstrel: A multi-agent system for auto-generating prompts.
- claude_marketplace: Official Claude Code skill marketplace.
Model-Specific Prompt Collections
Curated prompts optimized for specific models:
- ChatGPT:
wonderful-prompts - Anthropic Claude:
awesome-claude-prompts - DeepSeek & R1:
awesome-deepseek-prompts - Google Gemini:
awesome-gemini-prompts - xAI Grok:
awesome-grok-prompts - Alibaba Qwen:
qwen-prompts - Meta Llama 2/3:
awesome-llama-prompts - ByteDance Doubao:
awesome-doubao-prompts
Specialized Domains
- Multimodal: GPT-4V, DALL-E 3, image/video prompts.
- Deep Research: Research-focused prompts across models.
- Voice AI: Conversational agents and voice prompts.
- GraphRAG: Graph-based retrieval prompts.
- Security: LLM jailbreaks and defense research.
Contact LangGPT and Community
mainFor inquiries or to join the community, use the following resources:
- Knowledge Base: http://feishu.langgpt.ai
- Twitter/X: @langgptai
- GitHub Discussions: Community Forum
- Email: contact@langgpt.ai
What is a Structured Prompt?
mainA Structured Prompt is a method of writing prompts using organizational patterns similar to writing an article or using templates (like a CV or a research paper). Instead of providing a single block of unstructured text, you use a combination of Identifiers and Attribute Words to define the semantic structure of the prompt.
Key Components:
- Identifiers: Symbols like
#,##,<>,[], or-used to denote hierarchy, headings, or variables. LangGPT primarily uses Markdown syntax (#for H1,##for H2, etc.) to control content levels. - Attribute Words: Semantic labels like
Role,Profile,Rules,Workflow, andInitialization. These act like section headings in an academic paper (e.g., Abstract, Methods, Conclusion) to tell the model what the following content describes.
Comparison with Frameworks:
While frameworks like CRISPE (Capacity, Insight, Statement, Personality, Experiment) provide a mental model for what to include, Structured Prompting provides a formal template for how to present that information to the LLM.
- Identifiers: Symbols like
What is Relationship Expression (关系表达)?
mainRelationship Expression is a prompting strategy designed to overcome the limitations of using technical terminology (Entity Expression). Instead of trying to 'compress' complex feelings into precise terms like 'Minimalism' or 'Material Design'—which can lead to ambiguity or information loss—you 'expand' your requirements by describing the relationships between known and unknown things.
This method is highly effective for AI because LLMs operate on vector mathematics, understanding concepts based on their position in a 'relationship space' relative to other concepts.
What is LangGPT?
mainLangGPT (Language for GPT-like LLMs) is a natural language programming framework designed to improve the quality, reusability, and structure of prompts for Large Language Models (LLMs).
Inspired by the structure and reusability of programming languages, LangGPT moves away from unstructured natural language instructions toward a structured, two-layer design consisting of modules and internal elements. This approach aims to reduce the learning curve for non-AI experts and allow LLMs to automatically generate high-quality prompts in a manner similar to code generation.
What is a Prompt and Prompt Engineering?
mainPrompt
A Prompt is any content used by a Large Language Model (LLM) to predict an output. This includes:
- Pre-set system prompts.
- Direct user inputs.
- The model's own previous outputs (in multi-turn conversations).
Core Concept: "Everything that is used by the model to predict an output result is a Prompt."
Prompt Engineering
Prompt Engineering is the practice of designing and adjusting prompts to obtain ideal model results. It is the interface used to call and optimize the capabilities of an LLM. It is a foundational step in LLM application development, serving as the basis for performance optimization, RAG (Retrieval-Augmented Generation), and fine-tuning data construction.
LangGPT Design Principles for Prompt Engineering
mainTo optimize prompts, LangGPT follows four core design principles derived from the comparison between natural language and programming languages:
- Standardized Format: Prompts should use a standardized format to make user intent and requirements stand out, overcoming the ambiguity of natural language.
- Extensible Structure: The structure must be extensible, allowing users to design custom structures tailored to specific domains and tasks.
- Explicit and Complete Requirements: Instructions and additional constraints must be explicit and complete to avoid misunderstanding or bias.
- Flexible Language: While maintaining structure, the language used should remain flexible to adapt to different domains and ease of learning.
Understand the advantages of Structured Prompts
mainStructured Prompts offer several key advantages over unstructured text:
- Hierarchical Structure: Uses clear levels (e.g.,
# Role,## Profile,### Skill) to unify form and content, improving readability for humans and aligning with the hierarchical training data of LLMs like ChatGPT. - Improved Semantic Cognition: Identifiers (attribute words) group similar semantics together, reducing the cognitive load for both the user and the model. Attribute words act as semantic cues that help the model grasp the overall intent.
- Targeted Capability Activation: Using specific top-level identifiers like
Role,Expert, orMasterdirectly triggers the model's role-playing capabilities. UsingRulesorConstraintshelps mitigate hallucinations and ensure safety. - Production-Grade Engineering: Structured prompts behave like code. They are modular, easier to maintain, version-control (via Git), and support collaborative development (e.g., defining
InputandOutputmodules for multi-agent chains).
- Hierarchical Structure: Uses clear levels (e.g.,
The ultimate purpose and cognitive benefits of prompting
mainThe essence of prompting is a cognitive practice rather than a mere technical skill. It is designed to teach four core abilities:
- Fine Observation: Describing requires closer looking.
- Precise Articulation: Finding exact words to communicate with AI.
- Open Creation: Utilizing the 'gaps' in symbolic systems to invite surprises.
- Critical Reflection: Understanding how technology alters perception.
Core Principle: AI can generate content, but it cannot confer meaning. Meaning remains the exclusive domain of human intention, choice, and interpretation.
Core Concepts: Variables, Commands, and Logic
mainEnhance prompt intelligence using these advanced syntax patterns:
1. Variables and References Use
<Variable>syntax to create self-referential prompts that maintain consistency. Example:As a <Role>, you must follow <Rules>.2. Commands Define reusable actions for better UX, typically using a
/prefix. Example:## Commands - Prefix: "/" - Commands: - help: Display all available commands - continue: Resume interrupted output3. Conditional Logic Use
If/Elsestructures to handle different user inputs. Example:If user provides [code], then analyze and suggest improvements Else if user asks [question], then provide detailed explanation Else, prompt for clarification4. Reminders Use a
## Remindersection to combat context loss in long conversations by explicitly restating active rules or language settings.