secondme-init

Original🇨🇳 Chinese
Translated

Initialize SecondMe project configuration and feature module selection, create state.json and CLAUDE.md

14installs
Added on

NPX Install

npx skill4agent add mindverse/second-me-skills secondme-init

SKILL.md Content (Chinese)

View Translation Comparison →

SecondMe Project Initialization

Initialize SecondMe project configuration, supporting direct parsing of App Info format or manual credential input.
Tool Usage: Use the
AskUserQuestion
tool when collecting user input.

Workflow

Step 0: Environment Check

Important Reminder: The current directory will be used as the project root directory, and the Next.js project will be initialized directly here.
  1. Display the current working directory path for user confirmation:
    📂 Current Working Directory: /path/to/current/dir
    
    ⚠️  The Next.js project will be initialized directly in this directory. Please ensure you are running this in a new empty folder.
  2. Check the contents of the current directory (excluding configuration files like
    .secondme/
    ,
    .git/
    ,
    CLAUDE.md
    ,
    .claude/
    ):
    • If the directory is empty or only contains configuration files: Proceed to the next step
    • If other files exist: Issue a warning
      ⚠️  The current directory is not empty and contains the following files/folders:
      - src/
      - package.json
      - ...
      
      Continuing may overwrite existing files. Are you sure you want to proceed?
    • Use
      AskUserQuestion
      to let the user confirm whether to continue

Step 1: Check Existing Configuration

First, check if
.secondme/state.json
exists in the project root directory:
If it exists:
  1. Read and display a summary of the current configuration:
    📋 Existing Configuration:
    - App Name: secondme-tinder
    - Client ID: 71658da7-***
    - Database: postgresql://***
    - Selected Modules: auth, chat, profile
    - Current Stage: init
  2. Ask the user whether to modify the configuration or continue using it
If it does not exist: Proceed to Step 2

Step 2: Collect Configuration Information

First, ask the user if they already have the Client ID and Client Secret for the SecondMe application.
If the user does not have credentials, guide them to register on the developer platform:
📌 Don't have SecondMe application credentials yet? Follow these steps to obtain them:

1. Visit the SecondMe Developer Platform: https://develop.second.me
2. Register and log in to your account
3. Create a new App
4. After creation, you will get App Info (including Client ID, Client Secret, etc.)
5. Copy and paste the App Info here
Prompt the user to continue after obtaining the credentials. If the user already has credentials, proceed with the following process.

Method 1: Parse App Info Format (Recommended)

If the user provides information in the following format, parse it automatically:
## App Info
- App Name: secondme-tinder
- Client ID: 71658da7-659c-414a-abdf-cb6472037fc2
- Client Secret: <your-secret>
- Redirect URIs:
  - http://localhost:3000/api/auth/callback
  - https://xxx.vercel.app/api/auth/callback
- Allowed Scopes: user.info, user.info.shades, user.info.softmemory, chat, note.add, voice
Parsing Rules:
FieldExtraction Method
app_name
Directly extract App Name
client_id
Directly extract Client ID
client_secret
Directly extract Client Secret
redirect_uri
Prioritize the URI with
localhost:3000
(for development)
redirect_uris
Save all Redirect URIs in a list
modules
Automatically infer based on Allowed Scopes (see the table below)
Scopes to Modules Mapping:
ScopeModule
user.info
auth
(Required)
user.info.shades
profile
user.info.softmemory
profile
chat
chat
chat
act
note.add
note
voice
Record but do not generate code temporarily
Additional Information to Collect After Parsing:
  • Database URL (Required)

Method 2: Manual Input

If the user does not provide App Info, collect the following information in order:
  1. App Name (Optional)
    • Prompt: Please enter the application name
    • Default value:
      secondme-app
  2. Client ID (Required)
    • Prompt: Please enter the Client ID of your SecondMe application
    • If the user does not have one, prompt: Please register and create an App at https://develop.second.me to obtain it
    • Validation: Non-empty
  3. Client Secret (Required)
    • Prompt: Please enter the Client Secret of your SecondMe application
    • If the user does not have one, prompt: Please register and create an App at https://develop.second.me to obtain it
    • Validation: Non-empty
  4. Redirect URI (Optional)
    • Prompt: Please enter the callback URL
    • Default value:
      http://localhost:3000/api/auth/callback
  5. Database URL (Required)
    • Prompt: Please enter the database connection string
    • Provide format examples:
      • PostgreSQL:
        postgresql://user:pass@localhost:5432/dbname
      • MySQL:
        mysql://user:pass@localhost:3306/dbname
      • SQLite:
        file:./dev.db
  6. Feature Module Selection (Multiple Selection)

Step 3: Confirm Module Selection

Display the modules inferred from Scopes (or selected by the user):
ModuleDescriptionNotes
auth
OAuth AuthenticationRequired, automatically included
profile
User Information DisplayOptional
chat
Chat FunctionalityOptional
act
Structured Action Judgment (Returns JSON)Optional, reuses
chat
scope permissions
note
Note-taking FunctionalityOptional
Ask the user if they need to adjust the module selection.

Step 4: Generate Configuration Files

4.1 Create
.secondme/state.json

json
{
  "version": "1.0",
  "stage": "init",
  "app_name": "secondme-tinder",
  "modules": ["auth", "chat", "profile"],
  "config": {
    "client_id": "71658da7-659c-414a-abdf-cb6472037fc2",
    "client_secret": "User-provided Client Secret",
    "redirect_uri": "http://localhost:3000/api/auth/callback",
    "redirect_uris": [
      "http://localhost:3000/api/auth/callback",
      "https://xxx.vercel.app/api/auth/callback"
    ],
    "database_url": "User-provided database connection string",
    "allowed_scopes": ["user.info", "user.info.shades", "chat", "note.add"]
  },
  "api": {
    "base_url": "https://app.mindos.com/gate/lab",
    "oauth_url": "https://go.second.me/oauth/",
    "token_endpoint": "https://app.mindos.com/gate/lab/api/oauth/token",
    "access_token_ttl": 7200,
    "refresh_token_ttl": 2592000
  },
  "docs": {
    "quickstart": "https://develop-docs.second.me/zh/docs",
    "oauth2": "https://develop-docs.second.me/zh/docs/authentication/oauth2",
    "api_reference": "https://develop-docs.second.me/zh/docs/api-reference/secondme",
    "errors": "https://develop-docs.second.me/zh/docs/errors"
  },
  "prd": {}
}

4.2 Create or Update
CLAUDE.md

Create
CLAUDE.md
in the project root directory with the following content:
markdown
# SecondMe Integration Project

## Application Information

- **App Name**: [app_name]
- **Client ID**: [Partially hidden client_id]

## API Documentation

Refer to the official documentation during development (read from the `docs` field in `.secondme/state.json`):

| Document | Configuration Key |
|------|--------|
| Quick Start | `docs.quickstart` |
| OAuth2 Authentication | `docs.oauth2` |
| API Reference | `docs.api_reference` |
| Error Codes | `docs.errors` |

## Key Information

- API Base URL: [Read from state.json api.base_url]
- OAuth Authorization URL: [Read from state.json api.oauth_url]
- Access Token Expiry: 2 hours
- Refresh Token Expiry: 30 days

> All API endpoint configurations can be found in the `api` and `docs` fields of `.secondme/state.json`

## Selected Modules

[Dynamically generate module list based on inference/selection]

## Permission List (Scopes)

Based on Allowed Scopes in App Info:

| Permission | Description | Status |
|------|------|------|
| `user.info` | Basic user information | ✅ Authorized |
| `user.info.shades` | User interest tags | ✅ Authorized |
| `chat` | Chat functionality | ✅ Authorized |
| `note.add` | Add notes | ✅ Authorized |

Step 5: Output Results

Display success message and next steps:
✅ SecondMe project configuration is complete!

Application Name: secondme-tinder
Configuration saved to .secondme/state.json
Created/updated CLAUDE.md (contains SecondMe API documentation links)

Selected Modules (Inferred from Allowed Scopes):
- auth ✓
- profile ✓ (user.info.shades)
- chat ✓
- note ✓

⚠️  Important: Add .secondme/ to .gitignore to protect sensitive information

Next Steps:
- Run /secondme-prd to define product requirements (Recommended)
- Or run /secondme-nextjs --quick to quickly generate the project

Output Files

FileDescription
.secondme/state.json
Project state and configuration
CLAUDE.md
API reference documentation for development reference

App Info Format Example

The following is the complete App Info format, which users can copy directly from the SecondMe Developer Backend:
## App Info
- App Name: my-app
- Client ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- Client Secret: your-secret-here
- Redirect URIs:
  - http://localhost:3000/api/auth/callback
  - https://my-app.vercel.app/api/auth/callback
  - https://my-app.com/api/auth/callback
- Allowed Scopes: user.info, user.info.shades, user.info.softmemory, chat, note.add

Error Handling

  • App Info format cannot be parsed: Prompt format error and switch to manual input mode
  • Client Secret is a placeholder: Prompt user to fill in the actual Secret
  • Database connection string format error: Display correct format examples
  • Insufficient permissions to create directory: Prompt to check directory permissions