Skip to content

Create a copilot-instructions.md in the template #175

Open

Description

@horner

When running "npx react-native init MyApp"

It would be nice to have a copilot-instructions.md like so?

# Copilot Instructions

This project was generated with [React Native](https://reactnative.dev).

To get the most out of GitHub Copilot (or other AI coding assistants) while working on this codebase:

## General Guidance
- **Keep prompts specific.** Mention whether you’re targeting iOS, Android, or both when asking for help.
- **Reference APIs.** Copilot responds better if you include the React Native API name (e.g. `FlatList`, `useColorScheme`, `StyleSheet`).
- **Ask iteratively.** Start with small, scoped requests (e.g. *“generate a button component with onPress logging”*), then refine.

## Common Use Cases
- **UI Components**  
  Ask Copilot to scaffold screens, navigation stacks, or UI elements.  
  Example: *“Generate a login screen using React Navigation with two TextInput fields and a button.”*

- **Platform-Specific Code**  
  Specify iOS or Android if you need native modules, permissions, or configuration.  
  Example: *“Show me how to request camera permission on Android using React Native.”*

- **Testing**  
  Copilot can generate Jest/React Native Testing Library test cases.  
  Example: *“Write a test for a Button component that ensures onPress is called.”*

## Best Practices
- **Review suggestions carefully.** Copilot may propose outdated APIs—always verify against the [React Native docs](https://reactnative.dev/docs).
- **Keep context short.** Too much boilerplate in your prompt may confuse the assistant.
- **Use version awareness.** If you upgrade React Native, check that Copilot suggestions match the new APIs.

---

Happy coding with React Native 🚀

Activity

  1. horner commented on Sep 6, 2025

    @horner
    Author

    Would be happy to propose a PR if the maintainers think its a good idea.

  2. cortinico commented on Sep 6, 2025

    @cortinico
    Member

    In general, we're trying to keep the template as agnostic as possible. This change feels like we'll make it 'tool specific' (at least specific to GH Copilot). But at the same time is something we should explore as it will make RN projects easier to be consumed by AI tools.
    Let me brainstorm about it with my colleagues and get back to you 👍

  3. Shreyas-Kumar-S commented on Nov 3, 2026

    @Shreyas-Kumar-S

    @cortinico any update on this?

  4. cortinico commented on Nov 3, 2026

    @cortinico
    Member

    The original issue suggested we add a copilot-instructions.md which is not relevant anymore. However we could consider a AGENTS.md file addition to the template

  5. Shreyas-Kumar-S commented on Nov 3, 2026

    @Shreyas-Kumar-S

    could I write one and raise a PR?

  6. huntie commented on Nov 3, 2026

    @huntie
    Collaborator

    Opened #261

  7. Shreyas-Kumar-S commented on Nov 4, 2026

    @Shreyas-Kumar-S

    Thanks @huntie for putting the Agents.MD, it covers the main pitfalls well. One question(@cortinico) on the scope : would recovering from build failures after an upgrade or migration be in scope here, or be better as a follow-up?

    The idea would be a single bullet point under "Making changes", somthing like:

    • If the build fails after an upgrade or branch switch, escalate one step at a time: reset the Metro cache, reinstall node_modules, then for iOS rm -rf ios/Pods ios/build && bundle exec pod install, and for Android cd android && ./gradlew clean. Don't delete lockfiles or commit Pods/, build/ or .gradle/.

    The idea being agents tend to go down destructive loop or repeated installs when a native build fails after an upgrade or migration, and an ordered cheapest-first list helps avoid that. It also stays tool-agnostic and doesn't duplicate the existing Upgrade Helper / upgrade-react-native pointer, since it only covers recovery, not the upgrade itself.

    Happy to contribute towards it if you prefer it as separate pull request, rather than huntie's well put out AGENTS.md.

  8. huntie commented on Nov 4, 2026

    @huntie
    Collaborator

    @Shreyas-Kumar-S It's tough to put much at all in AGENTS.md to be honest, as capable models can basically figure everything they need out. In fact, if I ask Opus 5.5 to delete what it doesn't need to know from the #261 draft, it deletes half of it already.

    • I think basic instructions on the clean commands can fly.
    • Instructing how to use them, especially strongly, needs care and should be left up to the agent. Metro's --reset-cache for example should rarely be needed and is a last resort.
  9. Shreyas-Kumar-S commented on Nov 4, 2026

    @Shreyas-Kumar-S

    @huntie Makes sense that --reset-cache is a last resort and shouldn't be pushed.

    For context, I was coming at this from smaller, locally hosted open-weight models. They tend to guess at project-specific commands rather than work them out the way frontier models do, so I was wondering whether the file could cover that gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions