extension-infrastructurelisted
Install: claude install-skill systempromptio/systemprompt-template
# Extension: Infrastructure
Infrastructure traits provide background processing, database schemas, API routes, asset management, authentication, and config validation.
---
## 1. Jobs
Background tasks that run on schedule or on demand.
### Trait
```rust
#[async_trait]
pub trait Job: Send + Sync {
fn name(&self) -> &'static str;
fn schedule(&self) -> &'static str;
fn tags(&self) -> Vec<&'static str>;
async fn execute(&self, ctx: &dyn JobContext) -> Result<JobResult>;
fn enabled(&self) -> bool { true }
fn run_on_startup(&self) -> bool { false }
}
```
### Schedule Format
Cron syntax: `seconds minutes hours day_of_month month day_of_week`
| Example | Meaning |
|---------|---------|
| `0 0 * * * *` | Every hour |
| `0 0 3 * * *` | Daily at 3 AM |
| `0 */15 * * * *` | Every 15 minutes |
### Running Jobs Manually
```bash
systemprompt infra jobs run {job_name}
systemprompt infra jobs list
```
### Registration
```rust
impl Extension for MyExtension {
fn jobs(&self) -> Vec<Arc<dyn Job>> {
vec![Arc::new(MyJob)]
}
}
```
---
## 2. Schemas
Database table definitions embedded in extensions at compile time.
```rust
impl Extension for MyExtension {
fn schemas(&self) -> Vec<SchemaDefinition> {
vec![SchemaDefinition::inline("my_table", include_str!("../schema/my_table.sql"))]
}
fn migration_weight(&self) -> u32 { 100 }
fn dependencies(&self) -> Vec<&'static str> {
vec!["users"]
}
}
```
### Schema Conv