All skills

Sails.js framework patterns for The Boring JavaScript Stack - actions, helpers, routes, policies, hooks, configuration, security, middleware, file uploads, deployment, and more. Use this skill when building, reviewing, or debugging any server-side code in a Sails.js application.

Use this Skill: https://skilld.dev/gh/sailscastshq/boring-stack/sails

This session only. Nothing lands on disk.

README.md

≈898 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Sails.js Skill

A comprehensive skill for building server-side applications with Sails.js in The Boring JavaScript Stack. This skill gives any AI agent a deep understanding of Sails 1.0 -- from app anatomy and request lifecycle to production deployment.

Installation

npx skills add sailscastshq/boring-stack/skills/sails

What's Included

Getting Started

  • Getting Started - App anatomy, project structure, file conventions, naming patterns, .sailsrc, globals

Core Concepts

  • Actions - The actions2 format with inputs, exits, response types, and the four action patterns
  • Helpers - Reusable server-side functions with the machine specification
  • Routes - Route configuration, dynamic parameters, wildcards, and targets
  • Policies - Request-level guards for authentication and authorization
  • Hooks - App-level hooks for shared data, middleware, and initialization

Request Pipeline

  • Request Lifecycle - How HTTP requests flow through the entire Sails pipeline
  • Middleware - HTTP middleware configuration, Express integration, custom middleware

Configuration & Infrastructure

  • Configuration - Config files, environment variables, and custom settings
  • Responses - Custom response types including Inertia-specific responses
  • Security - CORS, CSRF protection, sessions, and security patterns
  • Deployment - Production configuration, Redis sessions, scaling, Docker

Framework Reference

  • Sails Object - The global sails object: config, helpers, models, hooks, log, inertia
  • File Uploads - File upload patterns with Skipper and cloud storage
  • Shell Scripts - Background tasks, data migrations, and maintenance scripts
  • Blueprints - Auto-generated REST API and when to use or disable it
  • Generators - Scaffolding new files with sails generate and custom generators

Usage

This skill teaches Sails.js patterns as used in The Boring JavaScript Stack, where Sails serves as the backend for Inertia.js-powered frontends (React, Vue, or Svelte).

Example Action (actions2)

// api/controllers/dashboard/view-dashboard.js
module.exports = {
  exits: {
    success: { responseType: 'inertia' }
  },
  fn: async function () {
    const stats = await sails.helpers.dashboard.getStats()
    return {
      page: 'dashboard/index',
      props: { stats }
    }
  }
}

Example Helper

// api/helpers/format-currency.js
module.exports = {
  inputs: {
    amount: { type: 'number', required: true }
  },
  fn: async function ({ amount }) {
    return new Intl.NumberFormat('en-US', {
      style: 'currency',
      currency: 'USD'
    }).format(amount / 100)
  }
}

Example Policy

// api/policies/is-authenticated.js
module.exports = async function (req, res, proceed) {
  if (req.session.userId) {
    return proceed()
  }
  await sails.helpers.returnUrl.set(req)
  return res.redirect('/login')
}

Example Route Configuration

// config/routes.js
module.exports.routes = {
  'GET /': { action: 'home/view-home' },
  'GET /dashboard': { action: 'dashboard/view-dashboard' },
  'POST /login': { action: 'auth/login' },
  'GET /settings/profile': { action: 'setting/view-profile' },
  'PATCH /settings/profile': { action: 'setting/update-profile' },
  'GET /team/:id': { action: 'team/view-team' }
}

Related Skills

  • waterline - Database ORM for models, queries, and associations
  • inertia - Client-server bridge connecting Sails to React/Vue/Svelte

Source: SKILL.md on GitHub

1 alert17d4 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides comprehensive documentation and coding patterns for the Sails.js framework as used in The Boring JavaScript Stack. It includes detailed guides on application anatomy, security best practices, and production deployment. No malicious patterns or security vulnerabilities were detected.

  • Socket17d

    2 alerts: gptSecurity

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    13/20 files flagged

Signed by skilld at bf19e10. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 8 months ago
Other metadata
metadata
{
  "author": "sailscastshq",
  "version": "2.1.0",
  "tags": "sails, sailsjs, backend, mvc, actions, helpers, routes, policies, hooks, middleware, deployment, boring-stack"
}

README badge

README badge for sailscastshq/boring-stack/sails