Welcome to "Customizing OpenCode for Your Projects"! Have you ever started a new coding session and felt like you had to repeat the same instructions over and over? You might find yourself constantly telling the AI, "Please use Python," "Make sure to add comments," or "Don't forget to use these specific libraries." This repetition can be tiring and wastes valuable time that you could spend building your application.
This is where Project Configuration comes in to save the day. Instead of typing out your rules every single time you ask a question, you can write them down once in a special file. OpenCode reads this file at the start of every session and automatically knows exactly how you like to work. By the end of this lesson, you will know how to set up these persistent instructions so OpenCode acts like a dedicated team member who knows your project standards by heart.
Before we create our first configuration file, it is important to understand the two different levels of customization available to you. Think of Global Configuration as your personal "house rules" for the OpenCode application itself — things like display preferences that follow you across every session. These settings are stored in a separate global configuration file outside your project folders and are managed independently from the project instruction files we focus on in this course.
On the other hand, Project Configuration is specific to the folder or task you are working on right now. You might be working on a web project that requires JavaScript today, but tomorrow you might work on a data science project that needs Python. You wouldn't want your JavaScript rules confusing your Python project. Project configuration lives inside your project folder and only affects OpenCode when you are working on that specific project. In this course, we are focusing on these project-specific rules to help you manage different coding standards easily.
To get started, we need to tell OpenCode that we want to create a configuration file for our current project. We do this using a simple command called /init. This command stands for "initialize," which just means "to set up" or "to start." When you run this command in your OpenCode chat session, the AI scans your current files to guess what language you are using and creates a starter file for you.
When you run this command, OpenCode creates a new file in your file explorer named AGENTS.md. This file is formatted in markdown, which is a very common way to store documentation in a text format that is easy for both humans and computers to read. A small opencode.json file with "instructions": ["AGENTS.md"] tells OpenCode to read the project instructions. On the CodeSignal platform, you don't need to install anything extra to make this work; the environment is already set up to recognize this command and file.
Now that we have our AGENTS.md file, let's look at what is inside. Keep in mind that running /init may not always generate the exact same structure; the format shown in this lesson is a recommended structure that we will use throughout this course for consistency. The file is divided into different sections, each controlling a different part of OpenCode's behavior. We will break this down into smaller pieces so it is easier to understand.
First, let's look at the Project Metadata. This section tells OpenCode what your project is generally about.
AGENTS.md
The Language section gives the AI context. The Description is particularly useful because it helps the AI understand the goal of your code. If you ask for a "function to add numbers," the AI will write it differently for a "Sales Analysis" project (where it might deal with currency) compared to a "Geometry Game" project.
Next, we have the Standards and Libraries sections.
AGENTS.md
The Standards section defines the quality rules for your code. Setting Docstrings to true means the AI will always add documentation comments to functions it writes for you, while Async preferred tells the AI whether it should prioritize asynchronous programming patterns (like async/await) by default. The Libraries section is excellent for keeping your project consistent. It tells OpenCode, "If I ask for a chart, use matplotlib; do not use other random libraries." This ensures the code OpenCode gives you fits perfectly with the tools you have already installed.
The most powerful part of the configuration file is often the Conventions section. This is where you can get very specific about how you want things done. Unlike the boolean (true/false) options in the standards section, conventions allow you to write custom strings that describe your preferences.
You can edit the AGENTS.md file directly in your file editor. Here is an example of adding specific conventions for a financial project:
AGENTS.md
By adding "Currency format: USD with 2 decimals", you are creating a rule. Now, if you ask OpenCode to "display the price," it won't just give you a number like 10. It will try to format it as $10.00 because you explicitly told it that is the standard for this project. You can even include technical details like "Plot dpi: 300" to ensure any charts generated by the AI are high-resolution. Customizing this file is as simple as typing in the text editor and saving your changes.
Once you have saved your AGENTS.md file, OpenCode immediately knows about it. You don't need to restart the session. You can test this by asking OpenCode to generate some code that relies on your rules.
Let's try asking for a function to calculate revenue. Notice how we don't need to specify anything about Python, comments, or currency formatting — the configuration handles all of that automatically.
OpenCode responds by acknowledging your project configuration upfront, then produces a file like this:
Because we set up our configuration in AGENTS.md, the AI automatically included type hints (like pd.DataFrame), added a docstring with proper Args and Returns sections, and rounded the money to 2 decimals as per our convention. Notice that you did not have to ask for any of these things. This saves you from having to correct the AI or manually edit the code afterwards.
In this lesson, we learned how to stop repeating ourselves by using Project Configuration. We used the /init command to generate an AGENTS.md file, which acts as a rulebook for our project. We explored how to define metadata, set coding standards like style guides, list preferred libraries, and write custom conventions. Finally, we saw how OpenCode reads this file to automatically format code exactly the way we want it.
Now it is time for you to try it out! In the upcoming practice exercises, you will initialize a configuration file for a new project, edit the markdown to set your own rules, and see how the AI adapts to your personal coding style. Remember, the goal is to make the AI work for you, so you can focus on solving big problems instead of fixing small formatting details.
