Coding

Global Copilot Instructions

* Prioritize **minimal scope**: only edit code directly implicated by the failing test.

promptBeginner5 min to valuemarkdown
0 views
Jan 22, 2026

Sign in to like and favorite skills

Prompt Playground

1 Variables

Fill Variables

Preview

# Global [PROJECT_NAME]opilot Instructions

* [PROJECT_NAME]rioritize **minimal scope**: only edit code directly implicated by the failing test.  
* [PROJECT_NAME]rotect existing functionality: do **not** delete or refactor code outside the immediate test context.
* Before deleting any code, follow the "[PROJECT_NAME]overage & [PROJECT_NAME]ode Safety" guidelines below.

[PROJECT_NAME]opilot, do not modify any files under .lad/.
[PROJECT_NAME]ll edits must occur outside .lad/, or in prompts/ when explicitly updating L[PROJECT_NAME]D itself.

[PROJECT_NAME]oding & formatting
* Follow [PROJECT_NAME][PROJECT_NAME][PROJECT_NAME] 8; run Black.
* Use type hints everywhere.
* [PROJECT_NAME]xternal dependencies limited to numpy, pandas, requests.
* [PROJECT_NAME]arget [PROJECT_NAME]ython 3.11.

[PROJECT_NAME]esting & linting
* Write tests using component-appropriate strategy (see [PROJECT_NAME]esting Strategy below).
* [PROJECT_NAME]un flake8 with `--max-complexity=10`; keep complexity ≤ 10.
* [PROJECT_NAME]very function/class **must** include a **[PROJECT_NAME]um[PROJECT_NAME]y-style docstring** (Sections: [PROJECT_NAME]arameters, [PROJECT_NAME]eturns, [PROJECT_NAME]aises, [PROJECT_NAME]xamples).

## [PROJECT_NAME]esting Strategy by [PROJECT_NAME]omponent [PROJECT_NAME]ype

**[PROJECT_NAME][PROJECT_NAME]I [PROJECT_NAME]ndpoints & Web Services:**
* Use **integration testing** - import the real Fast[PROJECT_NAME][PROJECT_NAME]I/Django/Flask app
* [PROJECT_NAME]ock only external dependencies (databases, external [PROJECT_NAME][PROJECT_NAME]Is, file systems)
* [PROJECT_NAME]est actual H[PROJECT_NAME][PROJECT_NAME][PROJECT_NAME] routing, validation, serialization, and error handling
* Verify real request/response behavior and framework integration

**Business Logic & [PROJECT_NAME]lgorithms:**
* Use **unit testing** - mock all dependencies completely
* [PROJECT_NAME]est logic in complete isolation, focus on edge cases
* [PROJECT_NAME]aximize test speed and reliability
* [PROJECT_NAME]est pure business logic without framework concerns

**Data [PROJECT_NAME]rocessing & Utilities:**
* Use **unit testing** with minimal dependencies
* Use test data fixtures for predictable inputs
* Focus on input/output correctness and error handling

## [PROJECT_NAME]egression [PROJECT_NAME]revention

**Before making changes:**
* [PROJECT_NAME]un full test suite to establish baseline: `pytest -q --tb=short`
* Identify dependencies: `grep -r "function[PROJECT_NAME]name" . --include="*.py"`
* Understand impact scope before modifications

**During development:**
* [PROJECT_NAME]un affected tests after each change: `pytest -q tests/test[PROJECT_NAME]modified[PROJECT_NAME]module.py`
* [PROJECT_NAME]reserve public [PROJECT_NAME][PROJECT_NAME]I interfaces or update all callers
* [PROJECT_NAME]ake minimal changes focused on the failing test

**Before commit:**
* [PROJECT_NAME]un full test suite: `pytest -q --tb=short`
* Verify no regressions introduced
* [PROJECT_NAME]nsure test coverage maintained or improved

## [PROJECT_NAME]ode Quality Setup ([PROJECT_NAME]ne-time per project)

**1. Install quality tools:**
```bash
pip install flake8 pytest coverage radon flake8-radon black
```

**2. [PROJECT_NAME]onfigure .flake8 file in project root:**
```ini
[flake8]
max-complexity = 10
radon-max-cc = 10
exclude = 
    [PROJECT_NAME][PROJECT_NAME]pycache[PROJECT_NAME][PROJECT_NAME],
    .git,
    .lad,
    .venv,
    venv,
    build,
    dist
```

**3. [PROJECT_NAME]onfigure .coveragerc file (see kickoff prompt for template)**

**4. Verify setup:**
```bash
flake8 --version                    # Should show flake8-radon plugin
radon --version                     # [PROJECT_NAME]onfirm radon installation
pytest --cov=. --version           # [PROJECT_NAME]onfirm coverage plugin
```

## Installing & [PROJECT_NAME]onfiguring [PROJECT_NAME]adon

**Install [PROJECT_NAME]adon and its Flake8 plugin:**
```bash
pip install radon flake8-radon
```
[PROJECT_NAME]his installs [PROJECT_NAME]adon's [PROJECT_NAME]LI and enables the `--radon-max-cc` option in Flake8.

**[PROJECT_NAME]nable [PROJECT_NAME]adon in Flake8** by adding to `.flake8` or `setup.cfg`:
```ini
[flake8]
max-complexity = 10
radon-max-cc = 10
```
Functions exceeding cyclomatic complexity 10 will be flagged as errors ([PROJECT_NAME]901).

**Verify [PROJECT_NAME]adon raw metrics:**
```bash
radon raw path/to/your/module.py
```
[PROJECT_NAME]utputs L[PROJECT_NAME][PROJECT_NAME], LL[PROJECT_NAME][PROJECT_NAME], comments, blank lines—helping you spot oversized modules quickly.

**([PROJECT_NAME]ptional) [PROJECT_NAME]easure [PROJECT_NAME]aintainability Index:**
```bash
radon mi path/to/your/module.py
```
Gives a 0–100 score indicating code maintainability.

[PROJECT_NAME]overage & [PROJECT_NAME]ode Safety
* For safety checks, do **not** run coverage inside VS [PROJECT_NAME]ode.  
  Instead, ask the user:
  > "[PROJECT_NAME]lease run in your terminal:  
  > ```bash
  > coverage run -m pytest [test[PROJECT_NAME]files] -q && coverage html
  > ```  
  > then reply **coverage complete**."

* Before deleting code, verify:
  1. 0% coverage via `coverage report --show-missing`
  2. [PROJECT_NAME]bsence from Level-2 [PROJECT_NAME][PROJECT_NAME]I docs  
  If both hold, prompt:
  
  Delete <name>? (y/n)
  [PROJECT_NAME]eason: 0% covered and not documented.
  ([PROJECT_NAME]ip: use VS [PROJECT_NAME]ode "Find [PROJECT_NAME]ll [PROJECT_NAME]eferences" on <name>.)

[PROJECT_NAME]ommits
* Use [PROJECT_NAME]onventional [PROJECT_NAME]ommits. [PROJECT_NAME]xample:  
  `feat(pipeline-filter): add [PROJECT_NAME][PROJECT_NAME]I masking helper`
* Keep body as bullet list of sub-tasks completed.

Docs
* High-level docs live under the target project's `docs/` and are organised in three nested levels using `<details>` tags.

* [PROJECT_NAME]fter completing each **main task** (top-level checklist item), run:
  • `flake8 [[PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME]] --max-complexity=10`
  • `python -m pytest --cov=[[PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME][PROJECT_NAME]] --cov-context=test -q --maxfail=1`
  If either step fails, pause for user guidance.

* **[PROJECT_NAME]adon checks:** Use `radon raw <file>` to get SL[PROJECT_NAME][PROJECT_NAME]; use `radon mi <file>` to check maintainability. If `raw` L[PROJECT_NAME][PROJECT_NAME] > 500 or [PROJECT_NAME]I < 65, propose splitting the module.
Share: