mojolicious
Assist with Mojolicious web framework development using documentation search, browsing, and testing requests without starting a server.
What this skill does
# Mojolicious Development
Use the Mojolicious app script for efficient development and testing.
## Core Capabilities
- **Search documentation** - Search Mojolicious docs using Google Custom Search
- **Browse documentation** - View official docs at https://docs.mojolicious.org/
- **Test requests** - Test app endpoints using the built-in commands
- **View routes** - List all application routes
## Documentation Access
### Searching Documentation
Use WebSearch with site restriction to search Mojolicious documentation:
```
WebSearch: "routing guide site:docs.mojolicious.org"
WebSearch: "websocket site:docs.mojolicious.org"
```
Or use WebFetch with Google Custom Search:
```
https://www.google.com/cse?cx=014527573091551588235:pwfplkjpgbi&q=<query>
```
### Browsing Documentation
Documentation URLs follow these patterns:
- **Mojolicious modules**: `https://docs.mojolicious.org/Mojolicious/Guides/Routing`
- Use `/` separators for Mojolicious namespace
- Example: `Mojolicious::Guides::Routing` → `/Mojolicious/Guides/Routing`
- **CPAN modules**: `https://docs.mojolicious.org/Path::To::Module`
- Use `::` separators for other modules
- Example: `Mojo::UserAgent` → `/Mojo::UserAgent`
## Testing Your Application
### Quick Testing
Quick testing is useful for rapid manual verification during development.
#### Testing Requests
Use the app script for GET requests only. For other HTTP methods (POST, PUT, DELETE), use curl with a running server:
```bash
# GET request (use app.pl)
./app.pl get /api/users
# GET request with query parameters (use app.pl)
./app.pl get /api/users?page=1
# GET request with custom headers (use app.pl)
./app.pl get /api/users -H 'Authorization: Bearer token123'
# For POST, PUT, DELETE: Start server first
./app.pl daemon -l http://127.0.0.1:3000
# POST request with JSON data (use curl)
curl -X POST http://127.0.0.1:3000/api/users \
-H 'Content-Type: application/json' \
-d '{"name":"Alice","email":"[email protected]"}'
# PUT request (use curl)
curl -X PUT http://127.0.0.1:3000/api/users/1 \
-H 'Content-Type: application/json' \
-d '{"name":"Alice Updated"}'
# DELETE request (use curl)
curl -X DELETE http://127.0.0.1:3000/api/users/1
# curl with custom headers
curl http://127.0.0.1:3000/api/users \
-H 'Authorization: Bearer token123'
```
#### Viewing Routes
List all application routes:
```bash
./app.pl routes
```
This shows the routing table with HTTP methods, paths, and route names.
### Unit Testing with Test::Mojo
For proper automated testing, use Test::Mojo. It provides a comprehensive testing framework with chainable assertions.
#### Creating Test Files
Create test files in the `t/` directory:
```perl
# t/api.t
use Test2::V0;
use Test::Mojo;
# Create test instance
my $t = Test::Mojo->new('path/to/app.pl');
# Test GET request
$t->get_ok('/api/todos')
->status_is(200)
->json_is([]);
# Test POST request
$t->post_ok('/api/todos' => json => {title => 'Buy milk', completed => 0})
->status_is(201)
->json_has('/id')
->json_is('/title' => 'Buy milk')
->json_is('/completed' => 0);
# Test GET specific todo
$t->get_ok('/api/todos/1')
->status_is(200)
->json_is('/title' => 'Buy milk');
# Test PUT request
$t->put_ok('/api/todos/1' => json => {completed => 1})
->status_is(200)
->json_is('/completed' => 1);
# Test DELETE request
$t->delete_ok('/api/todos/1')
->status_is(200)
->json_has('/message');
# Test error cases
$t->get_ok('/api/todos/999')
->status_is(404)
->json_has('/error');
$t->post_ok('/api/todos' => json => {})
->status_is(400)
->json_is('/error' => 'Title is required');
done_testing();
```
#### Running Tests
```bash
# Run all tests
prove -lv t/
# Run specific test file
prove -lv t/api.t
# Run with verbose output
perl t/api.t
```
#### Key Test::Mojo Features
- **Chainable assertions**: Chain multiple assertions for concise tests
- **HTTP methods**: `get_ok`, `post_ok`, `put_ok`, `delete_ok`, etc.
- **Status assertions**: `status_is()`, `status_isnt()`
- **JSON assertions**: `json_is()`, `json_has()`, `json_like()`
- **Content assertions**: `content_like()`, `content_type_is()`
- **Header assertions**: `header_is()`, `header_like()`
- **Automatic session management**: Cookies are handled automatically
- **No server needed**: Tests run without starting a real server
## Quick Examples
```bash
# View all routes in your application
./app.pl routes
# Test a GET endpoint (use app.pl)
./app.pl get /api/users
# Test with authentication header (use app.pl)
./app.pl get /api/protected -H 'Authorization: Bearer mytoken'
# Start server for testing POST/PUT/DELETE
./app.pl daemon -l http://127.0.0.1:3000
# Test a POST endpoint with JSON (use curl)
curl -X POST http://127.0.0.1:3000/api/users \
-H 'Content-Type: application/json' \
-d '{"name":"Bob","role":"admin"}'
```
## Workflow
1. **Plan**: Check routes with `./app.pl routes`
2. **Search**: Find relevant documentation for the feature
3. **Read docs**: Browse official docs at https://docs.mojolicious.org/
4. **Implement**: Write your code
5. **Test**:
- **Recommended**: Write unit tests with Test::Mojo in `t/` directory
- **Quick testing**: Use `./app.pl get` for GET requests, or curl with daemon for other methods
6. **Run tests**: Execute with `prove -lv t/` to verify all functionality
## Guidelines
- Always check `./app.pl routes` to understand the current routing structure
- **Prefer unit testing over quick testing:**
- Write automated tests with Test::Mojo in `t/` directory for reliable, repeatable testing
- Use quick testing (app.pl/curl) only for rapid manual verification during development
- For quick testing endpoints:
- GET requests: Use `./app.pl get <path>` (no server needed)
- POST/PUT/DELETE: Start server with `./app.pl daemon` and use curl
- Search documentation using site-restricted WebSearch: `site:docs.mojolicious.org <query>`
- For module documentation, use WebFetch with proper URL patterns:
- Mojolicious namespace: `https://docs.mojolicious.org/Mojolicious/Path`
- Other modules: `https://docs.mojolicious.org/Module::Name`
- Follow the workflow: plan → search → read docs → implement → unit test → (optional: quick test)
- Test::Mojo provides better test coverage and automation than manual curl commands
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.