Skip to content

Commit b2f24e1

Browse files
committed
docs: for prompts, import and env variables
1 parent e98a178 commit b2f24e1

File tree

7 files changed

+201
-11
lines changed

7 files changed

+201
-11
lines changed

docs/.vitepress/config.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export default withMermaid({
4343
text: 'MCP Server',
4444
items: [
4545
{text: 'Integration', link: '/mcp-server'},
46-
{text: 'Filesystem', link: '/mcp/filesystem'}
46+
{text: 'Filesystem', link: '/mcp/filesystem'},
47+
{text: 'Prompts', link: '/mcp/propmts'}
4748
]
4849
},
4950
{

docs/configuration.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ As you can see it's pretty simple.
111111

112112
## Configuration Imports
113113

114-
For large projects with multiple components or services, you can split your configuration across multiple files using the import functionality.
114+
For large projects with multiple components or services, you can split your configuration across multiple files using
115+
the import functionality.
115116

116117
- Import paths are resolved relative to the importing file
117118
- You can apply path prefixes to source paths in imported configurations
@@ -157,4 +158,14 @@ documents:
157158
}
158159
]
159160
}
160-
```
161+
```
162+
163+
## Using Environment Variables
164+
165+
Context Generator supports configuration via environment variables, which provides a flexible way to override settings
166+
without modifying your main configuration files.
167+
168+
### Setting Up
169+
170+
1. Create a `.env` file in your project root directory
171+
2. Add configuration variables using `KEY=VALUE` format

docs/getting-started/command-reference.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ Creates a new configuration file in the current directory. The default filename
5757
ctx init
5858
```
5959

60-
You can also specify a different file type [Supported types: `yaml`, `json`]:
60+
You can also specify a different filename (e.g., `context.json`. By default, it will create `context.yaml`):
6161

6262
```bash
63-
ctx init --type=json
63+
ctx init --config-file=context.json
6464
# or
65-
ctx init -t json
65+
ctx init -t context.json
6666
```
6767

68+
> **Note**: Only `php`, `json`, and `yaml` formats are supported for the configuration file.
69+
6870
## Check Version
6971

7072
Checks for available updates by comparing your version with the latest release on GitHub, and provides update
@@ -96,10 +98,10 @@ ctx update
9698
ctx u
9799
```
98100

99-
If you installed the PHAR file in a non-standard location, you can specify the path:
101+
If you installed ctx in a non-standard location, you can specify the path:
100102

101103
```bash
102-
ctx self-update --phar-path=/usr/local/bin/ctx
104+
ctx self-update --path=/usr/local/bin/ctx
103105
# or
104106
ctx self-update -p /usr/local/bin/ctx
105107
```

docs/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ When working with AI-powered development tools context is everything.
3434
custom explanations. Use AI to generate user guides, API references, or developer documentation based on your actual
3535
code.
3636

37+
- **Reusable Prompt Libraries:** Create, share, and import collections of specialized prompts for common development
38+
tasks. Build once, use everywhere, and leverage the community's expertise without reinventing the wheel.
39+
40+
- **Standardized Team Workflows:** Establish consistent AI interaction patterns across your team by sharing prompt
41+
libraries that encode best practices and domain expertise for your specific projects.
42+
3743
- **Seamless AI Integration**: With MCP support, [connect](/mcp-server) Claude AI directly to your codebase, allowing
3844
for real-time, context-aware assistance without manual context sharing.
3945

@@ -43,6 +49,7 @@ When working with AI-powered development tools context is everything.
4349
2. Targets specific files through pattern matching, content search, size, or date filters
4450
3. Applies optional modifiers (like extracting PHP signatures without implementation details)
4551
4. Organizes content into well-structured markdown documents
46-
5. Saves context files ready to be shared with LLMs
47-
6. Optionally serves context through an MCP server, allowing AI assistants like Claude to directly access project
52+
5. Provides pre-defined prompts for common tasks that can be imported, shared, and reused
53+
6. Saves context files ready to be shared with LLMs
54+
7. Optionally serves context through an MCP server, allowing AI assistants like Claude to directly access project
4855
information

docs/mcp-server.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,24 @@ When connected via MCP, Claude has access to the following tools:
150150
- `file-write`: Write content to a file with optional directory creation
151151
- `file-rename`: Rename a file or directory
152152
- `file-move`: Move a file to a different location
153-
- `file-info`: Get detailed information about a file or directory
153+
- `file-info`: Get detailed information about a file or directory
154+
155+
## Environment Variables
156+
157+
You can configure the MCP server using environment variables.
158+
159+
### Configuring Document Names
160+
161+
You can customize how document names appear in Claude's interface.
162+
163+
```dotenv
164+
CTX_DOCUMENT_NAME_FORMAT="{description} ({tags}) - {path}"
165+
```
166+
167+
Available placeholders:
168+
169+
- `{path}` - The document's output path
170+
- `{description}` - The document description
171+
- `{tags}` - Comma-separated list of document tags
172+
173+
By default, the format is: `[{path}] {description}`

docs/mcp/prompts.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Prompts
2+
3+
MCP server includes support for pre-defined prompts that provide structured conversation templates. These
4+
prompts can serve as starting points for common tasks, code generation, or project-specific workflows.
5+
6+
## How Prompts Work
7+
8+
Prompts are defined in your configuration files and can include:
9+
10+
- Template messages with variable placeholders
11+
- Input schemas for required and optional parameters
12+
- Descriptions for better discoverability
13+
14+
When LLM requests a prompt, the MCP server returns the structured conversation template with any variable
15+
placeholders filled in based on the provided arguments.
16+
17+
## Defining Prompts
18+
19+
```yaml
20+
prompts:
21+
- id: generate-controller
22+
description: "Generate a controller for a specific entity"
23+
schema:
24+
properties:
25+
entityName:
26+
description: "Name of the entity (e.g. User, Product)"
27+
required:
28+
- entityName
29+
messages:
30+
- role: system
31+
content: "You are a PHP code generator specializing in Symfony controllers."
32+
- role: assistant
33+
content: "I'll help you generate a controller for your entity. Please provide the entity name."
34+
- role: user
35+
content: "Generate a controller for the {{entityName}} entity."
36+
```
37+
38+
Each prompt contains:
39+
40+
- **id**: Unique identifier for the prompt
41+
- **description**: Human-readable description
42+
- **schema** (optional): Defines input parameters with descriptions and required fields
43+
- **messages**: The sequence of conversation messages that make up the prompt
44+
45+
## Variable Substitution
46+
47+
Prompts support variable substitution in message content using the format `{{variableName}}`. When LLM requests a
48+
prompt with arguments, the MCP server replaces these placeholders with the provided values.
49+
50+
## Available Prompt Tools
51+
52+
When connected via MCP, LLM has access to the following prompt-related tools:
53+
54+
### Prompts Tools
55+
56+
- `prompts.list`: List all available prompts defined in the configuration
57+
- `prompts.get`: Get a specific prompt by ID
58+
59+
## Example Usage
60+
61+
Here's how LLM might use prompts during a conversation:
62+
63+
1. **Listing available prompts**:
64+
Claude can request a list of all available prompts to discover what templates are available.
65+
66+
2. **Using a prompt with arguments**:
67+
Claude can request a specific prompt with arguments, which will return the prompt messages with variables
68+
substituted.
69+
70+
3. **Custom workflows**:
71+
Prompts can be designed for specific workflows like code generation, documentation creation, or project analysis.
72+
73+
## Shareable Prompts
74+
75+
Prompts in Context Generator aren't just static templates - they're designed to be shared, imported, and reused across
76+
projects and teams. This creates an ecosystem where:
77+
78+
- Teams can maintain consistent approaches to common development tasks
79+
- Best practices can be encoded once and shared widely
80+
- Specialized domain knowledge can be packaged into reusable templates
81+
- The community can collaborate on high-quality prompt libraries
82+
83+
Context Generator currently supports basic configuration imports from local filesystem sources.
84+
85+
**Coming soon**, we're extending this functionality to include remote sources, with a particular focus on making MCP
86+
prompts more accessible and shareable:
87+
88+
### Upcoming Import Capabilities
89+
90+
- **GitHub Repositories**: Import prompts directly from public or private GitHub repos
91+
- **Composer Packages**: Leverage prompts bundled in PHP Composer packages
92+
- **Remote URLs**: Reference prompt configurations via direct URLs
93+
- **Selective Imports**: Import only specific prompts from any source
94+
95+
This will transform how teams work with AI by enabling:
96+
97+
- **Reusability**: Create prompt repositories once, use them across multiple projects
98+
- **Community Sharing**: Participate in an ecosystem of community-maintained prompt libraries
99+
- **Standardization**: Promote best practices through shared prompt configurations
100+
- **Version Control**: Reference specific versions of remote prompt repositories
101+
102+
### Example Remote Import Configuration
103+
104+
```yaml
105+
import:
106+
# Local import (current implementation)
107+
- path: services/api/context.yaml
108+
type: local # default, can be omitted
109+
110+
# GitHub import (coming soon)
111+
- path: butschster/ctx-prompts/prompts/refactoring.yaml
112+
type: github
113+
ref: main # optional, defaults to main/master
114+
token: ${GITHUB_TOKEN} # optional, for private repos
115+
116+
# Composer package import (coming soon)
117+
- path: vendor/butschster/ctx-prompts/prompts/refactoring.yaml
118+
type: composer
119+
120+
# URL import (coming soon)
121+
- path: https://example.com/context-configs/api-prompts.yaml
122+
type: url
123+
headers: # optional HTTP headers
124+
Authorization: "Bearer ${API_TOKEN}"
125+
126+
# Selective import (coming soon, works with any source type)
127+
- path: butschster/ctx-prompts/prompts/all.yaml
128+
type: github
129+
docs:
130+
- refactoring/extract-method.md
131+
- refactoring/rename-class.md
132+
```

docs/quick-start.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ Point the MCP client to the Context Generator server:
113113

114114
Now you can ask Claude questions about your codebase without manually uploading context files!
115115

116+
## 7. Working with Prompts (Optional)
117+
118+
Define prompts that can be used with MCP server.
119+
120+
```yaml
121+
prompts:
122+
- id: generate-controller
123+
description: "Generate a controller for an entity"
124+
messages:
125+
- role: assistant
126+
content: "I'll help you generate a controller."
127+
- role: user
128+
content: "Generate a controller for the {{entityName}} entity."
129+
```
130+
131+
> **Note:** Read more about [Prompts](/mcp/prompts) for detailed configuration options.
132+
116133
## JSON Schema
117134

118135
For better editing experience, Context Generator provides a JSON schema for autocompletion and validation in your IDE:

0 commit comments

Comments
 (0)