WorkflowsguideNovember 10, 202512 min read

AI-Powered PR Automation: How Devonair Improves Code the Moment You Open a Pull Request

Devonair springs into action the moment a PR is opened. Automatic formatting, linting fixes, test generation, and security scanning - before anyone reviews.

The moment a developer clicks "Create Pull Request" is an opportunity. Before reviewers look, before discussions begin, before anyone forms an opinion - there's a window where code can improve itself. Devonair seizes this moment with AI that understands your code.

When a PR is created, Devonair automatically analyzes the changes, fixes what can be fixed, generates what's missing, and flags what needs attention. By the time a reviewer opens the PR, Devonair has already made it better.

This guide covers everything Devonair does when a PR is created - the automations available, the improvements possible, and how to configure Devonair to maximize the value of that critical first moment.

Why PR Creation Matters

The best time to fix issues is before anyone sees them.

The First Impression Problem

PRs create impressions:

Without Devonair:
  - Reviewer opens PR
  - Sees formatting issues
  - Notices missing tests
  - Finds linting violations
  - Forms negative impression
  - Requests changes
  - Developer fixes
  - Another round of review

Every issue caught by a human could have been caught by Devonair.

The Feedback Cycle Cost

Human feedback is expensive:

Manual feedback cycle:
  - Reviewer time to find issue
  - Comment writing time
  - Developer time to see comment
  - Developer time to fix
  - Reviewer time to verify
  - Days of calendar time

Devonair eliminates cycles by fixing issues before review begins.

The Context Window

Developers have maximum context at PR creation:

Context at PR creation:
  - Code just written
  - Intent fresh in mind
  - Understanding complete
  - Best time for improvements

Devonair's fixes arrive while context is still fresh, making review meaningful rather than mechanical.

What Devonair Does on PR Created

Comprehensive AI-powered improvement across your entire codebase.

Automatic Code Formatting

Devonair enforces your team's style instantly:

@devonair format on PR created:
  - Apply project formatting rules
  - Organize imports consistently
  - Fix indentation issues
  - Normalize whitespace
  - Commit formatting changes

When Devonair formats code, style discussions disappear from reviews. No more "please fix indentation" comments. No more formatting nits. Devonair handles it automatically.

The formatting changes appear as a commit on the PR branch. Developers see exactly what Devonair changed. Reviewers see consistently formatted code. Everyone wins.

Linting and Auto-Fixes

Devonair runs your linter and fixes what can be fixed:

@devonair lint on PR created:
  - Run configured linters
  - Apply automatic fixes
  - Commit fixable violations
  - Comment on unfixable issues
  - Report summary of changes

Most linting violations are automatically fixable - unused imports, missing semicolons, incorrect formatting, simple code patterns. Devonair fixes these without human involvement.

For violations that require human judgment, Devonair comments directly on the relevant lines. Developers see exactly what needs attention and why.

Type Annotation Addition

Devonair adds types to untyped code:

@devonair add types on PR created:
  - Identify untyped functions
  - Analyze usage patterns
  - Infer appropriate types
  - Add TypeScript or Python type hints
  - Verify type correctness

Gradual typing is tedious. Developers skip it because it's boring. Devonair handles it automatically - its AI infers types from context and usage patterns, adding appropriate annotations.

For TypeScript projects, Devonair adds function parameter types, return types, and interface definitions. For Python, Devonair adds type hints following PEP 484 conventions. The codebase gets more type-safe with every PR.

Documentation Generation

Devonair ensures new code is documented:

@devonair document on PR created:
  - Find undocumented public functions
  - Generate appropriate docstrings
  - Add JSDoc, Sphinx, or equivalent
  - Update README if API changed
  - Add inline comments for complex logic

Documentation written at creation time is better documentation. The code is fresh, the intent is clear, and Devonair captures it immediately. AI analyzes function behavior to generate accurate, meaningful documentation - not just boilerplate.

Devonair generates documentation that matches your project's conventions - JSDoc for JavaScript, docstrings for Python, XML comments for C#. The documentation style is consistent because Devonair is consistent.

Test Generation

Devonair creates tests for new code:

@devonair generate tests on PR created:
  - Analyze new functions
  - Generate unit test scaffolds
  - Create basic happy-path tests
  - Add edge case coverage
  - Follow project test conventions

Tests written at creation time are tests that exist. Devonair uses AI to generate test scaffolds that cover the basic cases, giving developers a foundation to build on.

Devonair follows your existing test patterns. If you use Jest, Devonair generates Jest tests. If you use pytest, Devonair generates pytest tests. The generated tests fit naturally into your test suite.

Security Scanning

Devonair catches vulnerabilities before review:

@devonair security scan on PR created:
  - Check for common vulnerability patterns
  - Detect hardcoded secrets or credentials
  - Identify SQL injection risks
  - Find XSS vulnerabilities
  - Flag authentication issues

Security issues caught at PR creation never reach production. Devonair scans for OWASP Top 10 vulnerabilities, secret exposure, and common security anti-patterns.

When Devonair finds security issues, it comments with specific guidance on how to fix them. Developers learn security best practices while addressing immediate concerns.

Dependency Analysis

Devonair evaluates dependency changes:

@devonair analyze dependencies on PR created:
  - Detect package.json/requirements.txt changes
  - Check new dependencies for vulnerabilities
  - Verify license compatibility
  - Assess breaking change risk
  - Report findings

New dependencies deserve scrutiny. Devonair checks them against vulnerability databases, verifies their licenses match your requirements, and assesses the risk they introduce.

Devonair reports findings directly on the PR, giving reviewers the context they need to evaluate dependency additions.

Configuring Devonair for PR Creation

Customizing Devonair's behavior.

Selecting Automations

Choose what Devonair does:

@devonair configure PR created:

  Always run:
    - Formatting
    - Linting
    - Security scanning

  Run for code changes:
    - Type annotations
    - Test generation
    - Documentation

  Run selectively:
    - Dependency analysis (when deps change)

Not every automation makes sense for every PR. Devonair can be configured to run different automations based on what changed.

Setting Strictness

Configure how strict Devonair should be:

@devonair strictness configuration:

  Formatting:
    - Strict: Auto-fix everything
    - Moderate: Auto-fix common issues
    - Lenient: Only report, don't fix

  Linting:
    - Strict: Fail PR on any violation
    - Moderate: Auto-fix, warn on rest
    - Lenient: Report only

Teams have different needs. Devonair adapts to your standards rather than imposing its own.

Excluding Paths

Control where Devonair operates:

@devonair path configuration:

  Include:
    - src/**
    - lib/**
    - tests/**

  Exclude:
    - vendor/**
    - node_modules/**
    - generated/**

Third-party code, generated files, and legacy areas can be excluded from Devonair's automations.

Customizing Messages

Control how Devonair communicates:

@devonair message configuration:

  Commit messages:
    - Style: conventional commits
    - Include: what was changed
    - Sign-off: Devonair automated

  PR comments:
    - Tone: helpful and direct
    - Detail level: concise
    - Include: how to fix

Devonair's communication style can match your team's preferences.

The Developer Experience

What developers see when Devonair activates.

Immediate Feedback

Devonair acts fast:

Developer experience:
  1. Create PR
  2. Within seconds, Devonair analysis starts
  3. Devonair commits appear on branch
  4. Summary comment appears on PR
  5. Developer sees what was improved

The feedback is immediate. Developers don't wait for CI pipelines or human reviewers. Devonair provides value within moments of PR creation.

Transparent Changes

Devonair shows its work:

Devonair transparency:
  - Separate commits for each improvement type
  - Clear commit messages
  - PR comment summarizing all changes
  - Diff visible for every modification

Developers see exactly what Devonair changed. Nothing is hidden. Every modification is visible, reviewable, and reversible.

Actionable Guidance

When Devonair can't auto-fix, it guides:

Devonair guidance:
  - Specific line comments
  - Explanation of the issue
  - Suggestion for resolution
  - Link to relevant documentation

Devonair doesn't just flag problems - it explains them. Developers learn while they fix, improving their skills along with their code.

Override Capability

Developers maintain control:

Developer control:
  - Revert any Devonair commit
  - Disable specific automations
  - Configure per-PR behavior
  - Override Devonair decisions

Devonair assists; it doesn't dictate. Developers always have final say over their code.

Real-World Scenarios

How Devonair helps in practice.

The Quick Fix PR

A developer submits a one-line bug fix:

@devonair on quick fix:
  - Verify formatting matches
  - Run security scan on change
  - Check for related test coverage
  - Minimal intervention

Devonair knows small changes need light touch. It verifies the basics without generating unnecessary tests or documentation for trivial changes.

The New Feature PR

A developer submits a complete new feature:

@devonair on new feature:
  - Format all new code
  - Add types to new functions
  - Generate documentation
  - Create test scaffolds
  - Full security scan
  - Dependency review if applicable

New features get comprehensive treatment. Devonair ensures the feature arrives with proper formatting, documentation, types, and test coverage.

The Refactoring PR

A developer submits a refactoring change:

@devonair on refactoring:
  - Verify formatting
  - Update affected tests
  - Check documentation accuracy
  - Flag potential breaking changes

Refactoring PRs need different attention. Devonair focuses on ensuring existing tests and documentation stay synchronized with the changes.

The Dependency Update PR

A developer updates dependencies:

@devonair on dependency update:
  - Analyze new versions
  - Check for vulnerabilities
  - Verify license compliance
  - Assess breaking change risk
  - Test compatibility

Dependency updates deserve focused security and compatibility analysis. Devonair provides the scrutiny these changes need.

Measuring Devonair's Impact

Understanding the value Devonair provides.

Issues Fixed Automatically

Track what Devonair catches:

@devonair metrics on PR created:
  - Formatting issues fixed
  - Lint violations resolved
  - Types added
  - Tests generated
  - Security issues flagged

Every issue Devonair fixes is an issue reviewers didn't have to catch. Track these to understand Devonair's value.

Review Cycles Reduced

Measure efficiency improvement:

Review efficiency metrics:
  - PRs requiring formatting changes: Before vs After
  - PRs requiring lint fixes: Before vs After
  - Average review iterations: Before vs After
  - Time from PR open to first approval

Devonair's greatest value is in the review cycles it eliminates. Measure this to quantify the time savings.

Quality Improvements

Track quality trends:

Quality trend metrics:
  - Test coverage on new code
  - Documentation coverage
  - Type coverage
  - Security issues reaching production

Over time, Devonair improves codebase quality. Track these trends to see the cumulative effect.

Common Questions

Addressing typical concerns.

"Will Devonair slow down PR creation?"

Devonair runs asynchronously. PR creation is instant - Devonair works in the background. Developers can continue working while Devonair improves their PR.

"What if Devonair makes changes I don't want?"

Every Devonair change is a commit you can revert. Developers maintain full control. If Devonair's changes aren't appropriate, undo them with a simple revert.

"Does Devonair replace code review?"

Devonair augments review, it doesn't replace it. Human reviewers still evaluate logic, architecture, and approach. Devonair handles the mechanical aspects so humans can focus on what matters.

"What about existing lint rules and formatters?"

Devonair uses your existing configuration. It runs your Prettier config, your ESLint rules, your project standards. Devonair enforces your rules, not its own.

Getting Started

Enable Devonair on PR creation.

Initial Setup

Start with the basics:

@devonair initial setup:
  1. Connect repository
  2. Enable PR created trigger
  3. Start with formatting only
  4. Verify it works as expected

Begin with low-risk automation. Formatting is universally beneficial and low-risk. Start there.

Gradual Expansion

Add automations over time:

@devonair gradual expansion:
  Week 1: Formatting
  Week 2: Add linting
  Week 3: Add security scanning
  Week 4: Add documentation generation
  Week 5: Add test generation

Each automation proves value before adding more. Build confidence through demonstrated results.

Team Communication

Prepare your team:

@devonair team preparation:
  - Explain what Devonair will do
  - Show example improvements
  - Address concerns
  - Gather feedback
  - Adjust based on experience

Devonair works best when teams understand and embrace it. Communication prevents surprise and builds support.

Ongoing Optimization

Refine based on experience:

@devonair optimization:
  - Review Devonair's changes regularly
  - Adjust configuration as needed
  - Address any false positives
  - Expand successful patterns

Devonair should evolve with your team's needs. Regular review ensures it stays helpful.

The moment a PR is created is the best moment to improve it. Devonair seizes that moment automatically - formatting code, fixing violations, generating documentation, creating tests, and scanning for security issues. By the time humans look at the PR, Devonair has already made it better. That's the power of AI-driven automation at PR creation.


FAQ

How quickly does Devonair act after a PR is created?

Devonair begins analysis within seconds of PR creation. Most automations complete within a minute or two, depending on the size of the changes. Developers see Devonair's improvements almost immediately.

Can Devonair handle very large PRs?

Yes. Devonair processes changes incrementally, handling large PRs effectively. However, Devonair also recognizes when PRs are too large and can suggest breaking them into smaller, more reviewable pieces.

What if Devonair's generated tests are wrong?

Devonair generates test scaffolds as a starting point, not a final solution. Developers should review and enhance generated tests. They provide a foundation, not a complete solution.

Does Devonair work with monorepos?

Yes. Devonair can be configured per-path within a repository, allowing different automations for different parts of a monorepo. Each area gets appropriate treatment.

How does Devonair handle PRs that touch many files?

Devonair prioritizes the most impactful improvements. For large PRs, it focuses on critical issues first - security vulnerabilities, obvious bugs, significant formatting issues - before addressing less urgent matters.