search-domain-validator by shipshitdev/library
npx skills add https://github.com/shipshitdev/library --skill search-domain-validator此技能使 Claude 能够验证域名格式、检查域名可用性状态,并根据关键词搜索可用域名。Claude 将使用此技能实现域名验证逻辑、集成域名可用性 API,并提供域名搜索功能。
当用户出现以下需求时,此技能会自动激活:
在提供域名验证指导之前,请先了解项目的上下文:
[project]-domain-validator 技能根据 RFC 1035 和 RFC 1123 标准验证域名。
域名规则:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
验证实现:
// TypeScript/JavaScript domain validation
function isValidDomain(domain: string): boolean {
if (!domain || domain.length > 253) {
return false;
}
// RFC 1035 compliant regex
const domainRegex = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
if (!domainRegex.test(domain)) {
return false;
}
// Check label length (max 63 chars)
const labels = domain.split('.');
for (const label of labels) {
if (label.length > 63 || label.length === 0) {
return false;
}
// Labels cannot start or end with hyphen
if (label.startsWith('-') || label.endsWith('-')) {
return false;
}
}
return true;
}
Python 验证:
import re
def is_valid_domain(domain: str) -> bool:
"""Validate domain name format according to RFC 1035 and RFC 1123."""
if not domain or len(domain) > 253:
return False
# RFC 1035 compliant regex
domain_pattern = r'^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$'
if not re.match(domain_pattern, domain, re.IGNORECASE):
return False
# Check label length (max 63 chars)
labels = domain.split('.')
for label in labels:
if len(label) > 63 or len(label) == 0:
return False
# Labels cannot start or end with hyphen
if label.startswith('-') or label.endswith('-'):
return False
return True
NestJS 验证:
import { IsString, Matches, MaxLength, ValidateIf } from 'class-validator';
export class DomainDto {
@IsString()
@MaxLength(253)
@Matches(
/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,
{
message: 'Invalid domain name format',
}
)
domain: string;
}
使用域名可用性 API 检查域名是否可供注册。
常见的域名可用性 API:
Namecheap API 集成:
// Namecheap domain availability check
async function checkDomainAvailability(domain: string): Promise<boolean> {
const apiUser = process.env.NAMECHEAP_API_USER;
const apiKey = process.env.NAMECHEAP_API_KEY;
const clientIp = process.env.NAMECHEAP_CLIENT_IP;
const url = `https://api.namecheap.com/xml.response?ApiUser=${apiUser}&ApiKey=${apiKey}&UserName=${apiUser}&Command=namecheap.domains.check&ClientIp=${clientIp}&DomainList=${domain}`;
try {
const response = await fetch(url);
const xml = await response.text();
// Parse XML response
// Available domains return <DomainCheckResult Domain="example.com" Available="true"/>
return xml.includes('Available="true"');
} catch (error) {
console.error('Error checking domain availability:', error);
throw error;
}
}
GoDaddy API 集成:
// GoDaddy domain availability check
async function checkGoDaddyAvailability(domain: string): Promise<boolean> {
const apiKey = process.env.GODADDY_API_KEY;
const apiSecret = process.env.GODADDY_API_SECRET;
const url = `https://api.godaddy.com/v1/domains/available?domain=${domain}`;
try {
const response = await fetch(url, {
headers: {
'Authorization': `sso-key ${apiKey}:${apiSecret}`,
'Content-Type': 'application/json',
},
});
const data = await response.json();
return data.available === true;
} catch (error) {
console.error('Error checking domain availability:', error);
throw error;
}
}
NestJS 服务示例:
import { Injectable } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { firstValueFrom } from 'rxjs';
@Injectable()
export class DomainService {
constructor(private httpService: HttpService) {}
async checkAvailability(domain: string): Promise<boolean> {
const apiKey = process.env.DOMAIN_API_KEY;
const apiSecret = process.env.DOMAIN_API_SECRET;
try {
const response = await firstValueFrom(
this.httpService.get(`https://api.example.com/domains/check`, {
params: { domain },
headers: {
'Authorization': `Bearer ${apiKey}`,
},
})
);
return response.data.available;
} catch (error) {
throw new Error(`Failed to check domain availability: ${error.message}`);
}
}
}
根据关键词搜索可用域名,生成建议和替代方案。
域名建议算法:
function generateDomainSuggestions(keyword: string, tlds: string[] = ['com', 'io', 'net', 'org']): string[] {
const suggestions: string[] = [];
const sanitized = keyword.toLowerCase().replace(/[^a-z0-9-]/g, '');
// Direct combinations
for (const tld of tlds) {
suggestions.push(`${sanitized}.${tld}`);
}
// Common prefixes
const prefixes = ['get', 'try', 'use', 'my', 'the'];
for (const prefix of prefixes) {
for (const tld of tlds) {
suggestions.push(`${prefix}${sanitized}.${tld}`);
}
}
// Common suffixes
const suffixes = ['app', 'hub', 'ly', 'fy', 'io'];
for (const suffix of suffixes) {
for (const tld of tlds) {
suggestions.push(`${sanitized}${suffix}.${tld}`);
}
}
return suggestions;
}
批量可用性检查:
async function searchAvailableDomains(keyword: string): Promise<string[]> {
const suggestions = generateDomainSuggestions(keyword);
const availableDomains: string[] = [];
// Check availability for all suggestions (with rate limiting)
for (const domain of suggestions) {
try {
const isAvailable = await checkDomainAvailability(domain);
if (isAvailable) {
availableDomains.push(domain);
}
// Rate limiting delay
await new Promise(resolve => setTimeout(resolve, 100));
} catch (error) {
console.error(`Error checking ${domain}:`, error);
}
}
return availableDomains;
}
示例 1:"验证此域名:example.com"
示例 2:"检查 example.com 是否可用"
示例 3:"搜索包含关键词 'techstartup' 的可用域名"
示例 4:"在此表单中实现域名验证"
通用顶级域名:
新通用顶级域名:
国家代码顶级域名:
在实现域名搜索时,请考虑包含与用户上下文或行业相关的流行 TLD。
每周安装次数
81
代码仓库
GitHub 星标数
19
首次出现
2026年1月20日
安全审计
安装于
codex64
opencode63
gemini-cli61
claude-code60
cursor56
github-copilot55
This skill enables Claude to validate domain name formats, check domain availability status, and search for available domain names based on keywords. Claude will use this skill to implement domain validation logic, integrate with domain availability APIs, and provide domain search functionality.
This skill activates automatically when users:
Before providing domain validation guidance, discover the project's context:
Scan Project Documentation:
Identify Existing Patterns:
Use Project-Specific Skills:
[project]-domain-validator skillValidate domain names according to RFC 1035 and RFC 1123 standards.
Domain Name Rules:
Validation Implementation:
// TypeScript/JavaScript domain validation
function isValidDomain(domain: string): boolean {
if (!domain || domain.length > 253) {
return false;
}
// RFC 1035 compliant regex
const domainRegex = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
if (!domainRegex.test(domain)) {
return false;
}
// Check label length (max 63 chars)
const labels = domain.split('.');
for (const label of labels) {
if (label.length > 63 || label.length === 0) {
return false;
}
// Labels cannot start or end with hyphen
if (label.startsWith('-') || label.endsWith('-')) {
return false;
}
}
return true;
}
Python Validation:
import re
def is_valid_domain(domain: str) -> bool:
"""Validate domain name format according to RFC 1035 and RFC 1123."""
if not domain or len(domain) > 253:
return False
# RFC 1035 compliant regex
domain_pattern = r'^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$'
if not re.match(domain_pattern, domain, re.IGNORECASE):
return False
# Check label length (max 63 chars)
labels = domain.split('.')
for label in labels:
if len(label) > 63 or len(label) == 0:
return False
# Labels cannot start or end with hyphen
if label.startswith('-') or label.endswith('-'):
return False
return True
NestJS Validation:
import { IsString, Matches, MaxLength, ValidateIf } from 'class-validator';
export class DomainDto {
@IsString()
@MaxLength(253)
@Matches(
/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,
{
message: 'Invalid domain name format',
}
)
domain: string;
}
Check if a domain is available for registration using domain availability APIs.
Common Domain Availability APIs:
Namecheap API Integration:
// Namecheap domain availability check
async function checkDomainAvailability(domain: string): Promise<boolean> {
const apiUser = process.env.NAMECHEAP_API_USER;
const apiKey = process.env.NAMECHEAP_API_KEY;
const clientIp = process.env.NAMECHEAP_CLIENT_IP;
const url = `https://api.namecheap.com/xml.response?ApiUser=${apiUser}&ApiKey=${apiKey}&UserName=${apiUser}&Command=namecheap.domains.check&ClientIp=${clientIp}&DomainList=${domain}`;
try {
const response = await fetch(url);
const xml = await response.text();
// Parse XML response
// Available domains return <DomainCheckResult Domain="example.com" Available="true"/>
return xml.includes('Available="true"');
} catch (error) {
console.error('Error checking domain availability:', error);
throw error;
}
}
GoDaddy API Integration:
// GoDaddy domain availability check
async function checkGoDaddyAvailability(domain: string): Promise<boolean> {
const apiKey = process.env.GODADDY_API_KEY;
const apiSecret = process.env.GODADDY_API_SECRET;
const url = `https://api.godaddy.com/v1/domains/available?domain=${domain}`;
try {
const response = await fetch(url, {
headers: {
'Authorization': `sso-key ${apiKey}:${apiSecret}`,
'Content-Type': 'application/json',
},
});
const data = await response.json();
return data.available === true;
} catch (error) {
console.error('Error checking domain availability:', error);
throw error;
}
}
NestJS Service Example:
import { Injectable } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { firstValueFrom } from 'rxjs';
@Injectable()
export class DomainService {
constructor(private httpService: HttpService) {}
async checkAvailability(domain: string): Promise<boolean> {
const apiKey = process.env.DOMAIN_API_KEY;
const apiSecret = process.env.DOMAIN_API_SECRET;
try {
const response = await firstValueFrom(
this.httpService.get(`https://api.example.com/domains/check`, {
params: { domain },
headers: {
'Authorization': `Bearer ${apiKey}`,
},
})
);
return response.data.available;
} catch (error) {
throw new Error(`Failed to check domain availability: ${error.message}`);
}
}
}
Search for available domain names based on keywords, generating suggestions and alternatives.
Domain Suggestion Algorithm:
function generateDomainSuggestions(keyword: string, tlds: string[] = ['com', 'io', 'net', 'org']): string[] {
const suggestions: string[] = [];
const sanitized = keyword.toLowerCase().replace(/[^a-z0-9-]/g, '');
// Direct combinations
for (const tld of tlds) {
suggestions.push(`${sanitized}.${tld}`);
}
// Common prefixes
const prefixes = ['get', 'try', 'use', 'my', 'the'];
for (const prefix of prefixes) {
for (const tld of tlds) {
suggestions.push(`${prefix}${sanitized}.${tld}`);
}
}
// Common suffixes
const suffixes = ['app', 'hub', 'ly', 'fy', 'io'];
for (const suffix of suffixes) {
for (const tld of tlds) {
suggestions.push(`${sanitized}${suffix}.${tld}`);
}
}
return suggestions;
}
Batch Availability Check:
async function searchAvailableDomains(keyword: string): Promise<string[]> {
const suggestions = generateDomainSuggestions(keyword);
const availableDomains: string[] = [];
// Check availability for all suggestions (with rate limiting)
for (const domain of suggestions) {
try {
const isAvailable = await checkDomainAvailability(domain);
if (isAvailable) {
availableDomains.push(domain);
}
// Rate limiting delay
await new Promise(resolve => setTimeout(resolve, 100));
} catch (error) {
console.error(`Error checking ${domain}:`, error);
}
}
return availableDomains;
}
Example 1: "Validate this domain: example.com"
Example 2: "Check if example.com is available"
Example 3: "Search for available domains with keyword 'techstartup'"
Example 4: "Implement domain validation in this form"
Generic TLDs:
New gTLDs:
Country Code TLDs:
When implementing domain search, consider including popular TLDs relevant to the user's context or industry.
Weekly Installs
81
Repository
GitHub Stars
19
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex64
opencode63
gemini-cli61
claude-code60
cursor56
github-copilot55
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
166,500 周安装
网站质量审计工具 - 基于Lighthouse的全面性能、SEO、无障碍访问检查与优化建议
154 周安装
Moodle外部API开发教程:创建自定义Web服务、REST端点与移动应用后端
153 周安装
Web Audio API 技能:JARVIS AI 音频反馈、语音处理与音效开发指南
152 周安装
X (Twitter) API v2 命令行工具 - 使用 OAuth 1.0a 管理推文、用户与互动
153 周安装
CRISPR筛选分析工具:基因必需性、合成致死性与药物靶点发现全流程
154 周安装
色彩理论与调色板和谐专家:基于感知科学的照片拼贴与色彩管理工具
154 周安装