
- Project: KodeKloud Task Manager (Flask)
- Key files Cursor can read:
app.py, templates, static assets,requirements.txt, andtests/folder. - Environment: Python virtual environment, SQLite DB stored in
instance/
app.py to illustrate the kind of file contents the assistant can parse and act on.
This snippet exposes a development
SECRET_KEY value. Do not commit secrets to source control — replace with environment-based configuration (e.g., os.environ['SECRET_KEY']) before deployment.- Prompt example: “Install pytest and update
requirements.txt” — Cursor will propose the commands and can execute them in the terminal. - Typical generated steps:
- Activate virtualenv:
source venv/bin/activate(macOS/Linux) orvenv\Scripts\activate(Windows) - Install test libs:
pip install pytest - Freeze to requirements:
pip freeze > requirements.txt
- Activate virtualenv:
- Use the quick command generator (e.g., Ctrl+K) to get a proposed command and then run it in the terminal.
- This is “question mode”: ask how to do something, review the generated command, then run it.
- Switch suggestion models (e.g., Claude 3.7) to alter suggestion style or thoroughness.
- Ask the assistant to “Create a test for the dashboard” and it may propose creating a
tests/folder and atests/test_app.pyfile. - If automated generation fails, create the files manually and paste the assistant’s suggested test content.
- Be specific with test targets. Running pytest against the wrong path can yield “collected 0 items”.
- Wrong example (runs the app module, not the tests):
- Correct example — run the tests in the
tests/folder or point to a specific test:
- To run a single test function:
python -m pytest tests/test_app.py::test_delete_task
- Create
tests/conftest.pyto configure a temporary database and Flask test client:
Be specific. Start with a short project overview (framework, structure, main components) and reference concrete file names and paths. Include environment details (Python version, virtual environment, dependencies) and any constraints (libraries to avoid, required versions). This helps the assistant generate accurate commands and tests.
More tips
- If a generated command fails, refine the prompt with exact filenames, paths, or function names.
- Use descriptive prompts like “Run pytest for
tests/test_app.py::test_delete_task” rather than generic “run tests”. - When running wide-scope commands (profiling, linting, or large test suites), narrow the scope to reduce noise and speed feedback.
- pytest documentation: https://docs.pytest.org/
- Flask testing: https://flask.palletsprojects.com/en/latest/testing/
- Python tempfile module: https://docs.python.org/3/library/tempfile.html
- sqlite3 module: https://docs.python.org/3/library/sqlite3.html