Install any skill in seconds. Free to start, no credit card required.
Get Started Free →How to create and structure packages in the Trezor Suite monorepo, including scopes and sizing guidance. Use when creating new packages or resolving cyclic dependencies.
.claude/skills/trezor-packages/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -37% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -20% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -42% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -27% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -50% | 0% |
Use command yarn generate-package @scope/newPackageName. For example using name @suite-common/wallet will create package in /suite-common folder. Full list of scopes:
| Scope | Folder | Description | Imports from | | ------------- | ------------- | ------------------------------------------------------------------------------------------------------- | ------------------------- | | @trezor | /packages | Public packages (Connect, etc...) and Suite web & desktop packages (that shall be moved to @suite soon) | @suite | | @suite-common | /suite-common | code shared between @suite and @suite native | @trezor | | @suite-native | /suite-native | mobile Suite | @trezor and @suite-common | | @suite | /suite | desktop & web Suite | @trezor and @suite-common |
Smaller is better.
Big packages usually lead to cyclic dependencies. Imagine this pattern:
packageA which has type FormInput and there are multiple forms in this package that need this typepackageB which also has a form that needs to use FormInput so you import it from packageApackageA but you can't because it will cause cyclic dependency.Now you have two options how to solve it:
packageB into packageA, but it will only amplify this cyclic deps issue for other packages. More things you will have in packageA, then more often you need to use packageA in other packages, but that will prevent you from importing any of that packages back into packageA because of cyclic dependency. That will force you to place everything into packageA which will grow into a monolith (that's the exact thing that happened in packages/suite).packageC which will contain this FormInput and both packageA and packageB can use it.So creating smaller packages from start is always better, because you have much lower chances to run into issue with cyclic dependencies, but not only that. Smaller packages give you better control of what you will use in other packages, you can run smaller subsets of tests, lints etc which is faster.
Other measured skills in the registry, with their headline benchmark lift.