> For the complete documentation index, see [llms.txt](https://calnix.gitbook.io/eth-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnix.gitbook.io/eth-dev/foundry/overview.md).

# Overview

## forge init&#x20;

> forge init \<project\_name>

* creates a new directory named after your project from the default template.&#x20;
* also initializes a new `git` repository.

#### Creating a New Project from template

> &#x20;forge init --template <https://github.com/foundry-rs/forge-template> \<project\_name>

#### Project Layout

You should see 3 directories:

* lib -> dependencies are stored as git submodules
* src -> default directory for contracts
* test -> default directory for tests

![](/files/y3m7WD2FGnxG1Mb3w8xe)

You can configure where Forge looks for both dependencies and contracts using the `--lib-paths` and `--contracts` flags respectively. Alternatively you can configure it in `foundry.toml`

{% hint style="info" %}
For automatic Hardhat support you can also pass the `--hh` flag, which sets the following flags: `--lib-paths node_modules --contracts contracts.`
{% endhint %}

## forge build

* compiles project

## forge test

* run all tests
* creates two new directories
  * out -> contains contract artifacts, such as the ABI
  * cache -> used by `forge` to only recompile what is necessary


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://calnix.gitbook.io/eth-dev/foundry/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
