소스 정보
- 저장소
- tools-only/X-Skills
- 최근 소스 활동
- 2026년 2월 9일 04:08
- 감지된 SKILL.md 언어
- 영어
- 스타
- 7
- 포크
- 1
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tools-only/X-Skills --skill auth-setup명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | auth-setup |
| description | Generate authentication boilerplate with JWT, OAuth, and session support |
| shortcut | as |
| category | backend |
| difficulty | intermediate |
| estimated_time | 5-10 minutes |
Generates complete authentication boilerplate including JWT, OAuth (Google/GitHub), session management, and password reset flows.
Generated Auth System:
Output: Complete authentication system ready for production
Time: 5-10 minutes
# Generate full auth system
/auth-setup jwt
# Shortcut
/as oauth --providers google,github
# With specific features
/as jwt --features email-verification,password-reset,2fa
auth.service.ts:
import bcrypt from 'bcrypt'
import jwt from 'jsonwebtoken'
import { User } from './models/User'
export class AuthService {
async register(email: string, password: string, name: string) {
// Check if user exists
const existing = await User.findOne({ email })
if (existing) {
throw new Error('Email already registered')
}
// Hash password
const hashedPassword = await bcrypt.hash(password, 12)
// Create user
const user = await User.create({
email,
password: hashedPassword,
name,
emailVerified: false
})
// Generate verification token
const verificationToken = this.generateToken({ userId: user.id, : }, )
.(email, verificationToken)
accessToken = .(user)
refreshToken = .(user)
{
: { : user., : user., : user. },
accessToken,
refreshToken
}
}
() {
user = .({ email })
(!user) {
()
}
validPassword = bcrypt.(password, user.)
(!validPassword) {
()
}
(!user.) {
()
}
accessToken = .(user)
refreshToken = .(user)
{
: { : user., : user., : user. },
accessToken,
refreshToken
}
}
() {
{
decoded = jwt.(refreshToken, process..!)
user = .(decoded.)
(!user) {
()
}
accessToken = .(user)
{ accessToken }
} (error) {
()
}
}
() {
decoded = jwt.(token, process..!)
(decoded. !== ) {
()
}
.(decoded., { : })
{ : }
}
() {
user = .({ email })
(!user) {
{ : }
}
resetToken = .({ : user., : }, )
.(email, resetToken)
{ : }
}
() {
decoded = jwt.(token, process..!)
(decoded. !== ) {
()
}
hashedPassword = bcrypt.(newPassword, )
.(decoded., { : hashedPassword })
{ : }
}
() {
jwt.(
{ : user., : user. },
process..!,
{ : }
)
}
() {
jwt.(
{ : user. },
process..!,
{ : }
)
}
() {
jwt.(payload, process..!, { expiresIn })
}
() {
}
() {
}
}
oauth.controller.ts:
import { OAuth2Client } from 'google-auth-library'
const googleClient = new OAuth2Client(
process.env.GOOGLE_CLIENT_ID,
process.env.GOOGLE_CLIENT_SECRET,
process.env.GOOGLE_REDIRECT_URI
)
export class OAuthController {
async googleLogin(req: Request, res: Response) {
const authUrl = googleClient.generateAuthUrl({
access_type: 'offline',
scope: ['profile', 'email']
})
res.redirect(authUrl)
}
async googleCallback(req: Request, res: Response) {
const { code } = req.query
const { tokens } = await googleClient.getToken(code as string)
googleClient.setCredentials(tokens)
const ticket = await googleClient.verifyIdToken({
idToken: tokens.!,
: process..
})
payload = ticket.()
(!payload) {
()
}
user = .({ : payload. })
(!user) {
user = .({
: payload.,
: payload.,
: payload.,
: ,
: ,
: payload.
})
}
accessToken = (user)
refreshToken = (user)
res.()
}
}
auth.middleware.ts:
import { Request, Response, NextFunction } from 'express'
import jwt from 'jsonwebtoken'
declare global {
namespace Express {
interface Request {
user?: {
userId: string
email: string
}
}
}
}
export async function authenticate(req: Request, res: Response, next: NextFunction) {
try {
const authHeader = req.headers.authorization
if (!authHeader?.startsWith('Bearer ')) {
return res.status(401).json({ error: 'No token provided' })
}
const token = authHeader.split(' ')[1]
const decoded = jwt.verify(token, process.env.JWT_SECRET!)
req. = {
: decoded.,
: decoded.
}
()
} (error) {
(error jwt.) {
res.().({ : })
}
res.().({ : })
}
}
() {
(: , : , : ) => {
(!req.) {
res.().({ : })
}
user = .(req..)
(!user || !roles.(user.)) {
res.().({ : })
}
()
}
}
import rateLimit from 'express-rate-limit'
export const authLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 5, // 5 requests per window
message: 'Too many login attempts, please try again later',
standardHeaders: true,
legacyHeaders: false
})
// Usage
app.post('/api/auth/login', authLimiter, authController.login)
# JWT
JWT_SECRET=your-super-secret-key-min-32-chars
JWT_REFRESH_SECRET=your-refresh-secret-key
JWT_EXPIRES_IN=15m
JWT_REFRESH_EXPIRES_IN=7d
# OAuth - Google
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3000/api/auth/google/callback
# OAuth - GitHub
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GITHUB_REDIRECT_URI=http://localhost:3000/api/auth/github/callback
# Email
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USER=apikey
SMTP_PASSWORD=your-sendgrid-api-key
FROM_EMAIL=[email protected]
// routes/auth.routes.ts
import { Router } from 'express'
import { AuthController } from '../controllers/auth.controller'
import { authenticate } from '../middleware/auth.middleware'
import { authLimiter } from '../middleware/rate-limit'
const router = Router()
const authController = new AuthController()
// Registration & Login
router.post('/register', authController.register)
router.post('/login', authLimiter, authController.login)
router.post('/refresh', authController.refreshToken)
router.post('/logout', authenticate, authController.logout)
// Email Verification
router.post('/verify-email', authController.verifyEmail)
router.post('/resend-verification', authController.resendVerification)
// Password Reset
router.post('/forgot-password', authLimiter, authController.forgotPassword)
router.post('/reset-password', authController.resetPassword)
router.(, authController.)
router.(, authController.)
router.(, authController.)
router.(, authController.)
router.(, authenticate, authController.)
router.(, authenticate, authController.)
router.(, authenticate, authController.)
router
/env-config-setup - Generate environment config/express-api-scaffold - Generate Express API/fastapi-scaffold - Generate FastAPISecure authentication. Easy integration. Production-ready.