Update PROMPT.md
This commit is contained in:
parent
628f853c85
commit
29d3cb05b1
1 changed files with 33 additions and 99 deletions
132
PROMPT.md
132
PROMPT.md
|
|
@ -1,95 +1,71 @@
|
||||||
# BotLib Development Prompt Guide
|
# BotLib Development Guide
|
||||||
|
|
||||||
**Version:** 6.1.0
|
**Version:** 6.2.0
|
||||||
**Purpose:** LLM context for BotLib shared library development
|
**Purpose:** Shared library for General Bots workspace
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ZERO TOLERANCE POLICY
|
## ZERO TOLERANCE POLICY
|
||||||
|
|
||||||
**This project has the strictest code quality requirements possible.**
|
|
||||||
|
|
||||||
**EVERY SINGLE WARNING MUST BE FIXED. NO EXCEPTIONS.**
|
**EVERY SINGLE WARNING MUST BE FIXED. NO EXCEPTIONS.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ABSOLUTE PROHIBITIONS
|
## ❌ ABSOLUTE PROHIBITIONS
|
||||||
|
|
||||||
```
|
```
|
||||||
❌ NEVER use #![allow()] or #[allow()] in source code to silence warnings
|
❌ NEVER use #![allow()] or #[allow()] in source code
|
||||||
❌ NEVER use _ prefix for unused variables - DELETE the variable or USE it
|
❌ NEVER use _ prefix for unused variables - DELETE or USE them
|
||||||
❌ NEVER use .unwrap() - use ? or proper error handling
|
❌ NEVER use .unwrap() - use ? or proper error handling
|
||||||
❌ NEVER use .expect() - use ? or proper error handling
|
❌ NEVER use .expect() - use ? or proper error handling
|
||||||
❌ NEVER use panic!() or unreachable!() - handle all cases
|
❌ NEVER use panic!() or unreachable!()
|
||||||
❌ NEVER use todo!() or unimplemented!() - write real code
|
❌ NEVER use todo!() or unimplemented!()
|
||||||
❌ NEVER leave unused imports - DELETE them
|
❌ NEVER leave unused imports or dead code
|
||||||
❌ NEVER leave dead code - DELETE it or IMPLEMENT it
|
❌ NEVER add comments - code must be self-documenting
|
||||||
❌ NEVER use approximate constants (3.14159) - use std::f64::consts::PI
|
|
||||||
❌ NEVER silence clippy in code - FIX THE CODE or configure in Cargo.toml
|
|
||||||
❌ NEVER add comments explaining what code does - code must be self-documenting
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## CARGO.TOML LINT EXCEPTIONS
|
## 🏗️ MODULE STRUCTURE
|
||||||
|
|
||||||
When a clippy lint has **technical false positives** that cannot be fixed in code,
|
|
||||||
disable it in `Cargo.toml` with a comment explaining why:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[lints.clippy]
|
|
||||||
# Disabled: has false positives for functions with mut self, heap types (Vec, String)
|
|
||||||
missing_const_for_fn = "allow"
|
|
||||||
# Disabled: Tauri commands require owned types (Window) that cannot be passed by reference
|
|
||||||
needless_pass_by_value = "allow"
|
|
||||||
# Disabled: transitive dependencies we cannot control
|
|
||||||
multiple_crate_versions = "allow"
|
|
||||||
```
|
```
|
||||||
|
src/
|
||||||
**Approved exceptions:**
|
├── lib.rs # Public exports, feature gates
|
||||||
- `missing_const_for_fn` - false positives for `mut self`, heap types
|
├── error.rs # Error types (thiserror)
|
||||||
- `needless_pass_by_value` - Tauri/framework requirements
|
├── models.rs # Shared data models
|
||||||
- `multiple_crate_versions` - transitive dependencies
|
├── message_types.rs # Message type definitions
|
||||||
- `future_not_send` - when async traits require non-Send futures
|
├── http_client.rs # HTTP client wrapper (feature-gated)
|
||||||
|
├── branding.rs # Version, branding constants
|
||||||
|
└── version.rs # Version information
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## MANDATORY CODE PATTERNS
|
## ✅ MANDATORY CODE PATTERNS
|
||||||
|
|
||||||
### Error Handling - Use `?` Operator
|
### Error Handling
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// ❌ WRONG
|
// ❌ WRONG
|
||||||
let value = something.unwrap();
|
let value = something.unwrap();
|
||||||
let value = something.expect("msg");
|
|
||||||
|
|
||||||
// ✅ CORRECT
|
// ✅ CORRECT
|
||||||
let value = something?;
|
let value = something?;
|
||||||
let value = something.ok_or_else(|| Error::NotFound)?;
|
let value = something.ok_or_else(|| Error::NotFound)?;
|
||||||
```
|
```
|
||||||
|
|
||||||
### Self Usage in Impl Blocks
|
### Self Usage
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// ❌ WRONG
|
|
||||||
impl MyStruct {
|
impl MyStruct {
|
||||||
fn new() -> MyStruct { MyStruct { } }
|
fn new() -> Self { Self { } } // ✅ Not MyStruct
|
||||||
}
|
|
||||||
|
|
||||||
// ✅ CORRECT
|
|
||||||
impl MyStruct {
|
|
||||||
fn new() -> Self { Self { } }
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Format Strings - Inline Variables
|
### Format Strings
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// ❌ WRONG
|
format!("Hello {name}") // ✅ Not format!("{}", name)
|
||||||
format!("Hello {}", name)
|
|
||||||
|
|
||||||
// ✅ CORRECT
|
|
||||||
format!("Hello {name}")
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Display vs ToString
|
### Display vs ToString
|
||||||
|
|
@ -105,52 +81,13 @@ impl std::fmt::Display for MyType { }
|
||||||
### Derive Eq with PartialEq
|
### Derive Eq with PartialEq
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// ❌ WRONG
|
#[derive(PartialEq, Eq)] // ✅ Always both
|
||||||
#[derive(PartialEq)]
|
|
||||||
struct MyStruct { }
|
|
||||||
|
|
||||||
// ✅ CORRECT
|
|
||||||
#[derive(PartialEq, Eq)]
|
|
||||||
struct MyStruct { }
|
struct MyStruct { }
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Version Management
|
## 📦 KEY DEPENDENCIES
|
||||||
|
|
||||||
**Version is 6.1.0 - NEVER CHANGE without explicit approval**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Project Overview
|
|
||||||
|
|
||||||
BotLib is the shared foundation library for the General Bots workspace.
|
|
||||||
|
|
||||||
```
|
|
||||||
botlib/ # THIS PROJECT - Shared library
|
|
||||||
botserver/ # Main server (depends on botlib)
|
|
||||||
botui/ # Web/Desktop UI (depends on botlib)
|
|
||||||
botapp/ # Desktop app (depends on botlib)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Module Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
src/
|
|
||||||
├── lib.rs # Public exports, feature gates
|
|
||||||
├── error.rs # Error types (thiserror)
|
|
||||||
├── models.rs # Shared data models
|
|
||||||
├── message_types.rs # Message type definitions
|
|
||||||
├── http_client.rs # HTTP client wrapper (feature-gated)
|
|
||||||
├── branding.rs # Version, branding constants
|
|
||||||
└── version.rs # Version information
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
| Library | Version | Purpose |
|
| Library | Version | Purpose |
|
||||||
|---------|---------|---------|
|
|---------|---------|---------|
|
||||||
|
|
@ -164,17 +101,14 @@ src/
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Remember
|
## 🔑 REMEMBER
|
||||||
|
|
||||||
- **ZERO WARNINGS** - Every clippy warning must be fixed
|
- **ZERO WARNINGS** - Every clippy warning must be fixed
|
||||||
- **NO ALLOW IN CODE** - Never use #[allow()] in source files
|
- **NO ALLOW IN CODE** - Never use #[allow()] in source files
|
||||||
- **CARGO.TOML EXCEPTIONS OK** - Disable lints with false positives in Cargo.toml with comment
|
- **NO DEAD CODE** - Delete unused code
|
||||||
- **NO DEAD CODE** - Delete unused code, never prefix with _
|
- **NO UNWRAP/EXPECT** - Use ? operator
|
||||||
- **NO UNWRAP/EXPECT** - Use ? operator or proper error handling
|
- **INLINE FORMAT ARGS** - `format!("{name}")` not `format!("{}", name)`
|
||||||
- **INLINE FORMAT ARGS** - format!("{name}") not format!("{}", name)
|
|
||||||
- **USE SELF** - In impl blocks, use Self not the type name
|
- **USE SELF** - In impl blocks, use Self not the type name
|
||||||
- **DERIVE EQ** - Always derive Eq with PartialEq
|
- **DERIVE EQ** - Always derive Eq with PartialEq
|
||||||
- **DISPLAY NOT TOSTRING** - Implement Display, not ToString
|
- **DISPLAY NOT TOSTRING** - Implement Display, not ToString
|
||||||
- **USE DIAGNOSTICS** - Use IDE diagnostics tool, never call cargo clippy directly
|
- **Version 6.2.0** - do not change without approval
|
||||||
- **Version**: Always 6.1.0 - do not change without approval
|
|
||||||
- **Session Continuation**: When running out of context, create detailed summary: (1) what was done, (2) what remains, (3) specific files and line numbers, (4) exact next steps.
|
|
||||||
Loading…
Add table
Reference in a new issue