Q31Agent Workflow
How should multi-file edits be managed in Cursor?
Ask for a file map first, then keep edits aligned to the intended feature. Inspect interfaces, configuration, migrations, and tests across all changed...
Answer
Ask for a file map first, then keep edits aligned to the intended feature. Inspect interfaces, configuration, migrations, and tests across all changed files. Run targeted tests and broader CI checks before merging.
Syntax
File map → edits → diff review → tests
Example
For a new API field, review DTO, validation, mapping, persistence, and consumer tests.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q32Codebase Context
How can you map an unfamiliar repository before making changes?
Identify entry points, module boundaries, build scripts, shared types, and test locations. Ask focused questions and verify the answers against the re...
Answer
Identify entry points, module boundaries, build scripts, shared types, and test locations. Ask focused questions and verify the answers against the repository. Avoid allowing an agent to rewrite architecture before the existing structure is understood.
Syntax
Entry points → modules → dependencies → tests
Example
Ask Cursor to list the request path for a feature and confirm each step in source.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q33Codebase Context
What should you do if Cursor's codebase context seems stale?
Confirm that the file is saved and included in the workspace, then refresh or re-index using the supported workflow if needed. Provide direct file ref...
Answer
Confirm that the file is saved and included in the workspace, then refresh or re-index using the supported workflow if needed. Provide direct file references and inspect the source manually. Never rely on an old summary when correctness depends on current code.
Syntax
Save changes → verify exclusions/index → re-query
Example
If a new method is missing from results, open its file and reference it directly.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q34Context
How should large files or long logs be supplied to an AI workflow?
Reduce context to relevant sections, error lines, symbols, and reproduction steps. Keep the full artifact available for verification and avoid truncat...
Answer
Reduce context to relevant sections, error lines, symbols, and reproduction steps. Keep the full artifact available for verification and avoid truncating the key evidence. Smaller focused context often produces a more testable answer.
Syntax
Full artifact → relevant excerpt → focused question
Example
Share the failing test and related method instead of an entire multi-megabyte log.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q35Testing
How can Cursor follow a test-first workflow?
Ask it to draft a regression test from the expected behavior, run the test to confirm it fails for the right reason, and then implement the fix. Re-ru...
Answer
Ask it to draft a regression test from the expected behavior, run the test to confirm it fails for the right reason, and then implement the fix. Re-run the test and related suite afterward. This reduces the chance of accepting code without behavioral evidence.
Syntax
Requirement → failing test → implementation → rerun
Example
Add a test for a discount threshold before changing the calculation.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q36Testing
How should an AI tool help diagnose flaky tests?
Collect repeated results, timing, environment, shared-state usage, and external dependencies before editing assertions. Distinguish genuine race condi...
Answer
Collect repeated results, timing, environment, shared-state usage, and external dependencies before editing assertions. Distinguish genuine race conditions from test pollution or infrastructure instability. Avoid simply increasing timeouts without evidence.
Syntax
Repeat → collect evidence → isolate cause → fix → rerun
Example
Check for shared mutable state or unordered async completion in an intermittent test.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q37Testing
How can Cursor generate integration tests safely?
Specify the system boundary, fixtures, isolation, cleanup, and expected side effects. Use disposable databases and test services, not production resou...
Answer
Specify the system boundary, fixtures, isolation, cleanup, and expected side effects. Use disposable databases and test services, not production resources or real credentials. Confirm the tests are repeatable and diagnose failures clearly.
Syntax
Arrange dependencies → invoke boundary → assert outcome
Example
Use a test database and local test server for an API integration test.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q38Testing
Does increased test coverage prove generated code is correct?
No. Coverage shows which code executed, not whether assertions catch defects. Review boundary conditions, negative paths, invariants, and regression s...
Answer
No. Coverage shows which code executed, not whether assertions catch defects. Review boundary conditions, negative paths, invariants, and regression sensitivity. Prefer meaningful tests that fail when the intended behavior breaks.
Syntax
Coverage + meaningful assertions + mutation sensitivity
Example
Verify a validation test fails if the validation branch is removed.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q39Code Review
What should an AI code-review finding contain?
A useful finding gives a location, evidence, impact, severity, and remediation. Ask for actionable defects rather than speculative style comments, and...
Answer
A useful finding gives a location, evidence, impact, severity, and remediation. Ask for actionable defects rather than speculative style comments, and reproduce important findings before changing code. A clean review is not proof that a patch is safe.
Syntax
Finding = location + evidence + impact + fix
Example
Prioritize an authorization bypass over a minor naming preference.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q40Git Workflow
How can Cursor draft a pull request description?
It can summarize a diff and draft test notes, but the author must ensure the description matches actual changes. State which tests were run and which ...
Answer
It can summarize a diff and draft test notes, but the author must ensure the description matches actual changes. State which tests were run and which were not. Never claim validation or performance gains without evidence.
Syntax
Diff → summary + test evidence + limitations
Example
Describe the changed API behavior and list the exact test command executed.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q41Git Workflow
How should AI help resolve merge conflicts?
Ask it to explain the intent of each side and propose a resolution that preserves required behavior. Inspect the merged semantics and run tests for bo...
Answer
Ask it to explain the intent of each side and propose a resolution that preserves required behavior. Inspect the merged semantics and run tests for both branches' functionality. Do not choose one side wholesale without understanding what would be lost.
Syntax
Conflict → compare intent → resolve → test
Example
Resolve a conflict in validation logic and test both previously supported cases.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q42Modernization
How can Cursor help modernize legacy code safely?
Use it to explain old patterns and propose incremental migrations, but avoid broad rewrites without baseline tests. Migrate one boundary at a time, pr...
Answer
Use it to explain old patterns and propose incremental migrations, but avoid broad rewrites without baseline tests. Migrate one boundary at a time, preserve compatibility, and verify performance. Small adapters and focused changes are often safer than a wholesale rewrite.
Syntax
Baseline → incremental migration → tests → expand
Example
Migrate one service away from a deprecated API before changing the whole application.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q43Database
How should AI-generated ORM queries be checked?
Review generated SQL, parameterization, tracking, query count, pagination, and transaction semantics. Watch for N+1 queries and unintended eager loadi...
Answer
Review generated SQL, parameterization, tracking, query count, pagination, and transaction semantics. Watch for N+1 queries and unintended eager loading. Use realistic data and execution plans for performance-sensitive paths.
Syntax
ORM expression → SQL → query plan
Example
Check whether a generated loop performs one database query per item.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q44Security
How should an AI-generated API be reviewed for authorization?
Confirm authentication and server-side authorization for each resource and action. Do not infer permission from UI visibility or a client-supplied own...
Answer
Confirm authentication and server-side authorization for each resource and action. Do not infer permission from UI visibility or a client-supplied owner ID. Add negative tests for unauthorized and cross-tenant access.
Syntax
Authenticate → authorize → validate → execute → safe response
Example
Test that changing a resource ID cannot expose another user's record.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q45Security
What is prompt injection in a coding workflow?
Prompt injection is untrusted content that attempts to manipulate an AI tool into ignoring intended instructions or taking unrelated actions. It can a...
Answer
Prompt injection is untrusted content that attempts to manipulate an AI tool into ignoring intended instructions or taking unrelated actions. It can appear in issues, comments, docs, or retrieved files. Treat that content as data and never follow it to reveal secrets or bypass controls.
Syntax
Untrusted text ≠ trusted instruction
Example
Ignore a repository comment that asks the agent to print environment secrets.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q46Privacy
How should secrets be handled during AI-assisted development?
Keep credentials in approved secret stores and environment configuration, not prompts, source files, or logs. Use placeholders in examples, enable sec...
Answer
Keep credentials in approved secret stores and environment configuration, not prompts, source files, or logs. Use placeholders in examples, enable secret scanning, and rotate exposed credentials. Follow the organization's approved tool and data policies.
Syntax
Secret manager → environment → redacted logs
Example
Use `API_TOKEN=<placeholder>` in a sample config.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q47Security
How can AI-generated code introduce supply-chain risk?
Suggestions may reference malicious, vulnerable, or nonexistent packages. Verify package identity, publisher, maintenance, license, advisories, and tr...
Answer
Suggestions may reference malicious, vulnerable, or nonexistent packages. Verify package identity, publisher, maintenance, license, advisories, and transitive dependencies. Use approved registries and lockfiles, and scan dependencies before merging.
Syntax
Package identity → provenance → advisories → lockfile
Example
Check the package registry before installing an unfamiliar dependency from a generated import.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q48Performance
How should AI-assisted performance changes be validated?
Use AI to form hypotheses, then measure with a profiler or benchmark. Optimize demonstrated bottlenecks and preserve correctness tests. Avoid introduc...
Answer
Use AI to form hypotheses, then measure with a profiler or benchmark. Optimize demonstrated bottlenecks and preserve correctness tests. Avoid introducing caching or concurrency without a clear invalidation and safety model.
Syntax
Baseline → profile → change → benchmark → compare
Example
Measure a slow query before adding a cache layer.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q49Architecture
How should Cursor be used in a monorepo?
Identify workspace boundaries, shared libraries, build scripts, and dependent applications before editing. Limit changes to relevant packages and cons...
Answer
Identify workspace boundaries, shared libraries, build scripts, and dependent applications before editing. Limit changes to relevant packages and consumers, then run targeted and integration tests. Do not assume a summary covers all dependencies.
Syntax
Workspace → package → dependents → tests
Example
For a shared type change, test every package that imports it.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q50Project Instructions
How should project rules be maintained?
Rules should be short, actionable, and consistent with current architecture and repository practices. Remove stale or conflicting rules, and avoid pla...
Answer
Rules should be short, actionable, and consistent with current architecture and repository practices. Remove stale or conflicting rules, and avoid placing secrets or overly broad instructions in them. Validate that the supported rule mechanism is actually applied by the installed version.
Syntax
Rules → task → inspect compliance → update stale rules
Example
Add a rule to use existing logging abstractions rather than introducing another logger.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q51Terminal
How should terminal access be controlled in an AI coding workflow?
Inspect each command's arguments, working directory, file effects, network use, and privilege. Prefer narrow, repeatable commands and isolated environ...
Answer
Inspect each command's arguments, working directory, file effects, network use, and privilege. Prefer narrow, repeatable commands and isolated environments. Destructive operations, deployments, and secret-bearing actions should require explicit approval and independent policy checks.
Syntax
Command proposal → validation → approval → scoped execution
Example
Allow a targeted test command but require approval for a deployment command.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q52Configuration
Why are AI-generated environment changes risky?
Environment configuration can alter credentials, network access, feature flags, and production behavior. Review every setting, avoid committing local ...
Answer
Environment configuration can alter credentials, network access, feature flags, and production behavior. Review every setting, avoid committing local paths or secrets, and validate configuration using normal deployment checks. Keep environment-specific values in approved configuration systems.
Syntax
Config diff → policy review → environment validation
Example
Reject a generated configuration file that embeds a local machine path or token.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q53Dependencies
How should AI-suggested dependency upgrades be evaluated?
Check release notes, breaking changes, security advisories, license, transitive dependencies, and lockfile changes. Run tests and review migration ins...
Answer
Check release notes, breaking changes, security advisories, license, transitive dependencies, and lockfile changes. Run tests and review migration instructions. Do not upgrade a dependency solely because generated code expects a newer API.
Syntax
Version → release notes → lockfile → tests
Example
Confirm the suggested method exists in the version pinned by the project.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q54Database
How should AI-generated database migrations be reviewed?
Review data loss, locking, compatibility with older application versions, rollback, and production data volume. Test on representative non-production ...
Answer
Review data loss, locking, compatibility with older application versions, rollback, and production data volume. Test on representative non-production data and consider expand-and-contract patterns for zero-downtime releases. A migration needs a recovery plan.
Syntax
Expand schema → deploy compatible app → migrate data → contract later
Example
Add a nullable column before deploying code that depends on it.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q55Architecture
How can Cursor preserve API compatibility during a change?
Specify compatibility constraints and inspect callers, clients, serialization, and versioning. Add contract tests where practical and avoid silently c...
Answer
Specify compatibility constraints and inspect callers, clients, serialization, and versioning. Add contract tests where practical and avoid silently changing response fields or exception behavior. Review the API boundary as well as internal implementation.
Syntax
Contract baseline → implementation → contract tests → diff
Example
Add an optional response field without removing or renaming existing fields.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q56Architecture
Why should hard tool permissions be enforced outside the model?
A deterministic policy layer can enforce allowed paths, commands, data classes, and approval requirements independently of model intent. Validate each...
Answer
A deterministic policy layer can enforce allowed paths, commands, data classes, and approval requirements independently of model intent. Validate each action at the execution boundary and record decisions. Prompt instructions alone are not a reliable security boundary.
Syntax
Model action → policy check → tool executor → audit event
Example
Block infrastructure apply commands unless target environment and approval requirements are satisfied.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q57Security
How does least privilege apply to Cursor agents?
Grant only the file, command, network, and credential access needed for the task. Separate read and write capabilities, use short-lived credentials, a...
Answer
Grant only the file, command, network, and credential access needed for the task. Separate read and write capabilities, use short-lived credentials, and require approval for privileged operations. Avoid exposing production secrets to a coding session.
Syntax
Capabilities = minimum required permissions
Example
Allow editing a feature branch but deny production deployment credentials.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q58Security
What should an AI coding sandbox isolate?
A sandbox should restrict filesystem access, process execution, network egress, credentials, and resource use. Containers alone may not be a complete ...
Answer
A sandbox should restrict filesystem access, process execution, network egress, credentials, and resource use. Containers alone may not be a complete boundary if privileged host resources are shared. Choose controls based on the threat model and verify isolation.
Syntax
Task → isolated workspace → restricted tools/network → audit
Example
Run untrusted build scripts in an ephemeral environment without production credentials.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q59Security
How can command injection occur in agent workflows?
Injection can occur when untrusted paths or generated arguments are interpolated into shell commands. Prefer structured process APIs, argument arrays,...
Answer
Injection can occur when untrusted paths or generated arguments are interpolated into shell commands. Prefer structured process APIs, argument arrays, strict allowlists, and validation. Avoid building shell commands by concatenating untrusted strings.
Syntax
spawn("grep", ["-R", validatedPattern, validatedPath])
Example
Do not concatenate a user-controlled branch name into a shell command without validation.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q60Security
How should file tools prevent path traversal?
Resolve paths against an approved workspace root, normalize them, and reject paths that escape the root, including symlink escapes where relevant. Rev...
Answer
Resolve paths against an approved workspace root, normalize them, and reject paths that escape the root, including symlink escapes where relevant. Revalidate at execution time to reduce time-of-check/time-of-use risks.
Syntax
resolved = realpath(join(root, inputPath))
assert isWithin(root, resolved)
Example
Reject `../../.ssh/id_rsa` when the tool may read only project files.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q61Governance
How should approval be bound to a proposed action?
Bind approval to the exact action, arguments, target environment, and relevant diff hash, and expire it when details change. Broad approvals can autho...
Answer
Bind approval to the exact action, arguments, target environment, and relevant diff hash, and expire it when details change. Broad approvals can authorize unintended actions and are difficult to audit.
Syntax
approval = hash(action + args + target + diff)
Example
If the patch changes after approval, require review of the new diff.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q62Governance
What should AI coding workflow audit logs contain?
Record task and actor identity, tool name, validated arguments or a redacted summary, policy decision, timestamp, outcome, and approval reference. Avo...
Answer
Record task and actor identity, tool name, validated arguments or a redacted summary, policy decision, timestamp, outcome, and approval reference. Avoid storing secrets or excessive personal data. Logs should support investigation without creating a new exposure risk.
Syntax
event = {taskId, tool, decision, time, outcome}
Example
Log that a deployment was denied without recording its credential.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q87Integrations
What is MCP and how might it extend a coding editor?
Model Context Protocol (MCP) is a protocol for connecting AI applications to external tools and data sources. In a coding workflow, integrations can p...
Answer
Model Context Protocol (MCP) is a protocol for connecting AI applications to external tools and data sources. In a coding workflow, integrations can provide access to issue trackers, documentation, or other systems, but each connector expands the trust boundary. Verify the current Cursor integration support and grant only necessary permissions.
Syntax
Prompt → connector/tool schema → permission check → result
Example
Use a read-only issue tracker integration to retrieve ticket acceptance criteria.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q88Integrations
How should external tool permissions be scoped?
Give each integration the minimum permissions needed, prefer read-only access when possible, and separate retrieval from actions that modify external ...
Answer
Give each integration the minimum permissions needed, prefer read-only access when possible, and separate retrieval from actions that modify external systems. Review the connector's authentication, scopes, data exposure, and audit trail before enabling it.
Syntax
Identity → scopes → allowed operations → audit
Example
A documentation connector should not receive repository-admin permissions just to read a page.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q89Project Instructions
What is the difference between project rules and a task prompt?
Project rules provide reusable guidance for a repository or workflow, while a task prompt states the immediate goal and its acceptance criteria. Rules...
Answer
Project rules provide reusable guidance for a repository or workflow, while a task prompt states the immediate goal and its acceptance criteria. Rules should not be used as a substitute for specific task details or deterministic security enforcement.
Syntax
Project rules + task-specific prompt → response
Example
Keep naming conventions in repository rules and describe the exact bug in the task prompt.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q90Agent Workflow
How should a multi-file edit workflow be structured?
For a multi-file task, first identify affected modules and contracts, then implement a coherent change, inspect the full diff, and run relevant checks...
Answer
For a multi-file task, first identify affected modules and contracts, then implement a coherent change, inspect the full diff, and run relevant checks. The exact UI name and capabilities of Cursor's editing workflows can change, so follow the current product documentation.
Syntax
Scope → file map → edit → diff review → tests
Example
Ask for a plan before updating a service, DTO, and related tests together.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q91Code Review
How can you detect scope creep in an AI-generated diff?
Compare every changed file against the task and investigate unrelated formatting, configuration, dependency, or generated-file changes. Keep the patch...
Answer
Compare every changed file against the task and investigate unrelated formatting, configuration, dependency, or generated-file changes. Keep the patch minimal and split unrelated improvements into separate changes. A small, focused diff is easier to test and review.
Syntax
Task scope ↔ changed files → justify each change
Example
Revert unrelated formatter changes from a one-line bug fix.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q93Performance
How can large repositories affect AI coding workflows?
Large repositories can increase indexing, retrieval, and review complexity. Use workspace boundaries, relevant file references, exclusions for generat...
Answer
Large repositories can increase indexing, retrieval, and review complexity. Use workspace boundaries, relevant file references, exclusions for generated artifacts, and focused tasks. Verify that important files remain discoverable and that exclusions do not hide required context.
Syntax
Workspace scope → relevant context → focused task
Example
Exclude build output but keep the source and tests needed for a feature available.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q95Quality
How should static analysis complement AI-generated code?
Use compiler checks, linters, type checking, static analysis, and dependency scanning as independent signals. Fix meaningful findings rather than supp...
Answer
Use compiler checks, linters, type checking, static analysis, and dependency scanning as independent signals. Fix meaningful findings rather than suppressing them just to make generated code pass. Some defects require domain review or runtime tests beyond static analysis.
Syntax
Generate → lint/type-check/SAST → review → test
Example
Run the same static-analysis gates used for human-written code.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.
Q98Workflow
How should developers revert an unwanted agent edit?
Use version control to inspect and selectively revert changes, preserving unrelated user work. Review the working tree before reset or checkout operat...
Answer
Use version control to inspect and selectively revert changes, preserving unrelated user work. Review the working tree before reset or checkout operations, and avoid destructive commands that discard uncommitted changes. For broad edits, a dedicated branch makes recovery safer.
Syntax
git diff → select changes → revert safely → retest
Example
Use a targeted revert for the agent's unwanted file rather than resetting the entire working tree.
Key Points
- Use focused, observable workflows.
- Validate tool results and proposed changes.
- Keep risky actions behind explicit review.