Helpful script we use again and again that creates all the files that can help Cline do its best work. Usage is simple. Place the script in your Project directory root folder. Then execute the script. The files will be created in this directory and then you can add your own preferences and instructions. Point Cline to this directory and you won't have to keep doing the same thing..
Instructions:
Place script in the root directory of the Project.
-------------------------
Execute Script:
Type in your terminal (within the same directory is located in):
chmod +x generate_cline_instructions.sh
./generate_cline_instructions.sh
-------------------------
It will create a folder called cline_instructions/ in your current directory.
-------------------------
Open the environment in VS Code:
code cline_instructions
-------------------------
Script generate_cline_instructions.sh:
#!/bin/bash
# Get the current working directory (the one from which the script is run)
BASE_DIR="$(pwd)"
PROJECT_DIR="$BASE_DIR/cline_instructions"
echo "📁 Creating Cline instructions environment in: $PROJECT_DIR"
mkdir -p "$PROJECT_DIR"
cd "$PROJECT_DIR" || exit 1
# --- VS Code Config ---
mkdir -p .vscode
cat <<EOF > .vscode/settings.json
{
"editor.tabSize": 4,
"editor.formatOnSave": true,
"files.autoSave": "onFocusChange",
"cline.assistant.enabled": true
}
EOF
cat <<EOF > .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Cline Formatter",
"type": "shell",
"command": "echo Running Cline code formatting...",
"problemMatcher": []
}
]
}
EOF
# --- Documentation ---
cat <<EOF > README.md
# Cline AI Coding Assistant Project
This environment is pre-configured for developing and testing the Cline AI coding assistant in Visual Studio Code.
## Features
- Auto-formatting
- Assistant rules
- Training data samples
EOF
cat <<EOF > instructions.md
# Instructions for Using Cline
1. All code contributions should follow the rules in \`rules.md\`.
2. Cline should assist by suggesting fixes, optimizing logic, and generating documentation.
3. Use the sample training data to guide response tuning.
EOF
cat <<EOF > rules.md
# Cline Assistant Coding Rules
- Follow language-specific style guides (PEP8, JS Standard, etc.)
- Generate helpful comments and docstrings.
- Prefer readable and modular code.
- When uncertain, ask clarifying questions.
- Never expose sensitive or hardcoded secrets.
EOF
# --- Training Data ---
mkdir -p training_data
cat <<EOF > training_data/examples.json
[
{
"prompt": "Write a Python function to add two numbers.",
"completion": "def add(a, b):\\n return a + b"
},
{
"prompt": "Convert a list of strings to uppercase in JavaScript.",
"completion": "const upper = arr => arr.map(str => str.toUpperCase());"
}
]
EOF
# --- System Prompt (for LLM-guidance or preloading in Cline) ---
mkdir -p cline_config
cat <<EOF > cline_config/system_prompt.txt
You are Cline, an AI assistant for software developers. You write clean, idiomatic code, explain your reasoning clearly, and always follow best practices.
Respond to user prompts with working code and brief explanations.
EOF
echo "✅ Cline environment is ready!"
echo "➡️ Open it in VS Code:"
echo " code $PROJECT_DIR"