본문으로 건너뛰기
cccskills
무료GitHub에 공개

feature-toggles

Add, modify, remove, or review feature toggles. Use when gating a feature, changing a toggle default, or changing behavior shared with a feature-gated path.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core스타 34(GitHub 34 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Feature Toggles

Key files

  • Config: ayunis-core-backend/src/config/features.config.ts — FeaturesConfig interface + registerAs('features', ...)
  • Guard: ayunis-core-backend/src/common/guards/feature.guard.ts — @RequireFeature(FeatureFlag.Xxx) decorator (composes UseGuards internally)
  • Endpoint: ayunis-core-backend/src/app/presenters/http/app.controller.ts — GET /feature-toggles
  • Response DTO: ayunis-core-backend/src/app/presenters/http/dto/feature-toggles-response.dto.ts
  • Frontend hooks: ayunis-core-frontend/src/features/feature-toggles/

Define both contracts first

Before implementation, state the observable behavior with the flag enabled and disabled. Identify any existing workflow that shares a route, controller, navigation action, service, or persisted state with the gated feature.

  • Gate the narrowest new entry point that satisfies the product contract.
  • Keep shared cleanup, revocation, logout, recovery, and existing-user paths available unless the disabled-state contract explicitly removes them.
  • Do not switch an existing shared consumer to a gated endpoint without proving its flag-off behavior.

Adding a new toggle

Backend

  1. Add property to FeaturesConfig interface and the registerAs factory in features.config.ts. Env var pattern: FEATURE_<SNAKE_CASE>_ENABLED. Pick the right default (off = not yet released, on = already shipped).
  2. Add property to FeatureTogglesResponseDto with @ApiProperty.
  3. Return it in AppController.featureToggles().
  4. Apply @RequireFeature(FeatureFlag.Xxx) to the controller(s). Controller-level = gates all routes. The decorator composes UseGuards internally — do not add @UseGuards(FeatureGuard) separately.
  5. Run guard tests: pnpm run test -- --testPathPattern=feature.guard

Frontend

  1. Regenerate API client: VITE_API_BASE_URL=http://localhost:<backend-port>/api pnpm run openapi:update from ayunis-core-frontend/.
  2. Add convenience hook in useIsFeatureEnabled.ts (follow useIsSkillsEnabled pattern).
  3. Gate sidebar item in AppSidebar.tsx — add to the conditional spread pattern.
  4. Gate route loaders — throw redirect({ to: '/chat' }) when disabled (see skills.index.tsx).
  5. Gate any other UI that references the feature (chat widgets, plus button, etc.).

Changing a default

Edit the default value in features.config.ts. parseBooleanWithDefault uses the default only when FEATURE_<NAME>_ENABLED is unset or empty, so the code default is the deployed value only if that host's ayunis-core-backend/.env does not set the var. Check the host file before claiming an environment flipped (DEPLOYMENT.md → Configuration Updates); CI may set them explicitly (.github/workflows/e2e-tests.yml).

Verification

  1. Config — add the default and the explicit-true case to ayunis-core-backend/src/config/features.config.spec.ts.
  2. Flag ON — the normal e2e run; enable the flag in the backend .env heredoc in .github/workflows/e2e-tests.yml.
  3. Flag OFF — required when the gate lands on something that already existed: a route, controller, navigation entry, or persisted state an existing workflow already depends on. If the gate covers only new code, OFF means "feature absent" and no OFF test is needed. One focused spec when it is needed, never a duplicated suite.

Flag-off e2e recipe

The flag resolves from process.env at boot, so one stack cannot serve both states — the OFF spec needs its own backend. Copy the sso-disabled setup from AYC-367. It was removed when SSO went GA; read it with git show 688f67e9d:

  • .github/workflows/e2e-tests.yml — steps Start backend with SSO login disabled and Test logout lifecycle with SSO login disabled: the same build artifact started again with the flag off on a spare port, health-polled, log added to the backend-log artifact. Same job as the flag-on run: one extra process and one spec, not a matrix.
  • ayunis-core-e2e/playwright.config.ts — the sso-disabled project. The spec must also be listed in the chromium project's testIgnore, or it runs in both states.
  • ayunis-core-e2e/tests/auth/sso-disabled-logout.spec.ts — prove the feature is gone first (gated route 404s; publicApi fixture for unauthenticated endpoints), then exercise the shared workflow that must stay available.

Locally: FEATURE_<NAME>_ENABLED=false pnpm run start:dev in a second slot. Shell env wins over .env.dev and .env, but ayunis-core-backend/.env.local overrides the shell — remove the flag from it first. Never hand-edit the generated .env.dev.

Mocked guards, mocked API clients, and direct controller invocation exercise wiring, not runtime composition: they do not satisfy the OFF contract for a shared path.

Record both ON and OFF results in the PR validation summary.

Turning a toggle on for local work

Follow Local Backend Environment Overrides in dev-environment. Do not edit the default in features.config.ts unless the production default is intentionally changing.

After applying the override, verify the effective value before debugging the feature:

curl -s localhost:<backend-port>/api/feature-toggles | jq

Guard behavior

  • @RequireFeature(FeatureFlag.Xxx) on class → applies to all routes in that controller
  • @RequireFeature(FeatureFlag.Xxx) on method → applies to that route only
  • Disabled → throws NotFoundException (404)
  • Missing metadata → allows (guard is a no-op without @RequireFeature)
  • Flag must be a member of FeatureFlag enum (type-safe)

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Query Ayunis deployed-environment telemetry in AppSignal — incidents, occurrence counts and error traces via the `appsignal-cli` binary; structured log attributes (user.id, org.id, nestjs.context, custom metadata) via the v2 logs API. Use when investigating a production/staging incident or log data — NOT for local dev logs (see backend-debugging).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Ayunis Core backend specifics — module boundaries, key files, and project conventions. Complements the nestjs-hexagonal-backend skill.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Frontend development in ayunis-core. Use when creating, modifying, or debugging frontend code (React, Feature-Sliced Design, API client).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Debug backend runtime errors (500s, crashes, unexpected behavior). Use when something is broken at runtime — not for writing new code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Shared test fixtures for backend specs — port mock factories, domain builders, and shared IDs in a per-module testing/ folder. Use when a module's *.use-case.spec.ts files repeat the same mock-repository literal, inline entity construction, or hardcoded UUIDs across files.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Analyze Cursor Bugbot PR comments through a root-cause lens: is the finding valid, and is the suggested fix the real fix or a bandaid over a deeper problem? Use when the user asks to check, assess, or triage bugbot comments.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

ayunis-core의 스킬 모두 보기

이 스킬의 문제 신고