bartste-prompts
A command-line tool to generate prompts for Large Language Models (LLMs) using customizable instruction templates.
Introduction
bartste-prompts is a CLI tool designed for developers to generate prompts for Large Language Models (LLMs). It uses a set of predefined instructions that can be customized per command and per file type. The tool is built with extensibility in mind, allowing users to define their own instructions. The CLI will adapt to custom instructions as a fixed directory structure is assumed.
Key features include:
- Dynamic prompt assembly from markdown instruction templates
- Support for multiple default commands (e.g., explain, fix, refactor, etc.) and file types
- Integration with tools like
aiderfor code editing and explanation - Can be extended with custom instructions
- The CLI adapts to new instructions. No changes in code are necessary.
- Question answering through the ask command for quick guidance
Installation
You can install bartste-prompts using pip:
pip install bartste-prompts
For development dependencies (testing, linting, etc.), install with:
pip install bartste-prompts[dev]
This will install the prompts command-line tool.
Usage
The basic command structure is:
prompts <command> [options]
Available Commands
The tool comes with these default commands:
ask: Answer user questions directlydocstrings: Generate docstrings for given filesexplain: Explain code functionalityfix: Fix code issuesrefactor: Improve code structuretypehints: Add type hints to codeunittests: Generate unit testscommit: Generate conventional commit messages
Common Options
All commands support these options:
--action <tool>: Specify output tool (print,json, oraider)--loglevel <level>: Set logging level (DEBUG,INFO,WARNING,ERROR,CRITICAL)--logfile <path>: Specify log file location
Command-Specific Options
Each command has additional options that correspond to instruction templates. For example:
# Explain command options
prompts explain --files <files> --filetype <type> --user <text>
# Fix command options
prompts fix --files <files> --filetype <type> --user <text>
Examples
Print prompt for explaining Python code:
prompts explain --files main.py --filetype python
Generate JSON output for adding type hints:
prompts typehints --files utils.py --filetype python --action json
Run aider to fix Lua code:
prompts fix --files script.lua --filetype lua --user "Fix memory leak" --action aider
Ask a question using the default instructions:
prompts ask --user "What does the fix command do?"
Craft a Conventional Commit message for staged changes:
prompts commit --user "$(git diff)"
Custom Instructions
You can use custom instructions by specifying the --dir option. The custom directory must follow the same structure as the default _instructions directory. Here's how it works:
Directory Structure
custom_instructions/
├── commands/
│ ├── <command1>/
│ │ ├── command.md
│ │ ├── <key1>.md --> "Text with {value1} as placeholder."
│ │ └── <key2>/
│ │ └── <value2>.md
│ ├── <command2>/
│ │ └── command.md
│ └── ...
└── default/
├── <key1>.md
└── <key2>/
└── <value2>.md
-
commands/: Contains subdirectories for each command (e.g.,
explain,fix, etc.)- Each command directory must contain a
command.mdfile (base instruction) - Additional markdown files or subdirectories correspond to command options (e.g.,
--files,--user, etc.). Here, the files and subdirectories handle the cli values differently:- File: The content of the value can be inserted in the markdown using a python placeholder. For example, for the cli option
--files=foo.py, the "files.md" file contains a placeholder{files}which will be replaced byfoo.py. - Subdirectory: The value represents a filename (without extension) of a markdown file within the subdirectory, which will be read.
- File: The content of the value can be inserted in the markdown using a python placeholder. For example, for the cli option
- Each command directory must contain a
-
default/: Contains fallback instructions in case an instruction is not found in the command directory.
Using a fixed directory structure allows the CLI to adapt to the custom instructions. For example, the directory structure above results in the following CLI:
prompts <command1> --key1 <value1> --key2 <value2>
prompts <command2> --key1 <value1> --key2 <value2>
Here, command2 will fallback to the default directory for options, key1 represents a file, value1 will be inserted in key1.md, key2 represents a directory and value2 is a file within the key2 directory.
Troubleshooting
If you encounter any issues, please report them on the issue tracker at: bartste-prompts issues
Contributing
Contributions are welcome! Please see CONTRIBUTING for more information.
License
Distributed under the MIT License.
Metadata
Release files for bartste-prompts 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bartste_prompts-1.3.1.tar.gz | 23.1 kB | With provenance | Details for bartste_prompts-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bartste_prompts-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for bartste_prompts-1.3.1-py3-none-any.whl |
Total release size: 55.3 kB
Release files / bartste_prompts-1.3.1.tar.gz
| Download URL | bartste_prompts-1.3.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e4835859d28507e1217953a8dcdefd282f65c499cdb6e1e9fcfe1349a3f49ff
|
|
BLAKE2b-256 checksum How to use checksums |
c1a2041b65415bae9eca35a2010c1dad7981dd68571d6f3d363c1bf9c75fa158
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.
Transparency logRelease files / bartste_prompts-1.3.1-py3-none-any.whl
| Download URL | bartste_prompts-1.3.1-py3-none-any.whl |
|---|---|
| Size | 32.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aacc22ab9c73a1712908094af656737b5284c9931c7fcd1fe93625d4dda88970
|
|
BLAKE2b-256 checksum How to use checksums |
1f36958f75ab95570082f44148c90426a943a2aa2d1573f932089e27904c4300
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.
Transparency logSecurity for bartste-prompts 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for bartste_prompts-1.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.