Question: I guess `~/.config` (`XDG_CONFIG_HOME`) is not correct because that way users have to be constantly aware which files are safe to commit to their dotfiles repository.

Answer: 
You'd rather want:

```
grep -rilZ 'first_string' . | xargs -r0 grep -Hi 'second_string'

```

assuming GNU utilities (which you seem to be having as you're already using the `-r` GNU extension).

That is:

* use `-Z` and `xargs -0` to reliably pass the list of paths (which on Unix-like systems can contain any byte value except 0, while `xargs` without `-0` expects a very specific format).
* use `-r` for `xargs` to avoid running the second `grep` if the first one doesn't find any file (ommiting it here is no big deal, it would just cause the second `grep` to grep its empty stdin).
* options should be placed before non-option arguments.
* we use the `-H` option for the second `grep` to make sure the file name is always printed (even if only one file path ends up being passed to it) so we know where the matches are. For `grep` implementations that don't support `-H`, an alternative is to add `/dev/null` to the list of files for `grep` to look in. Then, `grep` being passed more than one filename will always print the filename.
`find . | perl -ne 'open($fh, $_); $s1=0; $s2=0; while($line = <$fh>) { $s1=1 if($line=~/string 1/); $s2=1 if($line=~/string 2/); } ; print $_ if($s1==1 and $s2 ==1); close $fh;' | sort | uniq`

(It's a bit long to see, but this goes all on 1 line)

**Edit:** Some explanation:

* `find . |`  sends a list of all files in the directory you want to search through (`.`) to the next command (`perl`)
* `perl -ne 'COMMANDS'` loops through all the lines it receives on STDIN (so all files) and runs `COMMANDS` on each of them. The name of each file will each time end up in `$_`
* `open($fh, $_); COMMANDS; close $fh;` opens a file, binds it to the filehandle `$fh`, runs `COMMANDS` and closes it again.
* `$s1=0; $s2=0;` these vars are set to 0 again every time the next file starts (if we find a string in the current file it's set to 1)
* `while($line = <$fh>) { COMMANDS } ;` runs `COMMANDS` on every line in the file.
* `$s1=1 if($line=~/string 1/); $s2=1 if($line=~/string 2/);` if `string 1` is found in the current file `$s1` will become 1, same for `$s2`
* `print $_ if($s1==1 and $s2 ==1);` prints the filename if the strings are found.
* `| sort | uniq` sorts the filenames and filters out doubles (this should actually not be necessary)