Skip to content
secondsky avatar

Api Filtering Sorting

Flexible API filtering and sorting with whitelisted fields, typed operators, and multi-field sort parameters.

CCM score
52 of 100
skills.sh installs
440
GitHub stars
257
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers query parameter parsing for filters and sorts, from bracketed operators like price[gte] to comma-separated sort=-price,name ordering
  • Includes a Node.js implementation with allowedFilters and allowedSorts whitelists plus a parseValue helper that coerces booleans and numbers
  • Provides a table of 6 operators (eq, ne, gt/gte, lt/lte, in, like) with example query strings for each
  • Designed for search endpoints, data grids, and dynamic query APIs, with security guidance on input validation, indexing, and injection prevention

Install

$ npx -y skills add secondsky/claude-skills --skill api-filtering-sorting -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

API Filtering & Sorting

Build flexible filtering and sorting systems that handle complex queries efficiently.

Query Parameter Syntax

GET /products?category=electronics&price[gte]=100&price[lte]=500&sort=-price,name

Implementation (Node.js)

const allowedFilters = ['category', 'status', 'price', 'createdAt'];
const allowedSorts = ['name', 'price', 'createdAt'];

app.get('/products', async (req, res) => {
  const filter = {};
  const sort = {};

  // Parse filters
  for (const [key, value] of Object.entries(req.query)) {
    if (key === 'sort') continue;

    const match = key.match(/^(\w+)\[(\w+)\]$/);
    if (match) {
      const [, field, operator] = match;
      if (!allowedFilters.includes(field)) continue;
      filter[field] = { [`$${operator}`]: parseValue(value) };
    } else if (allowedFilters.includes(key)) {
      filter[key] = value;
    }
  }

  // Parse sort
  if (req.query.sort) {
    for (const field of req.query.sort.split(',')) {
      const direction = field.startsWith('-') ? -1 : 1;
      const name = field.replace(/^-/, '');
      if (allowedSorts.includes(name)) sort[name] = direction;
    }
  }

Details

Repository
github.com/secondsky/claude-skills
Categories
Backend & APIs, Databases
First seen
Jun 3, 2026

Questions

What is api-filtering-sorting?

api-filtering-sorting is an agent skill listed on Claude Marketplaces in the Backend & APIs category. The listing describes api-filtering-sorting like this: Builds flexible API filtering and sorting systems with query parameter parsing, validation, and security.

How do I install api-filtering-sorting?

Run npx -y skills add secondsky/claude-skills --skill api-filtering-sorting -y in a project to install api-filtering-sorting. After that, the agent can use api-filtering-sorting in that project.

Which category is api-filtering-sorting in?

api-filtering-sorting is in the Backend & APIs category on Claude Marketplaces. Other listings in that category next to api-filtering-sorting include entra-app-registration, neon and firebase-basics.

Where is the source code of api-filtering-sorting?

The source code of api-filtering-sorting is on GitHub at https://github.com/secondsky/claude-skills. The secondsky account on GitHub publishes api-filtering-sorting.

More from secondsky/claude-skills

All 116

Similar to Api Filtering Sorting

More Backend & APIs