Skip to content
Notifications
Clear all

Step-by-step: Setting up project-specific prompts for different repos.

1 Posts
1 Users
0 Reactions
3 Views
(@gracek)
Estimable Member
Joined: 1 week ago
Posts: 51
Topic starter   [#13424]

Alright, let's talk about the most over-hyped "feature" in the AI coding assistant space: context. Everyone's screaming about infinite context windows like it's the holy grail, but then they proceed to dump their entire monolithic repo at the thing and wonder why the output is a garbled, contradictory mess. More context isn't smarter; it's just noisier. The real trick—the one that actually moves the needle from a toy to a tool—is surgical constraint.

This is especially true for Cline, which seems to have a particular allergy to my sprawling, multi-service architecture if I don't put it on a very short leash. The promise of a "project-aware" assistant falls apart the moment you switch from your neatly packaged side project to the legacy enterprise monolith with three different coding standards and a README that hasn't been updated since 2018.

So, after a frankly embarrassing amount of trial and error (and many, many uselessly generic code suggestions), I've landed on a method to force Cline to actually understand the *project* it's working on, not just the *file*. It boils down to a system of project-specific prompt prefixes. Not a single global instruction, but a tailored set of rules per repository root.

Here's the step-by-step, born from necessity and a healthy dose of irritation:

**1. Ditch the Global "One Prompt to Rule Them All"**
Your global Cline prompt is for overarching principles. Mine is basically "be concise, don't lie about code you can't see." It's useless for project specifics.

**2. Create a `.cline` Directory at Your Project Root**
This is your control center. Inside, you'll create a `prompts.md` file. The mere existence of this directory seems to signal to Cline that this is a distinct context boundary.

**3. Structure Your `prompts.md` for Maximum Annoyance (to Cline)**
This isn't a gentle suggestion box. This is a directive. Be brutally specific. For example, for my current SaaS codebase:

```markdown
# Project: RevOps Portal Backend
## Core Technologies & Patterns
- Primary Language: TypeScript (strict mode enabled)
- Framework: NestJS (modular architecture)
- Database: PostgreSQL with TypeORM
- Testing: Jest with Supertest for E2E
- **DO NOT** suggest MongoDB drivers or examples.
- **DO NOT** use `any` type. Suggest `unknown` with proper narrowing if necessary.

## Project Conventions
- API responses must follow the `ApiResponse` wrapper defined in `/common/dtos`.
- All new service methods require JSDoc with `@param` and `@returns`.
- Exception handling must use our custom `BusinessLogicException` class, not generic HTTP exceptions.

## Current Focus (Q3)
- Refactoring legacy billing module. Refer to `/billing/README-refactor.md`.
- All new code must be compatible with the existing event-driven system (see `/events/core`).
```

**4. The Magic Step: Prefacing Every Query**
This is the manual part, but it's non-negotiable. You do **not** just ask your question. You prime Cline with the prompt. My typical workflow:
- Open chat in Cline.
- First message: `/load .cline/prompts.md` (or paste its critical contents).
- *Then* and only then, ask your actual question: "Now, given the above, how would you implement a new webhook handler for Stripe events in the billing module?"

**5. Rinse and Repeat for Each Distinct Repository**
You need a different `.cline/prompts.md` for your React frontend, your Python data pipeline, your old Django monolith. The prompts will contradict each other. That's the point. A single prompt trying to cover all those would be worthless.

The result? Cline stops suggesting Python's `requests` library in my TypeScript project. It stops inventing MongoDB queries for my PostgreSQL schema. It references our actual internal DTOs. It's less of a hallucinating intern and more of a junior dev who's actually read the onboarding docs.

Is this elegant? No. Should this level of manual configuration be necessary for a tool that bills itself as "project-aware"? Probably not. But until these assistants get genuinely intelligent about context segmentation, this is the only way I've found to make them consistently useful across different codebases. You're not teaching the AI; you're building a very specific cage for it to operate within. And ironically, that constraint is what finally frees it to be helpful.

🤷



   
Quote