Skip to content
filters-building logo

Filters Building Skill

filters-building

Building table filters with query parameters, model search, and supported query patterns

SKILL.md

Full skill instructions

Filters Building Skill

Filter Types Quick Reference

type FilterType =
  | "simple-select"              // Constants (single)
  | "multi-select"               // Constants (multiple)
  | "model-select"               // Model relationship (small lists)
  | "model-multi-select"         // Model relationships (small lists)
  | "model-search-select"        // Model relationship (large lists)
  | "model-search-multi-select"  // Model relationships (large lists)
  | "text"                       // Text input
  | "email"                      // Email input
  | "number"                     // Number input
  | "checkbox"                   // Boolean 0/​1
  | "date-range"                 // Date range picker
  | "gap";                       // Visual spacing

Field Definition

Field can be string OR object:

// Simple string - used for all three
field: "organization_id"

// Complex object for custom queries
field: {
  queryParam: "organization_type_id",       // URL query param
  postgresColumn: "organizations.type",     // Postgres column
  elasticsearchColumn: "organization_type_id" // ES column
}

Supported Query Patterns

Query ParameterSQL ResultDescription
?name=johnWHERE account.name = 'john'Exact match
?name[]=john&name[]=janeWHERE account.name IN('john','jane')Multiple values
?not:name=johnWHERE account.name != 'john'Not equal
?q:name=johnWHERE LOWER(account.name) ILIKE '%john%'Like search
?gt:age=25WHERE account.age > 25Greater than
?lt:age=65WHERE account.age < 65Less than
?between:age=25|65WHERE account.age >= 25 AND account.age <= 65Range

Gap (Section Separator)

{
  type: "gap",
  placeholder: "",
  label: "Organization Filters",
  field: "",
}

Text Filter

{
  placeholder: "Search Name",
  type: "text",
  field: "name", // Uses q:name for ILIKE search
}

Checkbox Filter

{
  placeholder: "Is Active",
  type: "checkbox",
  field: "is_active",
  checkedValue: "1",
  uncheckedValue: "",
}

Simple Select (Constants)

import { constants } from "@/​models/​constants";

{
  placeholder: "Status",
  type: "simple-select",
  field: "status",
  options: constants.asset.status,
}

Multi Select (Constants)

{
  placeholder: "Organization Type",
  type: "multi-select",
  field: {
    queryParam: "organization_type_id",
    postgresColumn: "organizations.type",
    elasticsearchColumn: "organization_type_id",
  },
  options: constants.organization.type,
}

Model Select (Small Lists)

For < 50 options:

{
  placeholder: "Organization",
  type: "model-select",
  field: "organization_id",
  modelName: "organization",
  modelDisplayField: "label",
  modelSearchFilters: { disabled: "0" },
}

Model Multi Select (Small Lists)

{
  placeholder: "Tags",
  type: "model-multi-select",
  field: "tag_ids",
  modelName: "tag",
  modelDisplayField: "label",
  modelSearchFilters: { disabled: "0" },
}

Model Search Select (Large Lists)

For > 50 options:

{
  placeholder: "Organization",
  type: "model-search-select",
  field: "organization_id",
  modelName: "organization",
  modelDisplayField: "label",
  modelSearchParam: "q",
  modelSearchFilters: { disabled: "0" },
}

Model Search Multi Select (Large Lists)

{
  placeholder: "Organizations",
  type: "model-search-multi-select",
  field: "organization_id",
  modelName: "organization",
  modelDisplayField: "label",
  modelSearchParam: "q",
  modelSearchFilters: { disabled: "0" },
}

Date Range Filter

{
  placeholder: "Created Date",
  type: "date-range",
  field: "created_at",
}

Complete Example

import { IFilterField } from "@/​ui/​common/​components/​types/​filters";
import { constants } from "@/​models/​constants";

export const assetFilters: IFilterField[] = [
  // Section 1: Basic Filters
  {
    placeholder: "Search Name",
    type: "text",
    field: "name",
  },
  {
    placeholder: "Status",
    type: "multi-select",
    field: "status",
    options: constants.asset.status,
  },
  {
    placeholder: "Is Active",
    type: "checkbox",
    field: "is_active",
    checkedValue: "1",
    uncheckedValue: "",
  },

  // Gap for visual separation
  {
    type: "gap",
    placeholder: "",
    label: "Organization Filters",
    field: "",
  },

  // Section 2: Relationships
  {
    placeholder: "Organization",
    type: "model-search-multi-select",
    field: "organization_id",
    modelName: "organization",
    modelDisplayField: "label",
    modelSearchParam: "q",
    modelSearchFilters: { disabled: "0" },
  },
  {
    placeholder: "Organization Type",
    type: "multi-select",
    field: {
      queryParam: "organization_type_id",
      postgresColumn: "organizations.type",
      elasticsearchColumn: "organization_type_id",
    },
    options: constants.organization.type,
  },

  // Gap for dates section
  {
    type: "gap",
    placeholder: "",
    label: "Date Filters",
    field: "",
  },

  // Section 3: Dates
  {
    placeholder: "Created Date",
    type: "date-range",
    field: "created_at",
  },
];

Best Practices

  1. Group related filters with gap separators
  2. Use search variants for lists > 50 items
  3. Always use label as modelDisplayField (modify model if needed)
  4. Always use q as modelSearchParam for consistency
  5. Add modelSearchFilters to exclude disabled/​archived records
  6. Use field objects only when postgres/​ES columns differ from query param
  7. Constants are model-specific: constants.{model}.{field}

Filter Selection Guide

Data TypeCountFilter Type
Text fieldN/​Atext
Email fieldN/​Aemail
Number fieldN/​Anumber
BooleanN/​Acheckbox
DateN/​Adate-range
Constants1simple-select
ConstantsManymulti-select
Model< 50model-select or model-multi-select
Model> 50model-search-select or model-search-multi-select

Key Rules

  1. Use gaps to separate logical filter sections
  2. Model filters should always filter out disabled records
  3. Use search variants for better UX with large datasets
  4. Field objects allow custom query building (see Go controller docs)
  5. Keep placeholder text concise and descriptive

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View