self-validating-example
Example skill demonstrating self-validating REST API generation with automatic test execution. Use as a template for creating skills with pre-tool-use validation hooks. Validates Node.js environment and dependencies before generating endpoints.
Why use this skill?
Learn to use the self-validating-example skill for OpenClaw to generate reliable Express API endpoints with automatic unit testing and linting.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anton-abyzov/sw-self-validating-exampleWhat This Skill Does
The self-validating-example skill for OpenClaw is a sophisticated architectural template designed to bridge the gap between AI-generated code and production-ready reliability. Rather than simply emitting code into a vacuum, this skill enforces a strict validation lifecycle for every REST API endpoint generated. It treats the local Node.js environment as a staging area, verifying the existence of Express dependencies before generating routes, and immediately executing automated test suites via Vitest. If the generated code fails type-checking (tsc) or integration tests, the agent receives explicit error feedback, allowing it to perform self-correction loops. This creates a closed-loop development process where the AI "learns" from its own errors in real-time.
Installation
To integrate this skill into your OpenClaw environment, execute the following command in your terminal:
clawhub install openclaw/skills/skills/anton-abyzov/sw-self-validating-example
Ensure your local environment has Node.js (v18+) and npm installed, as the skill relies on standard project structures like src/routes/ and requires vitest or jest for test execution.
Use Cases
- Rapid Prototyping: Build CRUD endpoints with embedded verification to ensure your API contract matches your data model.
- Automated Refactoring: Use the skill to generate code that automatically passes existing linter and type-safety rules in large codebases.
- CI/CD Pre-flight: Use this for local-first testing where code must be confirmed correct before being committed to version control.
- Educational Scaffolding: Ideal for teams learning to write test-driven code, as the agent provides the template and forces the necessary test files to exist.
Example Prompts
- "Generate a new user management API endpoint that validates email formats and ensures unique usernames, making sure the self-validation loop passes."
- "Create a task manager endpoint for POST requests that stores data in a mock database and includes comprehensive unit tests verifying error handling for empty payloads."
- "Refactor the existing /profile route to support PATCH requests with strict type validation, ensuring all tests pass through the self-validating-example toolchain."
Tips & Limitations
- Tip: Keep your
tsconfig.jsonup to date; the skill relies ontsc --noEmitto verify type integrity. - Tip: If validation fails repeatedly, check the agent's scratchpad for specific linting errors that might be blocking the test execution phase.
- Limitation: The skill is currently optimized for Express.js. Porting to other frameworks like Fastify or Koa may require manual configuration tweaks.
- Limitation: The automatic retry mechanism is capped at three attempts to prevent infinite loops in cases of complex logic failures.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anton-abyzov-sw-self-validating-example": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-write, file-read, code-execution
Related Skills
network-engineer
Cloud network architect for VPC design, service mesh, zero-trust networking, load balancers, and CDN optimization. Use for network troubleshooting or connectivity issues.
jira-multi-project-mapper
Expert in mapping SpecWeave specs to multiple JIRA projects with intelligent project detection and cross-project coordination. Use when syncing to multiple JIRA projects (project-per-team, component-based), or managing bidirectional sync across team boundaries.
helm-chart-scaffolding
Design, organize, and manage Helm charts for templating and packaging Kubernetes applications with reusable configurations. Use when creating Helm charts, packaging Kubernetes applications, or implementing templated deployments.
performance-optimization
React Native performance with Hermes V1, FlashList, expo-image v2, concurrent rendering. Use for slow app, memory leaks, or FPS issues.
release-strategy-advisor
Release strategy advisor - detects brownfield patterns (tags, CI/CD, changelogs), recommends versioning strategy based on architecture. Creates release-strategy.md.