agentleFS
lexmountlexmount/browseruse-agent-bench/.github/copilot-instructions.md

browseruse-agent-bench

Copilot instructions19 starsChanged 7 months agoApache-2.0View on GitHub

Generic code review instructions that can be customized for any project using GitHub Copilot

  • Reads credentials

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

44 rules. About 0 are common, 40 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈40

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When performing a code review, respond in Chinese.

    line 13
  2. Distinctive:

    When performing a code review, prioritize issues in the following order:

    line 17
  3. Distinctive:

    When performing a code review, follow these principles:

    line 39
  4. Distinctive:

    Be pragmatic: Not every suggestion needs immediate implementation

    line 46
  5. Distinctive:

    Group related comments: Avoid multiple comments about the same topic

    line 47
  6. Distinctive:

    When performing a code review, check for:

    line 51
  7. Distinctive:

    Prefer the smallest correct change with clear control flow

    line 57
  8. Distinctive:

    Prefer guard clauses and early returns over deep nesting

    line 58
  9. Very specific:

    Do not add else after branches that already return, raise, or continue

    line 59
  10. Distinctive:

    Keep functions small and focused (soft target: <= 40 lines.

    line 60
  11. Distinctive:

    Keep nesting depth shallow (soft target: <= 2 levels.

    line 61
  12. Very specific:

    Keep large conditional blocks manageable (soft target: <= 3 branches in one if/elif/else chain)

    line 62
  13. Distinctive:

    Avoid magic numbers and strings (use constants)

    line 63
  14. Very specific:

    Avoid over-defensive programming: do not wrap code in try/except unless an exception is genuinely expected and handled.

    line 65
  15. Distinctive:

    Do not guard against failure modes that cannot happen given the current invariants — such guards add noise and obscure intent

    line 66
  16. Distinctive:

    Prefer letting unexpected errors propagate so they are visible.

    line 67
  17. Distinctive:

    Avoid broad catch-all handlers unless there is a clear boundary reason

    line 94
  18. Very specific:

    No silent failures or ignored exceptions (for example, pass in exception handlers)

    line 95
  19. Distinctive:

    When performing a code review, check for security issues:

    line 125
  20. Distinctive:

    Sensitive Data: No passwords, API keys, tokens, or PII in code or logs

    line 127
  21. Distinctive:

    Input Validation: All user inputs are validated and sanitized

    line 128
  22. Distinctive:

    SQL Injection: Use parameterized queries, never string concatenation

    line 129
  23. Distinctive:

    Authorization: Verify user has permission to perform action

    line 131
  24. Distinctive:

    Cryptography: Use established libraries, never roll your own crypto

    line 132
  25. Distinctive:

    Dependency Security: Check for known vulnerabilities in dependencies

    line 133
  26. Distinctive:

    When performing a code review, verify test quality:

    line 157
  27. Distinctive:

    Behavior Changes: Every behavior-changing PR should add or update targeted tests

    line 159
  28. Distinctive:

    Assertions: Use specific assertions, avoid generic assertTrue/assertFalse

    line 166
  29. Distinctive:

    Edge Cases: Test boundary conditions, null values, empty collections

    line 167
  30. Distinctive:

    When performing a code review, check for performance issues:

    line 191
  31. Distinctive:

    Database Queries: Avoid N+1 queries, use proper indexing

    line 193
  32. Distinctive:

    When performing a code review, verify architectural principles:

    line 215
  33. Distinctive:

    Interface Segregation: Prefer small, focused interfaces

    line 219
  34. Distinctive:

    Consistent Patterns: Follow established patterns in the codebase

    line 222
  35. Distinctive:

    Boundary Discipline: Keep orchestration/control-flow logic separate from provider/integration details

    line 223
  36. Distinctive:

    Fail Fast on Selection: If an optional integration is selected but unavailable/incompatible, fail fast with clear errors

    line 225
  37. Distinctive:

    No Hidden Fallback Chains: Avoid layered fallbacks that mask real integration failures

    line 226
  38. Distinctive:

    When performing a code review, check documentation:

    line 230
  39. Distinctive:

    README Updates: Update README when adding features or changing setup

    line 234
  40. Distinctive:

    Breaking Changes: Document any breaking changes clearly

    line 235
  41. Distinctive:

    When performing a code review, use this format for comments:

    line 240
  42. Distinctive:

    When performing a code review, systematically verify:

    line 339
  43. Distinctive:

    When performing a code review:

    line 388
  44. Distinctive:

    Start by stating review scope and assumptions.

    line 390

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Generic Code Review Instructions

Comprehensive code review guidelines for GitHub Copilot that can be adapted to any project. These instructions follow best practices from prompt engineering and provide a structured approach to code quality, security, testing, and architecture review.

Review Language

When performing a code review, respond in Chinese.

Review Priorities

When performing a code review, prioritize issues in the following order:

🔴 CRITICAL (Block merge)

  • Security: Vulnerabilities, exposed secrets, authentication/authorization issues
  • Correctness: Logic errors, data corruption risks, race conditions
  • Breaking Changes: API contract changes without versioning
  • Data Loss: Risk of data loss or corruption

🟡 IMPORTANT (Requires discussion)

  • Code Quality: Severe violations of SOLID principles, excessive duplication
  • Test Coverage: Missing tests for critical paths or new functionality
  • Performance: Obvious performance bottlenecks (N+1 queries, memory leaks)
  • Architecture: Significant deviations from established patterns

🟢 SUGGESTION (Non-blocking improvements)

  • Readability: Poor naming, complex logic that could be simplified
  • Optimization: Performance improvements without functional impact
  • Best Practices: Minor deviations from conventions
  • Documentation: Missing or incomplete comments/documentation

General Review Principles

When performing a code review, follow these principles:

  1. Be specific: Reference exact lines, files, and provide concrete examples
  2. Provide context: Explain WHY something is an issue and the potential impact
  3. Suggest solutions: Show corrected code when applicable, not just what's wrong
  4. Be constructive: Focus on improving the code, not criticizing the author
  5. Recognize good practices: Acknowledge well-written code and smart solutions
  6. Be pragmatic: Not every suggestion needs immediate implementation
  7. Group related comments: Avoid multiple comments about the same topic

Code Quality Standards

When performing a code review, check for:

Clean Code

  • Descriptive and meaningful names for variables, functions, and classes
  • Single Responsibility Principle: each function/class does one thing well
  • DRY (Don't Repeat Yourself): no code duplication
  • Prefer the smallest correct change with clear control flow
  • Prefer guard clauses and early returns over deep nesting
  • Do not add else after branches that already return, raise, or continue
  • Keep functions small and focused (soft target: <= 40 lines; if > 60 lines, suggest splitting or justify why)
  • Keep nesting depth shallow (soft target: <= 2 levels; investigate when depth exceeds 3)
  • Keep large conditional blocks manageable (soft target: <= 3 branches in one if/elif/else chain)
  • Avoid magic numbers and strings (use constants)
  • Code should be self-documenting; comments only when necessary
  • Avoid over-defensive programming: do not wrap code in try/except unless an exception is genuinely expected and handled; do not add None/falsy checks unless the value can actually be absent at that point
  • Do not guard against failure modes that cannot happen given the current invariants — such guards add noise and obscure intent
  • Prefer letting unexpected errors propagate so they are visible; only catch exceptions at a level where you can meaningfully recover or translate them

Examples

// ❌ BAD: Poor naming and magic numbers
function calc(x, y) {
    if (x > 100) return y * 0.15;
    return y * 0.10;
}

// ✅ GOOD: Clear naming and constants
const PREMIUM_THRESHOLD = 100;
const PREMIUM_DISCOUNT_RATE = 0.15;
const STANDARD_DISCOUNT_RATE = 0.10;

function calculateDiscount(orderTotal, itemPrice) {
    const isPremiumOrder = orderTotal > PREMIUM_THRESHOLD;
    const discountRate = isPremiumOrder ? PREMIUM_DISCOUNT_RATE : STANDARD_DISCOUNT_RATE;
    return itemPrice * discountRate;
}

Error Handling

  • Proper error handling at appropriate levels
  • Meaningful error messages
  • Fail fast: validate inputs early
  • Catch specific error types/exceptions
  • Avoid broad catch-all handlers unless there is a clear boundary reason
  • No silent failures or ignored exceptions (for example, pass in exception handlers)
  • Log handled failures with actionable context

Examples

# ❌ BAD: Silent failure and generic error
def process_user(user_id):
    try:
        user = db.get(user_id)
        user.process()
    except:
        pass

# ✅ GOOD: Explicit error handling
def process_user(user_id):
    if not user_id or user_id <= 0:
        raise ValueError(f"Invalid user_id: {user_id}")

    try:
        user = db.get(user_id)
    except UserNotFoundError:
        raise UserNotFoundError(f"User {user_id} not found in database")
    except DatabaseError as e:
        raise ProcessingError(f"Failed to retrieve user {user_id}: {e}")

    return user.process()

Security Review

When performing a code review, check for security issues:

  • Sensitive Data: No passwords, API keys, tokens, or PII in code or logs
  • Input Validation: All user inputs are validated and sanitized
  • SQL Injection: Use parameterized queries, never string concatenation
  • Authentication: Proper authentication checks before accessing resources
  • Authorization: Verify user has permission to perform action
  • Cryptography: Use established libraries, never roll your own crypto
  • Dependency Security: Check for known vulnerabilities in dependencies

Examples

// ❌ BAD: SQL injection vulnerability
String query = "SELECT * FROM users WHERE email = '" + email + "'";

// ✅ GOOD: Parameterized query
PreparedStatement stmt = conn.prepareStatement(
    "SELECT * FROM users WHERE email = ?"
);
stmt.setString(1, email);
// ❌ BAD: Exposed secret in code
const API_KEY = "sk_live_abc123xyz789";

// ✅ GOOD: Use environment variables
const API_KEY = process.env.API_KEY;

Testing Standards

When performing a code review, verify test quality:

  • Behavior Changes: Every behavior-changing PR should add or update targeted tests
  • Coverage: Critical paths and new functionality must have tests
  • Prioritization: Prioritize changed behavior and risky edge cases over trivial coverage
  • Test Names: Descriptive names that explain what is being tested
  • Test Structure: Clear Arrange-Act-Assert or Given-When-Then pattern
  • Independence: Tests should not depend on each other or external state
  • Isolation: Tests should not implicitly overwrite local state; use fixtures or temporary directories for stateful scenarios
  • Assertions: Use specific assertions, avoid generic assertTrue/assertFalse
  • Edge Cases: Test boundary conditions, null values, empty collections
  • Mock Appropriately: Mock external dependencies, not domain logic

Examples

// ❌ BAD: Vague name and assertion
test('test1', () => {
    const result = calc(5, 10);
    expect(result).toBeTruthy();
});

// ✅ GOOD: Descriptive name and specific assertion
test('should calculate 10% discount for orders under $100', () => {
    const orderTotal = 50;
    const itemPrice = 20;

    const discount = calculateDiscount(orderTotal, itemPrice);

    expect(discount).toBe(2.00);
});

Performance Considerations

When performing a code review, check for performance issues:

  • Database Queries: Avoid N+1 queries, use proper indexing
  • Algorithms: Appropriate time/space complexity for the use case
  • Caching: Utilize caching for expensive or repeated operations
  • Resource Management: Proper cleanup of connections, files, streams
  • Pagination: Large result sets should be paginated
  • Lazy Loading: Load data only when needed

Examples

# ❌ BAD: N+1 query problem
users = User.query.all()
for user in users:
    orders = Order.query.filter_by(user_id=user.id).all()  # N+1!

# ✅ GOOD: Use JOIN or eager loading
users = User.query.options(joinedload(User.orders)).all()
for user in users:
    orders = user.orders

Architecture and Design

When performing a code review, verify architectural principles:

  • Separation of Concerns: Clear boundaries between layers/modules
  • Dependency Direction: High-level modules don't depend on low-level details
  • Interface Segregation: Prefer small, focused interfaces
  • Loose Coupling: Components should be independently testable
  • High Cohesion: Related functionality grouped together
  • Consistent Patterns: Follow established patterns in the codebase
  • Boundary Discipline: Keep orchestration/control-flow logic separate from provider/integration details
  • Optional Dependencies: Isolate optional-dependency loading at composition/router boundaries
  • Fail Fast on Selection: If an optional integration is selected but unavailable/incompatible, fail fast with clear errors
  • No Hidden Fallback Chains: Avoid layered fallbacks that mask real integration failures

Documentation Standards

When performing a code review, check documentation:

  • API Documentation: Public APIs must be documented (purpose, parameters, returns)
  • Complex Logic: Non-obvious logic should have explanatory comments
  • README Updates: Update README when adding features or changing setup
  • Breaking Changes: Document any breaking changes clearly
  • Examples: Provide usage examples for complex features

Comment Format Template

When performing a code review, use this format for comments:

**[PRIORITY] Category: Brief title**

Detailed description of the issue or suggestion.

**Why this matters:**
Explanation of the impact or reason for the suggestion.

**Suggested fix:**
[code example if applicable]

**Reference:** [link to relevant documentation or standard]

Example Comments

Critical Issue

**🔴 CRITICAL - Security: SQL Injection Vulnerability**

The query on line 45 concatenates user input directly into the SQL string,
creating a SQL injection vulnerability.

**Why this matters:**
An attacker could manipulate the email parameter to execute arbitrary SQL commands,
potentially exposing or deleting all database data.

**Suggested fix:**
```sql
-- Instead of:
query = "SELECT * FROM users WHERE email = '" + email + "'"

-- Use:
PreparedStatement stmt = conn.prepareStatement(
    "SELECT * FROM users WHERE email = ?"
);
stmt.setString(1, email);
```

**Reference:** OWASP SQL Injection Prevention Cheat Sheet

Important Issue

**🟡 IMPORTANT - Testing: Missing test coverage for critical path**

The `processPayment()` function handles financial transactions but has no tests
for the refund scenario.

**Why this matters:**
Refunds involve money movement and should be thoroughly tested to prevent
financial errors or data inconsistencies.

**Suggested fix:**
Add test case:
```javascript
test('should process full refund when order is cancelled', () => {
    const order = createOrder({ total: 100, status: 'cancelled' });

    const result = processPayment(order, { type: 'refund' });

    expect(result.refundAmount).toBe(100);
    expect(result.status).toBe('refunded');
});
```

Suggestion

**🟢 SUGGESTION - Readability: Simplify nested conditionals**

The nested if statements on lines 30-40 make the logic hard to follow.

**Why this matters:**
Simpler code is easier to maintain, debug, and test.

**Suggested fix:**
```javascript
// Instead of nested ifs:
if (user) {
    if (user.isActive) {
        if (user.hasPermission('write')) {
            // do something
        }
    }
}

// Consider guard clauses:
if (!user || !user.isActive || !user.hasPermission('write')) {
    return;
}
// do something
```

Review Checklist

When performing a code review, systematically verify:

Code Quality

  • Code follows consistent style and conventions
  • Names are descriptive and follow naming conventions
  • Functions/methods are small and focused
  • Control flow is clear (guard clauses preferred; no unnecessary else after early exit)
  • No code duplication
  • Complex logic is broken into simpler parts
  • Error handling is appropriate
  • No commented-out code or TODO without tickets

Security

  • No sensitive data in code or logs
  • Input validation on all user inputs
  • No SQL injection vulnerabilities
  • Authentication and authorization properly implemented
  • Dependencies are up-to-date and secure

Testing

  • New code has appropriate test coverage
  • Behavior-changing code includes targeted tests
  • Tests are well-named and focused
  • Tests cover edge cases and error scenarios
  • Tests are independent and deterministic
  • Tests do not implicitly overwrite local state
  • No tests that always pass or are commented out

Performance

  • No obvious performance issues (N+1, memory leaks)
  • Appropriate use of caching
  • Efficient algorithms and data structures
  • Proper resource cleanup

Architecture

  • Follows established patterns and conventions
  • Proper separation of concerns
  • No architectural violations
  • Dependencies flow in correct direction
  • Optional dependency handling is isolated and does not hide failures

Documentation

  • Public APIs are documented
  • Complex logic has explanatory comments
  • README is updated if needed
  • Breaking changes are documented

Review Scope & Final Verdict

When performing a code review:

  • Start by stating review scope and assumptions.
  • End with a clear decision (Approve or Request Changes).
  • Explicitly list blocking issues (if any) and the top risks to address next.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.