agent-workflow-kit-cli 1.3.3 β 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -9
- package/dist/cli/commands/add.js +1 -1
- package/dist/cli/commands/doctor.js +145 -47
- package/dist/cli/commands/ui.js +192 -0
- package/dist/cli/index.js +15 -1
- package/package.json +4 -2
- package/templates/devops/AGENTS.md.hbs +32 -0
- package/templates/devops/skills/devops/SKILL.md +477 -0
- package/templates/diagram/AGENTS.md.hbs +30 -0
- package/templates/diagram/skills/drawio-diagram/SKILL.md +427 -0
- package/templates/dotnet/AGENTS.md.hbs +11 -7
- package/templates/express/AGENTS.md.hbs +13 -9
- package/templates/fastapi/AGENTS.md.hbs +25 -3
- package/templates/fastapi/rules/api-testing.md +24 -0
- package/templates/fastapi/rules/database-async.md +26 -0
- package/templates/golang/AGENTS.md.hbs +15 -9
- package/templates/golang/skills/golang-db/SKILL.md +27 -0
- package/templates/golang/skills/golang-feature/SKILL.md +42 -0
- package/templates/nestjs/AGENTS.md.hbs +13 -9
- package/templates/next-js/AGENTS.md.hbs +13 -9
- package/templates/rust/AGENTS.md.hbs +16 -9
- package/templates/rust/skills/rust-db/SKILL.md +27 -0
- package/templates/rust/skills/rust-feature/SKILL.md +34 -0
- package/ui-dist/assets/Antigravity-IRHfUNd0.webp +0 -0
- package/ui-dist/assets/Codex-B3jt494H.png +0 -0
- package/ui-dist/assets/Logo-DARneFJW.png +0 -0
- package/ui-dist/assets/ReactTS-Cv7D5v-r.png +0 -0
- package/ui-dist/assets/devops-DfKGji1l.png +0 -0
- package/ui-dist/assets/drawio-D1K35acK.png +0 -0
- package/ui-dist/assets/expressjs-cjiJ1MIq.png +0 -0
- package/ui-dist/assets/fastapi-x75ez5Tf.png +0 -0
- package/ui-dist/assets/golang-DWpOzDNa.png +0 -0
- package/ui-dist/assets/index-BhHU4Khx.js +372 -0
- package/ui-dist/assets/index-C0BHmZv8.css +1 -0
- package/ui-dist/assets/nestjs-CZk_FY6t.png +0 -0
- package/ui-dist/assets/nextjs-DIQjv1J3.png +0 -0
- package/ui-dist/assets/python-CfV_cs4B.png +0 -0
- package/ui-dist/assets/rust-A_NnBwqP.png +0 -0
- package/ui-dist/assets/springbootjava--7jHXzq_.jpg +0 -0
- package/ui-dist/index.html +47 -0
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
## πΊοΈ Golang Development Guide (Go Backend)
|
|
2
2
|
|
|
3
3
|
### π Agent Development Lifecycle
|
|
4
|
-
The AI Agent must execute all Golang tasks following this
|
|
5
|
-
1. **Design &
|
|
6
|
-
2. **Comprehensive Testing:** Write unit tests using the table-driven testing pattern and Go's built-in `testing` library.
|
|
7
|
-
3. **
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- Build Validation: `go build ./...`
|
|
11
|
-
4. **Dependency Management:** Add new external libraries using `go get [library_name]`. Never manually edit the `go.sum` file.
|
|
4
|
+
The AI Agent must execute all Golang tasks following this structured 5-stage lifecycle:
|
|
5
|
+
1. **Design & Code:** Implement business logic adhering to the Standard Go Project Layout. Keep entrypoints in `cmd/`, core business logic in `internal/`, and standalone shared libraries in `pkg/`.
|
|
6
|
+
2. **Comprehensive Testing:** Write unit tests using the table-driven testing pattern and Go's built-in `testing` library. Mock database layers or third-party connections.
|
|
7
|
+
3. **Troubleshooting & Debugging:** When debugging goroutines or database locks, use context cancellation and trace log output.
|
|
8
|
+
4. **Code Quality & Review:** Verify code quality against `@golang-style.md` to check interface boundaries, error wrapping, and naming.
|
|
9
|
+
5. **Acyclic Design:** Ensure there are no circular imports. Encapsulate domain packages cleanly under `@project-layout.md` and manage concurrent access via `@concurrency.md`.
|
|
12
10
|
|
|
13
11
|
---
|
|
14
12
|
|
|
@@ -18,6 +16,8 @@ Refer to the detailed rules below:
|
|
|
18
16
|
- Directory organization and manual dependency injection: `@project-layout.md`
|
|
19
17
|
- Explicit error handling, wrapping, and custom API errors: `@error-handling.md`
|
|
20
18
|
- Concurrency, goroutine/channel lifecycle, and escape analysis: `@concurrency.md`
|
|
19
|
+
- Scaffolding a business feature (Handler, Service interface, tests): `@golang-feature`
|
|
20
|
+
- Scaffolding repository database operations and models: `@golang-db`
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -29,8 +29,14 @@ Refer to the detailed rules below:
|
|
|
29
29
|
|
|
30
30
|
#### 2. Explicit Error Handling
|
|
31
31
|
- **Check Every Error:** Never ignore returned errors. Write `if err != nil` checks immediately after calling fallible functions.
|
|
32
|
-
- **Wrap Errors:** Use `fmt.Errorf("failed to...: %w", err)` when propagating errors to preserve runtime context.
|
|
32
|
+
- **Wrap Errors:** Use `fmt.Errorf("failed to...: %w", err)` when propagating errors to preserve runtime context. Review details in `@error-handling.md`.
|
|
33
33
|
|
|
34
34
|
#### 3. Safe Concurrency
|
|
35
35
|
- **Context Propagation:** Pass `ctx context.Context` as the first argument to all functions executing I/O.
|
|
36
36
|
- **Prevent Race Conditions:** Protect shared memory access across goroutines using `sync.Mutex` or `sync/atomic`.
|
|
37
|
+
|
|
38
|
+
### π§ͺ Verification & Testing
|
|
39
|
+
Before completing a task, run the following verification pipeline locally:
|
|
40
|
+
- **Build Validation:** `go build ./...`
|
|
41
|
+
- **Testing:** `go test ./...`
|
|
42
|
+
- **Formatting:** `gofmt -w .`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: golang-db
|
|
3
|
+
description: Scaffold a Go database repository layer using SQLx, GORM, or raw SQL queries
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Follow this process to add or extend database entities and repository queries.
|
|
7
|
+
|
|
8
|
+
Inputs:
|
|
9
|
+
- structName: Model entity struct name (e.g., `User`)
|
|
10
|
+
- tableName: Database table name (e.g., `users`)
|
|
11
|
+
- repositoryName: Interface name (e.g., `UserRepository`)
|
|
12
|
+
|
|
13
|
+
Steps:
|
|
14
|
+
1. Declare the entity model struct with json and db (or gorm) tags:
|
|
15
|
+
```go
|
|
16
|
+
type User struct {
|
|
17
|
+
ID int64 `json:"id" db:"id" gorm:"primaryKey"`
|
|
18
|
+
Email string `json:"email" db:"email"`
|
|
19
|
+
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
2. Define the repository interface (e.g., `UserRepository`) containing standard SQL actions (`FindByID`, `Save`).
|
|
23
|
+
3. Implement the interface concrete struct wrapping the database handle (e.g., `*sql.DB`, `*sqlx.DB`, or `*gorm.DB`).
|
|
24
|
+
4. Wire the repository implementation to the service layer using constructor injection.
|
|
25
|
+
5. Create SQL schema files under the `/migrations` or `/db` directories if schema changes are required.
|
|
26
|
+
6. Verify code correctness using:
|
|
27
|
+
- `go build ./...`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: golang-feature
|
|
3
|
+
description: Scaffold a Go package slice including Handler, Service interfaces, and table-driven unit tests
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Follow this process to generate a new Go business feature slice.
|
|
7
|
+
|
|
8
|
+
Inputs:
|
|
9
|
+
- packageName: Name of the package (e.g., `billing`)
|
|
10
|
+
- structName: Primary model struct name (e.g., `Invoice`)
|
|
11
|
+
- functionality: Summary of the business requirements and API paths
|
|
12
|
+
|
|
13
|
+
Steps:
|
|
14
|
+
1. Create a directory inside `internal/` named `<packageName>/` (e.g., `internal/billing`).
|
|
15
|
+
2. Declare structs and interfaces in `<packageName>.go` or `types.go` (e.g., `BillingService` interface and `Invoice` struct).
|
|
16
|
+
3. Implement the concrete service class (e.g., `service.go` containing `type service struct { ... }` implementing `BillingService`).
|
|
17
|
+
4. Implement HTTP handlers in `handler.go` wrapping inputs/outputs via JSON bindings.
|
|
18
|
+
5. Register routers/handlers in the application bootloader (e.g., in `cmd/server/main.go`).
|
|
19
|
+
6. Write unit tests in `service_test.go` using table-driven tests:
|
|
20
|
+
```go
|
|
21
|
+
func TestBillingService(t *testing.T) {
|
|
22
|
+
tests := []struct {
|
|
23
|
+
name string
|
|
24
|
+
input string
|
|
25
|
+
wantErr bool
|
|
26
|
+
}{
|
|
27
|
+
{
|
|
28
|
+
name: "Valid input case",
|
|
29
|
+
input: "valid",
|
|
30
|
+
wantErr: false,
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
for _, tt := range tests {
|
|
34
|
+
t.Run(tt.name, func(t *testing.T) {
|
|
35
|
+
// Implement test validation
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
7. Run validation commands:
|
|
41
|
+
- `go build ./...`
|
|
42
|
+
- `go test ./...`
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
## πΊοΈ NestJS Development Guide (Node.js Backend)
|
|
2
2
|
|
|
3
3
|
### π Agent Development Lifecycle
|
|
4
|
-
The AI Agent must execute all NestJS tasks following this 5-
|
|
5
|
-
1. **Design &
|
|
4
|
+
The AI Agent must execute all NestJS tasks following this structured 5-stage lifecycle:
|
|
5
|
+
1. **Design & Code:** Implement business logic adhering to the Module-driven architecture. Keep Controllers thin; place 100% of business logic within Services. Encapsulate components cleanly as outlined in `@module-architecture.md`.
|
|
6
6
|
2. **Comprehensive Testing:** Write unit tests for Services using Jest Mocking (`.spec.ts`) and end-to-end (E2E) integration tests using Supertest.
|
|
7
|
-
3. **
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- Testing: `{{runCommand}} test` (or `{{runCommand}} test -- --run` for CI/CD environments)
|
|
11
|
-
- Build Validation: `{{runCommand}} build`
|
|
12
|
-
4. **Dependency Management:** Install new libraries using `{{packageManager}} add [library_name]`. Never modify the lockfile `{{lockFile}}` manually.
|
|
7
|
+
3. **Troubleshooting & Debugging:** When debugging request validations or database mappings, inspect class-validator metadata and database query logs.
|
|
8
|
+
4. **Code Quality & Review:** Perform self-review using `@validation-errors.md` to ensure constraints are enforced and exceptions are mapped correctly. Check formatting conventions in `@nestjs-style.md`.
|
|
9
|
+
5. **Production Readiness:** Verify compilation and lint errors are resolved before completion.
|
|
13
10
|
|
|
14
11
|
---
|
|
15
12
|
|
|
@@ -18,7 +15,7 @@ Refer to the detailed rules below:
|
|
|
18
15
|
- TypeScript coding style, indentation, decorator sorting, and clean code conventions: `@nestjs-style.md`
|
|
19
16
|
- Strict module boundaries, encapsulation, and resource sharing rules: `@module-architecture.md`
|
|
20
17
|
- Class Validator setups, ValidationPipe data transformations, and Exception Filters: `@validation-errors.md`
|
|
21
|
-
- Process to scaffold modular components (Module, Controller, Service, DTO, Entity): `@
|
|
18
|
+
- Process to scaffold modular components (Module, Controller, Service, DTO, Entity): `@nestjs-module`
|
|
22
19
|
|
|
23
20
|
---
|
|
24
21
|
|
|
@@ -36,3 +33,10 @@ Refer to the detailed rules below:
|
|
|
36
33
|
- **No Raw Server Errors:** Never expose raw database or system exceptions (HTTP 500) to clients.
|
|
37
34
|
- **Built-in HttpExceptions:** Handle try/catch flows inside Services and map errors to explicit NestJS HttpExceptions (e.g., `NotFoundException`, `BadRequestException`, `ForbiddenException`).
|
|
38
35
|
- **Global Exception Filter:** Expose a global Exception Filter to format all error responses consistently in JSON format.
|
|
36
|
+
|
|
37
|
+
### π§ͺ Verification & Testing
|
|
38
|
+
Before completing a task, run the following verification pipeline:
|
|
39
|
+
- **Linting:** `{{runCommand}} lint`
|
|
40
|
+
- **Type Checking:** `{{runCommand}} typecheck`
|
|
41
|
+
- **Testing:** `{{runCommand}} test`
|
|
42
|
+
- **Build Validation:** `{{runCommand}} build`
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
## πΊοΈ Next.js Development Guide (App Router)
|
|
2
2
|
|
|
3
3
|
### π Agent Development Lifecycle
|
|
4
|
-
The AI Agent must execute all Next.js tasks following this 5-
|
|
5
|
-
1. **Design &
|
|
4
|
+
The AI Agent must execute all Next.js tasks following this structured 5-stage lifecycle:
|
|
5
|
+
1. **Design & Code:** Build pages and components adhering to the App Router conventions. Default to React Server Components (RSC) as described in `@server-client-components.md`.
|
|
6
6
|
2. **Comprehensive Testing:** Write unit tests for business utilities and component behavior using Jest/Vitest.
|
|
7
|
-
3. **
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- Testing: `{{runCommand}} test` (or `{{runCommand}} test -- --run` for CI/CD environments)
|
|
11
|
-
- Build Validation: `{{runCommand}} build`
|
|
12
|
-
4. **Dependency Management:** Install new libraries using `{{packageManager}} add [library_name]`. Never modify the lockfile `{{lockFile}}` manually.
|
|
7
|
+
3. **Troubleshooting & Debugging:** When debugging data loading or hydration mismatch issues, isolate Server and Client component scopes.
|
|
8
|
+
4. **Code Quality & Review:** Perform self-review using `@data-fetching-mutations.md` (for Server Actions and query caching parameters) and `@seo-metadata.md`. Check styling rules in `@next-style.md`.
|
|
9
|
+
5. **Production Readiness:** Verify compilation, type checks, and next builds compile warning-free before committing.
|
|
13
10
|
|
|
14
11
|
---
|
|
15
12
|
|
|
@@ -19,7 +16,7 @@ Refer to the detailed rules below:
|
|
|
19
16
|
- Architectural boundaries between React Server Components (RSC) and React Client Components (RCC): `@server-client-components.md`
|
|
20
17
|
- Server-side data fetching, caching, revalidation, and secure Server Actions: `@data-fetching-mutations.md`
|
|
21
18
|
- Semantic HTML5 standards and Dynamic Metadata API configurations: `@seo-metadata.md`
|
|
22
|
-
- Step-by-step process to generate new Pages or Routes cleanly: `@
|
|
19
|
+
- Step-by-step process to generate new Pages or Routes cleanly: `@next-feature`
|
|
23
20
|
|
|
24
21
|
---
|
|
25
22
|
|
|
@@ -39,3 +36,10 @@ Refer to the detailed rules below:
|
|
|
39
36
|
- **Image Optimization:** Never use raw `<img>` tags. Use `next/image`'s `<Image />` with appropriate `sizes` attributes, and set `priority` for above-the-fold images.
|
|
40
37
|
- **Navigation:** Use `<Link />` from `next/link` to enable background pre-fetching when links enter the viewport.
|
|
41
38
|
- **Dynamic Metadata:** Export a `generateMetadata` function in dynamic routes to optimize search engine crawling.
|
|
39
|
+
|
|
40
|
+
### π§ͺ Verification & Testing
|
|
41
|
+
Before completing a task, run the following verification pipeline:
|
|
42
|
+
- **Linting:** `{{runCommand}} lint`
|
|
43
|
+
- **Type Checking:** `{{runCommand}} typecheck`
|
|
44
|
+
- **Testing:** `{{runCommand}} test`
|
|
45
|
+
- **Build Validation:** `{{runCommand}} build`
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
## πΊοΈ Rust Development Guide
|
|
2
2
|
|
|
3
3
|
### π Agent Development Lifecycle
|
|
4
|
-
The AI Agent must execute all Rust tasks following this
|
|
5
|
-
1. **Design &
|
|
6
|
-
2. **Comprehensive Testing:** Write unit tests inside internal test modules and integration tests in the `/tests` directory.
|
|
7
|
-
3. **
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- Build Validation: `cargo build`
|
|
11
|
-
4. **Dependency Management:** Add external libraries using `cargo add [library_name]`. Never manually edit the `Cargo.lock` file.
|
|
4
|
+
The AI Agent must execute all Rust tasks following this structured 5-stage lifecycle:
|
|
5
|
+
1. **Design & Code:** Implement business logic adhering to Rust conventions. Enforce structural separation: `main.rs` (for binary application setup) and `lib.rs` (for core business logic that can be reused and tested).
|
|
6
|
+
2. **Comprehensive Testing:** Write unit tests inside internal test modules and integration tests in the `/tests` directory. Mocks and double components should be declared under `#[cfg(test)]`.
|
|
7
|
+
3. **Troubleshooting & Debugging:** When debugging lifetimes, memory borrow errors, or asynchronous deadlocks, refer to `@memory-concurrency.md` directives.
|
|
8
|
+
4. **Code Quality & Review:** Verify code conforms strictly to `@rust-style.md` check criteria (preventing warnings, formatting code, avoiding over-cloning).
|
|
9
|
+
5. **Crate Architecture:** Organize workspace dependencies using Cargo Workspaces if building multi-crate projects, maintaining encapsulation guidelines in `@project-layout.md`.
|
|
12
10
|
|
|
13
11
|
---
|
|
14
12
|
|
|
@@ -18,6 +16,8 @@ Refer to the detailed rules below:
|
|
|
18
16
|
- Crate modules, Cargo Workspaces, and Trait-based Dependency Injection: `@project-layout.md`
|
|
19
17
|
- Failures management, Result/Option, `thiserror`, and `anyhow`: `@error-handling.md`
|
|
20
18
|
- Lifetimes `'a`, Smart Pointers, and async Tokio safety: `@memory-concurrency.md`
|
|
19
|
+
- Scaffolding a Rust feature (Struct, traits, implementations, unit tests): `@rust-feature`
|
|
20
|
+
- Scaffolding asynchronous database repositories and models: `@rust-db`
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -28,7 +28,14 @@ Refer to the detailed rules below:
|
|
|
28
28
|
- **Exclusive Mutable Borrow:** Ensure only one mutable reference `&mut T` exists at a time, and never let it coexist with any read references `&T` in the same scope.
|
|
29
29
|
|
|
30
30
|
#### 2. Safe Error Handling
|
|
31
|
-
- **No Unwraps:** Never use `.unwrap()` or `.expect()` in production code (except in tests). Propagate errors using `Result<T, E>` or `Option<T>` to ensure system reliability.
|
|
31
|
+
- **No Unwraps:** Never use `.unwrap()` or `.expect()` in production code (except in tests). Propagate errors using `Result<T, E>` or `Option<T>` to ensure system reliability. Manage library errors with `thiserror` and application errors with `anyhow` as outlined in `@error-handling.md`.
|
|
32
32
|
|
|
33
33
|
#### 3. Async Concurrency (Tokio)
|
|
34
34
|
- **CPU-Bound Tasks:** Never run heavy CPU operations (e.g., encryption, intensive loops) directly inside async contexts. Offload them using `tokio::task::spawn_blocking`.
|
|
35
|
+
- **Mutex Selection:** Prefer standard `std::sync::Mutex` for synchronizing state across threads if the guard is not held across `.await` points. Use `tokio::sync::Mutex` only when needed to prevent scheduling blocking.
|
|
36
|
+
|
|
37
|
+
### π§ͺ Verification & Testing
|
|
38
|
+
Before completing a task, run the following verification pipeline locally:
|
|
39
|
+
- **Lint check:** `cargo clippy --all-targets -- -D warnings`
|
|
40
|
+
- **Testing:** `cargo test`
|
|
41
|
+
- **Formatting:** `cargo fmt -- --check`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rust-db
|
|
3
|
+
description: Scaffold a database repository layer in Rust using SQLx, Diesel, or SeaORM
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Follow this process to add database models, tables, and access methods in Rust.
|
|
7
|
+
|
|
8
|
+
Inputs:
|
|
9
|
+
- modelName: Name of the struct (e.g., `User`)
|
|
10
|
+
- tableName: Database table name (e.g., `users`)
|
|
11
|
+
- databaseLibrary: DB access style: SQLx, Diesel, or SeaORM
|
|
12
|
+
|
|
13
|
+
Steps:
|
|
14
|
+
1. Declare the database entity struct, applying appropriate serialization/deserialization attributes (e.g., `#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]`).
|
|
15
|
+
2. Define the repository trait or struct handling asynchronous database connection execution.
|
|
16
|
+
3. If using SQLx, write queries using async query macros to ensure compile-time SQL validation:
|
|
17
|
+
```rust
|
|
18
|
+
let user = sqlx::query_as!<User, _>(
|
|
19
|
+
"SELECT id, email, created_at FROM users WHERE id = $1", id
|
|
20
|
+
)
|
|
21
|
+
.fetch_one(&self.pool)
|
|
22
|
+
.await?;
|
|
23
|
+
```
|
|
24
|
+
4. If using Diesel or SQLx migrations, add a migration script under the `/migrations` directory.
|
|
25
|
+
5. Setup connection pooling parameters and pass database pool references using constructor dependency injection.
|
|
26
|
+
6. Verify query compilation and formatting:
|
|
27
|
+
- `cargo clippy --all-targets -- -D warnings`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rust-feature
|
|
3
|
+
description: Scaffold a Rust module, including structs, traits, implementations, and unit/integration tests
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Follow this process to generate a new Rust feature or sub-module.
|
|
7
|
+
|
|
8
|
+
Inputs:
|
|
9
|
+
- moduleName: Name of the module/file (e.g., `billing`)
|
|
10
|
+
- traitName: Name of the trait interface if any (e.g., `BillingService`)
|
|
11
|
+
- functionality: Summary of the business requirements and structs
|
|
12
|
+
|
|
13
|
+
Steps:
|
|
14
|
+
1. Create a file under `src/` named `<moduleName>.rs` (e.g., `src/billing.rs`), or a subdirectory containing `mod.rs`.
|
|
15
|
+
2. Register the module in `lib.rs` or `main.rs` using `pub mod <moduleName>;`.
|
|
16
|
+
3. Declare traits, structs, and custom error types (using `thiserror` for domain-specific errors) in the new module.
|
|
17
|
+
4. Implement functionality for the structs, mapping options and results safely (no `unwrap` or `expect` allowed in production).
|
|
18
|
+
5. Write inline unit tests inside a nested `tests` module decorated with `#[cfg(test)]`:
|
|
19
|
+
```rust
|
|
20
|
+
#[cfg(test)]
|
|
21
|
+
mod tests {
|
|
22
|
+
use super::*;
|
|
23
|
+
|
|
24
|
+
#[test]
|
|
25
|
+
fn test_feature_logic() {
|
|
26
|
+
// Arrange, Act, Assert
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
6. Add integration tests inside `/tests` if this feature integrates multiple modules or dependencies.
|
|
31
|
+
7. Verify compilation and warnings:
|
|
32
|
+
- `cargo check`
|
|
33
|
+
- `cargo test`
|
|
34
|
+
- `cargo clippy --all-targets -- -D warnings`
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|