Artificial intelligence is quickly becoming a practical part of software development. Modern AI assistants can explain unfamiliar code, generate prototypes, write tests, review pull requests, create documentation, and help troubleshoot difficult bugs. They are useful whether you are building a mobile app, a web platform, a progressive web app (PWA), an API, or an internal business tool.
However, AI works best as a development partner—not as an autonomous engineer. It can produce convincing code that is incomplete, insecure, or based on incorrect assumptions. The key is to combine AI’s speed with clear requirements, incremental development, automated testing, and human review.
The following tips will help you use AI effectively while maintaining code quality and control over your project. For more background on AI-assisted coding, read this guide to AI programming in modern software development.
1. Start With a Small, Well-Defined Task
A common mistake is asking an AI tool to build an entire application in one prompt. A request such as “Create a complete marketplace app” leaves too many details undefined. The generated result may look impressive, but it will often contain inconsistent architecture, missing edge cases, and dependencies you do not need.
Instead, divide the project into small tasks:
- Define the data model.
- Create one API endpoint.
- Build a single interface component.
- Add form validation.
- Write tests for one service.
- Configure the PWA manifest.
- Implement offline caching for a specific route.
For example, rather than asking:
Build a PWA for managing personal tasks.
Use a more focused request:
Create a TypeScript function that stores a task in IndexedDB. A task contains an ID, title, completion status, and creation date. Include error handling and unit tests.
Smaller requests are easier to verify, test, and integrate. They also make it easier to identify where an incorrect assumption entered the code.
2. Give the AI Enough Technical Context

AI assistants cannot automatically know your architecture, coding standards, dependency versions, or deployment environment. The quality of the result depends heavily on the context you provide.
A useful prompt should mention:
- Programming language and version
- Framework and version
- Runtime environment
- Database or storage system
- Relevant dependencies
- Target platforms and browsers
- Coding conventions
- Security or accessibility requirements
- Expected input and output
- Files that may or may not be changed
A detailed request might look like this:
Using React 18, TypeScript, and Vite, create an accessible installation banner for a PWA. Do not use an external UI library. The component should listen for beforeinstallprompt, hide itself when installation is unavailable, and store dismissals in localStorage for seven days. Include Vitest tests.
This prompt establishes useful boundaries. It reduces the chance that the assistant will choose incompatible libraries or invent requirements.
When working in an existing repository, include the relevant interfaces, configuration, directory structure, and nearby code. Avoid pasting the entire project when only two files matter. Focused context usually produces better answers than an unfiltered code dump.
3. Ask for a Plan Before Asking for Code
For features involving several components, ask the AI to outline an implementation plan first. This gives you an opportunity to correct architectural mistakes before code is generated.
For example:
Propose a step-by-step plan for adding offline form submission to this PWA. The app uses a service worker, IndexedDB, and a REST API. Do not write code yet. Identify failure cases and browser limitations.
Review the plan for issues such as:
- Unnecessary complexity
- Missing error states
- Incorrect assumptions about browser support
- Poor separation of responsibilities
- Security and privacy concerns
- Changes that conflict with the current architecture
Once the plan is sound, request implementation one step at a time. This approach is especially valuable for authentication, payments, background synchronization, database migrations, and native-device integrations.
4. Use AI for Scaffolding, Not Blind Copying

AI is excellent at generating repetitive or predictable code. Useful examples include:
- Data transfer objects and schemas
- Basic CRUD endpoints
- Form components
- Validation rules
- Database migration drafts
- API client wrappers
- Test fixtures and mock data
- Docker configuration
- CI workflow templates
- Documentation and code comments
Treat this output as a first draft. Before adding it to your project, check:
- Does it compile?
- Does it match the current dependency versions?
- Does it follow project conventions?
- Are errors handled appropriately?
- Is the generated code simpler than writing it manually?
- Are there security or performance problems?
- Can another developer maintain it?
You should be able to explain every important line that enters your codebase. If the AI produces code you do not understand, ask it to explain the design, alternatives, and trade-offs before using it.
5. Build and Verify Features Incrementally
AI-generated code should enter the project in small, testable changes. Avoid accepting a large collection of modified files without reviewing the effect of each change.
A safer workflow is:
- Create a branch.
- Ask for one limited change.
- Review the diff.
- Run formatting and static analysis.
- Run existing tests.
- Add tests for the new behavior.
- Test the feature manually.
- Commit the working increment.
- Continue with the next task.
Frequent commits make experimentation less risky. If an AI-assisted change introduces a regression, you can isolate or revert it without discarding unrelated work.
Ask the tool to return patches or clearly identify changed files when possible. A concise diff is usually easier to inspect than a complete regenerated file.
6. Make Testing Part of Every Prompt
Do not wait until the application is complete to request tests. Include testing requirements from the beginning.
For a utility function, ask for unit tests covering normal inputs, invalid inputs, and boundary conditions. For an API, request integration tests for authorization failures and malformed payloads. For an app interface, include accessibility and interaction tests.
AI can help generate:
- Unit tests
- Integration tests
- End-to-end test scenarios
- Property-based test ideas
- Mocks and fixtures
- Regression tests for reported bugs
- Manual quality-assurance checklists
For example:
Write Playwright tests for the PWA login flow. Cover successful login, invalid credentials, network failure, keyboard navigation, and restoration after the app is reopened offline. Do not mock the interface behavior that the test is intended to verify.
Tests generated by the same AI that wrote the implementation can repeat its assumptions. Review whether the tests verify real requirements rather than merely confirming the current implementation. A passing test suite is only valuable when the tests are meaningful.
7. Use AI as a Debugging Partner
AI can accelerate debugging when you provide evidence rather than simply saying that something does not work.
Include:
- The exact error message
- The smallest relevant code sample
- Expected and actual behavior
- Steps needed to reproduce the problem
- Runtime, framework, and browser versions
- Recent changes
- Logs or stack traces
- Solutions you already attempted
Then ask the assistant to rank likely causes and propose a diagnostic process.
A useful debugging prompt is:
This service worker returns cached API data after the user signs out. Here are the fetch handler and cache names. Identify the three most likely causes. For each cause, suggest a way to confirm it before changing the code.
This is better than immediately requesting a fix. Diagnosis-first prompts discourage random changes and help you understand the underlying problem.
AI is also useful for interpreting unfamiliar stack traces, comparing configuration files, and creating minimal reproductions. Nevertheless, treat its explanation as a hypothesis until you verify it.
8. Pay Special Attention to PWA Requirements
Progressive web apps have several layers that are easy to implement incorrectly. AI can help with each layer, but the result must be tested on real target devices and browsers. Consult the official web.dev guide to progressive web apps when checking platform capabilities and implementation practices.
Service Workers and Offline Behavior
Be precise about what should be cached and how updates should work. Static assets, API responses, user-generated content, and authenticated data should not automatically use the same strategy.
Common strategies include:
- Cache first: Useful for versioned static assets.
- Network first: Suitable for frequently updated content with an offline fallback.
- Stale while revalidate: Quickly serves cached content while refreshing it.
- Network only: Often appropriate for sensitive or transactional requests.
Ask the AI to explain why a strategy fits each resource type. Verify cache invalidation, service-worker updates, logout behavior, and offline failures.
Installation and Platform Differences
PWA installation behavior varies across operating systems and browsers. Avoid assuming that one installation prompt works everywhere. Request graceful fallbacks and platform-aware instructions.
Test at least:
- Manifest validity
- Icons and screenshots
- Standalone display mode
- Start URL and scope
- Theme and background colors
- iOS home-screen behavior
- Android installation
- Desktop browser installation
- Update behavior after deployment
Resilience and Accessibility
Offline support is not merely a cached homepage. Users need understandable states when actions cannot be completed.
Your app should communicate:
- Whether the device is offline
- Which data may be outdated
- Whether an action has been queued
- When synchronization succeeds or fails
- How conflicts are resolved
AI can generate interface states, but accessibility still requires testing with keyboards, screen readers, zoom, reduced-motion settings, and sufficient color contrast.
9. Protect Security, Privacy, and Intellectual Property
Never paste secrets into a public or externally hosted AI tool. This includes:
- API keys
- Access tokens
- Private certificates
- Production credentials
- Customer records
- Proprietary source code without authorization
- Personally identifiable information
- Internal logs containing sensitive data
Use redacted examples or synthetic records. Check your organization’s policies and the AI provider’s data-retention settings before sharing code.
Review generated software for common vulnerabilities:
- SQL injection
- Cross-site scripting
- Missing authorization checks
- Unsafe file uploads
- Insecure token storage
- Weak cryptography
- Excessive permissions
- Sensitive information in logs
- Missing rate limits
- Unvalidated redirects
Do not ask only, “Is this secure?” Request a threat-oriented review tied to a specific environment. For example:
Review this password-reset endpoint for account enumeration, token leakage, replay attacks, rate-limit bypasses, and unsafe logging. List findings by severity and provide focused remediation steps.
Use established security scanners, dependency audits, and professional review for sensitive systems. AI is an additional reviewer, not a security guarantee.
10. Ask for Alternatives and Trade-Offs
AI tools often present the first plausible solution as if it were the only option. Encourage better decision-making by requesting alternatives.
Ask questions such as:
- What is the simplest implementation?
- What changes at larger scale?
- Can this be done without another dependency?
- What are the browser compatibility concerns?
- Which solution is easiest to maintain?
- What would make this approach fail?
- How would the design differ for a native app, web app, and PWA?
For example, background synchronization might use the Background Sync API, an application-level retry queue, or a manual retry interface. The best choice depends on browser support, data sensitivity, and reliability requirements.
Trade-off discussions are one of the most valuable uses of AI because they help expose hidden assumptions before those assumptions become technical debt.
11. Create Reusable Prompt Templates
As you discover prompts that work well, save them as part of your development documentation. Templates create consistency across features and team members.
A practical coding template can include:
Goal:
Technology and versions:
Relevant files:
Current behavior:
Expected behavior:
Constraints:
Edge cases:
Security/accessibility requirements:
Required tests:
Output format:
You can also maintain separate templates for debugging, code review, refactoring, test generation, and documentation. Version these prompts alongside the project when they encode important architectural rules.
12. Keep Human Judgment at the Center
AI can write code quickly, but speed is not the same as progress. Generated features still require product judgment, domain knowledge, testing, and maintenance planning.
The developer remains responsible for:
- Confirming that the feature solves the right problem
- Choosing an appropriate architecture
- Verifying licenses and dependencies
- Protecting user data
- Reviewing accessibility
- Measuring performance
- Maintaining consistency across the codebase
- Deciding when generated code should be rejected
Use AI to remove friction, explore possibilities, and shorten feedback loops. Do not let it replace understanding.
Conclusion
The most effective way to begin using AI in software development is to start small, provide precise context, request plans before complex implementations, and verify every result. AI can support mobile apps, web applications, PWAs, APIs, testing, debugging, documentation, and deployment—but its output should always pass through your normal engineering controls.
Treat AI as a fast collaborator that needs clear instructions and careful review. With incremental changes, strong tests, secure practices, and human oversight, it can improve productivity without sacrificing the reliability of the software you build.
Discover more from Rune Slettebakken
Subscribe to get the latest posts sent to your email.